/* ===== Tokens ===== */
:root {
  color-scheme: light;
  --brand: #0054a0;
  --brand-600: #00478a;
  --brand-700: #003a70;
  --brand-50: #eef5fc;
  --brand-100: #d9e8f7;
  --bg: #f4f6fa;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #e3eefb 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #eaf1f9 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f7;
  --border: #e3e8ef;
  --border-strong: #cfd7e2;
  --text: #0f1b2d;
  --text-2: #475569;
  --text-3: #6b7a8f;
  --danger: #c62828;
  --danger-bg: #fdecec;
  --warn: #a15c00;
  --warn-bg: #fff4e0;
  --ok: #18794e;
  --ok-bg: #e7f6ee;
  --info-bg: #e9f2fd;
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, .06);
  --shadow: 0 1px 2px rgba(15, 27, 45, .05), 0 4px 16px rgba(15, 27, 45, .06);
  --shadow-lg: 0 10px 40px rgba(15, 27, 45, .18);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --sidebar-w: 264px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand: #4c9be8;
    --brand-600: #6aaef0;
    --brand-700: #8cc2f5;
    --brand-50: #13243a;
    --brand-100: #1b3352;
    --bg: #0b1220;
    --bg-grad: radial-gradient(1200px 600px at 100% -10%, #12233d 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #0f1d31 0%, transparent 55%);
    --surface: #111a2b;
    --surface-2: #0f1727;
    --surface-3: #18243a;
    --border: #1f2c43;
    --border-strong: #2b3b57;
    --text: #e6edf7;
    --text-2: #a9b6c9;
    --text-3: #8191a8;
    --danger: #ff7b7b;
    --danger-bg: #3a1618;
    --warn: #ffb44d;
    --warn-bg: #36260c;
    --ok: #4cd394;
    --ok-bg: #0f2e21;
    --info-bg: #13243a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 20px rgba(0, 0, 0, .35);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #4c9be8;
  --brand-600: #6aaef0;
  --brand-700: #8cc2f5;
  --brand-50: #13243a;
  --brand-100: #1b3352;
  --bg: #0b1220;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #12233d 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #0f1d31 0%, transparent 55%);
  --surface: #111a2b;
  --surface-2: #0f1727;
  --surface-3: #18243a;
  --border: #1f2c43;
  --border-strong: #2b3b57;
  --text: #e6edf7;
  --text-2: #a9b6c9;
  --text-3: #8191a8;
  --danger: #ff7b7b;
  --danger-bg: #3a1618;
  --warn: #ffb44d;
  --warn-bg: #36260c;
  --ok: #4cd394;
  --ok-bg: #0f2e21;
  --info-bg: #13243a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 20px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.5 var(--font);
  color: var(--text);
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
kbd {
  font: 600 11px/1 var(--mono); padding: 3px 6px; border-radius: 6px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-3);
}
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::selection { background: var(--brand-100); }
.sprite { display: none; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-lg { width: 22px; height: 22px; }
.i-xl { width: 28px; height: 28px; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); font-size: .875rem; }
.mono { font-family: var(--mono); font-size: .92em; }
.row { display: flex; align-items: center; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.gap-xs { gap: 6px; } .gap-sm { gap: 10px; } .gap { gap: 16px; }
.grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip-link:focus { left: 8px; }

/* ===== Botones ===== */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--btn-fg); font: 600 14px/1 var(--font);
  cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .08s, box-shadow .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { --btn-bg: var(--brand); --btn-fg: #fff; --btn-bd: transparent; box-shadow: 0 1px 2px rgba(0, 84, 160, .3), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-primary:hover { background: var(--brand-600); }
:root[data-theme="dark"] .btn-primary { --btn-fg: #06121f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { --btn-fg: #06121f; } }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: transparent; }
.btn-danger:hover { filter: brightness(1.08); background: var(--danger); }
.btn-soft { --btn-bg: var(--brand-50); --btn-fg: var(--brand); --btn-bd: transparent; }
.btn-soft:hover { background: var(--brand-100); }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 46px; font-size: 15px; border-radius: 12px; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn-block { width: 100%; }
.spinner { display: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Formularios ===== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span:first-child { font-size: 13px; font-weight: 600; color: var(--text-2); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], select, textarea {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 15px var(--font); transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
input[aria-invalid=true] { border-color: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 15%, transparent); }
.input-group { position: relative; display: flex; }
.input-group input { padding-right: 84px; }
.input-addon {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 30px; padding: 0 10px;
  border: 0; border-radius: 8px; background: var(--surface-3); color: var(--text-2); font: 600 12px var(--font); cursor: pointer;
}
.hint { font-size: 12.5px; color: var(--text-3); }
.hint.warn { color: var(--warn); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 10px; font-size: 14px; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-info { background: var(--info-bg); color: var(--brand-700); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ===== Login ===== */
.login-body { display: grid; place-items: center; padding: 24px 16px; }
.login-wrap { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 18px; animation: rise .5s var(--ease); }
.login-card { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 32px 28px 24px; display: flex; flex-direction: column; gap: 16px; }
.login-logo { align-self: center; background: #fff; border-radius: 14px; padding: 6px 10px; }
.login-logo img { display: block; height: auto; }
.login-card h1 { text-align: center; font-size: 1.45rem; }
.login-card > p.muted { text-align: center; margin-top: -8px; }
.login-foot { font-size: 13px; text-align: center; }
.login-legal { font-size: 12px; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ===== Layout ===== */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; }
.shell > * { min-width: 0; }
td.mono, .mono.nowrap { white-space: nowrap; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 14px; padding: 18px 14px;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(14px);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px; color: var(--text); text-decoration: none !important; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: #fff; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.brand-sm .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
.brand-mark img { width: 80%; height: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { color: var(--text-3); font-size: 12px; }
.search-trigger {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-3); font: 14px var(--font); cursor: pointer;
}
.search-trigger span { flex: 1; text-align: left; }
.search-trigger:hover { border-color: var(--border-strong); color: var(--text-2); }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding: 12px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px;
  color: var(--text-2); font-weight: 550; text-decoration: none; position: relative;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a[aria-current=page] { background: var(--brand-50); color: var(--brand); }
.nav a[aria-current=page]::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px; }
.avatar {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--brand), #3d8fe0); color: #fff; font-weight: 700; font-size: 13px;
}
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }
.user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.user-meta strong, .user-meta small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { color: var(--text-3); font-size: 12px; }
.topbar { display: none; }
.tabbar { display: none; }
.view { padding: 28px 32px 48px; min-width: 0; outline: none; }
.page { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; animation: fade .35s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--brand); }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; }
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20;
    padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
    background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
  }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: sticky; bottom: 0; z-index: 20;
    padding: 6px 6px max(6px, env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--border);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 10px; font-size: 11px; font-weight: 600; color: var(--text-3); text-decoration: none; }
  .tabbar a[aria-current=page] { color: var(--brand); background: var(--brand-50); }
  .view { padding: 18px 16px 28px; }
  h1 { font-size: 1.35rem; }
}

/* ===== Tarjetas ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.grid { display: grid; gap: 16px; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.hero {
  position: relative; overflow: hidden; padding: 28px; border-radius: 22px; color: #fff;
  background: linear-gradient(120deg, #003a70 0%, #0054a0 55%, #2d7fd0 100%); box-shadow: var(--shadow);
}
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; border: 28px solid rgba(255, 255, 255, .08); }
.hero h1 { font-size: 1.75rem; }
.hero p { color: rgba(255, 255, 255, .82); margin-top: 6px; }
.hero .eyebrow { color: rgba(255, 255, 255, .75); }
mark { background: color-mix(in srgb, #ffd54a 55%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--danger); }
.hero .hero-search { margin-top: 18px; max-width: 520px; position: relative; z-index: 1; }
.hero .hero-search input { border: 0; height: 48px; padding-left: 44px; box-shadow: 0 6px 24px rgba(0, 0, 0, .18); color: #0f1b2d; background: #fff; }
.hero .hero-search .i { position: absolute; left: 14px; top: 15px; color: #6b7a8f; }
.action-card {
  display: flex; flex-direction: column; gap: 12px; padding: 20px; color: var(--text); text-decoration: none !important;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s;
}
.action-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--brand-100); }
.action-card .icon-tile { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.action-card p { color: var(--text-2); font-size: 14px; }
.action-card .go { margin-top: auto; display: flex; align-items: center; gap: 4px; color: var(--brand); font-weight: 600; font-size: 14px; }
.action-card:hover .go .i { transform: translateX(3px); }
.go .i { transition: transform .2s var(--ease); }
.stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.stat strong { font-size: 1.5rem; letter-spacing: -.02em; }
.stat span { color: var(--text-3); font-size: 13px; }

/* ===== Chips / badges ===== */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.badge-blue { background: var(--info-bg); color: var(--brand); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-amber { background: var(--warn-bg); color: var(--warn); }
.badge-green { background: var(--ok-bg); color: var(--ok); }
.badge-gray { background: var(--surface-3); color: var(--text-2); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-2); font: 600 13px var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all .15s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip[aria-pressed=true] { background: var(--brand); border-color: var(--brand); color: #fff; }
:root[data-theme="dark"] .chip[aria-pressed=true] { color: #06121f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip[aria-pressed=true] { color: #06121f; } }
.chip .count { font-size: 11px; opacity: .8; }

/* ===== Búsqueda ===== */
.searchbar { position: relative; }
.searchbar .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.searchbar input { height: 50px; padding-left: 44px; padding-right: 48px; font-size: 16px; border-radius: 14px; box-shadow: var(--shadow-sm); }
.searchbar kbd { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); }
.searchbar .clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }

/* ===== Liquidaciones ===== */
.lock-card { max-width: 460px; margin: 4vh auto 0; padding: 30px 28px; display: flex; flex-direction: column; gap: 16px; }
.lock-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.liq-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 18px 20px; }
.timer {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px 0 6px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.timer svg.ring { width: 22px; height: 22px; transform: rotate(-90deg); }
.timer .ring circle { fill: none; stroke-width: 3; }
.timer .ring .bg { stroke: var(--border-strong); }
.timer .ring .fg { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.timer.low .ring .fg { stroke: var(--warn); }
.liq-head .mono { white-space: nowrap; }
@media (max-width: 600px) {
  .liq-head .grow { flex-basis: calc(100% - 70px); }
  .liq-head h2 { font-size: 1.05rem; }
  .liq-head .timer { order: 3; }
  .liq-head .btn { order: 4; }
}
.liq-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.liq-layout.with-viewer { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
.month-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.liq-layout.with-viewer .month-grid { grid-template-columns: 1fr; gap: 8px; }
.month {
  display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow-sm); cursor: pointer; text-align: left; font: inherit; color: inherit;
  transition: border-color .15s, box-shadow .15s, transform .15s var(--ease);
}
.month:hover { border-color: var(--brand-100); box-shadow: var(--shadow); transform: translateY(-1px); }
.month[aria-current=true] { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
.month .m-name { font-weight: 700; font-size: 15px; }
.month .m-year { color: var(--text-3); font-size: 13px; }
.liq-layout.with-viewer .month { flex-direction: row; align-items: center; padding: 10px 12px; }
.liq-layout.with-viewer .month .m-actions { margin-left: auto; }
.m-actions { display: flex; gap: 6px; }
.viewer { position: sticky; top: 20px; height: calc(100dvh - 56px); display: flex; flex-direction: column; overflow: hidden; }
.viewer-body { position: relative; flex: 1; display: flex; }
.viewer iframe { flex: 1; width: 100%; border: 0; background: var(--surface-3); }
.viewer-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--text-2); background: var(--surface-2); }
.viewer-loading .spinner { display: inline-block; color: var(--brand); width: 22px; height: 22px; }
.year-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.strength { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.strength > i { display: block; height: 100%; width: 0; border-radius: 6px; transition: width .25s var(--ease), background .25s; }

/* ===== Tránsito ===== */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.product { overflow: hidden; }
.product-head {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: none; border: 0;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.product-head:hover { background: var(--surface-2); }
.product-head .chev { transition: transform .2s var(--ease); color: var(--text-3); }
.product[open-state=true] .chev { transform: rotate(90deg); }
.p-code { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--brand); background: var(--brand-50); padding: 3px 8px; border-radius: 7px; white-space: nowrap; }
.p-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.p-total { margin-left: auto; text-align: right; white-space: nowrap; }
.p-total strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.p-total small { display: block; color: var(--text-3); font-size: 12px; }
.product-body { border-top: 1px solid var(--border); }
.results { display: flex; flex-direction: column; gap: 10px; }
.product, .card { min-width: 0; }
@media (max-width: 700px) {
  .product-head { flex-wrap: wrap; gap: 8px 10px; padding: 12px 14px; }
  .p-name { overflow: visible; text-overflow: clip; }
  .p-name { flex-basis: 100%; order: 3; white-space: normal; }
  .p-total { margin-left: auto; }
}

/* ===== Reservas ===== */
.stats-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat-btn { text-align: left; font: inherit; color: inherit; cursor: pointer; border: 1px solid var(--border); transition: border-color .15s, box-shadow .15s; }
.stat-btn strong { color: var(--danger); }
.stat-btn:hover { border-color: var(--danger); }
.stat-btn[aria-pressed=true] { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent); }
.filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; }
.select-field { min-width: 170px; flex: 1 1 170px; max-width: 280px; }
.select-field select { height: 38px; }
.picking { overflow: hidden; }
.pk-head { display: flex; gap: 16px; align-items: flex-start; padding: 16px 18px; }
.pk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pk-client { font-weight: 600; }
.pk-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--text-2); font-size: 13px; }
.pk-meta span { display: inline-flex; align-items: center; gap: 5px; }
.pk-meta .i { width: 14px; height: 14px; color: var(--text-3); }
.pk-total { width: 170px; flex: none; text-align: right; display: flex; flex-direction: column; gap: 2px; }
.pk-total strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.pk-total span { color: var(--text-3); font-size: 12px; }
.bar { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; width: 0; border-radius: 6px; background: var(--danger); transition: width .5s var(--ease); }
.bar i.part { background: var(--warn); }
.bar i.full { background: var(--ok); }
.table.lines { border-top: 1px solid var(--border); }
.table.lines tr.no-res td { background: color-mix(in srgb, var(--warn-bg) 70%, transparent); }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border-strong); }
.spinner.inline { display: inline-block; width: 13px; height: 13px; color: var(--brand); }
.spin .i { animation: spin .8s linear infinite; }
@media (max-width: 700px) {
  .stats-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stats-4 .stat { padding: 12px 14px; }
  .stats-4 .stat strong { font-size: 1.2rem; }
  .stats-4 .stat span { font-size: 12px; line-height: 1.3; }
  .pk-head { flex-direction: column; gap: 10px; }
  .pk-total { width: 100%; text-align: left; }
  .select-field { max-width: none; min-width: 0; flex: 1 1 calc(50% - 6px); }
  .select-field > span { font-size: 12px; }
  .table.stack-sm tfoot tr { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; padding: 10px 14px; }
  .table.stack-sm tfoot td { padding: 0; border: 0; }
}

/* ===== Vacaciones ===== */
.stat-hero { background: linear-gradient(135deg, var(--brand), #2d7fd0); border: 0; }
.stat-hero strong, .stat-hero span { color: #fff; }
.stat-hero span { opacity: .85; }
.vac-dates { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
input[type=date] { width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 15px var(--font); }
input[type=date]:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.calc { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border-strong); }
.calc-result { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.calc-result strong { font-size: 1.15rem; color: var(--brand); }
.calc-result.over strong, .text-danger { color: var(--danger); }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; color: var(--text-3); }
details[open] > summary::before { content: "▾ "; }
.calc-detail { margin-top: 12px; font-size: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
select.sel-sm { height: 32px; font-size: 13px; padding: 0 8px; min-width: 180px; }
.fer-list { max-height: 360px; overflow-y: auto; }
.mail-preview { padding: 0; }
.mail-preview iframe { width: 100%; height: min(60vh, 520px); border: 0; display: block; background: #fff; border-radius: 0 0 18px 18px; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* ===== Tablas ===== */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) {
  .table.stack-sm thead { display: none; }
  .table.stack-sm tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table.stack-sm td { padding: 0; border: 0; }
  .table.stack-sm td::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-3); }
  .table.stack-sm td.full { grid-column: 1 / -1; }
  .table.stack-sm .num { text-align: left; }
}

/* ===== Documentos ===== */
.doc { display: flex; gap: 14px; padding: 16px; align-items: flex-start; }
.doc-icon { width: 44px; height: 52px; border-radius: 8px; flex: none; display: grid; place-items: end center; padding-bottom: 6px; background: linear-gradient(160deg, #e5484d, #b4232a); color: #fff; font: 800 10px var(--font); letter-spacing: .05em; position: relative; }
.doc-icon::after { content: ""; position: absolute; right: 0; top: 0; border-width: 0 12px 12px 0; border-style: solid; border-color: var(--surface) rgba(255, 255, 255, .35); border-radius: 0 8px 0 4px; }
.doc h3 { font-size: 15px; }
.doc p { color: var(--text-2); font-size: 13.5px; margin-top: 2px; }
.doc .doc-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: 14px; padding: 26px; text-align: center; color: var(--text-2);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone.drag, .dropzone:hover { border-color: var(--brand); background: var(--brand-50); }
.dropzone strong { color: var(--brand); }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 12px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tab { height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font: 600 14px var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.tab[aria-selected=true] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ===== Estados vacíos / skeleton ===== */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 48px 20px; color: var(--text-2); }
.empty .empty-icon { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); }
.empty h3 { color: var(--text); }
.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: 10px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 60%, transparent), transparent); animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 14px; } .sk-card { height: 76px; border-radius: 14px; }

/* ===== Toasts ===== */
.toasts { position: fixed; z-index: 1000; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; min-width: 260px; max-width: 380px; padding: 12px 14px;
  border-radius: 12px; background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg); font-size: 14px;
  animation: toast-in .3s var(--ease);
}
.toast.out { animation: toast-out .25s var(--ease) forwards; }
.toast.error .i { color: #ff8a8a; } .toast.ok .i { color: #5fe0a3; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px) scale(.97); } }
@media (max-width: 900px) { .toasts { left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); } .toast { max-width: none; } }

/* ===== Diálogos ===== */
dialog { border: 0; padding: 0; color: var(--text); background: var(--surface); }
dialog::backdrop { background: rgba(8, 15, 28, .45); backdrop-filter: blur(3px); }
dialog[open] { animation: pop .22s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal { width: min(520px, calc(100vw - 24px)); border-radius: 18px; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(1100px, calc(100vw - 24px)); height: min(92dvh, 1000px); }
.modal.wide .modal-body { padding: 0; flex: 1; display: flex; }
.modal.wide iframe { flex: 1; border: 0; width: 100%; }
.modal-inner { display: flex; flex-direction: column; height: 100%; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 18px 18px; }
.secret-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-radius: 12px; background: var(--brand-50); border: 1px dashed var(--brand); font: 700 24px/1 var(--mono); letter-spacing: .12em; color: var(--brand); }

.palette { width: min(640px, calc(100vw - 24px)); margin-top: 12vh; border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 6px 14px; border-bottom: 1px solid var(--border); }
.palette-input input { border: 0; height: 52px; padding: 0; font-size: 16px; background: transparent; box-shadow: none !important; }
.palette-list { list-style: none; margin: 0; padding: 8px; max-height: 50vh; overflow-y: auto; }
.palette-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--text-2); }
.palette-list li .grow { color: var(--text); }
.palette-list li small { color: var(--text-3); }
.palette-list li[aria-selected=true] { background: var(--brand-50); color: var(--brand); }
.palette-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 8px 12px 4px; cursor: default !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
