:root {
  /* Neutrals — cool slate (default) */
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fbfbfc;
  --line: #e6e8ec;
  --line-strong: #d4d8df;
  --ink: #0f1729;
  --ink-2: #2a3142;
  --muted: #5a6478;
  --muted-2: #8a91a3;

  /* Accent — driven by --accent-h hue var */
  --accent-h: 265;
  --accent: oklch(0.45 0.13 var(--accent-h));
  --accent-soft: oklch(0.96 0.025 var(--accent-h));
  --accent-ink: oklch(0.36 0.13 var(--accent-h));
  --accent-line: oklch(0.86 0.06 var(--accent-h));

  /* Signals */
  --pos: oklch(0.52 0.12 155);
  --pos-soft: oklch(0.96 0.04 155);
  --neg: oklch(0.55 0.16 25);
  --neg-soft: oklch(0.96 0.04 25);
  --warn: oklch(0.68 0.13 75);
  --warn-soft: oklch(0.96 0.05 75);

  /* Selection */
  --row-sel: oklch(0.93 0.04 var(--accent-h));
  --row-sel-ink: oklch(0.30 0.13 var(--accent-h));
  --row-hover: #f1f3f7;

  --radius: 8px;
  --radius-sm: 5px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 41, 0.05);
  --shadow-md: 0 4px 14px rgba(15, 23, 41, 0.08), 0 1px 2px rgba(15, 23, 41, 0.04);
  --shadow-lg: 0 18px 50px rgba(15, 23, 41, 0.18), 0 4px 12px rgba(15, 23, 41, 0.08);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* App shell */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
}
.brand-text { line-height: 1.15; }
.brand-text .co { font-size: 12px; font-weight: 600; color: var(--ink); }
.brand-text .sub { font-size: 11px; color: var(--muted); }

.search {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.search input {
  width: 100%;
  padding: 7px 10px 7px 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a91a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m21 21-4.3-4.3'/></svg>") 9px 50% / 14px no-repeat;
  outline: none;
  transition: border-color .12s, background-color .12s;
}
.search input:focus { border-color: var(--accent); background-color: #fff; }

.nav { padding: 6px 8px; overflow: auto; flex: 1; min-height: 0; }
.nav-group { margin-bottom: 2px; }
.nav-group-head {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border: none; background: none;
  width: 100%;
  text-align: left;
  color: var(--ink-2);
  font-weight: 500;
  border-radius: var(--radius-sm);
}
.nav-group-head:hover { background: var(--row-hover); }
.nav-group-head .chev { margin-left: auto; color: var(--muted-2); transition: transform .15s; }
.nav-group.open .chev { transform: rotate(90deg); }
.nav-icon { width: 16px; height: 16px; color: var(--muted); flex: 0 0 16px; }
.nav-group.active .nav-icon, .nav-item.active .nav-icon { color: var(--accent); }

.nav-children { padding: 2px 0 4px 30px; display: none; }
.nav-group.open .nav-children { display: block; }
.nav-item {
  display: block;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-size: 12.5px;
  cursor: pointer;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--row-hover); color: var(--ink-2); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}

.user-tile {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, oklch(0.65 0.12 var(--accent-h)), oklch(0.55 0.13 calc(var(--accent-h) + 30)));
  color: #fff;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
}
.user-tile .who { line-height: 1.2; }
.user-tile .name { font-size: 12px; font-weight: 600; }
.user-tile .role { font-size: 11px; color: var(--muted); }

/* Main */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  height: 52px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 16px;
}
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.crumbs .sep { color: var(--muted-2); }
.crumbs .here { color: var(--ink); font-weight: 600; }
.topbar .spacer { flex: 1; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 11.5px;
}
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--pos); }

.page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px 20px 0;
  overflow: hidden;
}

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
}
.page-head h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.page-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: none;
}
.toolbar .group {
  display: flex; align-items: center; gap: 4px;
  padding-right: 8px;
  border-right: 1px solid var(--line);
}
.toolbar .group:last-of-type { border-right: none; }
.toolbar .spacer { flex: 1; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-weight: 500;
  font-size: 12.5px;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--row-hover); border-color: var(--line-strong); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.danger { color: var(--neg); }
.btn.danger:hover { background: var(--neg-soft); border-color: oklch(0.85 0.06 25); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--row-hover); }
.btn.icon { padding: 6px; }
.btn svg { width: 14px; height: 14px; }
.btn .kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 4px;
  margin-left: 4px;
}

/* Filter bar */
.filterbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-bottom: none;
}
.field { display: flex; align-items: center; gap: 6px; }
.field label { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.field select, .field input[type=date], .field input[type=text] {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  outline: none;
  min-height: 28px;
}
.field select:focus, .field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.checkfield { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }

/* Table */
.table-wrap {
  flex: 1;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  background: #fff;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.table-scroll { flex: 1; overflow: auto; min-height: 0; }
table.grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
table.grid thead th {
  position: sticky; top: 0;
  background: #fbfbfc;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 9px 10px;
  white-space: nowrap;
  z-index: 2;
}
table.grid thead th.num { text-align: right; }
table.grid tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  vertical-align: middle;
}
table.grid tbody tr { cursor: pointer; }
table.grid tbody tr:hover { background: var(--row-hover); }
table.grid tbody tr.selected td {
  background: var(--row-sel);
  color: var(--row-sel-ink);
}
table.grid tbody tr.selected:hover td { background: oklch(0.91 0.05 265); }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.mono, table.grid th.mono { font-family: var(--font-mono); }
table.grid td.muted { color: var(--muted); }

.poliza-id {
  display: inline-flex; align-items: center; gap: 6px;
}
.tipo-pill {
  display: inline-grid; place-items: center;
  width: 26px; height: 20px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}
.tipo-30 { background: oklch(0.55 0.13 var(--accent-h)); }   /* DIARIO */
.tipo-40 { background: oklch(0.55 0.12 195); }   /* INGRESO */
.tipo-20 { background: oklch(0.55 0.12 155); }   /* EGRESO */
.tipo-10 { background: oklch(0.58 0.12 75); }    /* OTROS */

.numero { font-family: var(--font-mono); font-weight: 500; }

.badge {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.badge.has { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); }
.badge.zero { color: var(--muted-2); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.pill.ok { background: var(--pos-soft); color: var(--pos); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.neg { background: var(--neg-soft); color: var(--neg); }
.pill .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.statusbar {
  border-top: 1px solid var(--line);
  background: #fbfbfc;
  padding: 8px 14px;
  display: flex; align-items: center; gap: 18px;
  font-size: 12px;
  color: var(--muted);
}
.statusbar .total { font-family: var(--font-mono); color: var(--ink); font-weight: 600; }
.statusbar .pull-right { margin-left: auto; }

/* Drawer */
.scrim {
  position: fixed; inset: 0;
  background: rgba(15, 23, 41, 0.32);
  backdrop-filter: blur(2px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.scrim.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(1100px, 92vw);
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.32,.72,.18,1);
  min-height: 0;
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  padding: 14px 20px 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.drawer-head .row1 {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
}
.drawer-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.drawer-head .row1 .pull { margin-left: auto; display: flex; gap: 6px; }
.metaline {
  display: flex; flex-wrap: wrap; gap: 8px 14px;
  font-size: 12px;
  color: var(--muted);
  padding-bottom: 12px;
}
.metaline b { color: var(--ink-2); font-weight: 600; }
.metaline .meta-edit {
  display: flex; align-items: center; gap: 6px;
}
.metaline .meta-edit input, .metaline .meta-edit select {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  font-size: 12px;
  color: var(--ink);
}

.tabs {
  display: flex; gap: 4px;
  margin-top: 6px;
}
.tab {
  padding: 8px 14px;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  position: relative;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink-2); }
.tab.active {
  color: var(--accent-ink);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.tab .count {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 10.5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-weight: 500;
}
.tab.active .count {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent-ink);
}

.drawer-body {
  flex: 1;
  min-height: 0;
  display: flex; flex-direction: column;
  background: var(--surface-2);
}

.drawer-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: #fff;
  display: flex; align-items: center; gap: 10px;
}
.drawer-foot .balance {
  display: flex; align-items: center; gap: 18px;
  font-size: 12.5px;
}
.drawer-foot .balance b { font-family: var(--font-mono); }
.drawer-foot .pull { margin-left: auto; display: flex; gap: 8px; }

/* Asientos editable grid */
.editgrid-wrap {
  flex: 1; min-height: 0;
  margin: 12px 16px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.editgrid-toolbar {
  padding: 8px 12px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--line);
  background: #fbfbfc;
}
.editgrid-scroll { flex: 1; overflow: auto; min-height: 0; }
table.editgrid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
table.editgrid thead th {
  position: sticky; top: 0;
  background: #fbfbfc;
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  z-index: 2;
}
table.editgrid thead th.num { text-align: right; }
table.editgrid td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.editgrid tbody tr { cursor: pointer; }
table.editgrid tbody tr:hover { background: var(--row-hover); }
table.editgrid tbody tr.selected td { background: var(--row-sel); color: var(--row-sel-ink); }
table.editgrid td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
table.editgrid td.mono { font-family: var(--font-mono); }
table.editgrid td.idx { color: var(--muted-2); font-family: var(--font-mono); width: 36px; text-align: right; }
table.editgrid .acct-code { font-family: var(--font-mono); font-weight: 500; }
table.editgrid .acct-name { color: var(--muted); font-size: 11.5px; margin-top: 1px; }
table.editgrid td.cargos { color: var(--ink); }
table.editgrid td.abonos { color: var(--ink); }
table.editgrid tbody tr.add-row td {
  background: var(--surface-2);
  color: var(--muted);
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px dashed var(--line);
}
table.editgrid tbody tr.add-row:hover td { background: var(--accent-soft); color: var(--accent-ink); }

/* Comprobantes tab */
.comp-tools {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 12px 16px 0;
}
.cap-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  min-width: 160px;
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s, transform .08s;
}
.cap-btn:hover { border-color: var(--accent-line); box-shadow: var(--shadow-sm); }
.cap-btn:active { transform: translateY(1px); }
.cap-btn .ic {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: grid; place-items: center;
}
.cap-btn .ic svg { width: 18px; height: 18px; }
.cap-btn .lbl { font-weight: 600; font-size: 13px; }
.cap-btn .hint { font-size: 11.5px; color: var(--muted); }

/* Adjuntos tab */
.dropzone {
  margin: 12px 16px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 36px;
  text-align: center;
  background: #fff;
  color: var(--muted);
  transition: border-color .12s, background .12s;
}
.dropzone:hover, .dropzone.over {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.dropzone .big { font-size: 24px; margin-bottom: 6px; }
.dropzone .lbl { font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.adj-list {
  margin: 0 16px 12px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.adj-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
}
.adj-card .file-ic {
  width: 32px; height: 36px; flex: 0 0 auto;
  background: var(--accent-soft); color: var(--accent-ink);
  border-radius: 4px;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
}
.adj-card .meta { min-width: 0; flex: 1; }
.adj-card .name { font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adj-card .sub { font-size: 11px; color: var(--muted); }

/* Concepto block (Adjuntos) */
.concepto-block {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  margin: 0 16px 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  align-items: end;
}
.concepto-block label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.concepto-block input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  outline: none;
}
.concepto-block input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.concepto-block .receptor { font-size: 12px; color: var(--muted); padding: 0 2px 6px; }
.concepto-block .receptor b { color: var(--ink-2); font-weight: 600; }

/* Modal (Asiento detail) */
.modal-scrim {
  position: fixed; inset: 0;
  background: rgba(15, 23, 41, 0.42);
  z-index: 60;
  display: grid; place-items: center;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: min(720px, 100%);
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: modalIn .18s cubic-bezier(.32,.72,.18,1);
}
@keyframes modalIn {
  from { transform: translateY(8px) scale(.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.modal-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.modal-head .seg { margin-left: auto; display: flex; gap: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.modal-head .seg button {
  border: none; background: #fff; padding: 5px 10px;
  font-size: 12px; color: var(--muted); border-right: 1px solid var(--line);
}
.modal-head .seg button:last-child { border-right: none; }
.modal-head .seg button.on { background: var(--accent); color: #fff; }

.modal-body {
  padding: 16px 18px;
  overflow: auto;
  flex: 1; min-height: 0;
}
.formgrid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px 14px;
}
.fg { grid-column: span 12; }
.fg-6 { grid-column: span 6; }
.fg-4 { grid-column: span 4; }
.fg-3 { grid-column: span 3; }
.fg-8 { grid-column: span 8; }
.fg label {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 5px;
}
.fg label .req { color: var(--neg); margin-left: 2px; }
.fg input, .fg select, .fg textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  outline: none;
}
.fg input:focus, .fg select:focus, .fg textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.fg .hint {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--muted);
}
.fg.amount input {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  text-align: right;
  padding: 10px 12px;
}
.fg.amount.cargo input { background: var(--pos-soft); border-color: oklch(0.85 0.06 155); color: var(--pos); }
.fg.amount.abono input { background: var(--neg-soft); border-color: oklch(0.85 0.06 25); color: var(--neg); }
.fg.amount.muted input { background: var(--surface-2); color: var(--muted-2); }

.cuenta-input {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px;
}
.cuenta-input input { font-family: var(--font-mono); font-weight: 500; }
.cuenta-input .acct-name {
  display: flex; align-items: center;
  padding: 0 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 12.5px;
}
.toggle-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.toggle-row label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.toggle-row select { padding: 5px 8px; }

.aux-buttons { display: flex; gap: 6px; margin-top: 6px; }

.modal-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  display: flex; align-items: center; gap: 8px;
}
.modal-foot .pull { margin-left: auto; display: flex; gap: 8px; }

/* Density — cascades through grids and forms */
body[data-density="compact"] {
  --row-pad-y: 4px;
  --row-pad-x: 8px;
  --tool-pad-y: 6px;
  --base-fs: 12px;
  --hd-fs: 18px;
  --gap: 6px;
}
body[data-density="cozy"] {
  --row-pad-y: 8px;
  --row-pad-x: 11px;
  --tool-pad-y: 10px;
  --base-fs: 13px;
  --hd-fs: 20px;
  --gap: 10px;
}
body[data-density="spacious"] {
  --row-pad-y: 13px;
  --row-pad-x: 14px;
  --tool-pad-y: 14px;
  --base-fs: 14px;
  --hd-fs: 24px;
  --gap: 14px;
}
body[data-density] { font-size: var(--base-fs); }
body[data-density] table.grid tbody td,
body[data-density] table.editgrid tbody td {
  padding: var(--row-pad-y) var(--row-pad-x);
}
body[data-density] table.grid thead th,
body[data-density] table.editgrid thead th {
  padding: calc(var(--row-pad-y) + 2px) var(--row-pad-x);
}
body[data-density] .toolbar,
body[data-density] .filterbar,
body[data-density] .editgrid-toolbar {
  padding-top: var(--tool-pad-y);
  padding-bottom: var(--tool-pad-y);
}
body[data-density] .page-head h1 { font-size: var(--hd-fs); }
body[data-density="spacious"] .badge { min-width: 26px; height: 22px; }
body[data-density="spacious"] .pill { padding: 4px 9px; font-size: 12px; }
body[data-density="spacious"] .btn { padding: 8px 13px; }
body[data-density="compact"] .btn { padding: 4px 9px; font-size: 12px; }
body[data-density="compact"] .pill { padding: 1px 6px; font-size: 10.5px; }

/* Theme — Warm paper */
body[data-theme="paper"] {
  --bg: #f5efe4;
  --surface: #fdfaf2;
  --surface-2: #f8f1e2;
  --line: #e6dcc6;
  --line-strong: #d6c8a8;
  --ink: #3a2e1c;
  --ink-2: #54442a;
  --muted: #8a7657;
  --muted-2: #a89876;
  --row-hover: #efe6d2;
  --row-sel: oklch(0.91 0.06 var(--accent-h));
}
body[data-theme="paper"] .brand-mark { background: oklch(0.45 0.10 var(--accent-h)); }

/* Theme — Dark */
body[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1c222b;
  --line: #2a313c;
  --line-strong: #3a414e;
  --ink: #e8eaed;
  --ink-2: #c5cad3;
  --muted: #8a91a3;
  --muted-2: #5a6478;
  --row-hover: #20262f;
  --row-sel: oklch(0.30 0.10 var(--accent-h));
  --row-sel-ink: oklch(0.85 0.10 var(--accent-h));
  --accent: oklch(0.65 0.15 var(--accent-h));
  --accent-soft: oklch(0.25 0.08 var(--accent-h));
  --accent-ink: oklch(0.80 0.13 var(--accent-h));
  --accent-line: oklch(0.40 0.10 var(--accent-h));
  --pos-soft: oklch(0.25 0.08 155);
  --neg-soft: oklch(0.25 0.10 25);
  --warn-soft: oklch(0.25 0.08 75);
  --pos: oklch(0.72 0.15 155);
  --neg: oklch(0.72 0.18 25);
  --warn: oklch(0.78 0.15 75);
}
body[data-theme="dark"] .sidebar,
body[data-theme="dark"] .topbar,
body[data-theme="dark"] .toolbar,
body[data-theme="dark"] .table-wrap,
body[data-theme="dark"] .drawer,
body[data-theme="dark"] .drawer-head,
body[data-theme="dark"] .drawer-foot,
body[data-theme="dark"] .modal,
body[data-theme="dark"] .editgrid-wrap,
body[data-theme="dark"] .adj-card,
body[data-theme="dark"] .cap-btn,
body[data-theme="dark"] .dropzone {
  background: var(--surface);
}
body[data-theme="dark"] table.grid thead th,
body[data-theme="dark"] table.editgrid thead th,
body[data-theme="dark"] .statusbar,
body[data-theme="dark"] .filterbar,
body[data-theme="dark"] .editgrid-toolbar,
body[data-theme="dark"] .modal-foot {
  background: var(--surface-2);
}
body[data-theme="dark"] .btn { background: var(--surface-2); color: var(--ink-2); }
body[data-theme="dark"] .btn:hover { background: var(--row-hover); }
body[data-theme="dark"] .btn.primary { background: var(--accent); color: #0d1117; }
body[data-theme="dark"] .field select,
body[data-theme="dark"] .field input,
body[data-theme="dark"] .fg input,
body[data-theme="dark"] .fg select,
body[data-theme="dark"] .fg textarea,
body[data-theme="dark"] .concepto-block input,
body[data-theme="dark"] .search input,
body[data-theme="dark"] .metaline .meta-edit input,
body[data-theme="dark"] .metaline .meta-edit select {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}
body[data-theme="dark"] .modal-scrim { background: rgba(0,0,0,.6); }
body[data-theme="dark"] .scrim { background: rgba(0,0,0,.55); }
body[data-theme="dark"] .cuenta-input .acct-name,
body[data-theme="dark"] .toggle-row { background: var(--surface-2); color: var(--ink-2); }
body[data-theme="dark"] .nav-item.active { background: var(--accent-soft); color: var(--accent-ink); }
body[data-theme="dark"] .file-ic { background: var(--accent-soft); color: var(--accent-ink); }
body[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #3a414e; background-clip: padding-box; }

/* Old density classes (still used as fallback toggle from list) */
.density-compact table.grid tbody td { padding: 5px 10px; }
.density-cozy table.grid tbody td { padding: 9px 10px; }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d4d8df; border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #b8becb; background-clip: padding-box; border: 2px solid transparent; }

/* Language switcher */
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
}
.lang-switch button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 9px;
  border: none;
  background: #fff;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.lang-switch button:last-child { border-right: none; }
.lang-switch button:hover { background: var(--row-hover); color: var(--ink-2); }
.lang-switch button.on {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}
.lang-switch .flag { font-size: 13px; line-height: 1; }
.lang-switch .lbl { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; }

/* Tweaks panel hint */
.tweaks-hint {
  position: fixed; bottom: 16px; right: 16px;
  background: var(--ink);
  color: #fff;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
}

/* Selection visuals when row is double-clickable */
table.grid tbody tr.selected td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}
table.editgrid tbody tr.selected td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

/* misc */
.hr { height: 1px; background: var(--line); margin: 8px 0; }
.spacer-8 { height: 8px; }
.text-muted { color: var(--muted); }
.text-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.kbd-tip { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

/* Shortcut hint pill */
.hint-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--muted);
}
.hint-pill kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 4px;
}
