/* ===== Tokens: noche (por defecto) y día ===== */
:root {
  --bg: #151612; --bg-deep: #10110e; --card: #181915; --card-2: #1d1e19; --line: #2f302a; --line-soft: #24251f;
  --text: #efede5; --muted: #a09e92; --faint: #6f6d63;
  --gold: #c3a86a; --gold-text: #cab885; --gold-soft: rgba(195, 168, 106, .12); --on-gold: #151612;
  --pos: #8fbf8a; --neg: #e0968a; --shadow: 0 1px 0 rgba(255,255,255,.02) inset;
  --serif: 'Fraunces Variable', 'Iowan Old Style', Georgia, serif;
  --sans: 'Inter Variable', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --bg: #f4f2eb; --bg-deep: #ebe8de; --card: #fffefa; --card-2: #f8f6ef; --line: #dfdcd3; --line-soft: #ebe8de;
    --text: #171713; --muted: #6d6a5f; --faint: #9a978b; --gold: #b39659; --gold-text: #8f7338; --gold-soft: rgba(179,150,89,.14); --on-gold: #171713;
    --pos: #3d7a45; --neg: #b3473a; --shadow: 0 1px 2px rgba(60,50,20,.06); color-scheme: light; }
}
:root[data-theme="light"] { --bg: #f4f2eb; --bg-deep: #ebe8de; --card: #fffefa; --card-2: #f8f6ef; --line: #dfdcd3; --line-soft: #ebe8de;
  --text: #171713; --muted: #6d6a5f; --faint: #9a978b; --gold: #b39659; --gold-text: #8f7338; --gold-soft: rgba(179,150,89,.14); --on-gold: #171713;
  --pos: #3d7a45; --neg: #b3473a; --shadow: 0 1px 2px rgba(60,50,20,.06); color-scheme: light; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.eyebrow { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); font-weight: 500; }
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; }
.accent { font-style: italic; color: var(--gold-text); }
.muted { color: var(--muted); }

/* ===== Botones ===== */
.btn { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 9px 18px; font-size: 14px; font-weight: 500; transition: background .15s, border-color .15s; }
.btn:hover { border-color: var(--gold); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.btn.primary:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--line); }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: transparent; }
.icon-btn:hover { border-color: var(--gold); }
.icon-btn svg { width: 17px; height: 17px; }

/* ===== Login ===== */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.login-hero { position: relative; overflow: hidden; padding: 56px 64px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(circle at 20% 90%, #262318 0, #151410 45%, #10110e 100%); color: #efede5; }
.login-hero::after { content: ''; position: absolute; left: -120px; bottom: -200px; width: 640px; height: 640px; border-radius: 50%; border: 1px solid rgba(195,168,106,.14); pointer-events: none; }
.brand { display: flex; align-items: center; gap: 16px; }
.brand img { width: 52px; height: 52px; }
.brand .eyebrow { display: block; font-size: 10px; }
.brand-name { font-size: 28px; line-height: 1.15; }
.brand-name small { font-family: var(--sans); font-size: 10px; letter-spacing: .3em; color: #8d8b80; margin-left: 8px; }
.hero-copy .eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.hero-copy h1 { font-size: clamp(40px, 5.2vw, 66px); line-height: 1.04; }
.hero-copy h1 .accent { color: #cab885; }
.hero-copy p { color: #a9a79b; max-width: 460px; margin-top: 28px; font-size: 17px; line-height: 1.65; }
.pillars { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 0; border-top: 1px solid #2a2b24; border-bottom: 1px solid #2a2b24; margin-top: 40px; max-width: 780px; }
.pillars div { padding: 22px 36px 22px 0; }
.pillars div + div { padding-left: 28px; border-left: 1px solid #2a2b24; }
.pillars span { display: block; font-size: 10px; letter-spacing: .22em; color: #6f6d63; text-transform: uppercase; margin: 8px 0 4px; }
.pillars b { font-weight: 500; font-size: 15px; }
.pillars svg { width: 18px; height: 18px; color: #c3a86a; }
.hero-foot { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: .22em; color: #5f5d53; text-transform: uppercase; }
.login-panel { position: relative; display: flex; flex-direction: column; justify-content: center; padding: 56px clamp(24px, 7vw, 96px); background: var(--bg); }
.login-top { position: absolute; top: 24px; right: 28px; left: 28px; display: flex; justify-content: space-between; align-items: center; }
.secure { display: flex; align-items: center; gap: 8px; font-size: 10px; letter-spacing: .22em; color: var(--muted); text-transform: uppercase; }
.secure svg { width: 13px; height: 13px; }
.login-panel h2 { font-size: clamp(34px, 3.6vw, 46px); line-height: 1.1; margin: 12px 0 14px; }
.login-panel .lead { color: var(--muted); margin-bottom: 30px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 28px; box-shadow: var(--shadow); }
.card h3 { font-size: 19px; font-weight: 600; font-family: var(--sans); }
.card .sub { color: var(--muted); margin-top: 4px; }
.field { display: block; margin-top: 20px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.input:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px var(--gold-soft); }
.codes { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 4px 0 8px; }
.codes input { width: 46px; height: 54px; text-align: center; font-size: 22px; font-weight: 600; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 0; }
.codes input:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px var(--gold-soft); }
.codes i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); margin: 0 4px; }
.hint { font-size: 13px; color: var(--muted); }
.login-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
.login .btn.block { width: 100%; padding: 14px; font-size: 16px; margin-top: 22px; }
.notice { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 18px; font-size: 13.5px; color: var(--muted); }
.notice svg { width: 18px; height: 18px; flex: none; color: var(--gold); margin-top: 1px; }
.error { color: var(--neg); font-size: 13.5px; margin-top: 12px; min-height: 20px; }

/* ===== App shell ===== */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-soft); }
.topbar-in { max-width: 1320px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 24px; }
.topbar .brand img { width: 36px; height: 36px; }
.topbar .brand-name { font-size: 20px; }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a { text-decoration: none; padding: 7px 14px; border-radius: 999px; font-size: 14px; color: var(--muted); }
.nav a[aria-current="page"] { background: var(--gold-soft); color: var(--gold-text); font-weight: 500; }
.nav a:hover { color: var(--text); }
.spacer { flex: 1; }
.who { text-align: right; line-height: 1.25; }
.who b { font-size: 13px; font-weight: 500; display: block; }
.who small { font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
main { max-width: 1320px; margin: 0 auto; padding: 28px 24px 80px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: clamp(28px, 3vw, 38px); line-height: 1.1; margin-top: 6px; }
.page-head p { color: var(--muted); margin-top: 6px; }

/* ===== Filtros ===== */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; margin-bottom: 18px; }
.filters > label, .filters > .lbl { display: flex; flex-direction: column; gap: 5px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.filters .input { padding: 8px 10px; font-size: 14px; letter-spacing: 0; text-transform: none; min-width: 0; border-radius: 10px; }
.filters .grow { flex: 1 1 200px; }
.filters .input, .filters .multi > summary, .filters .chip { height: 40px; }
.filters select.input { padding-right: 8px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 6px 12px; font-size: 12.5px; color: var(--muted); }
.chip:hover { border-color: var(--gold); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--gold-soft); border-color: var(--gold); color: var(--gold-text); }
.multi { position: relative; }
.multi > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 190px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 14px; color: var(--text); letter-spacing: 0; text-transform: none; }
.multi > summary::-webkit-details-marker { display: none; }
.multi[open] > summary { border-color: var(--gold); }
.multi-pop { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: 340px; max-height: 380px; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px; box-shadow: 0 18px 40px rgba(0,0,0,.35); }
.multi-pop .tools { display: flex; gap: 8px; padding: 4px 6px 8px; }
.check { display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; font-size: 13.5px; line-height: 1.3; color: var(--text); letter-spacing: 0; text-transform: none; cursor: pointer; }
.check > span { flex: 1; min-width: 0; text-align: left; }
.check:hover { background: var(--gold-soft); }
.check input { accent-color: var(--gold); width: 16px; height: 16px; flex: none; }
.check small { color: var(--muted); margin-left: auto; font-size: 12px; }

/* ===== KPIs, tarjetas ===== */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px 22px; box-shadow: var(--shadow); }
.kpi .label { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.kpi .value { font-family: var(--serif); font-size: clamp(24px, 2.5vw, 34px); line-height: 1.15; margin-top: 10px; letter-spacing: -.01em; }
.kpi .note { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.kpi.hero { border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); background: linear-gradient(160deg, var(--gold-soft), transparent 70%), var(--card); }
.grid2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px 22px; box-shadow: var(--shadow); min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h3 { font-size: 16px; font-weight: 600; font-family: var(--sans); }
.panel-head span { font-size: 12.5px; color: var(--muted); }
.chart-box { position: relative; height: 270px; }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bars + .bars-title { margin-top: 22px; }
.bar-title { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 18px 0 10px; }
.bar-title:first-child { margin-top: 0; }
.bar-row .top { display: flex; justify-content: space-between; font-size: 13.5px; gap: 10px; }
.bar-row .top span:last-child { color: var(--muted); }
.track { height: 6px; border-radius: 99px; background: var(--line-soft); margin-top: 6px; overflow: hidden; }
.track i { display: block; height: 100%; background: var(--gold); border-radius: 99px; }

/* ===== Tablas ===== */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th.r, td.r { text-align: right; }
th button { all: unset; cursor: pointer; }
th button:hover { color: var(--text); }
th[aria-sort] button { color: var(--gold-text); }
td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:hover td { background: var(--card-2); }
td small { display: block; color: var(--muted); font-size: 12px; }
tr.clickable { cursor: pointer; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; border: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.pill.gold { border-color: var(--gold); color: var(--gold-text); }
.pill.off { color: var(--neg); border-color: var(--neg); }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 13px; color: var(--muted); gap: 12px; flex-wrap: wrap; }
.pager div { display: flex; gap: 8px; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }

/* ===== Admin ===== */
.stack { display: flex; flex-direction: column; gap: 14px; }
.dropzone { display: block; width: 100%; box-sizing: border-box; cursor: pointer; border: 1.5px dashed var(--line); border-radius: 16px; padding: 26px; text-align: center; color: var(--muted); transition: border-color .15s, background .15s; }
.dropzone.over, .dropzone:hover { border-color: var(--gold); background: var(--gold-soft); }
.dropzone b { color: var(--text); }
.result { margin-top: 14px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card-2); font-size: 14px; }
.result.ok { border-color: var(--pos); }
.result.bad { border-color: var(--neg); }
dialog { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 22px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0,0,0,.5); }
dialog::backdrop { background: rgba(8,8,6,.6); backdrop-filter: blur(3px); }
.dlg { padding: 26px; }
.dlg h3 { font-size: 22px; margin-bottom: 4px; }
.dlg .list { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 6px; margin-top: 8px; background: var(--bg); }
.dlg .row { display: flex; gap: 12px; margin-top: 0; }
.dlg .row > * { flex: 1; }
.dlg .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
details.log summary { cursor: pointer; font-size: 14px; color: var(--muted); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--card); border: 1px solid var(--gold); padding: 11px 20px; border-radius: 999px; z-index: 100; box-shadow: 0 12px 30px rgba(0,0,0,.4); font-size: 14px; }
.skeleton { background: linear-gradient(90deg, var(--line-soft), var(--card-2), var(--line-soft)); background-size: 200% 100%; animation: sk 1.2s linear infinite; border-radius: 8px; min-height: 18px; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ===== Responsive ===== */
@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { padding: 28px 24px; min-height: 0; gap: 28px; }
  .hero-copy p, .pillars, .hero-foot { display: none; }
  .hero-copy h1 { font-size: 34px; }
  .login-hero::after { display: none; }
  .login-panel { padding-top: 84px; }
}
@media (max-width: 640px) {
  .topbar-in { padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
  .nav { margin-left: 0; order: 5; width: 100%; }
  .who { display: none; }
  main { padding: 20px 14px 60px; }
  .kpis { gap: 10px; }
  .filters { padding: 14px; }
  .multi-pop { width: min(340px, calc(100vw - 56px)); }
  .codes input { width: 40px; height: 48px; }
  .dlg .row { flex-direction: column; gap: 0; }
}

/* ===== Tasas Arkax ===== */
.notice.warn { margin: 0 0 14px; border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); background: var(--gold-soft); color: var(--text); }
.notice.warn a { color: var(--gold-text); font-weight: 500; }
.rates-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.rates-bar .inline { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.rate-in { width: 76px; padding: 7px 8px; text-align: right; }
.rate-in.changed { border-color: var(--gold); background: var(--gold-soft); }
#rates td { vertical-align: middle; }

.rate-in.needs { border-color: var(--neg); }
.rate-in.changed.needs { border-color: var(--gold); }
table.matrix { min-width: 1060px; }
table.matrix th.grp { text-align: center; border-bottom: 1px solid var(--line); color: var(--gold-text); }
table.matrix th.sub { text-align: center; padding: 6px 4px; }
table.matrix td.cell { padding: 8px 4px; text-align: center; }
table.matrix td.cell:nth-child(3n+2), table.matrix th.grp + th.grp { border-left: 1px solid var(--line-soft); }
table.matrix tr.tpl td { background: var(--gold-soft); }
table.matrix tr.tpl td:first-child small { color: var(--muted); }
table.matrix td:first-child, table.matrix th:first-child { min-width: 230px; }

/* Tasa predeterminada y CLABE */
.default-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--gold-soft); }
.default-bar .hint { flex: 1 1 280px; align-self: center; }
.clabe-msg { display: block; min-height: 16px; font-size: 12px; color: var(--muted); }
.clabe-msg.ok { color: var(--gold); }
.clabe-msg.bad { color: #c0564a; }
.clabe-in.changed { border-color: var(--gold); }
