/* Kontu — estilos del panel interior (cartera, calendario). Depende de tokens.css */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: var(--fs-14); line-height: 1.45; color: var(--text);
  background: var(--bg); -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
}
button { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-xs); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ================= Esqueleto ================= */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }

/* ---------- Sidebar ---------- */
.side { background: var(--ink-900); color: var(--text-on-ink); display: flex; flex-direction: column; padding: 14px 12px; position: sticky; top: 0; height: 100vh; }
.studio { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; border-bottom: 1px solid var(--ink-800); margin-bottom: 12px; }
.studio .mk { flex: none; }
.studio b { display: block; font-size: var(--fs-13); font-weight: 600; line-height: 1.2; }
.studio span { display: block; font-size: var(--fs-12); color: var(--ink-300); }
.studio .chev { margin-left: auto; color: var(--ink-500); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); color: var(--ink-300); font-size: var(--fs-14); font-weight: 500; position: relative; transition: background var(--t-fast), color var(--t-fast); }
.nav a:hover { background: var(--ink-800); color: var(--text-on-ink); }
.nav a.on { background: var(--ink-800); color: #fff; }
.ph h1, .dr-title h2, .month-head h2, .dp-head h3 { color: var(--heading); }
.nav a.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--saffron); }
.nav .ct { margin-left: auto; font-size: var(--fs-12); color: var(--ink-500); font-weight: 500; }
.nav .ct.alert { color: #FFB4AA; }
.nav-sep { font-size: var(--fs-12); color: var(--ink-500); padding: 18px 10px 6px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.sii { border: 1px solid var(--ink-700); border-radius: var(--r-md); padding: 10px 12px; font-size: var(--fs-12); color: var(--ink-300); }
.sii b { display: flex; align-items: center; gap: 8px; color: var(--text-on-ink); font-weight: 500; font-size: var(--fs-13); margin-bottom: 2px; }
.sii .live { width: 7px; height: 7px; border-radius: 50%; background: #3E9C70; box-shadow: 0 0 0 3px rgba(62,156,112,.2); }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-sm); font-size: var(--fs-13); }
.me:hover { background: var(--ink-800); }
.me div span { color: var(--ink-300); font-size: var(--fs-12); display: block; }

.av { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 600; flex: none; }
.av.jg { background: #DCE7FD; color: #1D4FB8; }
.av.mc { background: #F7E3D4; color: #8A4515; }
.av.rs { background: #DDEFE5; color: #1E6645; }
.side .av { width: 28px; height: 28px; }

/* ---------- Barra superior ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.top { height: 56px; display: flex; align-items: center; gap: 16px; padding: 0 32px; border-bottom: 1px solid var(--line); background: rgba(244,245,247,.85); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.cmdk { white-space: nowrap; overflow: hidden; display: flex; align-items: center; gap: 10px; height: 34px; width: min(440px, 100%); padding: 0 8px 0 12px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); color: var(--text-3); cursor: text; font-size: var(--fs-13); transition: border-color var(--t-fast); }
.cmdk:hover { border-color: var(--line-strong); }
kbd { font-family: var(--font); font-size: 11px; font-weight: 500; color: var(--text-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; background: var(--surface-2); }
.cmdk kbd { margin-left: auto; }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: var(--fs-13); color: var(--text-2); }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: var(--r-sm); border: 0; background: none; cursor: pointer; color: var(--text-2); position: relative; }
.icon-btn:hover { background: var(--line); color: var(--text); }
.link, .sec h3 a, .field-row a { color: var(--accent); }
.icon-btn .badge { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--risk); box-shadow: 0 0 0 2px var(--bg); }

.page { padding: 28px 32px 64px; max-width: 1480px; width: 100%; }

/* ---------- Encabezado de página ---------- */
.ph { display: flex; align-items: flex-start; gap: 24px; margin-bottom: 22px; }
.ph h1 { margin: 0; font-size: var(--fs-24); letter-spacing: -.02em; font-weight: 600; line-height: 1.2; }
.ph .brief { margin: 6px 0 0; color: var(--text-2); max-width: 72ch; }
.ph .brief strong { color: var(--text); font-weight: 600; }
.ph .brief .r { color: var(--risk); font-weight: 600; }
.ph-actions { margin-left: auto; display: flex; gap: 8px; flex: none; }

/* ---------- Botones ---------- */
.btn { height: 34px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-13); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background var(--t-fast), border-color var(--t-fast); }
.btn:hover { background: var(--surface-2); border-color: #B5BDC9; }
.btn.primary { background: var(--saffron); border-color: var(--saffron); color: var(--text-on-yellow); font-weight: 600; }
.btn.primary:hover { background: var(--saffron-hover); border-color: var(--saffron-hover); }
.btn.primary:active { background: var(--saffron-press); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--line); }
.btn.sm { height: 28px; padding: 0 10px; font-size: var(--fs-12); }

/* ---------- Franja de 30 días ---------- */
.horizon { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: 20px; }
.hz-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.hz-stat { padding: 14px 20px; border-right: 1px solid var(--line); }
.hz-stat:last-child { border-right: 0; }
.hz-stat .k { font-size: var(--fs-12); color: var(--text-3); }
.hz-stat .v { font-size: var(--fs-20); font-weight: 600; letter-spacing: -.02em; margin-top: 2px; display: flex; align-items: baseline; gap: 8px; }
.hz-stat .v small { font-size: var(--fs-12); font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.hz-stat .v.risk { color: var(--risk); }
.hz-body { display: grid; grid-template-columns: 108px 1fr; gap: 0; padding: 16px 20px 12px; }
.hz-late { border-right: 1px dashed var(--line-strong); padding-right: 16px; display: flex; flex-direction: column; justify-content: flex-end; }
.hz-late .bar { background: repeating-linear-gradient(135deg, var(--risk) 0 4px, #D9574A 4px 8px); border-radius: 3px; width: 100%; }
.hz-late .cap { font-size: var(--fs-12); color: var(--risk); font-weight: 600; margin-top: 8px; }
.hz-days { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; padding-left: 16px; position: relative; }
.hz-col { display: flex; flex-direction: column; justify-content: flex-end; height: 92px; position: relative; cursor: default; }
.hz-col .stack { display: flex; flex-direction: column-reverse; gap: 1px; border-radius: 3px; overflow: hidden; }
.hz-col .seg { width: 100%; }
.hz-col .seg.tax { background: var(--ink-700); }
.hz-col .seg.pay { background: var(--ink-500); }
.hz-col .seg.wait { background: var(--warn); }
.hz-col .base { height: 2px; background: var(--line); border-radius: 2px; margin-top: 3px; }
.hz-col.wknd .base { background: transparent; }
.hz-col.today .base { background: var(--saffron); height: 3px; }
.hz-col .lbl { position: absolute; bottom: var(--h, 100%); left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 11px; color: var(--text-2); font-weight: 500; margin-bottom: 4px; }
.hz-col:hover .stack { filter: brightness(1.15); }
.hz-axis { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; padding-left: 124px; padding-right: 20px; padding-bottom: 12px; font-size: 11px; color: var(--text-3); }
.hz-axis span { text-align: center; }
.hz-axis .m { color: var(--text); font-weight: 600; }
.hz-legend { display: flex; gap: 16px; font-size: var(--fs-12); color: var(--text-2); padding: 10px 20px; border-top: 1px solid var(--line); }
.hz-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.hz-legend .sp { margin-left: auto; color: var(--text-3); }

/* ---------- Vistas y filtros ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.views { display: flex; gap: 2px; background: var(--line); padding: 3px; border-radius: 8px; }
.views button { white-space: nowrap; flex: none; border: 0; background: none; height: 28px; padding: 0 10px; border-radius: 6px; font-size: var(--fs-13); font-weight: 500; color: var(--text-2); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.views button:hover { color: var(--text); }
.views button.on { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgba(20,33,61,.08); }
.views button.on .c { color: var(--accent); }
.views .c { font-size: var(--fs-12); color: var(--text-3); font-weight: 500; }
.views .c.r { color: var(--risk); }
.filters { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text-3); width: 240px; }
.search input { border: 0; outline: none; font: inherit; font-size: var(--fs-13); width: 100%; background: none; color: var(--text); }
.search:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.select { height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-13); color: var(--text-2); cursor: pointer; }
.select b { color: var(--text); font-weight: 500; }

/* ---------- Tabla ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; }
.grid th { text-align: left; font-weight: 500; font-size: var(--fs-12); color: var(--text-3); background: var(--surface-2); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid th.sort { color: var(--text); }
.grid td { padding: 0 12px; height: 56px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.grid tr:last-child td { border-bottom: 0; }
.grid tbody tr { cursor: pointer; transition: background var(--t-fast); position: relative; }
.grid tbody tr:hover { background: #F6F9FF; }
.grid tbody tr.sel { background: var(--accent-soft); }
.grid tbody tr.active { background: var(--accent-soft); }
.grid td:first-child, .grid th:first-child { padding-left: 16px; width: 40px; position: relative; }
.grid td:first-child::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: transparent; }
.grid tr.st-risk td:first-child::before { background: var(--risk); }
.grid tr.st-warn td:first-child::before { background: var(--warn); }
.grid th.r, .grid td.r { text-align: right; }
.grid th.c, .grid td.c { text-align: center; }
.cb { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--line-strong); display: inline-grid; place-items: center; background: var(--surface); cursor: pointer; vertical-align: middle; }
.cb.on { background: var(--accent); border-color: var(--accent); }
.cb.on::after { content: ""; width: 8px; height: 4px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.cb.mixed { background: var(--accent); border-color: var(--accent); }
.cb.mixed::after { content: ""; width: 8px; height: 2px; background: #fff; border-radius: 1px; }
.who b { display: block; font-weight: 600; font-size: var(--fs-14); }
.who span { display: block; font-size: var(--fs-12); color: var(--text-3); margin-top: 1px; }
.rut { color: var(--text-2); font-size: var(--fs-13); }
.lvl { width: 22px; height: 22px; border-radius: var(--r-xs); display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; }
.lvl.A { background: var(--lvl-a-bg); color: var(--lvl-a-fg); }
.lvl.B { background: var(--lvl-b-bg); color: var(--lvl-b-fg); }
.lvl.C { background: var(--lvl-c-bg); color: var(--lvl-c-fg); }
.lvl.D { background: var(--lvl-d-bg); color: var(--lvl-d-fg); box-shadow: inset 0 0 0 1.5px var(--lvl-d-line); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: var(--fs-12); font-weight: 600; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.risk { background: var(--risk-bg); color: var(--risk); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.idle { background: var(--idle-bg); color: var(--text-2); }
.next b { display: block; font-weight: 500; font-size: var(--fs-13); }
.next span { display: block; font-size: var(--fs-12); color: var(--text-3); }
.next span.r { color: var(--risk); }
.hist { display: inline-flex; gap: 3px; }
.hist i { width: 10px; height: 14px; border-radius: 2px; background: var(--ok-line); }
.hist i.late { background: #F0C27A; }
.hist i.miss { background: var(--risk); }
.hist i.now { background: repeating-linear-gradient(135deg, var(--line-strong) 0 2px, transparent 2px 4px); }
.sii-st { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; }
.sii-st.ok { color: var(--ok); }
.sii-st.no { color: var(--warn); background: var(--warn-bg); }
.fees { font-weight: 500; }
.row-act { opacity: 0; transition: opacity var(--t-fast); display: inline-flex; gap: 2px; }
.grid tr:hover .row-act, .grid tr.active .row-act { opacity: 1; }
.row-act button { width: 28px; height: 28px; display: inline-grid; place-items: center; border: 0; border-radius: var(--r-sm); background: none; cursor: pointer; color: var(--text-2); }
.row-act button:hover { background: var(--line); color: var(--text); }
.tfoot { display: flex; align-items: center; padding: 10px 16px; font-size: var(--fs-12); color: var(--text-3); border-top: 1px solid var(--line); background: var(--surface-2); gap: 16px; }
.tfoot .sp { margin-left: auto; display: flex; gap: 16px; }

/* ---------- Barra de acciones en lote ---------- */
.bulk { position: fixed; left: calc(232px + (100% - 232px) / 2); bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink-900); color: #fff; border-radius: 10px; padding: 6px 6px 6px 16px; display: flex; align-items: center; gap: 6px; box-shadow: var(--shadow-overlay); transition: transform var(--t-slow) var(--ease-out), opacity var(--t-base); z-index: 30; font-size: var(--fs-13); }
.bulk.on { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.bulk .n { font-weight: 600; margin-right: 10px; white-space: nowrap; }
.bulk button { white-space: nowrap; flex: none; height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: none; color: var(--text-on-ink); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; font-size: var(--fs-13); font-weight: 500; }
.bulk button:hover { background: var(--ink-800); }
.bulk button.main-a { background: var(--saffron); color: var(--text-on-yellow); font-weight: 600; }
.bulk button.main-a:hover { background: var(--saffron-hover); }
.bulk .x { color: var(--ink-300); width: 30px; padding: 0; justify-content: center; }

/* ---------- Drawer (ficha del cliente) ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity var(--t-slow); z-index: 40; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 8px; right: 8px; bottom: 8px; width: min(540px, calc(100vw - 16px)); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-overlay); transform: translateX(calc(100% + 16px)); transition: transform var(--t-slow) var(--ease-out); z-index: 41; display: flex; flex-direction: column; overflow: hidden; }
.drawer.on { transform: none; }
.dr-head { padding: 18px 20px 0; }
.dr-top { display: flex; align-items: center; gap: 8px; font-size: var(--fs-12); color: var(--text-3); margin-bottom: 10px; }
.dr-top .sp { margin-left: auto; display: flex; gap: 2px; }
.dr-title { display: flex; align-items: center; gap: 12px; }
.dr-title h2 { margin: 0; font-size: var(--fs-20); letter-spacing: -.02em; font-weight: 600; }
.dr-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--r-xs); background: var(--surface-2); border: 1px solid var(--line); font-size: var(--fs-12); color: var(--text-2); }
.dr-actions { display: flex; gap: 8px; margin: 16px 0 0; }
.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); margin-top: 18px; }
.tabs button { border: 0; background: none; padding: 10px 0; font-size: var(--fs-13); font-weight: 500; color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--accent); border-color: var(--accent); }
.dr-body { padding: 20px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 22px; }
.callout { border-radius: var(--r-md); padding: 12px 14px; display: flex; gap: 12px; font-size: var(--fs-13); line-height: 1.5; }
.callout.risk { background: var(--risk-bg); color: #7E2319; border: 1px solid var(--risk-line); }
.callout.ok { background: var(--ok-bg); color: #1D5A3E; border: 1px solid var(--ok-line); }
.callout.warn { background: var(--warn-bg); color: #7A4A00; border: 1px solid var(--warn-line); }
.callout svg { margin-top: 2px; }
.sec h3 { font-size: var(--fs-13); font-weight: 600; margin: 0 0 10px; display: flex; align-items: center; }
.sec h3 .sp { margin-left: auto; font-weight: 500; font-size: var(--fs-12); }
.list { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: var(--fs-13); }
.li:last-child { border-bottom: 0; }
.li b { font-weight: 500; display: block; }
.li span.s { display: block; font-size: var(--fs-12); color: var(--text-3); }
.kv { display: grid; grid-template-columns: 150px 1fr; row-gap: 8px; font-size: var(--fs-13); }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; }
.file { width: 28px; height: 32px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-size: 9px; font-weight: 700; color: var(--text-2); }

/* proceso de carpeta tributaria */
.job { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; display: none; }
.job.on { display: block; }
.job-steps { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: var(--fs-13); }
.job-steps li { display: flex; gap: 10px; align-items: center; color: var(--text-3); }
.job-steps li .st { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line-strong); flex: none; display: grid; place-items: center; }
.job-steps li.run { color: var(--text); }
.job-steps li.run .st { border-color: var(--accent); border-right-color: transparent; animation: spin 700ms linear infinite; }
.job-steps li.done { color: var(--text-2); }
.job-steps li.done .st { background: var(--ok); border-color: var(--ok); }
.job-steps li.done .st::after { content: ""; width: 6px; height: 3px; border: 1.5px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(0, -1px); }
@keyframes spin { to { transform: rotate(360deg); } }
.meter { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 500ms var(--ease-out); }
.job-done { display: none; align-items: center; gap: 12px; }
.job.finished .job-steps, .job.finished .meter { display: none; }
.job.finished .job-done { display: flex; }
.job-done .pdf { width: 36px; height: 44px; border-radius: 4px; background: #FCEBE9; color: var(--risk); font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 1px solid var(--risk-line); flex: none; }
.job-done b { display: block; font-size: var(--fs-13); }
.job-done span { font-size: var(--fs-12); color: var(--text-3); }
.job-done .btn { margin-left: auto; }

/* ---------- Paleta de comandos ---------- */
.palette { position: fixed; left: 50%; top: 14vh; transform: translate(-50%, -8px) scale(.98); width: min(620px, calc(100vw - 32px)); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-overlay); z-index: 51; opacity: 0; pointer-events: none; transition: opacity var(--t-base), transform var(--t-base) var(--ease-out); overflow: hidden; }
.palette.on { opacity: 1; pointer-events: auto; transform: translate(-50%, 0) scale(1); }
.pal-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 50; opacity: 0; pointer-events: none; transition: opacity var(--t-base); }
.pal-scrim.on { opacity: 1; pointer-events: auto; }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 52px; border-bottom: 1px solid var(--line); }
.pal-in input:focus-visible { box-shadow: none; }
.pal-in input { border: 0; outline: none; font: inherit; font-size: var(--fs-16); flex: 1; color: var(--text); }
.pal-list { padding: 6px; max-height: 380px; overflow: auto; }
.pal-g { font-size: var(--fs-12); color: var(--text-3); padding: 10px 10px 4px; }
.pal-it { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); font-size: var(--fs-14); cursor: pointer; }
.pal-it .sub { color: var(--text-3); font-size: var(--fs-12); margin-left: auto; }
.pal-it.on { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.pal-foot { display: flex; gap: 16px; padding: 8px 16px; border-top: 1px solid var(--line); font-size: var(--fs-12); color: var(--text-3); background: var(--surface-2); }

/* ---------- Toast ---------- */
.toast { position: fixed; right: 24px; bottom: 24px; background: var(--ink-900); color: #fff; border-radius: 10px; padding: 10px 10px 10px 14px; display: flex; gap: 12px; align-items: center; font-size: var(--fs-13); box-shadow: var(--shadow-overlay); transform: translateY(16px); opacity: 0; transition: transform var(--t-slow) var(--ease-out), opacity var(--t-base); z-index: 60; }
.toast.on { transform: none; opacity: 1; }
.toast .ok { width: 18px; height: 18px; border-radius: 50%; background: var(--ok); display: grid; place-items: center; }
.toast button { background: none; border: 0; color: var(--saffron); font-weight: 600; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.toast button:hover { background: var(--ink-800); }

/* ---------- Calendario ---------- */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.month { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.month-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.month-head h2 { white-space: nowrap; margin: 0; font-size: var(--fs-16); font-weight: 600; letter-spacing: -.01em; }
.month-head .sp { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.dow span { padding: 8px 10px; font-size: var(--fs-12); color: var(--text-3); }
.mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.day { min-height: 116px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; transition: background var(--t-fast); position: relative; }
.day:nth-child(7n) { border-right: 0; }
.day:hover { background: #F6F9FF; }
.day.out { background: var(--surface-2); color: var(--text-3); cursor: default; }
.day.wk { background: #FBFBFC; }
.day .d { font-size: var(--fs-12); font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.day .d .hol { font-weight: 500; color: var(--text-3); }
.day.today .d b { background: var(--saffron); color: var(--text-on-yellow); border-radius: 4px; padding: 0 5px; }
.day.pick { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.ob { display: flex; align-items: center; gap: 6px; font-size: var(--fs-12); padding: 3px 6px; border-radius: var(--r-xs); background: var(--surface-2); border: 1px solid var(--line); }
.ob { align-items: flex-start; }
.ob b { font-weight: 600; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.ob .n { margin-left: auto; color: var(--text-3); font-weight: 500; }
.ob .prog { position: absolute; }
.ob.risk { background: var(--risk-bg); border-color: var(--risk-line); color: #7E2319; }
.ob.warn { background: var(--warn-bg); border-color: var(--warn-line); color: #7A4A00; }
.ob.ok { background: var(--ok-bg); border-color: var(--ok-line); color: #1D5A3E; }
.ob.plan { background: #EEF3FC; border-color: #D5E0F3; color: var(--ink-700); }
.daypanel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); position: sticky; top: 76px; overflow: hidden; }
.dp-head { padding: 16px; border-bottom: 1px solid var(--line); }
.dp-head h3 { margin: 0; font-size: var(--fs-16); font-weight: 600; letter-spacing: -.01em; }
.dp-head p { margin: 4px 0 12px; font-size: var(--fs-13); color: var(--text-2); }
.progress-row { display: flex; align-items: center; gap: 10px; font-size: var(--fs-12); color: var(--text-2); }
.progress-row .meter { flex: 1; height: 6px; }
.progress-row .meter i { background: var(--ok); }
.dp-group { padding: 12px 16px 4px; font-size: var(--fs-12); color: var(--text-3); display: flex; }
.dp-group .sp { margin-left: auto; }
.dp-row { display: flex; align-items: center; gap: 10px; padding: 8px 16px; font-size: var(--fs-13); border-top: 1px solid var(--line); }
.dp-row .cb { flex: none; }
.dp-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-row .nm.done { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.dp-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; background: var(--surface-2); }
.legend-row { white-space: nowrap; display: flex; gap: 14px; font-size: var(--fs-12); color: var(--text-2); }
.legend-row i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .col-hist, .col-resp { display: none; }
}
@media (max-width: 1100px) {
  .col-rut, .col-docs { display: none; }
  .cal-layout { grid-template-columns: 1fr; }
  .daypanel { position: static; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .top { padding: 0 16px; }
  .page { padding: 20px 16px 80px; }
  .ph { flex-direction: column; gap: 12px; }
  .ph-actions { margin-left: 0; }
  .hz-stats { grid-template-columns: 1fr 1fr; }
  .hz-stat:nth-child(2) { border-right: 0; }
  .hz-stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .hz-body, .hz-axis, .hz-legend { display: none; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .views { overflow-x: auto; }
  .filters { margin-left: 0; }
  .search { flex: 1; width: auto; }
  .col-sii, .col-fees, .col-lvl, .col-act, .col-next { display: none; }
  .top-r > span, .filters .select { display: none; }
  .grid td:first-child, .grid th:first-child { width: 14px; padding: 0 0 0 6px; }
  .grid td:first-child .cb, .grid th:first-child .cb { display: none; }
  .who b { white-space: normal; }
  .grid td { height: auto; padding-top: 10px; padding-bottom: 10px; }
  .bulk { left: 50%; }
  .day { min-height: 72px; }
  .day .ob b, .day .ob .n { display: none; }
}
