:root{
  --bg0:#0b1020;
  --bg1:#0b1227;
  --card:rgba(255,255,255,.06);
  --card2:rgba(255,255,255,.08);
  --border:rgba(255,255,255,.10);
  --text:#e8edf7;
  --muted:rgba(232,237,247,.72);
  --muted2:rgba(232,237,247,.55);
  --accent:#7c3aed; /* violet */
  --accent2:#22c55e; /* green */
  --warn:#f59e0b;
  --bad:#ef4444;
  --shadow: 0 18px 50px rgba(0,0,0,.35);
  --radius:16px;
  --radius2:12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial;
}

/* Light mode overrides */
html[data-theme="light"]{
  --bg0:#f6f7fb;
  --bg1:#eef2ff;
  --card:rgba(17,24,39,.04);
  --card2:rgba(17,24,39,.06);
  --border:rgba(17,24,39,.10);
  --text:#0f172a;
  --muted:rgba(15,23,42,.72);
  --muted2:rgba(15,23,42,.55);
  --shadow: 0 18px 50px rgba(2,6,23,.10);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:var(--text);
  font-family:var(--sans);
  background:
    radial-gradient(1200px 800px at 15% 0%, rgba(124,58,237,.35) 0%, rgba(124,58,237,0) 60%),
    radial-gradient(900px 700px at 90% 20%, rgba(34,197,94,.22) 0%, rgba(34,197,94,0) 55%),
    radial-gradient(800px 700px at 50% 110%, rgba(59,130,246,.18) 0%, rgba(59,130,246,0) 60%),
    linear-gradient(180deg, var(--bg0) 0%, var(--bg1) 100%);
  background-attachment:fixed;
  background-repeat:no-repeat;
  min-height:100vh;
}

a{color:inherit}

/* Login Screen */
.login-screen{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:100vh;
  padding:22px;
}
.login-card{
  width:100%;
  max-width:420px;
  border-radius:var(--radius);
  border:1px solid var(--border);
  background:var(--card);
  box-shadow:var(--shadow);
  padding:32px;
}
.login-form{
  margin-top:24px;
  display:flex;
  flex-direction:column;
  gap:16px;
}

/* Forms */
.form-group{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.form-group label{
  font-size:13px;
  font-weight:700;
  color:var(--muted);
}
.form-group input[type="checkbox"]{
  width:18px;
  height:18px;
  cursor:pointer;
  accent-color:var(--accent);
}
.form-group label:has(input[type="checkbox"]){
  flex-direction:row;
  align-items:center;
  gap:8px;
  cursor:pointer;
}
.input, .select, textarea{
  width:100%;
  padding:10px 12px;
  border-radius:var(--radius2);
  border:1px solid var(--border);
  background:rgba(255,255,255,.04);
  color:var(--text);
  font-family:var(--sans);
  font-size:14px;
  transition:all 0.2s;
}
.input:focus, .select:focus, textarea:focus{
  outline:none;
  border-color:var(--accent);
  background:rgba(255,255,255,.06);
  box-shadow:0 0 0 3px rgba(124,58,237,.1);
}
.input::placeholder{
  color:var(--muted2);
}
textarea{
  resize:vertical;
  min-height:80px;
}
.form-row{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
}
.form-error{
  padding:10px 12px;
  border-radius:var(--radius2);
  background:rgba(239,68,68,.15);
  border:1px solid rgba(239,68,68,.3);
  color:var(--bad);
  font-size:13px;
}
.form-hint{
  margin-top:6px;
  font-size:12px;
  color:var(--muted2);
}

/* Form Tabs */
.form-tabs{
  display:flex;
  gap:4px;
  border-bottom:1px solid var(--border);
  margin-bottom:20px;
  overflow-x:auto;
}
.form-tab{
  padding:10px 16px;
  background:transparent;
  border:none;
  border-bottom:2px solid transparent;
  color:var(--muted);
  font-size:14px;
  font-weight:500;
  cursor:pointer;
  white-space:nowrap;
  transition:all 0.2s;
  margin-bottom:-1px;
}
.form-tab:hover{
  color:var(--text);
  background:rgba(255,255,255,.03);
}
.form-tab.active{
  color:var(--accent);
  border-bottom-color:var(--accent);
  background:rgba(124,58,237,.05);
}
.form-tab-content{
  display:none;
}
.form-tab-content.active{
  display:block;
}

/* Buttons */
.btn{
  cursor:pointer;
  user-select:none;
  border:1px solid var(--border);
  background:rgba(255,255,255,.04);
  color:var(--text);
  padding:9px 12px;
  border-radius:var(--radius2);
  font-weight:700;
  font-size:12px;
  transition:all 0.2s;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
}
.btn:hover:not(:disabled){
  background:rgba(255,255,255,.06);
}
.btn:active:not(:disabled){
  transform:translateY(1px);
}
.btn:disabled{
  opacity:0.5;
  cursor:not-allowed;
}
.btn--primary{
  background:rgba(124,58,237,.20);
  border-color:rgba(124,58,237,.28);
}
.btn--primary:hover:not(:disabled){
  background:rgba(124,58,237,.26);
}
.btn--block{
  width:100%;
}
.btn--disabled{
  opacity:0.5;
  cursor:not-allowed;
}
.btn-icon{
  cursor:pointer;
  background:none;
  border:none;
  padding:6px;
  border-radius:6px;
  font-size:16px;
  opacity:0.7;
  transition:all 0.2s;
}
.btn-icon:hover{
  opacity:1;
  background:rgba(255,255,255,.06);
}

/* Spinner */
.spinner{
  width:16px;
  height:16px;
  border:2px solid rgba(255,255,255,.2);
  border-top-color:var(--text);
  border-radius:50%;
  animation:spin 0.6s linear infinite;
}
@keyframes spin{
  to{transform:rotate(360deg)}
}

/* App Layout */
.app{
  min-height:100vh;
  display:grid;
  grid-template-columns:280px 1fr;
}
.sidebar{
  padding:22px 18px;
  border-right:1px solid var(--border);
  background:linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0));
  overflow-y:auto;
}
.brand{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  border-radius:14px;
  background:rgba(255,255,255,.03);
  border:1px solid var(--border);
  box-shadow:var(--shadow);
}
.brand__logo{
  width:40px;
  height:40px;
  border-radius:12px;
  background:radial-gradient(circle at 30% 30%, rgba(255,255,255,.24), rgba(255,255,255,0) 55%),
             linear-gradient(135deg, var(--accent), #3b82f6);
  display:grid;
  place-items:center;
  font-weight:800;
  color:white;
}
.brand__meta{
  display:flex;
  flex-direction:column;
  line-height:1.2;
}
.brand__title{
  font-weight:800;
  letter-spacing:.2px;
}
.brand__sub{
  color:var(--muted2);
  font-size:12px;
}

.nav{
  margin-top:18px;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.nav__item{
  cursor:pointer;
  display:flex;
  gap:10px;
  align-items:center;
  padding:10px 12px;
  border-radius:12px;
  color:var(--muted);
  border:1px solid transparent;
  transition:all 0.2s;
}
.nav__item:hover{
  color:var(--text);
  background:rgba(255,255,255,.03);
  border-color:var(--border);
}
.nav__item[aria-current="page"]{
  color:var(--text);
  background:rgba(124,58,237,.14);
  border-color:rgba(124,58,237,.22);
}
.nav__dot{
  width:10px;
  height:10px;
  border-radius:999px;
  background:rgba(255,255,255,.25);
  box-shadow:0 0 0 4px rgba(255,255,255,.05);
}
.nav__item[aria-current="page"] .nav__dot{
  background:var(--accent);
  box-shadow:0 0 0 4px rgba(124,58,237,.15);
}

.sidebar__footer{
  margin-top:22px;
  padding:12px;
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.03);
}
.kvs{
  display:grid;
  gap:8px;
}
.kv{
  display:flex;
  justify-content:space-between;
  gap:10px;
  font-size:12px;
}
.kv__k{
  color:var(--muted2);
}
.kv__v{
  font-family:var(--mono);
  color:var(--muted);
}

.main{
  padding:22px;
  overflow-y:auto;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:16px 18px;
  border-radius:var(--radius);
  border:1px solid var(--border);
  background:rgba(255,255,255,.03);
  box-shadow:var(--shadow);
  margin-bottom:18px;
}
.topbar__left{
  display:flex;
  flex-direction:column;
  gap:2px;
}
.topbar__title{
  font-weight:900;
  font-size:18px;
}
.topbar__subtitle{
  color:var(--muted2);
  font-size:12px;
}
.topbar__right{
  display:flex;
  gap:10px;
  align-items:center;
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.03);
  font-size:12px;
  color:var(--muted);
}
.pill__badge{
  width:10px;
  height:10px;
  border-radius:999px;
  background:rgba(255,255,255,.25);
}
.pill--ok .pill__badge{
  background:var(--accent2);
}
.pill--warn .pill__badge{
  background:var(--warn);
}
.pill--bad .pill__badge{
  background:var(--bad);
}

.grid{
  margin-top:18px;
  display:grid;
  grid-template-columns:repeat(12, 1fr);
  gap:14px;
}
.card{
  grid-column:span 4;
  border-radius:var(--radius);
  border:1px solid var(--border);
  background:var(--card);
  box-shadow:var(--shadow);
  padding:16px 16px 14px;
}
.card--wide{
  grid-column:span 8;
}
.card--full{
  grid-column:span 12;
  margin-top:0;
}
.card__header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  margin-bottom:12px;
}
.card__title{
  font-weight:900;
  letter-spacing:.2px;
}
.card__sub{
  margin-top:6px;
  color:var(--muted2);
  font-size:12px;
  line-height:1.45;
}
.metric{
  margin-top:12px;
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:10px;
}
.metric__v{
  font-size:28px;
  font-weight:950;
  letter-spacing:-.6px;
}
.metric__t{
  color:var(--muted2);
  font-size:12px;
}
.mini{
  margin-top:12px;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.tag{
  font-family:var(--mono);
  font-size:11px;
  padding:6px 8px;
  border-radius:10px;
  border:1px solid var(--border);
  background:var(--card2);
  color:var(--muted);
  text-decoration:none;
  display:inline-block;
}
.tag:hover{
  background:rgba(255,255,255,.1);
}

.section{
  display:none;
  margin-top:18px;
}
.section[aria-hidden="false"]{
  display:block;
}

/* Models Toolbar */
.models-toolbar{
  display:flex;
  flex-direction:column;
  gap:12px;
  margin-bottom:20px;
  padding:20px;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
}
.models-toolbar__row{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  flex-wrap:wrap;
}
.models-toolbar__row:first-child{
  padding-bottom:16px;
  border-bottom:1px solid var(--border);
  margin-bottom:4px;
}
.models-toolbar__left{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(140px, 1fr));
  gap:10px;
  flex:1;
  min-width:0;
  align-items:start;
}
.models-toolbar__left .input{
  min-width:0;
  width:100%;
}
.models-toolbar__left .input[type="search"]{
  grid-column:span 2;
  min-width:0;
}
.models-toolbar__left .select{
  min-width:0;
  width:100%;
}
.models-toolbar__right{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  align-items:center;
  flex-shrink:0;
}
.models-bulk-actions{
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px 16px;
  border-radius:var(--radius2);
  background:rgba(124,58,237,.08);
  border:1px solid rgba(124,58,237,.15);
  margin-bottom:18px;
  flex-wrap:wrap;
}
.models-bulk-actions__text{
  color:var(--text);
  font-size:13px;
  font-weight:600;
  margin-right:auto;
}
.models-bulk-actions .btn{
  flex-shrink:0;
}

/* Table */
.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  background:var(--card);
  border-radius:var(--radius);
  overflow:hidden;
  border:1px solid var(--border);
}
.table thead{
  background:var(--card2);
  position:sticky;
  top:0;
  z-index:10;
}
.table th{
  padding:16px 18px;
  text-align:left;
  font-weight:700;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.5px;
  color:var(--muted);
  border-bottom:2px solid var(--border);
}
.table td{
  padding:14px 18px;
  border-bottom:1px solid var(--border);
  font-size:14px;
  vertical-align:middle;
  color:var(--text);
}
.table tbody tr{
  transition:background .15s ease;
}
.table tbody tr:hover{
  background:rgba(124,58,237,.08);
}
.table tbody tr:last-child td{
  border-bottom:0;
}
.table-actions{
  display:flex;
  gap:4px;
  align-items:center;
}
.table-actions .btn-icon{
  min-width:32px;
  height:32px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:16px;
}
.table-cell-photo{
  width:56px;
  height:56px;
  border-radius:12px;
  overflow:hidden;
  background:rgba(255,255,255,.06);
  display:flex;
  align-items:center;
  justify-content:center;
  border:2px solid var(--border);
  flex-shrink:0;
}
.table-cell-photo img,
.table-cell-photo-img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.table-cell-photo-placeholder{
  font-size:28px;
  opacity:0.6;
}
.table-cell-name{
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:0;
}
.table-cell-name strong{
  color:var(--text);
  font-weight:600;
  font-size:14px;
  line-height:1.3;
}
.table-cell-meta{
  font-size:12px;
  color:var(--muted);
  line-height:1.3;
}

.table-sort{
  background:transparent;
  border:0;
  padding:0;
  color:var(--text);
  font-weight:800;
  cursor:pointer;
}
.table-sort:hover{
  text-decoration:underline;
}

/* Photos: toolbar + progress + sortable tweaks */
.photos-toolbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  padding:6px 2px 12px;
  width:100%;
  flex-wrap:wrap;
}
.form-group .photos-toolbar{
  margin-top:8px;
  margin-bottom:0;
}
.photos-toolbar__hint{
  color:var(--muted2);
  font-size:12px;
}
.photos-toolbar__actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.btn--danger{
  background:rgba(239,68,68,.16);
  border-color:rgba(239,68,68,.22);
  color:#fecaca;
}
.btn--danger:hover{
  background:rgba(239,68,68,.22);
}
.photo-grid--sortable .photo-item--sortable{
  position:relative;
}
.photo-item__drag{
  position:absolute;
  top:8px;
  right:10px;
  font-size:14px;
  color:rgba(255,255,255,.75);
  background:rgba(0,0,0,.25);
  border:1px solid rgba(255,255,255,.12);
  border-radius:10px;
  padding:2px 6px;
}
.photo-item__select{
  position:absolute;
  top:10px;
  left:10px;
  background:rgba(0,0,0,.25);
  border:1px solid rgba(255,255,255,.12);
  border-radius:10px;
  padding:2px 6px;
}
.photo-item--sortable.is-dragging{
  opacity:.6;
  transform:scale(.98);
}
.photo-progress{
  padding:8px;
  border-top:1px solid var(--border);
}
.photo-progress__bar{
  height:8px;
  border-radius:999px;
  background:rgba(255,255,255,.06);
  overflow:hidden;
}
.photo-progress__fill{
  height:100%;
  width:0%;
  background:linear-gradient(90deg, var(--accent), var(--accent2));
}
.photo-progress__text{
  margin-top:6px;
  font-size:11px;
  color:var(--muted2);
}

/* Lightbox */
#lightbox{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:9999;
}
#lightbox[aria-hidden="true"]{
  display:none;
}
.lightbox__backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.75);
}
.lightbox__content{
  position:relative;
  z-index:1;
  max-width:min(92vw, 1100px);
  max-height:92vh;
  display:flex;
  flex-direction:column;
  gap:10px;
  align-items:flex-end;
}
.lightbox__content img{
  max-width:100%;
  max-height:82vh;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.2);
}
.lightbox__close{
  align-self:flex-end;
}

/* Models: cards view */
.models-cards-toolbar{
  display:flex;
  justify-content:flex-start;
  padding:6px 2px 12px;
}
.models-cards-selectall{
  display:inline-flex;
  align-items:center;
  gap:8px;
  color:var(--muted2);
  font-size:12px;
  user-select:none;
}
.models-cards-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(280px, 1fr));
  gap:20px;
  max-width:100%;
}
@media (min-width: 1200px) {
  .models-cards-grid{
    grid-template-columns:repeat(4, 1fr);
  }
}
.models-card{
  border:1px solid var(--border);
  border-radius:20px;
  background:var(--card);
  box-shadow:0 4px 16px rgba(0,0,0,.15);
  padding:0;
  cursor:pointer;
  transition:all .2s ease;
  overflow:hidden;
  position:relative;
  display:flex;
  flex-direction:column;
}
.models-card:hover{
  transform:translateY(-4px);
  border-color:rgba(124,58,237,.5);
  box-shadow:0 12px 32px rgba(124,58,237,.25);
}
.models-card-check{
  position:absolute;
  top:12px;
  left:12px;
  z-index:10;
  background:rgba(0,0,0,.5);
  border-radius:8px;
  padding:4px;
  backdrop-filter:blur(4px);
}
.models-card-photo{
  width:100%;
  aspect-ratio:3/4;
  border-radius:0;
  overflow:hidden;
  background:rgba(255,255,255,.06);
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
  border:none;
  box-shadow:none;
  cursor:pointer;
  position:relative;
}
.models-card-photo::after{
  content:"";
  position:absolute;
  inset:0;
  background:transparent;
  transition:background 0.2s ease;
}
.models-card:hover .models-card-photo::after{
  background:rgba(124,58,237,.1);
}
.models-card-photo img,
.models-card-photo-img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
  transition:transform 0.3s ease;
}
.models-card:hover .models-card-photo img{
  transform:scale(1.05);
}
.models-card-photo-placeholder{
  font-size:80px;
  opacity:0.4;
}
.models-card-main{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:16px;
  align-items:center;
  text-align:center;
}
.models-card-name{
  font-size:18px;
  font-weight:700;
  color:var(--text);
  line-height:1.3;
}
.models-card-age{
  font-size:14px;
  color:var(--muted);
  line-height:1.4;
}
.models-card-actions{
  display:none;
}
.right{
  text-align:right;
}

/* Badges */
.badge{
  display:inline-block;
  padding:4px 8px;
  border-radius:6px;
  font-size:11px;
  font-weight:700;
}
.badge--success{
  background:rgba(34,197,94,.2);
  color:var(--accent2);
}
.badge--muted{
  background:rgba(255,255,255,.06);
  color:var(--muted);
}

/* Pagination */
.pagination{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-top:16px;
  padding-top:16px;
  border-top:1px solid var(--border);
}
.pagination-pages{
  display:flex;
  gap:6px;
  flex:1;
  justify-content:center;
}
.pagination-dots{
  padding:9px 4px;
  color:var(--muted2);
}

/* Empty State */
.empty-state{
  text-align:center;
  padding:60px 20px;
}
.empty-state__icon{
  font-size:64px;
  margin-bottom:16px;
  opacity:0.5;
}
.empty-state__title{
  font-size:18px;
  font-weight:800;
  margin-bottom:8px;
  color:var(--text);
}
.empty-state__sub{
  color:var(--muted2);
  font-size:14px;
  margin-bottom:24px;
}

/* Photo grid (model card) */
.photo-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap:14px;
  padding:4px;
  width:100%;
  box-sizing:border-box;
}
.form-group .photo-grid{
  margin-top:8px;
  width:100%;
}
.photo-item{
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;
  background:rgba(255,255,255,.04);
  transition:all 0.2s ease;
  position:relative;
}
.photo-item:hover{
  border-color:var(--accent);
  background:rgba(255,255,255,.06);
  transform:translateY(-2px);
  box-shadow:0 4px 12px rgba(0,0,0,.2);
}
.photo-item img{
  width:100%;
  height:140px;
  object-fit:cover;
  display:block;
  transition:transform 0.2s ease;
}
.photo-item:hover img{
  transform:scale(1.05);
}
.photo-item--sortable{
  cursor:move;
}
.photo-item--sortable:active{
  cursor:grabbing;
  opacity:0.8;
}
.photo-item__select{
  position:absolute;
  top:8px;
  left:8px;
  z-index:2;
}
.photo-item__drag{
  position:absolute;
  top:8px;
  right:8px;
  font-size:14px;
  color:rgba(255,255,255,.75);
  background:rgba(0,0,0,.4);
  border:1px solid rgba(255,255,255,.12);
  border-radius:6px;
  padding:4px 6px;
  cursor:move;
  backdrop-filter:blur(4px);
}
.photo-item__number{
  position:absolute;
  bottom:8px;
  left:8px;
  background:rgba(0,0,0,.6);
  color:var(--text);
  font-size:11px;
  font-weight:600;
  padding:4px 8px;
  border-radius:6px;
  backdrop-filter:blur(4px);
}
.photo-actions{
  display:flex;
  gap:6px;
  padding:8px;
  border-top:1px solid var(--border);
  justify-content:space-between;
  align-items:stretch;
  background:rgba(0,0,0,.2);
  flex-wrap:nowrap;
  min-height:44px;
}
.photo-actions .btn{
  padding:6px 8px;
  font-size:10px;
  flex:1 1 0;
  min-width:0;
  white-space:nowrap;
  text-align:center;
  overflow:hidden;
  text-overflow:ellipsis;
}
.photo-preview-container{
  padding:12px;
  border:1px solid var(--border);
  border-radius:var(--radius2);
  background:rgba(255,255,255,.02);
}
.photo-preview-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-size:13px;
}
.photo-preview-item{
  position:relative;
}
.photo-preview-item img{
  border:2px dashed var(--accent);
  opacity:0.9;
}
.photo-preview-name{
  font-size:11px;
  color:var(--muted);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  max-width:120px;
}

/* Skeleton */
.skeleton-table{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.skeleton-row{
  height:56px;
  border-radius:var(--radius2);
  background:linear-gradient(90deg, rgba(255,255,255,.05) 25%, rgba(255,255,255,.1) 50%, rgba(255,255,255,.05) 75%);
  background-size:200% 100%;
  animation:skeleton 1.5s ease-in-out infinite;
}
@keyframes skeleton{
  0%{background-position:200% 0}
  100%{background-position:-200% 0}
}

/* Modal */
.modal{
  position:fixed;
  inset:0;
  z-index:1000;
  align-items:center;
  justify-content:center;
  padding:22px;
  display:none;
}
.modal[aria-hidden="false"]{
  display:flex;
}
.modal__backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.6);
  backdrop-filter:blur(4px);
}
.modal__content{
  position:relative;
  width:100%;
  max-width:1000px;
  max-height:95vh;
  border-radius:var(--radius);
  border:1px solid var(--border);
  background:var(--card);
  box-shadow:var(--shadow);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  z-index:1;
}
.modal__header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:20px 24px;
  border-bottom:1px solid var(--border);
  gap:12px;
}
.modal__title{
  font-size:20px;
  font-weight:900;
  flex:1;
}
.modal__header-actions{
  display:flex;
  gap:8px;
  align-items:center;
}
.modal__header-actions .btn{
  padding:8px 16px;
  font-size:13px;
}
.modal__close{
  width:32px;
  height:32px;
  border:none;
  background:none;
  font-size:24px;
  color:var(--muted);
  cursor:pointer;
  border-radius:8px;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:all 0.2s;
}
.modal__close:hover{
  background:rgba(255,255,255,.06);
  color:var(--text);
}
.modal__body{
  padding:28px;
  overflow-y:auto;
  flex:1;
  max-height:calc(95vh - 140px);
}
.modal__footer{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  padding:16px 24px;
  border-top:1px solid var(--border);
}

/* Progress Bar */
.progress-bar{
  width:100%;
  height:8px;
  border-radius:4px;
  background:rgba(255,255,255,.06);
  overflow:hidden;
  margin-top:12px;
}
.progress-bar__fill{
  height:100%;
  background:var(--accent);
  transition:width 0.3s ease;
  width:0%;
}

/* Toast */
.toast{
  position:fixed;
  right:16px;
  bottom:16px;
  width:min(520px, calc(100vw - 32px));
  border-radius:14px;
  border:1px solid var(--border);
  background:rgba(0,0,0,.25);
  backdrop-filter:blur(12px);
  box-shadow:var(--shadow);
  padding:12px 12px;
  display:none;
  z-index:2000;
}
html[data-theme="light"] .toast{
  background:rgba(255,255,255,.65);
}
.toast[aria-hidden="false"]{
  display:block;
}
.toast--success{
  border-color:rgba(34,197,94,.3);
  background:rgba(34,197,94,.15);
}
.toast--error{
  border-color:rgba(239,68,68,.3);
  background:rgba(239,68,68,.15);
}
.toast--warn{
  border-color:rgba(245,158,11,.3);
  background:rgba(245,158,11,.15);
}
.toast__title{
  font-weight:900;
}
.toast__body{
  margin-top:4px;
  color:var(--muted);
  font-size:12px;
  line-height:1.35;
}
.toast__row{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
}

/* Model Card View */
.model-card-view{
  padding:0;
}
.model-card-header{
  display:flex;
  gap:20px;
  margin-bottom:24px;
  padding-bottom:20px;
  border-bottom:1px solid var(--border);
}
.model-card-photo{
  width:200px;
  height:200px;
  border-radius:var(--radius);
  overflow:hidden;
  background:rgba(255,255,255,.04);
  flex-shrink:0;
  border:1px solid var(--border);
}
.model-card-photo img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.model-card-photo-placeholder{
  width:100%;
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:64px;
  opacity:0.5;
}
.model-card-info{
  flex:1;
}
.model-card-name{
  font-size:24px;
  font-weight:900;
  margin:0 0 12px 0;
  color:var(--text);
}
.model-card-meta{
  display:flex;
  flex-direction:column;
  gap:8px;
  font-size:14px;
  color:var(--muted);
}
.model-card-meta div{
  display:flex;
  gap:8px;
}
.model-card-meta strong{
  color:var(--text);
  min-width:120px;
}
.model-card-details{
  margin-bottom:24px;
  padding-bottom:20px;
  border-bottom:1px solid var(--border);
}
.model-card-details:last-of-type{
  border-bottom:none;
}
.model-card-details h3{
  font-size:16px;
  font-weight:800;
  margin:0 0 12px 0;
  color:var(--text);
}
.model-card-grid{
  display:grid;
  grid-template-columns:repeat(2, 1fr);
  gap:12px;
  font-size:14px;
  color:var(--muted);
}
.model-card-grid div{
  display:flex;
  gap:8px;
}
.model-card-grid strong{
  color:var(--text);
  min-width:140px;
}
.model-card-grid a{
  color:var(--accent);
  text-decoration:none;
}
.model-card-grid a:hover{
  text-decoration:underline;
}
.model-card-tags{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.model-card-notes{
  font-size:14px;
  color:var(--muted);
  line-height:1.6;
  white-space:pre-wrap;
}
.model-card-photos{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(150px, 1fr));
  gap:12px;
  margin-top:12px;
}
.model-card-photo-item{
  position:relative;
  border-radius:var(--radius2);
  overflow:hidden;
  border:1px solid var(--border);
  background:rgba(255,255,255,.04);
  aspect-ratio:3/4;
}
.model-card-photo-item img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.model-card-photo-preview{
  border:2px solid var(--accent);
  box-shadow:0 0 0 4px rgba(124,58,237,.15);
}
.model-card-photo-badge{
  position:absolute;
  top:8px;
  right:8px;
  background:var(--accent);
  color:white;
  padding:4px 8px;
  border-radius:6px;
  font-size:11px;
  font-weight:700;
}
.model-card-footer{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  align-items:center;
  margin-top:24px;
  padding-top:20px;
  border-top:1px solid var(--border);
}
.model-card-date{
  font-size:12px;
  color:var(--muted2);
  margin-left:auto;
}

/* Responsive */
@media (max-width:980px){
  .app{
    grid-template-columns:1fr;
  }
  .sidebar{
    border-right:none;
    border-bottom:1px solid var(--border);
  }
  .grid{
    grid-template-columns:repeat(6, 1fr);
  }
  .card{
    grid-column:span 6;
  }
  .card--wide{
    grid-column:span 6;
  }
  .form-row{
    grid-template-columns:1fr;
  }
  .models-toolbar__row{
    flex-direction:column;
  }
  .models-toolbar__left{
    width:100%;
    grid-template-columns:1fr;
  }
  .models-toolbar__left .input[type="search"]{
    grid-column:span 1;
  }
  .models-toolbar__left .input,
  .models-toolbar__left .select{
    width:100%;
    min-width:100%;
  }
  .models-toolbar__right{
    width:100%;
    justify-content:stretch;
  }
  .models-toolbar__right .btn{
    flex:1;
    min-width:0;
  }
  .models-bulk-actions{
    flex-direction:column;
    align-items:stretch;
  }
  .models-bulk-actions__text{
    margin-right:0;
    margin-bottom:8px;
  }
  .models-bulk-actions .btn{
    width:100%;
  }
  .models-cards-grid{
    grid-template-columns: repeat(2, 1fr);
    gap:16px;
  }
  .models-card-photo{
    aspect-ratio:3/4;
  }
  .modal__header{
    flex-wrap:wrap;
  }
  .modal__header-actions{
    width:100%;
    justify-content:flex-end;
    margin-top:8px;
  }
  .photo-grid{
    grid-template-columns: repeat(2, 1fr);
    gap:10px;
  }
  .photo-item img{
    height:120px;
  }
  .photo-actions{
    flex-direction:column;
    gap:6px;
    padding:8px;
  }
  .photo-actions .btn{
    width:100%;
    min-width:0;
    padding:8px;
    font-size:11px;
  }
  .photos-toolbar{
    flex-direction:column;
    align-items:stretch;
    gap:8px;
  }
  .photos-toolbar__actions{
    width:100%;
    justify-content:stretch;
  }
  .photos-toolbar__actions .btn{
    flex:1;
  }
  .table{
    font-size:12px;
  }
  .modal__content{
    max-width:100%;
    max-height:100vh;
    border-radius:0;
    margin:0;
  }
  .modal__body{
    padding:20px;
    max-height:calc(100vh - 140px);
  }
  .table th, .table td{
    padding:8px;
  }
  .model-card-header{
    flex-direction:column;
  }
  .model-card-photo{
    width:100%;
    max-width:300px;
    margin:0 auto;
  }
  .model-card-grid{
    grid-template-columns:1fr;
  }
  .model-card-photos{
    grid-template-columns:repeat(auto-fill, minmax(100px, 1fr));
  }
}
