/* CobroControl — hoja de estilos única. Sin dependencias externas (no se cargan fuentes de terceros). */
:root {
  --paper: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --ink: #1a1f36;
  --ink-2: #3c4257;
  --muted: #5e6680;
  --faint: #8792a8;
  --rule: #e6e9f0;
  --rule-strong: #d2d7e2;

  --brand: #5046e5;
  --brand-hover: #4338ca;
  --brand-ink: #ffffff;
  --brand-soft: #eef0ff;
  --brand-soft-2: #e0e3ff;
  --brand-2: #8b5cf6;
  --focus: #6366f1;

  --late: #c0362c;   --late-bg: #fdecea;
  --soon: #9a6700;   --soon-bg: #fff4d6;
  --paid: #0e7a4d;   --paid-bg: #e3f6ec;
  --dispute: #6d3fc0; --dispute-bg: #f1eafd;
  --review: #1f62b5; --review-bg: #e6f0fc;
  --void: #5e6680;   --void-bg: #eef0f4;
  --open: #3c4257;   --open-bg: #eef0f5;

  --age-ok: #7dd3ae;
  --age-1: #fbbf24;
  --age-2: #f59e0b;
  --age-3: #ea580c;
  --age-4: #b91c1c;
  --age-none: #c4cad6;

  --radius-lg: 14px;
  --radius: 10px;
  --radius-small: 8px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow: 0 4px 12px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
  --shadow-lg: 0 20px 48px rgba(16, 24, 40, .14), 0 4px 12px rgba(16, 24, 40, .06);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 var(--font);
  font-feature-settings: "kern", "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 650; letter-spacing: -0.015em; color: var(--ink); }
h1 { font-size: 1.75rem; letter-spacing: -0.025em; }
h2 { font-size: 1.05rem; }
h3 { font-size: .98rem; margin-top: 1.25rem; }
p { margin: 0 0 .75em; }
a { color: var(--brand); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--brand-hover); text-decoration: underline; text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: .88em; background: var(--brand-soft); color: var(--brand-hover); padding: 1px 5px; border-radius: 5px; }
ul, ol { margin: 0 0 .75em; padding-left: 1.25em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--brand-soft-2); }
.icon { flex: none; vertical-align: middle; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--surface); padding: 8px 12px; z-index: 100; border-radius: var(--radius); box-shadow: var(--shadow); }
.skip:focus { top: 8px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.strong { font-weight: 600; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.r { text-align: right; }
.late-text { color: var(--late); }
.ok-text { color: var(--paid); }
.danger-text { color: var(--late); }
.js-only { display: none !important; }
html.js .js-only { display: inline-flex !important; }
html.js .js-hide { display: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(90deg, var(--surface) 0 247px, var(--rule) 247px 248px, transparent 248px); }
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--rule);
  padding: 18px 14px 16px;
  display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.06rem; letter-spacing: -0.02em; padding: 4px 6px; }
.brand:hover { color: var(--ink); text-decoration: none; }
.logo { flex: none; }
.logo-bg { fill: var(--brand); }
.nav-toggle { display: none; }
.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius-small);
  color: var(--ink-2); text-decoration: none; font-weight: 520; font-size: .94rem;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav a .icon { color: var(--faint); transition: color .15s var(--ease); }
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a:hover .icon { color: var(--ink-2); }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-hover); font-weight: 620; }
.nav a[aria-current="page"] .icon { color: var(--brand); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; font-size: .84rem; }
.sidebar-legal { display: flex; gap: 14px; padding: 0 6px; }
.sidebar-legal a { color: var(--muted); }
.send-state { display: flex; align-items: center; gap: 8px; margin: 0; padding: 9px 11px; border: 1px solid var(--rule); border-radius: var(--radius-small); background: var(--surface-2); color: var(--ink-2); font-weight: 520; }
.send-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--paid); box-shadow: 0 0 0 3px var(--paid-bg); flex: none; }
.send-state-paused { background: var(--late-bg); border-color: #f6c7c2; color: var(--late); font-weight: 620; }
.send-state-paused .send-dot { background: var(--late); box-shadow: 0 0 0 3px #f9d6d2; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 32px; background: rgba(255, 255, 255, .86); border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 30; backdrop-filter: saturate(180%) blur(10px); -webkit-backdrop-filter: saturate(180%) blur(10px);
}
.topbar-org, .topbar-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.org-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role { font-size: .76rem; color: var(--brand-hover); background: var(--brand-soft); border-radius: 999px; padding: 2px 9px; font-weight: 600; white-space: nowrap; }
.user-name { color: var(--ink-2); font-weight: 520; font-size: .92rem; }
.avatar {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%); color: #fff; font-weight: 650; font-size: .8rem; letter-spacing: .02em;
}
.avatar-sm { width: 26px; height: 26px; font-size: .74rem; background: var(--brand-soft); color: var(--brand-hover); }
.org-switch { display: flex; gap: 6px; }
.org-switch select { min-height: 34px; font-weight: 600; }
main { padding: 28px 32px 72px; max-width: 1320px; width: 100%; min-width: 0; }
main:focus { outline: none; }

.banner { display: block; padding: 10px 32px; font-size: .9rem; border-bottom: 1px solid var(--rule); }
.banner a { font-weight: 600; }
.banner-demo { background: #fffaeb; color: #6b4e00; border-bottom-color: #f6e3a6; }
.banner-paused { background: var(--late-bg); color: var(--late); font-weight: 520; }
.banner-danger { background: var(--late); color: #fff; }
.banner-danger a { color: #fff; text-decoration: underline; }
.offline-banner {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: var(--radius); box-shadow: var(--shadow-lg); max-width: calc(100% - 32px);
}

.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-header h1 { margin: 0; }
.page-sub { margin: 4px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; font-size: .88rem; margin-bottom: 6px; color: var(--muted); font-weight: 520; }
.back:hover { color: var(--brand); }
.back::before { content: "←"; margin-right: 6px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 7px 14px; border-radius: var(--radius-small);
  border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-size: .92rem; font-weight: 580; text-decoration: none; cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease), transform .05s;
}
.btn:hover { border-color: #b9c0cf; background: var(--surface-2); color: var(--ink); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 1px 2px rgba(80, 70, 229, .25), inset 0 1px 0 rgba(255, 255, 255, .15);
}
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn-danger { color: var(--late); border-color: #f2c2bd; }
.btn-danger:hover { background: var(--late); border-color: var(--late); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--rule); }
.btn-white { background: #fff; color: var(--brand-hover); border-color: #fff; }
.btn-white:hover { background: #f4f4ff; color: var(--brand-hover); border-color: #f4f4ff; }
.btn-small { min-height: 30px; padding: 4px 10px; font-size: .85rem; }
.btn-lg { min-height: 46px; padding: 10px 20px; font-size: 1rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; font-weight: 550; cursor: pointer; }
.btn-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
form[aria-busy="true"] { cursor: progress; }
form[aria-busy="true"] .btn-primary { opacity: .75; }

/* ---------- Formularios ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; align-items: start; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; gap: 16px; padding-top: 4px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
fieldset { border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0; }
legend { font-weight: 620; padding: 0 6px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-weight: 580; font-size: .9rem; color: var(--ink-2); }
.req { color: var(--late); }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea {
  font: inherit; font-size: .95rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: var(--radius-small);
  padding: 8px 11px; min-height: 40px; width: 100%;
  box-shadow: var(--shadow-xs);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type="file"] { font: inherit; padding: 10px; border: 1px dashed var(--rule-strong); border-radius: var(--radius); background: var(--surface-2); width: 100%; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 580; margin-right: 12px; padding: 6px 12px; border-radius: var(--radius-small); border: 1px solid var(--rule-strong); background: var(--surface); cursor: pointer; }
textarea { min-height: 90px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(99, 102, 241, .18); }
.field-error input, .field-error select, .field-error textarea { border-color: var(--late); background: #fffafa; }
.field-error input:focus, .field-error select:focus, .field-error textarea:focus { box-shadow: 0 0 0 3px rgba(192, 54, 44, .15); }
.hint { margin: 0; font-size: .83rem; color: var(--muted); }
.error-text { margin: 0; font-size: .85rem; color: var(--late); font-weight: 560; }
.check { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: start; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); }
.check .hint, .check .error-text { grid-column: 2; }
.check-inline { align-self: end; padding-bottom: 9px; }
.radio-row { border: 0; padding: 0; display: flex; gap: 16px; flex-wrap: wrap; }
.radio-row label { display: inline-flex; gap: 7px; align-items: center; }
.radio-row input { accent-color: var(--brand); }
.input-small { min-height: 30px !important; padding: 3px 8px !important; width: 150px !important; font-size: .86rem !important; }
.input-wide { flex: 1; }
.copy-row { display: flex; gap: 8px; }

.filters {
  display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow-xs);
}
.filters .field { width: 172px; }
.filters .field-grow { flex: 1 1 220px; width: auto; }
.filters .field-num { width: 116px; }
.filters-actions { display: flex; gap: 12px; align-items: center; padding-bottom: 2px; }
.filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }

/* ---------- Avisos ---------- */
.alert { border-radius: var(--radius); padding: 13px 16px; margin-bottom: 16px; border: 1px solid; background: var(--surface); }
.alert > :last-child { margin-bottom: 0; }
.alert ul { margin-bottom: .5em; }
.alert-title { font-weight: 650; margin-bottom: .35em; }
.alert-error { border-color: #f6c7c2; background: var(--late-bg); color: #7a1f18; }
.alert-warn { border-color: #f5dc9a; background: var(--soon-bg); color: #5c3d00; }
.alert-info { border-color: #c6dcf6; background: var(--review-bg); color: #163f73; }
.alert-ok { border-color: #b9e6cf; background: var(--paid-bg); color: #0a4f33; }
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; border-radius: var(--radius); margin-bottom: 18px; font-weight: 550; border: 1px solid;
  animation: flash-in .35s var(--ease);
}
.flash::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.flash-ok { background: var(--paid-bg); color: var(--paid); border-color: #b9e6cf; }
.flash-error { background: var(--late-bg); color: var(--late); border-color: #f6c7c2; }
.flash-info { background: var(--review-bg); color: var(--review); border-color: #c6dcf6; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.note { background: var(--surface); border: 1px dashed var(--rule-strong); padding: 11px 16px; border-radius: var(--radius); }

/* ---------- Paneles y tablas ---------- */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.panel > :last-child { margin-bottom: 0; }
.panel h2 { font-size: 1rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.panel-head > a { font-size: .87rem; font-weight: 580; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.grid-2 > .panel { margin-bottom: 0; }

.table-wrap { position: relative; max-width: 100%; overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.panel .table-wrap { border: 0; box-shadow: none; border-radius: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
.table td.r, .table th.r { text-align: right; }
.table thead th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s var(--ease); }
.table tbody tr:hover { background: #fafbff; }
.table-compact th, .table-compact td { padding: 8px 10px; }
.panel .table-compact th:first-child, .panel .table-compact td:first-child { padding-left: 0; }
.panel .table-compact th:last-child, .panel .table-compact td:last-child { padding-right: 0; }
.panel .table thead th { background: transparent; }
.table-raw td { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.table-caption { caption-side: top; text-align: left; font-weight: 620; padding: 12px 0 6px; }
.row-late td:first-child { box-shadow: inset 3px 0 0 var(--late); }
.row-void td { color: var(--muted); text-decoration: line-through; }
.row-void td:last-child, .row-void td:nth-child(3) { text-decoration: none; }
.sort { color: inherit; text-decoration: none; }
.sort:hover { color: var(--brand); }
.quiet-link { color: inherit; text-decoration: none; }
.quiet-link:hover { color: var(--brand); }
.cust-link { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 560; }
.cust-link:hover { color: var(--brand); text-decoration: none; }
.result-summary { color: var(--muted); }
.pagination { display: flex; gap: 16px; align-items: center; justify-content: flex-end; padding: 14px 0; flex-wrap: wrap; }
.pagination .disabled { color: var(--rule-strong); }

.tabs { position: relative; display: flex; gap: 4px; border-bottom: 1px solid var(--rule); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 560; font-size: .93rem; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--brand-hover); border-bottom-color: var(--brand); font-weight: 640; }
.tab-count { margin-left: 6px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--rule); border-radius: 999px; padding: 0 7px; font-size: .76rem; font-weight: 620; }
.tabs a[aria-current="page"] .tab-count { background: var(--brand-soft); color: var(--brand-hover); border-color: var(--brand-soft-2); }

.empty { text-align: left; padding: 24px 20px; border: 1px dashed var(--rule-strong); border-radius: var(--radius); background: var(--surface-2); }
.empty-title { font-weight: 650; margin-bottom: .35em; }
.empty > :last-child { margin-bottom: 0; }

/* ---------- Estados ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 620; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge-abierta { background: var(--open-bg); color: var(--open); }
.badge-parcialmente_pagada { background: var(--soon-bg); color: var(--soon); }
.badge-pagada { background: var(--paid-bg); color: var(--paid); }
.badge-disputada { background: var(--dispute-bg); color: var(--dispute); }
.badge-en_revision { background: var(--review-bg); color: var(--review); }
.badge-anulada { background: var(--void-bg); color: var(--void); text-decoration: line-through; }
.pill { display: inline-block; margin-left: 8px; padding: 1px 9px; border-radius: 999px; font-size: .77rem; background: var(--brand-soft); color: var(--brand-hover); font-weight: 600; }
.pill-incumplida { background: var(--late-bg); color: var(--late); }
.pill-cumplida { background: var(--paid-bg); color: var(--paid); }
.pill-sec { background: var(--review-bg); color: var(--review); }
.tag-demo {
  display: inline-block; padding: 0 7px; border-radius: 5px; font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  background: #fff6d6; color: #7a5600; border: 1px solid #f3dc8c;
  vertical-align: 1px;
}
.due { white-space: nowrap; }
.due-days { display: block; font-size: .8rem; color: var(--muted); }
.due-late .due-days { color: var(--late); font-weight: 620; }
.due-today .due-days { color: var(--soon); font-weight: 620; }
.due-unknown { color: var(--soon); font-size: .86rem; }

.priority { position: relative; display: inline-block; }
.priority summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 680; border: 1px solid; }
.priority summary::-webkit-details-marker { display: none; }
.priority-alta summary { color: var(--late); border-color: #f6c7c2; background: var(--late-bg); }
.priority-media summary { color: var(--soon); border-color: #f5dc9a; background: var(--soon-bg); }
.priority-baja summary { color: var(--muted); border-color: var(--rule); background: var(--surface-2); }
.priority-pop {
  position: absolute; z-index: 20; left: 0; top: calc(100% + 8px); width: 300px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow-lg); font-size: .86rem; text-align: left; font-weight: 400;
}
.priority-pop ul { padding-left: 1.1em; }
.priority-pop li { display: flex; justify-content: space-between; gap: 8px; }
.priority-pop-title { font-weight: 650; }

/* ---------- Panel principal ---------- */
.stats { display: grid; grid-template-columns: 1.35fr repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 18px 20px;
  box-shadow: var(--shadow-sm); color: var(--ink); text-decoration: none;
  transition: box-shadow .2s var(--ease), transform .2s var(--ease), border-color .2s var(--ease);
}
a.stat:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--rule-strong); color: var(--ink); text-decoration: none; }
.stat-label { display: flex; align-items: center; gap: 8px; font-size: .86rem; font-weight: 560; color: var(--muted); margin: 0; }
.stat-value { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; color: var(--ink); overflow-wrap: anywhere; }
.stat-foot { font-size: .8rem; color: var(--muted); margin: 0; }
.stat-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot-late { background: var(--late); }
.dot-soon { background: var(--age-1); }
.dot-ok { background: var(--paid); }
.stat-hero {
  background: linear-gradient(140deg, #4f46e5 0%, #6d4fe8 55%, #8b5cf6 100%); border: 0; color: #fff;
  box-shadow: 0 10px 30px rgba(80, 70, 229, .28);
  overflow: hidden;
}
.stat-hero::after {
  content: ""; position: absolute; right: -40px; top: -60px; width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, 0) 70%); pointer-events: none;
}
.stat-hero .stat-label { color: rgba(255, 255, 255, .85); }
.stat-hero .stat-value { color: #fff; font-size: 2.15rem; text-decoration: none; }
.stat-hero .stat-value:hover { color: #fff; text-decoration: none; opacity: .92; }
.stat-hero .stat-foot { color: rgba(255, 255, 255, .78); }
.stat-hero .tag-demo { background: rgba(255, 255, 255, .2); color: #fff; border-color: rgba(255, 255, 255, .35); }
.kpi-late .stat-value { color: var(--late); }
.trend { font-weight: 650; }
.trend-up { color: var(--paid); }
.trend-down { color: var(--late); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
.dash-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.dash-col > .panel { margin-bottom: 0; }

.chart { margin: 0; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-grid { stroke: var(--rule); stroke-dasharray: 3 4; }
.chart-base { stroke: var(--rule-strong); }
.chart-bar { fill: var(--brand-soft-2); transition: fill .15s; }
.chart-bar:hover { fill: #c7cbff; }
.chart-bar-now { fill: var(--brand); }
.chart-bar-now:hover { fill: var(--brand-hover); }
.chart-value { font-size: 11px; font-weight: 650; fill: var(--ink-2); font-family: var(--font); }
.chart-label { font-size: 12px; fill: var(--muted); font-family: var(--font); text-transform: capitalize; }
.chart-label-now { fill: var(--brand-hover); font-weight: 700; }
.chart-empty { margin-top: 8px; }

.aging { margin: 4px 0 0; }
.aging-bar { width: 100%; height: 14px; display: block; border-radius: 999px; overflow: hidden; }
.aging-legend { list-style: none; padding: 0; margin: 16px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; }
.aging-legend a { display: grid; grid-template-columns: 10px 1fr; column-gap: 9px; text-decoration: none; color: var(--ink); padding: 7px 9px; border-radius: var(--radius-small); transition: background .12s; }
.aging-legend a:hover { background: var(--surface-2); text-decoration: none; }
.aging-legend .swatch { grid-row: 1 / span 3; width: 10px; height: 10px; border-radius: 3px; margin-top: 5px; }
.aging-label { font-size: .8rem; color: var(--muted); }
.aging-amount { font-weight: 650; font-size: .95rem; }
.aging-count { font-size: .76rem; }
.aging-zero { opacity: .5; }
rect.aging-no_vencido, .swatch.aging-no_vencido { fill: var(--age-ok); background: var(--age-ok); }
rect.aging-d1_30, .swatch.aging-d1_30 { fill: var(--age-1); background: var(--age-1); }
rect.aging-d31_60, .swatch.aging-d31_60 { fill: var(--age-2); background: var(--age-2); }
rect.aging-d61_90, .swatch.aging-d61_90 { fill: var(--age-3); background: var(--age-3); }
rect.aging-d90, .swatch.aging-d90 { fill: var(--age-4); background: var(--age-4); }
rect.aging-sin, .swatch.aging-sin { fill: var(--age-none); background: var(--age-none); }

.count-badge { min-width: 26px; height: 26px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--brand); color: #fff; font-weight: 700; font-size: .82rem; }
.count-badge-zero { background: var(--paid-bg); color: var(--paid); }
.today-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.today-item { display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; align-items: center; padding: 9px 10px; margin: 0 -10px; border-radius: var(--radius); color: var(--ink); text-decoration: none; transition: background .12s; }
.today-item:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.today-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; }
.ti-late { background: var(--late-bg); color: var(--late); }
.ti-warn { background: var(--soon-bg); color: var(--soon); }
.ti-brand { background: var(--brand-soft); color: var(--brand); }
.ti-dispute { background: var(--dispute-bg); color: var(--dispute); }
.today-text { min-width: 0; font-size: .92rem; }
.today-n { font-size: 1.2rem; font-weight: 700; }

/* Compatibilidad con estilos previos de indicadores (otras páginas). */
.hero { margin-bottom: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi-label { font-size: .86rem; color: var(--muted); }
.kpi-value { font-size: 1.3rem; font-weight: 700; }
.kpi-foot { font-size: .8rem; color: var(--muted); }

.onboard { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-sm); }
.onboard-head { display: flex; gap: 16px; align-items: flex-start; }
.onboard-head h2 { font-size: 1.25rem; margin-bottom: .25em; }
.onboard-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(140deg, var(--brand), var(--brand-2)); color: #fff; flex: none; box-shadow: 0 8px 20px rgba(80, 70, 229, .25); }
.onboard-steps { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 22px 0 0; }
.onboard-steps li { border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; align-items: flex-start; background: var(--surface-2); transition: border-color .15s, box-shadow .15s; }
.onboard-steps li:hover { border-color: var(--brand-soft-2); box-shadow: var(--shadow); background: var(--surface); }
.onboard-steps li p { flex: 1; color: var(--muted); font-size: .92rem; }
.onboard-steps h3 { margin: 12px 0 6px; }
.onboard-step-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }

.task-list { list-style: none; padding: 0; margin: 0; }
.task-list li { display: grid; grid-template-columns: 70px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--rule); align-items: start; }
.task-list li:last-child { border-bottom: 0; }
.task-list a { font-weight: 580; }
.task-list p { margin: 2px 0 2px; }
.activity { list-style: none; padding: 0; margin: 0; }
.activity li { display: grid; grid-template-columns: 112px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: .91rem; }
.activity li:last-child { border-bottom: 0; }
.activity-when { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }

/* ---------- Detalle ---------- */
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); margin-bottom: 20px; box-shadow: var(--shadow-sm); overflow: hidden; }
.fact { padding: 16px 18px; border-right: 1px solid var(--rule); display: flex; flex-direction: column; gap: 4px; }
.fact:last-child { border-right: 0; }
.fact-label { font-size: .8rem; color: var(--muted); font-weight: 560; }
.fact-value { font-weight: 620; }
.fact-big { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.fact-foot { font-size: .82rem; color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.detail-side .panel { padding: 16px 18px; }
.blocked { background: var(--surface-2); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 16px; }
.blocked ul { margin-bottom: 0; }
.warn-list { color: var(--soon); }
.form-details { margin-top: 12px; }
.form-details > summary { list-style: none; display: inline-flex; }
.form-details > summary::-webkit-details-marker { display: none; }
.form-details[open] > summary { margin-bottom: 14px; background: var(--brand-soft); border-color: var(--brand-soft-2); color: var(--brand-hover); }
.inline-details { display: inline-block; position: relative; text-align: left; }
.inline-details > summary { cursor: pointer; color: var(--brand); font-size: .86rem; font-weight: 560; }
.inline-details[open] > .small-form, .inline-details[open] > form {
  position: absolute; right: 0; z-index: 10; width: 260px; margin-top: 8px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-lg);
}
.inline-details[open] > form + form { position: static; box-shadow: none; border: 0; padding: 6px 0 0; width: auto; }
.small-form { gap: 8px; }
.small-form label { font-size: .84rem; font-weight: 580; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row-actions { display: inline-flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.promise-list { list-style: none; padding: 0; margin: 0 0 8px; }
.promise-list li { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.promise-late strong { color: var(--late); }
.dl { display: grid; grid-template-columns: 100px 1fr; gap: 8px 12px; margin: 0; font-size: .91rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.dl-wide { grid-template-columns: 1fr; }
.dl-row { display: grid; grid-template-columns: 220px 1fr; gap: 10px; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--rule); margin-left: 6px; }
.tl { display: grid; grid-template-columns: 120px 1fr auto; gap: 4px 12px; padding: 8px 0 8px 18px; position: relative; font-size: .91rem; }
.tl::before { content: ""; position: absolute; left: -7px; top: 13px; width: 12px; height: 12px; border-radius: 50%; background: var(--rule-strong); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--rule); }
.tl-pago_registrado::before { background: var(--paid); }
.tl-borrador_aprobado::before, .tl-envio_registrado::before { background: var(--brand); }
.tl-estado_cambiado::before, .tl-incidencia_registrada::before { background: var(--dispute); }
.tl-promesa_registrada::before, .tl-promesa_resuelta::before { background: var(--age-1); }
.tl-when { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }

.review { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.review-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 22px; margin: 0; }
.review-grid dt { font-size: .8rem; color: var(--muted); font-weight: 560; }
.review-grid dd { margin: 0; font-weight: 620; overflow-wrap: anywhere; }
.message { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface-2); margin-bottom: 12px; overflow: hidden; }
.message-subject { padding: 12px 16px; border-bottom: 1px solid var(--rule); margin: 0; font-weight: 640; background: var(--surface); }
.message-body { margin: 0; padding: 16px; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; }
.steps { padding-left: 1.3em; }
.channel-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.plain-list { list-style: none; padding: 0; }
.plain-list li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.pause-panel { border-left: 4px solid var(--rule-strong); }
.pause-panel.is-paused { border-left-color: var(--late); background: var(--late-bg); }
.danger-zone { border-color: #f2c2bd; }

/* ---------- Importación ---------- */
.wizard { list-style: none; padding: 0; margin: 0 0 22px; display: flex; gap: 8px; counter-reset: paso; }
.wizard li { flex: 1; display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--rule); color: var(--muted); counter-increment: paso; font-size: .9rem; font-weight: 540; }
.wizard li::before { content: counter(paso); display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--rule-strong); font-size: .78rem; font-weight: 700; flex: none; }
.wizard li.done { color: var(--ink-2); }
.wizard li.done::before { content: "✓"; background: var(--paid-bg); border-color: #b9e6cf; color: var(--paid); }
.wizard li[aria-current="step"] { border-color: var(--brand-soft-2); background: var(--brand-soft); color: var(--brand-hover); font-weight: 650; }
.wizard li[aria-current="step"]::before { background: var(--brand); border-color: var(--brand); color: #fff; }
.summary-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); margin-bottom: 20px; box-shadow: var(--shadow-sm); overflow: hidden; }
.summary-strip > div { padding: 16px 18px; border-right: 1px solid var(--rule); display: flex; flex-direction: column; }
.summary-strip > div:last-child { border-right: 0; }
.summary-strip .big { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; }
.summary-strip span:not(.big) { color: var(--muted); font-size: .86rem; }

/* ---------- Diálogo ---------- */
.confirm-dialog { border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 22px 24px; max-width: 440px; width: calc(100% - 32px); box-shadow: var(--shadow-lg); color: var(--ink); animation: dlg-in .2s var(--ease); }
.confirm-dialog::backdrop { background: rgba(26, 31, 54, .45); backdrop-filter: blur(2px); }
.confirm-dialog p { font-size: 1rem; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Acceso (entrar, registro, invitación) ---------- */
body.public { background: var(--surface); }
.auth { display: grid; grid-template-columns: minmax(360px, 46%) minmax(0, 1fr); min-height: 100vh; }
.auth-aside {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 40px; padding: 36px 48px;
  background: radial-gradient(1200px 600px at -10% -10%, #6d5cf6 0%, rgba(109, 92, 246, 0) 55%),
              radial-gradient(800px 500px at 110% 110%, #a78bfa 0%, rgba(167, 139, 250, 0) 55%),
              linear-gradient(150deg, #2b2470 0%, #3d33b8 50%, #4f46e5 100%);
  color: #fff;
}
.auth-aside .brand { color: #fff; }
.auth-aside .logo-bg { fill: rgba(255, 255, 255, .18); }
.auth-pitch { margin: auto 0; max-width: 440px; }
.auth-kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 650; color: rgba(255, 255, 255, .7); margin-bottom: 12px; }
.auth-headline { font-size: 2.1rem; line-height: 1.15; font-weight: 720; letter-spacing: -0.03em; margin-bottom: 28px; }
.auth-points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 18px; }
.auth-points li { display: grid; grid-template-columns: 36px 1fr; gap: 14px; align-items: start; font-size: .94rem; color: rgba(255, 255, 255, .82); }
.auth-points strong { color: #fff; font-weight: 640; }
.auth-point-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); }
.auth-aside-foot { margin: 0; font-size: .8rem; color: rgba(255, 255, 255, .6); }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; background: var(--paper); }
.brand-mobile { display: none; margin-bottom: 20px; }
.public-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow); }
.public-card h1 { font-size: 1.55rem; }
.lead { color: var(--muted); }
.switch-auth { margin: 20px 0 0; text-align: center; color: var(--muted); font-size: .92rem; }
.switch-auth a { font-weight: 620; }
.public-foot { display: flex; justify-content: center; gap: 18px; margin-top: 20px; font-size: .86rem; }
.public-foot a { color: var(--muted); }
.error-code { color: var(--muted); margin-bottom: 4px; }
.prose { max-width: 70ch; }
.prose h2 { margin-top: 1.5em; font-size: 1.15rem; }
.prose li { margin-bottom: .35em; }

/* ---------- Web pública ---------- */
body.marketing main { padding: 0; max-width: none; }
.mk-container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.mk-header { position: sticky; top: 0; z-index: 40; background: rgba(255, 255, 255, .82); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid rgba(230, 233, 240, .8); }
.mk-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; height: 66px; }
.mk-nav { display: flex; gap: 28px; }
.mk-nav a { color: var(--ink-2); font-weight: 540; font-size: .94rem; }
.mk-nav a:hover { color: var(--ink); text-decoration: none; }
.mk-header-cta { display: flex; gap: 8px; align-items: center; }

.mk-hero { position: relative; overflow: hidden; padding: 80px 0 90px; background:
  radial-gradient(900px 500px at 85% 0%, rgba(139, 92, 246, .18), rgba(139, 92, 246, 0) 60%),
  radial-gradient(700px 500px at 0% 20%, rgba(80, 70, 229, .12), rgba(80, 70, 229, 0) 60%),
  linear-gradient(180deg, #ffffff 0%, #f6f7ff 100%); }
.mk-hero-inner { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 56px; align-items: center; }
.mk-eyebrow { display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; font-weight: 650; color: var(--brand-hover); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 14px; }
.mk-hero h1 { font-size: clamp(2.2rem, 4.6vw, 3.6rem); line-height: 1.06; letter-spacing: -0.04em; font-weight: 760; margin-bottom: 22px; }
.mk-grad { background: linear-gradient(100deg, #4f46e5 0%, #7c3aed 60%, #a855f7 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mk-lead { font-size: 1.16rem; line-height: 1.6; color: var(--muted); max-width: 34em; margin-bottom: 30px; }
.mk-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 26px; }
.mk-checks { list-style: none; padding: 0; margin: 0; display: flex; gap: 22px; flex-wrap: wrap; color: var(--ink-2); font-size: .92rem; font-weight: 540; }
.mk-checks li { display: inline-flex; align-items: center; gap: 7px; }
.mk-checks .icon { color: var(--paid); }

.mock { position: relative; background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; box-shadow: 0 30px 70px rgba(43, 36, 112, .18), 0 8px 20px rgba(16, 24, 40, .06); transform: perspective(1400px) rotateY(-6deg) rotateX(3deg); }
.mock-bar { display: flex; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--rule); }
.mock-bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--rule-strong); }
.mock-body { padding: 18px; display: flex; flex-direction: column; gap: 14px; background: var(--paper); border-radius: 0 0 16px 16px; }
.mock-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mock-stat { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 11px 12px; display: flex; flex-direction: column; gap: 2px; }
.mock-stat span { font-size: .7rem; color: var(--muted); font-weight: 560; }
.mock-stat strong { font-size: 1.05rem; letter-spacing: -0.02em; }
.mock-stat:first-child { background: linear-gradient(140deg, #4f46e5, #8b5cf6); border: 0; color: #fff; }
.mock-stat:first-child span { color: rgba(255, 255, 255, .8); }
.mock-stat-late strong { color: var(--late); }
.mock-stat-ok strong { color: var(--paid); }
.mock-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 10px; }
.mock-card { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 12px; }
.mock-title { font-size: .76rem; font-weight: 650; margin-bottom: 6px; }
.mock-chart { width: 100%; height: auto; display: block; }
.mock-col { fill: var(--brand-soft-2); }
.mock-col-now { fill: var(--brand); }
.mock-axis { font-size: 9px; fill: var(--muted); font-family: var(--font); }
.mock-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: .72rem; color: var(--ink-2); }
.mock-list li { display: flex; gap: 6px; align-items: center; }
.mock-pri { font-size: .62rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--rule); }
.mock-pri-high { background: var(--late-bg); color: var(--late); border-color: #f6c7c2; }
.mock-pri-mid { background: var(--soon-bg); color: var(--soon); border-color: #f5dc9a; }
.mock-caption { position: absolute; bottom: -26px; right: 4px; margin: 0; font-size: .74rem; color: var(--faint); }

.mk-band { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--surface); padding: 22px 0; text-align: center; }
.mk-band p { margin: 0; color: var(--muted); font-size: .98rem; }
.mk-section { padding: 96px 0; }
.mk-section-alt { background: var(--paper); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.mk-h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); letter-spacing: -0.035em; line-height: 1.15; font-weight: 740; max-width: 22em; margin-bottom: 14px; }
.mk-sub { font-size: 1.07rem; color: var(--muted); max-width: 40em; margin-bottom: 40px; }
.mk-features { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.mk-feature { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 26px; transition: box-shadow .2s var(--ease), transform .2s var(--ease), border-color .2s; }
.mk-feature:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--brand-soft-2); }
.mk-feature h3 { font-size: 1.05rem; margin: 16px 0 8px; }
.mk-feature p { color: var(--muted); margin: 0; font-size: .95rem; }
.mk-feature-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.mk-steps { list-style: none; padding: 0; margin: 40px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; counter-reset: none; }
.mk-steps li { position: relative; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 26px; box-shadow: var(--shadow-sm); }
.mk-steps h3 { font-size: 1.05rem; margin: 16px 0 8px; }
.mk-steps p { color: var(--muted); margin: 0; }
.mk-step-n { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(140deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 700; }
.mk-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 56px; align-items: start; }
.mk-trust { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.mk-trust li { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 22px; }
.mk-trust h3 { margin: 0 0 6px; font-size: 1rem; }
.mk-trust p { margin: 0; color: var(--muted); font-size: .92rem; }
.mk-trust-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--paid-bg); color: var(--paid); }
.mk-final { padding: 0 0 96px; }
.mk-final-inner {
  text-align: center; border-radius: 22px; padding: 64px 32px; color: #fff;
  background: radial-gradient(700px 300px at 20% 0%, rgba(167, 139, 250, .55), rgba(167, 139, 250, 0) 60%), linear-gradient(140deg, #2b2470 0%, #4f46e5 60%, #7c3aed 100%);
  box-shadow: 0 30px 60px rgba(80, 70, 229, .25);
}
.mk-final h2 { color: #fff; font-size: clamp(1.6rem, 3vw, 2.3rem); letter-spacing: -0.03em; margin-bottom: 12px; }
.mk-final p { color: rgba(255, 255, 255, .82); font-size: 1.08rem; max-width: 36em; margin: 0 auto 28px; }
.mk-footer { border-top: 1px solid var(--rule); background: var(--surface); padding: 32px 0 40px; }
.mk-footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 28px; }
.mk-footer-inner > p { flex-basis: 100%; margin: 0; }
.mk-footer-links { display: flex; gap: 22px; flex-wrap: wrap; }
.mk-footer-links a { color: var(--muted); font-size: .92rem; }

.public-doc { background: var(--paper); }
.doc-wrap { max-width: 860px; margin: 0 auto; padding: 48px 24px 72px; }
.doc-card { max-width: none; padding: 40px 44px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }


/* ---------- Mensajería multicanal ---------- */
.chan { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .77rem; font-weight: 620; white-space: nowrap; border: 1px solid transparent; }
.chan-manual { background: var(--surface-2); color: var(--ink-2); border-color: var(--rule); }
.chan-email { background: var(--brand-soft); color: var(--brand-hover); }
.chan-sms { background: #e6f4fb; color: #0b6390; }
.chan-whatsapp { background: #e4f7ec; color: #0b7a3e; }
.dlv, .dst { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .77rem; font-weight: 620; white-space: nowrap; }
.dlv-ok, .dst-ok { background: var(--paid-bg); color: var(--paid); }
.dlv-read { background: #dff3ff; color: #0a5d8f; }
.dlv-wait, .dst-wait { background: var(--review-bg); color: var(--review); }
.dlv-bad, .dst-bad { background: var(--late-bg); color: var(--late); }
.dlv-muted, .dst-muted { background: var(--void-bg); color: var(--void); }
.dst-draft { background: var(--soon-bg); color: var(--soon); }

.chan-picker { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.chan-picker legend { font-weight: 580; font-size: .9rem; color: var(--ink-2); margin-bottom: 6px; padding: 0; }
.chan-opt { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--radius); cursor: pointer; background: var(--surface); transition: border-color .15s, box-shadow .15s, background .15s; }
.chan-opt:hover { border-color: var(--brand-soft-2); }
.chan-opt input { margin-top: 3px; accent-color: var(--brand); }
.chan-opt:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(99, 102, 241, .14); background: #fbfbff; }
.chan-opt-off { cursor: not-allowed; background: var(--surface-2); }
.chan-opt-off .chan-opt-title { color: var(--faint); }
.chan-opt-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chan-opt-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 620; font-size: .9rem; }
.chan-opt-detail { color: var(--muted); overflow-wrap: anywhere; }

.phone { margin: 0 auto; max-width: 360px; border-radius: 26px; border: 8px solid #1a1f36; background: #1a1f36; box-shadow: var(--shadow-lg); overflow: hidden; }
.phone-top { display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: #f5f6f8; color: var(--ink); border-bottom: 1px solid var(--rule); }
.phone-whatsapp .phone-top { background: #075e54; color: #fff; border-bottom: 0; }
.phone-whatsapp .phone-top .small { color: rgba(255,255,255,.8); }
.phone-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 700; flex: none; }
.phone-whatsapp .phone-avatar { background: #25d366; }
.phone-screen { padding: 18px 14px 26px; min-height: 180px; background: #fff; }
.phone-whatsapp .phone-screen { background: #ece5dd; }
.bubble { margin: 0; max-width: 92%; padding: 10px 12px; border-radius: 14px 14px 14px 4px; background: #e9e9eb; color: #111; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .92rem; line-height: 1.45; }
.phone-whatsapp .bubble { background: #fff; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.phone figcaption { background: #fff; padding: 8px 12px 10px; text-align: center; }

.batch-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; padding: 12px 16px; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.batch-bar .check { align-items: center; }
.batch-all { display: inline-flex; gap: 8px; align-items: center; font-weight: 580; font-size: .9rem; }
.row-check { width: 18px; height: 18px; accent-color: var(--brand); }
.batch-gen { padding: 14px 18px; }
.batch-gen-sum { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.batch-gen-sum::-webkit-details-marker { display: none; }
.batch-gen-sum .icon { color: var(--brand); }
.batch-gen[open] .batch-gen-sum { margin-bottom: 14px; }
.batch-gen-form .field { width: 220px; }
.section-title { font-size: 1rem; margin: 6px 0 12px; }

.inbox { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.inbox-item { border: 1px solid var(--rule); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: 12px 14px; background: var(--surface); }
.inbox-done { border-left-color: var(--rule-strong); opacity: .75; }
.inbox-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 6px; }
.inbox-body { margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }

.chan-status { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.chan-status li { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface-2); }
.chan-status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rule-strong); margin-top: 6px; flex: none; }
.chan-status li.is-ready { background: #f4fbf7; border-color: #c9ead8; }
.chan-status li.is-ready .chan-status-dot { background: var(--paid); box-shadow: 0 0 0 3px var(--paid-bg); }
.setup-steps { padding-left: 1.2em; display: flex; flex-direction: column; gap: 10px; }
.setup-steps code { margin: 0 2px; }
.break { word-break: break-all; }
.template-box { background: var(--surface-2); border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 8px; }
.w-full { width: 100%; flex-basis: 100%; margin: 0; }
.consent-list { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 6px; }
.consent-list li { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.consent-list li.is-ok { color: var(--paid); font-weight: 560; }
.consent-box { display: flex; flex-direction: column; gap: 12px; }
.reactivate { background: var(--soon-bg); border-radius: var(--radius-small); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.reactivate .check { display: flex; gap: 8px; }

/* ---------- Inteligencia ---------- */
.payer { display: inline-block; position: relative; vertical-align: middle; }
.payer > summary { list-style: none; cursor: pointer; }
.payer > summary::-webkit-details-marker { display: none; }
.payer-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.payer-puntual { background: var(--paid-bg); color: var(--paid); }
.payer-irregular { background: var(--soon-bg); color: var(--soon); }
.payer-tardio { background: #ffedd5; color: #9a3412; }
.payer-riesgo { background: var(--late-bg); color: var(--late); }
.payer-sin_historial { background: var(--surface-2); color: var(--muted); border-color: var(--rule); }
.payer-pop { position: absolute; z-index: 25; left: 0; top: calc(100% + 8px); width: 320px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-lg); font-weight: 400; color: var(--ink); }
.payer-pop ul { list-style: none; padding: 0; margin: 0 0 8px; }
.payer-pop li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px dashed var(--rule); }
.payer-pop-title { font-weight: 650; margin-bottom: 8px; }
.detail-side .payer-pop { left: auto; right: 0; }
.fc-total { margin: -4px 0 8px; }
.fc-total .num { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.fc-bar { fill: #c7d2fe; }
.fc-now { fill: var(--brand); }
.fc-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.fc-chip { padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--rule); color: var(--ink-2); }
.fc-atrasado { background: var(--late-bg); border-color: #f6c7c2; color: #7a1f18; }
.fc-riesgo { background: var(--dispute-bg); border-color: #e0d0fa; color: var(--dispute); }
.fc-how { margin-top: 10px; color: var(--muted); }
.fc-how summary { cursor: pointer; font-weight: 560; color: var(--brand); }
.autopilot-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; margin-bottom: 20px; border-radius: var(--radius); background: linear-gradient(90deg, #eef0ff, #f5efff); border: 1px solid var(--brand-soft-2); color: var(--brand-hover); font-size: .92rem; }
.autopilot-strip:hover { text-decoration: none; border-color: var(--brand); color: var(--brand-hover); }
.autopilot-strip span { color: var(--ink-2); }
.autopilot-hero { display: flex; gap: 16px; align-items: flex-start; }
.autopilot-hero h2 { font-size: 1.15rem; }
.autopilot-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--faint); border: 1px solid var(--rule); }
.autopilot-hero.is-on .autopilot-icon { background: linear-gradient(140deg, var(--brand), var(--brand-2)); color: #fff; border: 0; box-shadow: 0 8px 20px rgba(80, 70, 229, .3); animation: spin-slow 14s linear infinite; }
@keyframes spin-slow { to { transform: rotate(360deg); } }
.steps-table select { min-height: 32px; padding: 4px 8px; font-size: .88rem; }

/* ---------- Portal del cliente ---------- */
.portal-body { background: var(--paper); }
.portal-container { max-width: 760px; margin: 0 auto; padding: 0 20px; }
.portal-header { background: var(--surface); border-bottom: 1px solid var(--rule); }
.portal-header-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; height: 64px; flex-wrap: wrap; }
.portal-org { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.portal-org-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(140deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 750; }
.portal-secure { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--paid); font-weight: 600; }
.portal-main { padding-top: 28px; padding-bottom: 40px; max-width: 760px; }
.portal-hero { margin-bottom: 18px; }
.portal-hello { color: var(--muted); margin-bottom: 4px; }
.portal-hero h1 { font-size: 1.6rem; margin-bottom: 16px; }
.portal-total { display: flex; flex-direction: column; gap: 2px; padding: 20px 22px; border-radius: var(--radius-lg); color: #fff; background: linear-gradient(140deg, #4f46e5 0%, #6d4fe8 55%, #8b5cf6 100%); box-shadow: 0 10px 30px rgba(80, 70, 229, .25); }
.portal-total-label { font-size: .86rem; color: rgba(255,255,255,.85); }
.portal-total-amount { font-size: 2.2rem; font-weight: 750; letter-spacing: -0.03em; }
.portal-total-foot { font-size: .85rem; color: rgba(255,255,255,.8); }
.portal-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.portal-card h2 { display: flex; align-items: center; gap: 8px; }
.portal-invoices { list-style: none; padding: 0; margin: 0; }
.portal-invoices li { display: flex; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.portal-invoices li:last-child { border-bottom: 0; }
.portal-invoices li.is-late { box-shadow: inset 3px 0 0 var(--late); padding-left: 12px; margin-left: -12px; }
.portal-pay-text { margin: 0 0 10px; white-space: pre-wrap; font: inherit; font-size: .95rem; background: var(--surface-2); border: 1px dashed var(--rule-strong); border-radius: var(--radius); padding: 12px 14px; overflow-wrap: anywhere; }
.portal-actions { display: flex; flex-direction: column; gap: 10px; }
.portal-action { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.portal-action > summary { list-style: none; cursor: pointer; display: flex; gap: 14px; align-items: center; padding: 16px 18px; transition: background .15s; }
.portal-action > summary::-webkit-details-marker { display: none; }
.portal-action > summary:hover { background: var(--surface-2); }
.portal-action[open] > summary { border-bottom: 1px solid var(--rule); }
.portal-action > form { padding: 16px 18px 18px; }
.pa-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.pa-ok { background: var(--paid-bg); color: var(--paid); }
.pa-date { background: var(--brand-soft); color: var(--brand); }
.pa-warn { background: var(--soon-bg); color: var(--soon); }
.portal-done { text-align: center; padding: 28px 22px; border-color: #b9e6cf; }
.portal-done-icon { width: 56px; height: 56px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--paid); color: #fff; margin-bottom: 8px; }
.portal-empty { text-align: center; padding: 30px 22px; }
.portal-contact { text-align: center; margin-top: 16px; }
.portal-footer { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 10px; padding-bottom: 32px; text-align: center; }
.portal-powered { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--faint); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .mk-hero-inner, .mk-split { grid-template-columns: minmax(0, 1fr); gap: 48px; }
  .mock { transform: none; }
  .mk-features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mk-nav { display: none; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .brand-mobile { display: inline-flex; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); background: none; }
  .sidebar { position: sticky; top: 0; z-index: 35; height: auto; padding: 10px 14px; gap: 0; border-right: 0; border-bottom: 1px solid var(--rule); overflow: visible; }
  .sidebar-nav { margin-top: 8px; overflow-x: auto; }
  .nav { flex-direction: row; gap: 2px; }
  .nav a { white-space: nowrap; padding: 7px 10px; }
  .sidebar-foot { display: none; }
  html.js .nav-toggle { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-small); border: 1px solid var(--rule); background: var(--surface); color: var(--ink); cursor: pointer; }
  html.js .sidebar-nav { display: none; }
  html.js body.nav-open .sidebar-nav { display: block; overflow: visible; }
  html.js body.nav-open .nav { flex-direction: column; padding: 6px 0 4px; }
  html.js body.nav-open .sidebar-foot { display: flex; padding-top: 10px; }
  .topbar { position: static; padding: 10px 16px; }
  .logout-label, .user-name { display: none; }
  main { padding: 20px 16px 56px; }
  .banner { padding-left: 16px; padding-right: 16px; }
  .grid-2, .form-grid, .form-grid-3, .filter-grid { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fact:nth-child(2) { border-right: 0; }
  .fact:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
  .review-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .onboard-steps { grid-template-columns: 1fr; }
  .filters .field, .filters .field-num { width: calc(50% - 7px); }
  .tl { grid-template-columns: 1fr; }
  .dl-row { grid-template-columns: 1fr; }
  .wizard { flex-direction: column; }
  .mk-section { padding: 64px 0; }
  .mk-hero { padding: 48px 0 64px; }
  .mk-steps { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .chan-picker, .chan-status { grid-template-columns: minmax(0, 1fr); }
  .portal-hero h1 { font-size: 1.3rem; }
  .portal-total-amount { font-size: 1.8rem; }
  .payer-pop { width: min(320px, calc(100vw - 48px)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stats .stat-hero { grid-column: 1 / -1; }
  .stats .stat:last-child { grid-column: 1 / -1; }
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 1.2rem; }
  .chart-value { font-size: 17px; }
  .chart-label { font-size: 19px; }
  .stat-hero .stat-value { font-size: 1.8rem; }
  .aging-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts, .review-grid { grid-template-columns: 1fr; }
  .fact { border-right: 0; border-bottom: 1px solid var(--rule); }
  .filters .field, .filters .field-num { width: 100%; }
  .page-actions { width: 100%; }
  .activity li { grid-template-columns: 1fr; gap: 2px; }
  .public-card { padding: 22px; }
  .doc-card { padding: 24px 20px; }
  .mk-features, .mk-trust, .mock-stats { grid-template-columns: minmax(0, 1fr); }
  .mock-grid { grid-template-columns: minmax(0, 1fr); }
  .mk-header-cta .btn-ghost { display: none; }
  .mk-container { padding: 0 16px; }
  .mk-final-inner { padding: 44px 20px; border-radius: 16px; }
  h1 { font-size: 1.5rem; }
}
@media print {
  .sidebar, .topbar, .banner, .page-actions, .filters, form, .pagination, .mk-header, .mk-footer { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
  .panel, .stat, .table-wrap { box-shadow: none; }
}

/* ---------------------------------------------------------------------------
   Cuenta y seguridad
   --------------------------------------------------------------------------- */
.badge-off { background: var(--open-bg); color: var(--open); }
.badge-ok { background: var(--paid-bg); color: var(--paid); }
.badge-inline { margin-left: 8px; vertical-align: middle; }
.badge .icon, .badge svg { width: 12px; height: 12px; }
.badge:has(svg)::before { display: none; }
.warn-text { color: var(--soon); font-weight: 560; }
.top-gap { margin-top: 18px; }
.narrow { max-width: 320px; }

.disclosure { margin: 14px 0 0; border-top: 1px solid var(--rule); padding-top: 12px; }
.disclosure > summary { cursor: pointer; font-weight: 580; color: var(--ink-2); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before { content: "›"; display: inline-block; transition: transform .15s ease; color: var(--faint); font-size: 1.1em; }
.disclosure[open] > summary::before { transform: rotate(90deg); }
.disclosure[open] > summary { margin-bottom: 12px; }

.totp-setup .steps { display: grid; gap: 22px; padding-left: 1.4em; margin: 0; }
.totp-setup .steps > li::marker { font-weight: 700; color: var(--brand); }
.totp-setup .steps > li > strong { display: block; }
.qr-wrap { margin: 12px 0 4px; padding: 12px; display: block; width: max-content; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.qr { display: block; width: 216px; height: 216px; }
code.secret { font-size: 1.02rem; letter-spacing: .06em; padding: 6px 10px; background: var(--surface-2); border: 1px solid var(--rule); border-radius: var(--radius-small); word-break: break-all; }

.recovery-codes { list-style: none; padding: 0; margin: 16px 0; display: grid; grid-template-columns: repeat(2, minmax(0, max-content)); gap: 8px 28px; }
.recovery-codes code { font-size: 1.05rem; letter-spacing: .05em; }

.row-menu { position: relative; display: inline-block; }
.row-menu > summary { list-style: none; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu-body { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 240px; display: grid; gap: 8px; text-align: left;
  padding: 10px 12px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-lg); }

.lang-switch { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); }
.lang-switch a { padding: 2px 8px; border-radius: 999px; font-size: .74rem; font-weight: 650; letter-spacing: .04em; color: var(--muted); text-decoration: none; }
.lang-switch a:hover { color: var(--ink); }
.lang-switch a[aria-current="true"] { background: var(--brand-soft); color: var(--brand); }
.public-foot .lang-switch { margin-left: auto; }
.user-link { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; padding: 2px 8px 2px 2px; border-radius: 999px; }
.user-link:hover, .user-link[aria-current="page"] { background: var(--surface-2); }

@media print {
  .sidebar, .topbar, .inline-actions, .page-header-actions, .flash { display: none !important; }
  .recovery-codes { grid-template-columns: repeat(2, max-content); }
}
