/* =====================================================================
   ContaWeb · hoja de estilos
   ===================================================================== */
:root {
  --bg: #f3f5f9; --panel: #fff; --panel-2: #f8fafc; --text: #1b2433; --muted: #6b7687; --line: #e3e8ef; --line-2: #cfd7e2;
  --hover: #f1f5fb; --input: #fff; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.16);
  --ok: #15803d; --ok-bg: #e9f7ef; --warn: #a15c00; --warn-bg: #fff5e0; --err: #c42b1c; --err-bg: #fdecea; --info: #1d4ed8; --info-bg: #eaf1fe;
  --side-w: 264px; --side-mini: 74px; --top-h: 64px;
  --side-bg: linear-gradient(180deg, #0f1f40 0%, #13264c 55%, #0d1a36 100%);
  --side-text: #b9c5da; --side-text-hi: #fff; --side-line: rgba(255,255,255,.08); --side-hover: rgba(255,255,255,.06);
  --accent: #e0263b; --accent-2: #b8162a; --accent-soft: rgba(224,38,59,.10); --accent-ring: rgba(224,38,59,.35);
  --radius: 10px;
  color-scheme: light;
}
[data-accent="azul"]    { --accent: #2563eb; --accent-2: #1d47b8; --accent-soft: rgba(37,99,235,.10); --accent-ring: rgba(37,99,235,.35); }
[data-accent="verde"]   { --accent: #0f9d58; --accent-2: #0b7442; --accent-soft: rgba(15,157,88,.10); --accent-ring: rgba(15,157,88,.35); }
[data-accent="morado"]  { --accent: #7c3aed; --accent-2: #5b21b6; --accent-soft: rgba(124,58,237,.10); --accent-ring: rgba(124,58,237,.35); }
[data-accent="naranja"] { --accent: #ea6a0c; --accent-2: #b94f05; --accent-soft: rgba(234,106,12,.10); --accent-ring: rgba(234,106,12,.35); }
[data-accent="grafito"] { --accent: #374151; --accent-2: #1f2937; --accent-soft: rgba(55,65,81,.10); --accent-ring: rgba(55,65,81,.35); }
[data-theme="dark"] {
  --bg: #0d1220; --panel: #151c2c; --panel-2: #111827; --text: #e5e9f0; --muted: #94a0b4; --line: #253047; --line-2: #34415c;
  --hover: #1b2438; --input: #0f1626; --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 14px 40px rgba(0,0,0,.55);
  --ok-bg: #0f2a1c; --warn-bg: #2d2210; --err-bg: #301615; --info-bg: #13213f; --ok: #4ade80; --warn: #fbbf24; --err: #f87171; --info: #93b4ff;
  --side-bg: linear-gradient(180deg, #0a1328 0%, #0c1732 60%, #08101f 100%);
  color-scheme: dark;
}
[data-theme="dark"][data-accent="grafito"] { --accent: #64748b; --accent-2: #475569; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .6em; line-height: 1.25; }
h2 { font-size: 1.02rem; }
h3 { font-size: .93rem; margin-top: 1em; }
code, kbd { background: var(--hover); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; font-size: .88em; }
kbd { font-family: inherit; font-weight: 600; box-shadow: 0 1px 0 var(--line-2); }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; }
.muted { color: var(--muted); }
.small { font-size: .84em; }
.neg { color: var(--err); }
.ok-txt { color: var(--ok); font-weight: 600; }
.r { text-align: right; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }
.i { width: 18px; height: 18px; flex: none; vertical-align: middle; }

/* ===================== Shell ===================== */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; z-index: 40; transition: width .2s ease, transform .2s ease; }
.side-brand { display: flex; align-items: center; gap: 12px; height: var(--top-h); padding: 0 18px; color: #fff; font-weight: 800; font-size: 1.15rem; letter-spacing: .4px; border-bottom: 1px solid var(--side-line); flex: none; }
.side-brand:hover { text-decoration: none; }
.side-brand .logo { flex: none; border-radius: 9px; }
.side-search { margin: 14px 16px 6px; position: relative; flex: none; }
.side-search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; color: #8ea0bf; }
.side-search input { width: 100%; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12); color: #fff; padding: 9px 10px 9px 34px; border-radius: 8px; }
.side-search input::placeholder { color: #8ea0bf; }
.side-search input:focus { outline: none; border-color: var(--accent); background: rgba(255,255,255,.08); }
.side-nav { flex: 1; overflow-y: auto; padding: 8px 12px 12px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-link { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; margin: 2px 0; border-radius: 9px; color: var(--side-text); background: none; border: 0; font: inherit; text-align: left; cursor: pointer; position: relative; white-space: nowrap; }
.nav-link:hover { background: var(--side-hover); color: var(--side-text-hi); text-decoration: none; }
.nav-ico { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex: none; transition: background .15s; }
.nav-ico .i { width: 19px; height: 19px; }
.nav-txt { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-link.active { background: rgba(255,255,255,.07); color: #fff; font-weight: 600; box-shadow: 0 10px 22px -12px var(--accent); }
.nav-link.active .nav-ico { background: var(--accent); color: #fff; box-shadow: 0 6px 16px -4px var(--accent-ring); }
.nav-link.has-active { color: #fff; }
.nav-chev { display: grid; transition: transform .2s; opacity: .7; }
.nav-chev .i { width: 15px; height: 15px; }
.nav-group.open > .nav-toggle .nav-chev { transform: rotate(90deg); }
.nav-sub { display: none; padding: 2px 0 6px 18px; margin-left: 16px; border-left: 1px solid var(--side-line); }
.nav-group.open > .nav-sub { display: block; }
.nav-sub .nav-link { padding: 6px 10px; font-size: .93em; }
.nav-sub .nav-ico { width: 26px; height: 26px; }
.nav-sub .nav-ico .i { width: 16px; height: 16px; }
.nav-sep { height: 1px; background: var(--side-line); margin: 10px 8px; }
.side-nav.searching .nav-sub { display: block; }
.side-nav.searching .nav-sep { display: none; }
.side-user { margin: 8px 14px; flex: none; position: relative; }
.user-card { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: 10px; color: #fff; cursor: pointer; font: inherit; text-align: left; }
.user-card:hover { background: rgba(255,255,255,.09); }
.avatar { position: relative; width: 38px; height: 38px; flex: none; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .9rem; }
.avatar .online { position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; border: 2px solid #13264c; }
.user-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-txt strong { font-size: .92rem; overflow: hidden; text-overflow: ellipsis; }
.user-txt small { color: #9fb0cc; font-size: .78rem; }
.side-foot { padding: 12px 18px 14px; font-size: .74rem; color: #8193b3; border-top: 1px solid var(--side-line); text-align: center; flex: none; }
.side-foot strong { color: #cdd7e8; }

.topbar { position: fixed; top: 0; right: 0; left: var(--side-w); height: var(--top-h); display: flex; align-items: center; gap: 14px; padding: 0 20px;
  background: linear-gradient(100deg, var(--accent) 0%, var(--accent-2) 100%); color: #fff; z-index: 30; box-shadow: 0 2px 12px -4px var(--accent-ring); transition: left .2s ease; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 9px; background: transparent; color: inherit; cursor: pointer; }
.icon-btn:hover { background: rgba(255,255,255,.14); }
.topbar .icon-btn .i { width: 20px; height: 20px; }
.icon-btn .badge { position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #fff; color: var(--accent-2); font: 700 10px/17px inherit; font-style: normal; text-align: center; }
.icon-btn.help { background: #fff; color: var(--accent); width: 32px; height: 32px; border-radius: 50%; margin-left: 4px; }
.icon-btn.help:hover { background: #fff; transform: scale(1.06); }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; }
.crumbs a, .crumbs span { color: #fff; }
.crumb-home { font-weight: 700; font-size: 1.12rem; }
.crumb-sep { opacity: .7; display: grid; }
.crumb-sep .i { width: 14px; height: 14px; }
.crumbs > span:not(.crumb-sep) { font-size: .86rem; opacity: .92; text-transform: uppercase; letter-spacing: .03em; overflow: hidden; text-overflow: ellipsis; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.top-date { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-family: ui-monospace, Consolas, monospace; font-size: .9rem; padding: 0 10px; }
.top-date .i { width: 17px; }
.emp-pill { display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); border-radius: 9px; padding: 0 4px 0 10px; height: 38px; margin-right: 6px; }
.emp-pill .i { width: 16px; }
.emp-pill select { background: transparent; border: 0; color: #fff; font-weight: 600; max-width: 230px; padding: 6px 4px; cursor: pointer; }
.emp-pill select:focus { outline: none; }
.emp-pill option { color: #111; }
.when-dark { display: none; }
[data-theme="dark"] .when-dark { display: grid; }
[data-theme="dark"] .when-light { display: none; }

.content { margin-left: var(--side-w); padding: calc(var(--top-h) + 22px) 26px 40px; min-height: 100vh; transition: margin-left .2s ease; }
body.bare .content { margin: 0; padding: 0; }

/* sidebar mini */
.side-mini .sidebar { width: var(--side-mini); }
.side-mini .topbar { left: var(--side-mini); }
.side-mini .content { margin-left: var(--side-mini); }
.side-mini .sidebar .nav-txt, .side-mini .sidebar .nav-chev, .side-mini .sidebar .nav-txt-block { display: none; }
.side-mini .side-brand { justify-content: center; padding: 0; }
.side-mini .nav-link { justify-content: center; padding: 7px 0; }
.side-mini .nav-sub { margin-left: 0; padding-left: 0; border-left: 0; }
.side-mini .user-card { justify-content: center; padding: 8px 0; }
.side-mini .nav-link:hover::after { content: attr(data-tip); }
.side-backdrop { display: none; }

/* dropdowns */
.dropdown { position: relative; }
.dropdown-menu { display: none; position: absolute; top: calc(100% + 8px); left: 0; min-width: 230px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; }
.dropdown-menu.right { left: auto; right: 0; }
.dropdown-menu.up { top: auto; bottom: calc(100% + 8px); width: 100%; }
.dropdown-menu.wide { min-width: 320px; }
.dropdown.open > .dropdown-menu { display: block; animation: pop .14s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.dropdown-menu a, .dropdown-menu > button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); font-size: .9rem; }
.dropdown-menu a:hover { background: var(--hover); text-decoration: none; }
.dropdown-menu a.danger { color: var(--err); }
.dropdown-menu a.tone-warn .i { color: var(--warn); }
.dropdown-menu a.tone-info .i { color: var(--info); }
.dd-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; }
.dd-head small { color: var(--muted); }
.dd-empty { padding: 14px 10px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; padding: 8px 6px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 2px var(--text); }
.sw-rojo { background: #e0263b; } .sw-azul { background: #2563eb; } .sw-verde { background: #0f9d58; }
.sw-morado { background: #7c3aed; } .sw-naranja { background: #ea6a0c; } .sw-grafito { background: #374151; }

/* ===================== Página ===================== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.45rem; margin: 0; letter-spacing: -.01em; }
.page-head .sub { margin: 3px 0 0; color: var(--muted); font-size: .88rem; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; box-shadow: var(--shadow); }
.panel.flush { padding: 0; overflow: hidden; }
.panel-title { display: flex; align-items: center; gap: 8px; }
.panel-title .i { color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow); }
.card-ico { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.card-ico .i { width: 22px; height: 22px; }
.card-l { color: var(--muted); font-size: .82rem; }
.card-v { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.card-v.neg { color: var(--err); }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.quick a { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); background: var(--panel-2); }
.quick a:hover { border-color: var(--accent); text-decoration: none; background: var(--accent-soft); }
.quick a .i { color: var(--accent); width: 22px; height: 22px; }

.alert { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: 9px; margin-bottom: 14px; border: 1px solid transparent; }
.alert > .i { margin-top: 1px; }
.alert > span { flex: 1; }
.alert.ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert.error { background: var(--err-bg); color: var(--err); border-color: color-mix(in srgb, var(--err) 25%, transparent); }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert.info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.alert pre { white-space: pre-wrap; font-size: .8em; }
.alert-x { background: none; border: 0; color: inherit; cursor: pointer; opacity: .6; padding: 0; }
.alert-x:hover { opacity: 1; }

/* botones y formularios */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text);
  border-radius: 8px; cursor: pointer; font: inherit; font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s, opacity .12s; }
.btn .i { width: 17px; height: 17px; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 12px -4px var(--accent-ring); }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--err); }
.btn.danger:hover { background: var(--err-bg); border-color: var(--err); }
.btn.small { height: 30px; padding: 0 10px; font-size: .86em; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.primary:disabled { background: var(--accent); }
button.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
form.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }

input, select, textarea { font: inherit; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--input); color: var(--text); min-width: 0; height: 36px; }
textarea { height: auto; }
input[type=checkbox], input[type=radio] { height: auto; accent-color: var(--accent); width: 16px; height: 16px; }
input[type=file] { height: auto; padding: 6px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[readonly], input:disabled, select:disabled { background: var(--panel-2); color: var(--muted); }
label { display: inline-flex; flex-direction: column; gap: 4px; font-size: .84em; font-weight: 500; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 7px; color: var(--text); font-weight: 400; font-size: .9em; }
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.form-stack > label { display: flex; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid > label { display: flex; }
.form-grid input, .form-grid select, .form-stack input, .form-stack select { width: 100%; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.with-hint { display: flex; gap: 8px; align-items: center; }
.with-hint input { width: 9em !important; }
fieldset { border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; }
legend { font-size: .84em; color: var(--muted); padding: 0 4px; }
.hint { color: var(--muted); font-size: .84em; margin: 6px 0; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.filters .spacer { flex: 1; }
.quick-dates { display: inline-flex; gap: 2px; align-self: center; }
.quick-dates button.link { padding: 4px 8px; border-radius: 6px; font-size: .84em; }
.quick-dates button.link:hover { background: var(--accent-soft); }

.tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 20px; font-size: .74em; font-weight: 600; background: var(--hover); color: var(--muted); vertical-align: middle; white-space: nowrap; }
.t-cerrado, .t-cancelada, .t-anulado, .t-inactivo { background: var(--err-bg); color: var(--err); }
.t-abierto, .t-activa, .t-vigente, .t-activo { background: var(--ok-bg); color: var(--ok); }
.t-fel, .t-xml { background: var(--info-bg); color: var(--info); }
.t-api { background: #f3e8fb; color: #6b2fa0; }
.t-cierre, .t-importacion { background: var(--warn-bg); color: var(--warn); }
[data-theme="dark"] .t-api { background: #2a1840; color: #d2a8ff; }

/* ===================== Tablas ===================== */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--panel-2); white-space: nowrap; }
.tbl .r, .tbl th.r { text-align: right; }
.tbl.compact th, .tbl.compact td { padding: 5px 10px; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--line-2); background: var(--panel-2); }
.tbl tr.acum td { background: var(--panel-2); font-weight: 600; }
.tbl tr.cancel td { color: var(--muted); }
.tbl tr.cancel td.strike { text-decoration: line-through; }
.tbl tr.sec td { font-weight: 700; padding-top: 14px; border-bottom: 2px solid var(--line-2); }
.tbl tr.subtot td { font-weight: 600; border-top: 1px solid var(--muted); }
.tbl tr.total td { font-weight: 700; background: var(--panel-2); }
.tbl tr.total.big td { font-size: 1.04em; border-top: 2px solid var(--text); border-bottom: 3px double var(--text); }
.tbl tbody.diario-pol tr:last-child td { border-bottom: 2px solid var(--line-2); }
.tbl .empty td { text-align: center; color: var(--muted); padding: 34px 12px; }
.panel.flush .tbl tr:last-child td { border-bottom: 0; }

/* selección de filas */
.tbl.selectable tbody tr[data-id] { cursor: pointer; user-select: none; transition: background .08s; }
.tbl.selectable tbody tr[data-id]:hover td { background: var(--hover); }
.tbl.selectable tbody tr.sel td { background: var(--accent-soft) !important; }
.tbl.selectable tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.tbl.selectable:focus { outline: none; }
.tbl.selectable:focus-visible tbody tr.cursor td { box-shadow: inset 0 0 0 1px var(--accent-ring); }
.tbl .dt-check { width: 34px; text-align: center; padding-left: 12px; padding-right: 0; }
.tbl .dt-check input { pointer-events: none; }
.tbl th.dt-check input { pointer-events: auto; cursor: pointer; }

.dt-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
.dt-actions, .dt-right { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dt-count { font-size: .84em; color: var(--muted); margin-right: 6px; }
.dt-count.has { color: var(--accent); font-weight: 600; }
.dt-search { position: relative; display: inline-flex; }
.dt-search .i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; color: var(--muted); }
.dt-search input { padding-left: 32px; width: 240px; }
.dt-sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.panel.flush > .dt-toolbar { border-radius: var(--radius) var(--radius) 0 0; }
.dt-foot { padding: 10px 14px; font-size: .84em; color: var(--muted); border-top: 1px solid var(--line); background: var(--panel-2); display: flex; justify-content: space-between; gap: 10px; }

/* ===================== Diálogos ===================== */
dialog.modal { border: 0; padding: 0; border-radius: 14px; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); background: var(--panel); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.modal.lg { width: min(860px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(10,16,30,.55); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: pop .16s ease; display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.05rem; }
.modal-head .icon-btn:hover { background: var(--hover); }
.modal-body { padding: 18px 20px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ===================== Reportes ===================== */
.report-head { text-align: center; margin-bottom: 14px; line-height: 1.4; }
.rh-emp { font-weight: 700; font-size: 1.1rem; }
.rh-title { font-weight: 700; margin-top: 4px; text-transform: uppercase; letter-spacing: .03em; }
.rh-cur { font-size: .8em; color: var(--muted); }
.report.narrow { max-width: 860px; }
.aux-title { background: var(--accent-soft); color: var(--text); padding: 7px 10px; border-radius: 6px; font-size: .92rem; }
.firmas { display: flex; justify-content: space-around; gap: 30px; margin-top: 70px; text-align: center; }
.firmas div { border-top: 1px solid currentColor; padding-top: 4px; min-width: 180px; }
.no-screen { display: none; }

/* ===================== Póliza ===================== */
.pol-head { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.pol-head .grow { flex: 1; min-width: 260px; }
.pol-head .grow input { width: 100%; }
.grid-edit td { padding: 3px 4px; vertical-align: top; }
.grid-edit input { width: 100%; height: 34px; padding: 5px 8px; }
.grid-edit .ln { color: var(--muted); text-align: center; padding-top: 10px; }
.grid-edit .c-nom { color: var(--muted); padding: 1px 2px; min-height: 1.2em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; font-size: .82em; }
.grid-edit .c-del { padding-top: 7px; color: var(--err); }
.pol-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
#t-dif { font-weight: 700; }
.suggest { position: absolute; z-index: 80; background: var(--panel); color: var(--text); border: 1px solid var(--line-2); border-radius: 9px; box-shadow: var(--shadow-lg); max-height: 320px; overflow-y: auto; padding: 4px; }
.s-item { padding: 6px 10px; cursor: pointer; white-space: nowrap; border-radius: 6px; }
.s-item b { font-family: ui-monospace, Consolas, monospace; margin-right: 8px; }
.s-item.on, .s-item:hover { background: var(--accent-soft); }
.token { display: block; margin-top: 6px; padding: 8px; word-break: break-all; cursor: copy; }
.token.copied::after { content: '  ✓ copiada'; color: var(--ok); }
.kbd-tbl td:first-child { white-space: nowrap; width: 1%; }

/* ===================== Login ===================== */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); }
.login-hero { position: relative; overflow: hidden; color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(1200px 600px at 110% -10%, var(--accent-ring), transparent 60%), linear-gradient(160deg, #0f1f40 0%, #13264c 50%, #0b1730 100%); }
.login-hero::before, .login-hero::after { content: ''; position: absolute; border-radius: 50%; border: 1px solid rgba(255,255,255,.08); }
.login-hero::before { width: 520px; height: 520px; right: -180px; bottom: -160px; }
.login-hero::after { width: 760px; height: 760px; right: -300px; bottom: -280px; }
.hero-brand { display: flex; align-items: center; gap: 14px; font-size: 1.4rem; font-weight: 800; letter-spacing: .4px; position: relative; z-index: 1; }
.hero-copy { position: relative; z-index: 1; max-width: 520px; }
.hero-copy h1 { font-size: 2.3rem; line-height: 1.15; margin-bottom: 14px; letter-spacing: -.02em; }
.hero-copy h1 em { font-style: normal; background: linear-gradient(90deg, #fff, #ffd2d7); -webkit-background-clip: text; background-clip: text; color: transparent; }
[data-accent] .hero-copy h1 em { background: linear-gradient(90deg, #fff, color-mix(in srgb, var(--accent) 35%, #fff)); -webkit-background-clip: text; background-clip: text; }
.hero-copy p { color: #c4cfe3; font-size: 1.02rem; }
.hero-feats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 30px; }
.hero-feat { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.09); backdrop-filter: blur(4px); }
.hero-feat .i { width: 22px; height: 22px; color: #fff; padding: 5px; box-sizing: content-box; border-radius: 8px; background: var(--accent); flex: none; }
.hero-feat strong { display: block; font-size: .92rem; }
.hero-feat span { color: #b2bfd6; font-size: .82rem; }
.hero-foot { position: relative; z-index: 1; font-size: .8rem; color: #8ea0bf; }
.login-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 410px; }
.login-card .mobile-brand { display: none; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; margin-bottom: 26px; }
.login-card h2 { font-size: 1.7rem; margin-bottom: 6px; letter-spacing: -.01em; }
.login-card .lead { color: var(--muted); margin: 0 0 26px; }
.field { position: relative; display: flex; }
.field > .i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; pointer-events: none; }
.field input { width: 100%; height: 46px; padding-left: 42px; border-radius: 10px; font-size: .97rem; }
.field .pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; color: var(--muted); }
.field .pw-toggle:hover { background: var(--hover); }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form label.lbl { color: var(--text); font-weight: 600; font-size: .86rem; }
.login-row { display: flex; justify-content: space-between; align-items: center; font-size: .88rem; }
.caps { display: none; color: var(--warn); font-size: .82rem; gap: 6px; align-items: center; margin-top: 2px; }
.caps.on { display: flex; }
.caps .i { width: 15px; height: 15px; }
.btn.block { width: 100%; height: 46px; font-size: 1rem; font-weight: 600; border-radius: 10px; }
.btn .spin { display: none; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.loading .spin { display: inline-block; }
.btn.loading .btn-lbl { opacity: .8; }
@keyframes spin { to { transform: rotate(360deg); } }
.login-sec { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 22px; font-size: .8rem; color: var(--muted); }
.login-sec .i { width: 15px; height: 15px; color: var(--ok); }
.login-tools { position: absolute; top: 18px; right: 18px; display: flex; gap: 6px; }
.login-tools .icon-btn { color: var(--muted); border: 1px solid var(--line); background: var(--panel); }
.login-tools .icon-btn:hover { background: var(--hover); }
.forgot { color: var(--muted); }

/* ===================== Responsivo ===================== */
@media (max-width: 1200px) { .top-date { display: none; } }
@media (max-width: 980px) {
  .grid2 { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); width: var(--side-w) !important; box-shadow: var(--shadow-lg); }
  .side-open .sidebar { transform: none; }
  .side-mini .sidebar .nav-txt, .side-mini .sidebar .nav-chev { display: initial; }
  .side-mini .sidebar .nav-txt-block { display: block; }
  .side-open .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(10,16,30,.45); z-index: 35; }
  .topbar, .side-mini .topbar { left: 0; }
  .content, .side-mini .content { margin-left: 0; padding: calc(var(--top-h) + 16px) 14px 30px; }
  .emp-pill select { max-width: 130px; }
  .hide-sm { display: none; }
  .crumbs > span:not(.crumb-sep):not(.crumb-cur), .crumbs > .crumb-sep:first-of-type { display: none; }
  .login { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-card .mobile-brand { display: flex; }
  .dt-search input { width: 170px; }
}
@media (max-width: 640px) {
  .crumbs { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .dt-actions .btn span { display: none; }
  .dt-actions .btn { padding: 0 10px; }
}

/* ===================== Impresión ===================== */
@media print {
  @page { size: letter; margin: 12mm; }
  html { --bg: #fff; --panel: #fff; --panel-2: #fff; --text: #000; --muted: #444; --line: #bbb; --line-2: #888; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .no-print, .topbar, .sidebar, .filters, .dt-toolbar, .actions, .page-head, .alert, .side-backdrop, dialog { display: none !important; }
  .no-screen { display: flex; }
  .content { margin: 0 !important; padding: 0 !important; }
  .panel { border: 0; padding: 0; margin: 0 0 10px; box-shadow: none; }
  .tbl th { background: none; color: #000; }
  .tbl tr.acum td, .tbl.selectable tbody tr.sel td { background: none !important; box-shadow: none !important; }
  .tbl tbody tr { break-inside: avoid; }
  .tbl .dt-check { display: none; }
  a { color: inherit; }
  .grid2 { display: block; }
  .report.narrow { max-width: none; }
}
.tag .i { width: 12px; height: 12px; margin-right: 3px; }
.report-body { padding: 18px; }
.report.narrow { max-width: 900px; }
.doc-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
.doc-form > label { display: flex; }
.doc-form input, .doc-form select { width: 100%; }
.doc-form .span2 { grid-column: span 2; }
.doc-form .span3 { grid-column: span 3; }
.doc-form .span4 { grid-column: 1 / -1; }
@media (max-width: 700px) { .doc-form { grid-template-columns: 1fr 1fr; } .doc-form .span3 { grid-column: 1 / -1; } }
.avatar.sm { display: inline-grid; width: 28px; height: 28px; border-radius: 8px; font-size: .72rem; vertical-align: middle; margin-right: 6px; }
.t-manual { background: var(--hover); color: var(--muted); }

/* ajustes v1.1 */
.form-grid input[type=checkbox], .form-stack input[type=checkbox] { width: 16px; }
.form-grid > label.check, .form-stack > label.check { flex-direction: row; align-items: center; }
.user-txt small, .user-txt strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl.selectable:focus-visible tbody tr.cursor td { box-shadow: none; }
.tbl.selectable:focus-visible tbody tr.cursor td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.dt-toolbar .btn { height: 34px; padding: 0 11px; font-size: .9rem; }
@media (max-width: 980px) { .emp-pill select { max-width: 110px; } .topbar { gap: 8px; padding: 0 10px; } }

/* selector de periodo */
.per-pill { display: flex; align-items: center; height: 38px; background: #fff; color: var(--accent-2); border-radius: 9px; margin-right: 4px; box-shadow: 0 2px 8px -3px rgba(0,0,0,.25); }
.per-pill.is-closed { background: #fff3f3; }
.per-step { display: contents; }
.per-arrow { display: grid; place-items: center; width: 28px; height: 38px; border: 0; background: none; color: inherit; cursor: pointer; border-radius: 9px; }
.per-arrow:hover { background: var(--accent-soft); }
.per-arrow .i { width: 16px; height: 16px; }
.per-label { display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 6px; border: 0; background: none; color: inherit; cursor: pointer; font: inherit; font-weight: 700; white-space: nowrap; }
.per-label:hover { background: var(--accent-soft); border-radius: 6px; }
.per-label .i { width: 17px; height: 17px; }
.per-txt { display: flex; flex-direction: column; line-height: 1.05; text-align: left; font-size: .9rem; }
.per-txt small { font-size: .62rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; opacity: .7; }
.per-menu { width: 290px; padding: 10px; }
.per-year { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.per-year strong { font-size: 1.05rem; }
.per-year .icon-btn { color: var(--text); }
.per-year .icon-btn:hover { background: var(--hover); }
.per-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.per-m { position: relative; height: 40px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); cursor: pointer; font: inherit; font-weight: 600; text-transform: capitalize; display: flex; align-items: center; justify-content: center; gap: 3px; }
.per-m:hover { border-color: var(--accent); background: var(--accent-soft); }
.per-m.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.per-m.today:not(.on)::after { content: ''; position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.per-m.closed:not(.on) { color: var(--muted); background: var(--panel-2); }
.per-m .i { width: 12px; height: 12px; }
.per-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.per-foot .i { width: 14px; height: 14px; }
.periodo-banner { display: inline-flex; align-items: center; gap: 6px; }
[data-theme="dark"] .per-pill { background: #0f1626; color: #fff; }
[data-theme="dark"] .per-pill.is-closed { background: #2a1416; }
@media (max-width: 1400px) { .top-date { display: none; } }
@media (max-width: 980px) { .per-txt small { display: none; } .per-arrow { width: 22px; } }
@media (max-width: 640px) { .per-pill .per-step { display: none; } .emp-pill { display: none; } }
.dd-label { padding: 6px 10px 2px; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.dd-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; text-align: left; }
.dd-item:hover { background: var(--hover); }
.dd-item.on { color: var(--accent); font-weight: 600; }
.dd-sep { height: 1px; background: var(--line); margin: 4px 0; }

/* calendario miniatura del menú lateral */
.side-cal { margin: 4px 14px 2px; padding: 10px 10px 8px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.09); flex: none; }
.sc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.sc-title { color: #fff; font-weight: 700; font-size: .86rem; }
.sc-nav { width: 26px; height: 26px; border: 0; border-radius: 7px; background: none; color: #cdd7e8; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.sc-nav:hover { background: rgba(255,255,255,.1); color: #fff; }
.sc-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.sc-dow { font-size: .65rem; font-weight: 700; color: #7f92b4; padding: 2px 0; }
.sc-d { height: 26px; display: grid; place-items: center; border-radius: 7px; font-size: .78rem; color: #cdd7e8; font-variant-numeric: tabular-nums; }
.sc-d.we { color: #8193b3; }
.sc-d.today { background: var(--accent); color: #fff; font-weight: 700; box-shadow: 0 4px 12px -3px var(--accent-ring); }
.sc-today { display: block; width: 100%; margin-top: 6px; height: 26px; border: 1px solid rgba(255,255,255,.14); border-radius: 7px; background: none; color: #cdd7e8; font: inherit; font-size: .76rem; cursor: pointer; }
.sc-today:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-cal-mini { display: none; }
.side-mini .side-cal { display: none; }
.side-mini .side-cal-mini { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 48px; height: 52px; margin: 6px auto; border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.05); color: #fff; cursor: pointer; font: inherit; line-height: 1.05; flex: none; }
.side-cal-mini small { font-size: .6rem; text-transform: uppercase; font-weight: 700; color: var(--accent); filter: brightness(1.4); }
.side-cal-mini b { font-size: 1.15rem; }
@media (max-width: 980px) { .side-mini .side-cal { display: block; } .side-mini .side-cal-mini { display: none; } }
.top-date { white-space: nowrap; }
