/* Impulsa Institute CRM — hoja de estilos (sin dependencias externas). */

:root {
  --ink: #0e1e33;
  --ink-2: #1c2d45;
  --bg: #f6f4ee;
  --surface: #ffffff;
  --surface-2: #faf9f5;
  --line: #e4e0d6;
  --line-strong: #cfc9bb;
  --text: #0e1e33;
  --text-2: #4b5468;
  --text-3: #6b7385;
  --primary: #0e7a68;
  --primary-hover: #0b6657;
  --primary-soft: #e3f3ef;
  --accent: #f2a93b;
  --accent-soft: #fdf1dc;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --good: #0e7a68;
  --good-soft: #e3f3ef;
  --info: #1f5fae;
  --info-soft: #e7eff9;
  --violet: #6b3fa0;
  --violet-soft: #f0e9f8;
  --muted-soft: #eeece6;
  --s-income: #16a38a;
  --s-expense: #e0922a;
  --focus: #1f5fae;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgb(14 30 51 / .06), 0 4px 14px rgb(14 30 51 / .05);
  --shadow-lg: 0 20px 60px rgb(14 30 51 / .25);
  --sidebar: 248px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b1422;
  --surface: #122036;
  --surface-2: #0f1b2e;
  --line: #22324b;
  --line-strong: #33455f;
  --text: #eef1f6;
  --text-2: #b7c0cf;
  --text-3: #8d98ab;
  --primary: #2dbfa3;
  --primary-hover: #4fd1b8;
  --primary-soft: #133a37;
  --accent-soft: #3a2c14;
  --danger: #ff8a7a;
  --danger-soft: #3b1d1d;
  --warn: #f2b35e;
  --warn-soft: #3a2c14;
  --good: #4fd1b8;
  --good-soft: #133a37;
  --info: #8ab8f0;
  --info-soft: #172f4f;
  --violet: #c6a8ec;
  --violet-soft: #2b2140;
  --muted-soft: #1c2a40;
  --s-income: #1fa88e;
  --s-expense: #c8801f;
  --focus: #8ab8f0;
  --shadow: 0 1px 2px rgb(0 0 0 / .3);
  --shadow-lg: 0 20px 60px rgb(0 0 0 / .5);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1422; --surface: #122036; --surface-2: #0f1b2e; --line: #22324b; --line-strong: #33455f;
    --text: #eef1f6; --text-2: #b7c0cf; --text-3: #8d98ab; --primary: #2dbfa3; --primary-hover: #4fd1b8;
    --primary-soft: #133a37; --accent-soft: #3a2c14; --danger: #ff8a7a; --danger-soft: #3b1d1d;
    --warn: #f2b35e; --warn-soft: #3a2c14; --good: #4fd1b8; --good-soft: #133a37; --info: #8ab8f0;
    --info-soft: #172f4f; --violet: #c6a8ec; --violet-soft: #2b2140; --muted-soft: #1c2a40;
    --s-income: #1fa88e; --s-expense: #c8801f; --focus: #8ab8f0;
    --shadow: 0 1px 2px rgb(0 0 0 / .3); --shadow-lg: 0 20px 60px rgb(0 0 0 / .5);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; font-weight: 700; }
h2 { font-size: 1.02rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--primary); }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-3); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }
.owed { color: var(--warn); font-weight: 600; }
.boot, .loading { padding: 48px 16px; text-align: center; color: var(--text-3); }
.noscript { padding: 24px; text-align: center; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 6px; }
.skip-link:focus { left: 8px; }

.icon { width: 18px; height: 18px; flex: none; }
.icon-sm { width: 15px; height: 15px; }

/* ------------------------------------------------------------ layout */
.layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--ink); color: #dfe5ee;
  padding: 16px 12px 24px; display: flex; flex-direction: column; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 4px 6px 10px; border-bottom: 1px solid rgb(255 255 255 / .08); }
.brand-logo { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 9px; padding: 3px; }
.brand strong { display: block; font-size: .98rem; }
.brand small { display: block; color: var(--accent); font-weight: 700; letter-spacing: .12em; font-size: .7rem; }
.nav-group + .nav-group { margin-top: 6px; }
.nav-group-title { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #8d9ab0; padding: 8px 10px 4px; font-weight: 700; }
.sidenav ul { list-style: none; margin: 0; padding: 0; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #cfd7e3; text-decoration: none; font-weight: 500; font-size: .93rem; }
.nav-link:hover { background: rgb(255 255 255 / .06); color: #fff; }
.nav-link.active { background: rgb(255 255 255 / .1); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav-link .icon { opacity: .85; }
.content { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar-title { flex: 1; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-btn { display: none; }
.main { padding: 24px; max-width: 1280px; width: 100%; margin: 0 auto; outline: none; }
.nav-scrim { display: none; }

.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 6px; border-radius: 999px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--muted-soft); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
:root[data-theme="dark"] .avatar { background: var(--primary-soft); }
.user-name { font-weight: 600; font-size: .9rem; }
.user-pop { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; min-width: 240px; z-index: 30; }
.user-email { padding: 8px 10px; color: var(--text-3); font-size: .85rem; border-bottom: 1px solid var(--line); margin-bottom: 4px; word-break: break-all; }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; color: var(--text); text-decoration: none; border-radius: 7px; font: inherit; cursor: pointer; text-align: left; }
.pop-item:hover { background: var(--muted-soft); }

/* ------------------------------------------------------------ page */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head-text { min-width: 0; }
.subtitle { color: var(--text-2); margin-top: 4px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; text-decoration: none; margin-bottom: 6px; color: var(--text-2); }
.back-link:hover { color: var(--primary); }
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 12px; }
.row-gap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* ------------------------------------------------------------ botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 7px 14px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; font-size: .9rem; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--text-3); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
:root[data-theme="dark"] .btn-primary { color: #06231e; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost-danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn-ghost-danger:hover { background: var(--danger-soft); border-color: transparent; }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: .84rem; }
.btn-block { width: 100%; min-height: 44px; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 0; background: transparent; color: inherit; border-radius: 8px; cursor: pointer; }
.icon-btn:hover { background: var(--muted-soft); }
.link { font-size: .85rem; font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; font-size: .82rem; cursor: pointer; text-decoration: underline; }
.link-btn.center { display: block; margin: 14px auto 0; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.seg-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 0; background: none; color: var(--text-2); font: inherit; font-size: .86rem; font-weight: 600; text-decoration: none; cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn.on, .seg-btn:hover { background: var(--muted-soft); color: var(--text); }

/* ------------------------------------------------------------ formularios */
.input {
  width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: .93rem;
}
.input:focus { outline: 2px solid color-mix(in srgb, var(--focus) 45%, transparent); outline-offset: 0; border-color: var(--focus); }
.input:disabled { background: var(--surface-2); color: var(--text-2); }
.input[aria-invalid="true"] { border-color: var(--danger); }
textarea.input { resize: vertical; min-height: 84px; }
.input-sm { min-height: 36px; padding: 6px 10px; width: auto; font-size: .88rem; }
.checkbox { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; vertical-align: -3px; }
.label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: 5px; color: var(--text-2); }
.req { color: var(--danger); }
.hint { color: var(--text-3); font-size: .82rem; margin-top: 5px; }
.hint.center { text-align: center; margin-top: 16px; }
.field-error { color: var(--danger); font-size: .84rem; margin-top: 5px; font-weight: 500; }
.check-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; font-size: .9rem; }
.inline-label { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--text-2); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.field { min-width: 0; }
.field .check-label { margin-top: 28px; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.form-actions .btn-ghost-danger { margin-right: auto; }
.callout { background: var(--info-soft); color: var(--info); padding: 10px 12px; border-radius: var(--radius-sm); margin-top: 16px; font-size: .9rem; }

/* selector con búsqueda */
.combo { position: relative; }
.combo .input { padding-right: 34px; }
.combo-clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: 0; background: none; color: var(--text-3); cursor: pointer; border-radius: 6px; display: grid; place-items: center; }
.combo-clear:hover { background: var(--muted-soft); }
.combo-clear .icon { width: 14px; height: 14px; }
.combo-list { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0; max-height: 260px; overflow-y: auto; list-style: none; margin: 0; padding: 4px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.combo-item { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: .9rem; }
.combo-item.active, .combo-item:hover { background: var(--muted-soft); }
.combo-item.selected { font-weight: 600; color: var(--primary); }
.combo-empty { padding: 8px 10px; color: var(--text-3); font-size: .88rem; }
.combo-sm { width: 220px; }
.combo-sm .input { min-height: 36px; font-size: .88rem; }

/* ------------------------------------------------------------ tarjetas */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.form-card h2 { margin-bottom: 16px; }
.record-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.record-single { max-width: 860px; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

/* indicadores */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: inherit; box-shadow: var(--shadow); position: relative; overflow: hidden; }
a.stat:hover { border-color: var(--line-strong); }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; }
.stat-accent::before { background: var(--primary); }
.stat-warn::before { background: var(--accent); }
.stat-bad::before { background: var(--danger); }
.stat-good::before { background: var(--good); }
.stat-label { font-size: .8rem; color: var(--text-2); font-weight: 600; }
.stat-value { font-size: clamp(1.1rem, 1.5vw, 1.4rem); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value.small { font-size: 1rem; padding-top: 6px; }
.stat-note { font-size: .8rem; color: var(--text-3); }
.big-number { font-size: 2rem; font-weight: 700; margin-bottom: 12px; }
.big-number span { display: block; font-size: .88rem; font-weight: 500; color: var(--text-2); }
.count-badge { display: inline-block; min-width: 26px; padding: 2px 8px; border-radius: 999px; background: var(--muted-soft); color: var(--text-2); font-size: .78rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.mini-list li:first-child { border-top: 0; padding-top: 0; }
.mini-list a { text-decoration: none; color: inherit; min-width: 0; display: flex; flex-direction: column; }
.mini-list a:hover .mini-title { color: var(--primary); }
.mini-title { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-sub { color: var(--text-3); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-sub.overdue { color: var(--danger); font-weight: 600; }
.funnel { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.funnel li { display: flex; justify-content: space-between; align-items: center; }

/* estados */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 650; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-good { background: var(--good-soft); color: var(--good); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-bad { background: var(--danger-soft); color: var(--danger); }
.tone-accent { background: var(--violet-soft); color: var(--violet); }
.tone-muted { background: var(--muted-soft); color: var(--text-2); }

/* ------------------------------------------------------------ filtros y tablas */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.search-box { position: relative; flex: 1 1 260px; max-width: 420px; }
.search-box .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search-box .input { padding-left: 34px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .table-wrap { box-shadow: none; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); font-weight: 700; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:first-child td { border-top: 0; }
.table th.num, .table td.num { text-align: right; }
.table th.center, .table td.center { text-align: center; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.row-link { color: inherit; font-weight: 600; text-decoration: none; }
.row-link:hover { color: var(--primary); text-decoration: underline; }
.actions-col { width: 1%; white-space: nowrap; text-align: right; }
.empty { padding: 32px 16px; text-align: center; color: var(--text-3); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.card .empty, .empty.small { border: 0; background: none; padding: 16px 0; font-size: .9rem; }
.empty.big { padding: 64px 16px; display: grid; gap: 12px; justify-items: center; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 12px; }
.pager-info { color: var(--text-3); font-size: .85rem; margin-top: 10px; }
.pager .pager-info { margin: 0 auto 0 0; }
.table-toggle { margin-top: 12px; }
.table-toggle summary { cursor: pointer; color: var(--primary); font-weight: 600; font-size: .86rem; margin-bottom: 8px; }

/* tablero */
.board { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.board-col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 240px; }
.board-col.drop { outline: 2px dashed var(--primary); outline-offset: -4px; }
.board-col-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.board-cards { display: grid; gap: 8px; }
.board-card { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; text-decoration: none; color: inherit; box-shadow: var(--shadow); cursor: grab; }
.board-card:hover { border-color: var(--primary); }
.board-card.dragging { opacity: .5; }

/* pestañas */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 10px 14px; font: inherit; font-weight: 600; font-size: .9rem; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.tab:hover { color: var(--text); }

/* notas */
.notes-card { position: sticky; top: 72px; }
.note-form { display: grid; gap: 8px; justify-items: end; margin-bottom: 14px; }
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-height: 60vh; overflow-y: auto; }
.note { border-left: 3px solid var(--accent); background: var(--surface-2); padding: 8px 12px; border-radius: 0 8px 8px 0; }
.note-meta { font-size: .78rem; color: var(--text-3); display: flex; gap: 4px; align-items: baseline; flex-wrap: wrap; }
.note-meta .link-btn { margin-left: auto; }
.note-body { white-space: pre-wrap; font-size: .9rem; margin-top: 3px; overflow-wrap: anywhere; }

/* asistencia */
.att-tools { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.att-list { list-style: none; margin: 0; padding: 0; }
.att-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.att-name { font-weight: 600; }
.att-opts { display: flex; gap: 6px; border: 0; margin: 0; padding: 0; }
.att-opt { position: relative; }
.att-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.att-opt span[aria-hidden] { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line-strong); font-weight: 700; color: var(--text-2); background: var(--surface); }
.att-opt input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.att-presente input:checked + span { background: var(--good); border-color: var(--good); color: #fff; }
.att-ausente input:checked + span { background: var(--danger); border-color: var(--danger); color: #fff; }
.att-tarde input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.att-justificado input:checked + span { background: var(--info); border-color: var(--info); color: #fff; }

/* permisos */
.perm-wrap { margin-top: 18px; }
.perm-table th[scope=row] { font-weight: 600; text-transform: none; letter-spacing: 0; font-size: .9rem; color: var(--text); background: none; }
.perm-group { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 700; }
.perm-table td, .perm-table th { padding: 8px 12px; }
.big-code { background: var(--surface-2); border: 1px solid var(--line); padding: 12px; border-radius: 8px; margin: 12px 0; font-size: .95rem; overflow-wrap: anywhere; }

/* importación */
.import-info { margin-top: 12px; display: grid; gap: 8px; }
.ok-col { color: var(--good); font-weight: 600; }
.skip-col { color: var(--text-3); text-decoration: line-through; }
.error-list { max-height: 200px; overflow-y: auto; color: var(--danger); font-size: .85rem; padding-left: 18px; margin: 0; }

/* gráficos */
.chart { margin: 0; }
.chart-legend { display: flex; gap: 16px; font-size: .84rem; color: var(--text-2); margin-bottom: 8px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.swatch.s-income { background: var(--s-income); }
.swatch.s-expense { background: var(--s-expense); }
.chart-area { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg .grid { stroke: var(--line); stroke-width: 1; }
.chart-svg .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart-svg .tick { fill: var(--text-3); font-size: 11px; }
.chart-svg .bar.s-income { fill: var(--s-income); }
.chart-svg .bar.s-expense { fill: var(--s-expense); }
.chart-svg .hit { fill: transparent; cursor: default; }
.chart-svg .hit.on { fill: color-mix(in srgb, var(--text) 5%, transparent); }
.chart-svg .hit:focus { outline: none; }
.chart-tip { position: absolute; top: 0; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg); border-radius: 8px; padding: 8px 10px; font-size: .82rem; pointer-events: none; min-width: 160px; z-index: 5; }
.tip-row { display: flex; align-items: center; gap: 6px; margin-top: 3px; color: var(--text-2); }
.tip-row b { white-space: nowrap; color: var(--text); font-variant-numeric: tabular-nums; margin-left: auto; padding-left: 8px; }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hbar-top { display: flex; justify-content: space-between; gap: 10px; font-size: .86rem; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-value { font-weight: 650; font-variant-numeric: tabular-nums; }
.hbar-track { height: 8px; background: var(--muted-soft); border-radius: 4px; margin-top: 4px; }
.hbar-fill { height: 100%; background: var(--s-income); border-radius: 4px; }

/* ------------------------------------------------------------ diálogos */
.backdrop { position: fixed; inset: 0; background: rgb(8 15 26 / .55); display: grid; place-items: center; padding: 16px; z-index: 60; animation: fade .15s ease; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal-wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 1.1rem; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-body > div > p + p { margin-top: 8px; }
@keyframes fade { from { opacity: 0; } }

.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 80; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: #fff; padding: 11px 14px; border-radius: 9px; box-shadow: var(--shadow-lg); font-size: .9rem; border-left: 4px solid var(--s-income); transition: opacity .4s, transform .4s; }
.toast-error { border-left-color: #ff6b5b; }
.toast-warn { border-left-color: var(--accent); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ------------------------------------------------------------ acceso */
body.is-auth { background: radial-gradient(1200px 600px at 10% -10%, #17314f 0%, transparent 60%), var(--ink); }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); background: var(--surface); border-radius: 16px; padding: 28px; box-shadow: var(--shadow-lg); }
.auth-card h1 { font-size: 1.35rem; margin-top: 18px; }
.auth-card .subtitle { margin-bottom: 18px; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand strong { display: block; }
.auth-brand span { color: var(--text-3); font-size: .85rem; }
.auth-logo { width: 52px; height: 52px; object-fit: contain; border-radius: 10px; background: #fff; border: 1px solid var(--line); padding: 3px; }
.verify-result { margin-top: 18px; display: grid; gap: 4px; }
.verify-result:empty { display: none; }
.verify-result.ok { background: var(--good-soft); color: var(--good); padding: 14px; border-radius: 10px; }
.verify-result.bad { background: var(--danger-soft); color: var(--danger); padding: 14px; border-radius: 10px; }
.verify-result p { color: var(--text); }

/* ------------------------------------------------------------ impresión */
.print-toolbar { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.paper { background: #fff; color: #0e1e33; max-width: 820px; margin: 0 auto; padding: 40px; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 6px; }
.paper-head { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: start; border-bottom: 2px solid #0e1e33; padding-bottom: 16px; }
.paper-logo { width: 90px; height: auto; }
.paper-org, .paper-num { display: flex; flex-direction: column; font-size: .85rem; color: #4b5468; }
.paper-org strong { color: #0e1e33; font-size: 1.1rem; }
.paper-num { text-align: right; }
.paper-num span:first-child { font-weight: 700; letter-spacing: .08em; color: #0e7a68; }
.paper-num strong { font-size: 1.2rem; color: #0e1e33; }
.paper-fields { display: grid; grid-template-columns: 170px 1fr; gap: 12px 16px; margin: 28px 0; }
.paper-fields dt { font-weight: 700; color: #4b5468; font-size: .88rem; }
.paper-fields dd { margin: 0; border-bottom: 1px dotted #b8b2a4; padding-bottom: 4px; }
.paper-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-top: 48px; }
.sign { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .85rem; color: #4b5468; min-width: 220px; }
.sign-line { width: 100%; border-top: 1px solid #0e1e33; }
.paper-note { font-size: .82rem; color: #4b5468; max-width: 320px; text-align: right; }
.certificate { padding: 18px; }
.cert-border { border: 3px double #0e7a68; outline: 1px solid #f2a93b; outline-offset: -12px; padding: 48px 40px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.cert-logo { width: 150px; }
.cert-org { font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #0e7a68; font-size: .9rem; }
.cert-title { font-family: Georgia, "Times New Roman", serif; font-size: 2.8rem; font-weight: 400; letter-spacing: .06em; color: #0e1e33; }
.cert-sub { color: #4b5468; }
.cert-name { font-family: Georgia, "Times New Roman", serif; font-size: 2.1rem; color: #0e1e33; border-bottom: 1px solid #b8b2a4; padding: 0 24px 6px; }
.cert-program { font-size: 1.35rem; font-weight: 700; color: #0e1e33; }
.cert-signs { display: flex; gap: 48px; justify-content: center; margin-top: 40px; flex-wrap: wrap; }
.cert-code { margin-top: 26px; font-size: .75rem; color: #6b7385; }

@media print {
  @page { margin: 12mm; }
  body { background: #fff !important; }
  .sidebar, .topbar, .no-print, .toasts, .skip-link, .nav-scrim { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; max-width: none; }
  .paper { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .certificate { padding: 0; }
  body.printing-view .certificate { page-break-inside: avoid; }
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .record-grid { grid-template-columns: 1fr; }
  .notes-card { position: static; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(290px, 85vw); z-index: 50; transform: translateX(-100%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; background: rgb(8 15 26 / .5); z-index: 45; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 12px; }
  .main { padding: 16px; }
  .dash-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .user-name { display: none; }
}
@media (max-width: 640px) {
  h1 { font-size: 1.3rem; }
  .form-grid { grid-template-columns: 1fr; }
  .field .check-label { margin-top: 0; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-value { font-size: 1.15rem; }
  .combo-sm, .search-box { width: 100%; max-width: none; flex-basis: 100%; }
  .filters > select, .filters > .inline-label { flex: 1 1 45%; }
  /* Tablas como tarjetas en móvil */
  .table-wrap:not(.keep-table) .table thead { display: none; }
  .table-wrap:not(.keep-table) .table tr { display: block; padding: 10px 12px; border-top: 1px solid var(--line); }
  .table-wrap:not(.keep-table) .table tbody tr:first-child { border-top: 0; }
  .table-wrap:not(.keep-table) .table td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  .table-wrap:not(.keep-table) .table td::before { content: attr(data-label); color: var(--text-3); font-size: .78rem; font-weight: 600; text-align: left; }
  .table-wrap:not(.keep-table) .table td.actions-col { justify-content: flex-end; width: auto; }
  .table-wrap:not(.keep-table) .table td.actions-col::before { content: none; }
  .paper { padding: 20px; }
  .paper-head { grid-template-columns: 1fr; }
  .paper-num { text-align: left; }
  .paper-fields { grid-template-columns: 1fr; gap: 4px; }
  .paper-fields dd { margin-bottom: 10px; }
  .cert-border { padding: 28px 16px; }
  .cert-title { font-size: 2rem; }
  .cert-name { font-size: 1.5rem; }
  .att-row { flex-direction: column; align-items: flex-start; }
}
