/* ============================================================================
   SATOR — Design System (Luxury Fashion-Tech)
   Mobile-first · tokens · componentes · layouts
   ============================================================================ */
:root {
  --bg: #0E0D0B;
  --bg-elev: #151412;
  --bg-card: #1A1916;
  --bg-card-hover: #201E1A;
  --line: rgba(242, 237, 228, 0.08);
  --line-strong: rgba(242, 237, 228, 0.16);
  --ink: #F2EDE4;
  --ink-2: #B8B1A5;
  --ink-3: #7E786E;
  --accent: #C9A961;
  --accent-2: #E4CC8C;
  --accent-ink: #1A150A;
  --danger: #C96A61;
  --ok: #7FA97F;
  --warn: #D2A24C;
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 22px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, "Didot", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, system-ui, sans-serif;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body { font-family: var(--sans); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; margin: 0; letter-spacing: 0.005em; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 22px; line-height: 1.2; }
h3 { font-size: 17px; }
.eyebrow { font-family: var(--sans); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.muted { color: var(--ink-2); }
.subtle { color: var(--ink-3); }
.small { font-size: 12.5px; }
.serif { font-family: var(--serif); }
.num { font-variant-numeric: tabular-nums; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.app { min-height: 100dvh; }
.main { padding: calc(18px + var(--safe-t)) 18px calc(var(--tab-h) + var(--safe-b) + 24px); max-width: 1180px; margin: 0 auto; }
.sidebar { display: none; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b); background: rgba(14, 13, 11, 0.86); backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid var(--line); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; z-index: 40;
}
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; letter-spacing: 0.04em; color: var(--ink-3); }
.tabbar a.active { color: var(--accent); }
.tabbar svg, .nav svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: 248px 1fr; }
  .sidebar { display: flex !important; flex-direction: column; position: sticky; top: 0; height: 100dvh; padding: 28px 18px; border-right: 1px solid var(--line); background: var(--bg-elev); }
  .tabbar { display: none !important; }
  .main { padding: 40px 48px 60px; }
  .brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 28px; }
  .brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-family: var(--serif); font-size: 22px; }
  .brand-name { font-family: var(--serif); font-size: 20px; letter-spacing: 0.22em; }
  .nav { display: flex; flex-direction: column; gap: 2px; }
  .nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--ink-2); font-size: 14px; }
  .nav a:hover { background: var(--bg-card); color: var(--ink); }
  .nav a.active { background: var(--bg-card); color: var(--ink); box-shadow: inset 2px 0 0 var(--accent); }
  .nav .nav-sep { margin: 14px 12px 6px; font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); }
  .sidebar-foot { margin-top: auto; }
}
@media (min-width: 1280px) { .main { padding: 48px 64px 72px; } }

/* ── Header de página ──────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head .titles { display: flex; flex-direction: column; gap: 6px; }
.page-head .actions { display: flex; gap: 8px; flex-shrink: 0; }
.mobile-brand { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.mobile-brand .brand-name { font-family: var(--serif); font-size: 18px; letter-spacing: 0.24em; }
@media (min-width: 960px) { .mobile-brand { display: none; } }

/* ── Botones ───────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--bg-card); color: var(--ink); font-size: 14px; font-weight: 500; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
.btn:hover { background: var(--bg-card-hover); border-color: rgba(242, 237, 228, 0.28); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg-card); color: var(--ink); }
.btn-danger { border-color: rgba(201, 106, 97, 0.5); color: var(--danger); background: transparent; }
.btn-danger:hover { background: rgba(201, 106, 97, 0.12); }
.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: 50%; }
.btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.btn-block { width: 100%; }

/* ── Cards / superficies ───────────────────────────────────────────────── */
.card { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 18px; }
.card-head a, .link { color: var(--accent); font-size: 13px; }
.section { margin-top: 30px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.divider { height: 1px; background: var(--line); margin: 20px 0; }

/* ── Stat tiles ────────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1100px) { .stats { grid-template-columns: repeat(6, 1fr); } }
.stat { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 4px; min-height: 92px; }
.stat .v { font-family: var(--serif); font-size: 32px; line-height: 1; color: var(--ink); }
.stat .l { font-size: 12px; color: var(--ink-3); letter-spacing: 0.04em; }
.stat.hero { grid-column: span 2; background: linear-gradient(135deg, #1F1B12, #171510); border-color: rgba(201, 169, 97, 0.28); }
.stat.hero .v { color: var(--accent-2); font-size: 40px; }
a.stat:hover { border-color: var(--line-strong); }

/* ── Grid de piezas ────────────────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1400px) { .grid { grid-template-columns: repeat(5, 1fr); } }
.grid.compact { grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 640px) { .grid.compact { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1000px) { .grid.compact { grid-template-columns: repeat(6, 1fr); } }

.item-card { position: relative; background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform .18s ease, border-color .18s, box-shadow .18s; }
.item-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.item-card .thumb { aspect-ratio: 4 / 5; background: #23211D; position: relative; overflow: hidden; }
.item-card .thumb img, .thumb-ph { width: 100%; height: 100%; object-fit: cover; }
.thumb-ph { display: grid; place-items: center; position: relative; }
.thumb-ph svg { width: 42%; height: 42%; stroke: rgba(242, 237, 228, 0.55); fill: none; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
.thumb-ph .swatch-band { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; }
.item-card .body { padding: 12px 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.item-card .name { font-size: 13.5px; font-weight: 500; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-card .meta { font-size: 12px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.item-card .fav { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%; background: rgba(14, 13, 11, 0.55); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 2; }
.item-card .fav svg { width: 16px; height: 16px; stroke: var(--ink); fill: none; stroke-width: 1.6; }
.item-card .fav.on svg { fill: var(--accent); stroke: var(--accent); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px; font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; background: rgba(242, 237, 228, 0.07); color: var(--ink-2); }
.badge.accent { background: rgba(201, 169, 97, 0.16); color: var(--accent-2); }
.badge.warn { background: rgba(210, 162, 76, 0.16); color: var(--warn); }
.badge.danger { background: rgba(201, 106, 97, 0.16); color: var(--danger); }
.badge.ok { background: rgba(127, 169, 127, 0.16); color: var(--ok); }
.badge.abs { position: absolute; top: 8px; left: 8px; z-index: 2; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1px solid rgba(255,255,255,0.15); vertical-align: -1px; }

/* ── Toolbar (búsqueda, filtros, orden) ────────────────────────────────── */
.toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.search { position: relative; }
.search input { width: 100%; padding: 12px 14px 12px 42px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--bg-card); color: var(--ink); outline: none; }
.search input:focus { border-color: var(--accent); }
.search svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; stroke: var(--ink-3); fill: none; stroke-width: 1.7; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--ink-2); font-size: 13px; transition: all .15s; }
.chip:hover { border-color: rgba(242,237,228,.3); color: var(--ink); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.accent.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.toolbar-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.count { font-size: 13px; color: var(--ink-3); }
.filter-panel { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 760px) { .filter-panel { grid-template-columns: repeat(4, 1fr); } }

/* ── Formularios ───────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; padding: 11px 13px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--bg-elev); color: var(--ink); outline: none; transition: border-color .15s; -webkit-appearance: none; appearance: none; }
.field select { background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field .hint { font-size: 12px; color: var(--ink-3); }
.field .err { font-size: 12px; color: var(--danger); }
.field.invalid input, .field.invalid select { border-color: var(--danger); }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .span2 { grid-column: span 2; } }
@media (min-width: 1000px) { .form-grid.cols3 { grid-template-columns: repeat(3, 1fr); } .form-grid.cols3 .span2 { grid-column: span 2; } }
.form-section { margin-top: 26px; }
.form-section h3 { margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); font-size: 15px; letter-spacing: .04em; }
.multi { display: flex; flex-wrap: wrap; gap: 6px; }
.multi .chip { font-size: 12.5px; padding: 6px 11px; }
.form-actions { position: sticky; bottom: calc(var(--tab-h) + var(--safe-b) + 8px); display: flex; gap: 10px; justify-content: flex-end; padding: 12px; margin-top: 24px; background: rgba(14, 13, 11, 0.8); backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: var(--radius); }
@media (min-width: 960px) { .form-actions { bottom: 16px; } }
.color-select { display: flex; flex-wrap: wrap; gap: 6px; }
.color-select .sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; outline: 1px solid rgba(255,255,255,.12); cursor: pointer; position: relative; }
.color-select .sw.active { border-color: var(--bg); outline: 2px solid var(--accent); }
.color-select .sw[title] { }
.range { display: flex; align-items: center; gap: 12px; }
.range input[type=range] { flex: 1; accent-color: var(--accent); }
.range .val { font-family: var(--serif); font-size: 22px; width: 32px; text-align: center; }

/* ── Detalle ───────────────────────────────────────────────────────────── */
.detail { display: grid; gap: 22px; }
@media (min-width: 900px) { .detail { grid-template-columns: minmax(300px, 420px) 1fr; align-items: start; } }
.hero-img { aspect-ratio: 4/5; border-radius: var(--radius-lg); overflow: hidden; background: #23211D; border: 1px solid var(--line); position: relative; }
.hero-img img { width: 100%; height: 100%; object-fit: cover; }
.hero-img .thumb-ph svg { width: 34%; height: 34%; }
.hero-img .badge.abs { top: 14px; left: 14px; }
.attr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
@media (min-width: 640px) { .attr-grid { grid-template-columns: repeat(3, 1fr); } }
.attr { display: flex; flex-direction: column; gap: 2px; }
.attr .k { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.attr .v { font-size: 14.5px; }
.attr .v.pending { color: var(--warn); font-style: italic; }
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; }
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .primary { font-size: 14px; }
.list-row .secondary { font-size: 12.5px; color: var(--ink-3); }
.mini { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.mini:last-child { border-bottom: 0; }
.mini .mini-thumb { width: 52px; height: 64px; border-radius: 8px; overflow: hidden; background: #23211D; flex-shrink: 0; }
.mini .mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mini .mini-thumb .thumb-ph svg { width: 50%; height: 50%; }
.mini .t { flex: 1; min-width: 0; }
.mini .t .n { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .t .s { font-size: 12px; color: var(--ink-3); }
.mini .r { font-family: var(--serif); font-size: 20px; color: var(--accent-2); }

/* ── Estados ───────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 56px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); }
.empty h3 { font-size: 22px; margin-bottom: 8px; }
.empty p { color: var(--ink-2); margin: 0 0 18px; }
.loading { display: flex; align-items: center; justify-content: center; padding: 60px; color: var(--ink-3); gap: 12px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }
.error-box { border: 1px solid rgba(201,106,97,.45); background: rgba(201,106,97,.08); padding: 14px 16px; border-radius: var(--radius); color: var(--ink); }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 16px); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px; font-size: 14px; z-index: 60; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.toast.error { background: var(--danger); color: #fff; }
@media (min-width: 960px) { .toast { bottom: 28px; } }

/* ── Modal / sheet ─────────────────────────────────────────────────────── */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .modal-bg { align-items: center; } }
.modal { background: var(--bg-elev); border: 1px solid var(--line-strong); border-radius: var(--radius-lg) var(--radius-lg) 0 0; width: 100%; max-width: 520px; max-height: 92dvh; overflow: auto; padding: 22px 20px calc(22px + var(--safe-b)); }
@media (min-width: 640px) { .modal { border-radius: var(--radius-lg); } }
.modal h3 { font-size: 20px; margin-bottom: 14px; }
.modal .form-grid { gap: 12px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* ── Login ─────────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 50% -10%, rgba(201,169,97,.12), transparent 60%), var(--bg); }
.login { width: 100%; max-width: 380px; }
.login .mark { font-family: var(--serif); font-size: 56px; letter-spacing: 0.3em; text-align: center; color: var(--ink); margin-bottom: 4px; padding-left: .3em; }
.login .tag { text-align: center; color: var(--ink-3); font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 36px; }
.login .card { padding: 24px; }
.login .field + .field { margin-top: 14px; }

/* ── Utilidades ────────────────────────────────────────────────────────── */
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.roadmap { border: 1px solid rgba(201,169,97,.25); background: linear-gradient(160deg, rgba(201,169,97,.08), transparent 50%); border-radius: var(--radius-lg); padding: 28px 22px; }
.roadmap h2 { margin-bottom: 8px; }
.roadmap ol { margin: 14px 0 0; padding-left: 20px; color: var(--ink-2); }
.roadmap li + li { margin-top: 6px; }
.bar { height: 6px; background: rgba(242,237,228,.08); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; background: rgba(242,237,228,.06); padding: 2px 6px; border-radius: 6px; }

/* ── Sin chrome (login) ─────────────────────────────────────────────────── */
.main.no-chrome { padding: 0; max-width: none; }
@media (max-width: 639px) { .hide-sm { display: none; } }
svg.accent { color: var(--accent); stroke: var(--accent); width: 22px; height: 22px; fill: none; stroke-width: 1.5; }
