/* Op Orde — estilos. Los colores y tipos salen de los tokens definidos en index.html. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-body); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
h1, h2, h3, p, dl, dd { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a { color: var(--brand-strong); }
:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.pos { color: var(--good); font-weight: 600; }
.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stack { display: flex; flex-direction: column; gap: 28px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1 1 0; min-width: 0; }

/* ---------- arranque ---------- */
.boot { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 40px 16px; text-align: center; }
.boot-name { font-family: var(--font-display); font-weight: 700; font-size: 32px; letter-spacing: -0.02em; }
.boot-text { color: var(--ink-2); }

/* ---------- estructura ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 34px; max-width: 1320px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.side { position: sticky; top: env(safe-area-inset-top, 0px); align-self: start; max-height: 100dvh; overflow-y: auto; padding-block: 24px; display: flex; flex-direction: column; gap: 18px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 12px 4px; font-family: var(--font-display); font-weight: 700; font-size: 24px; letter-spacing: -0.02em; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-mark rect { fill: var(--brand); }
.brand-mark path { fill: none; stroke: var(--brand-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 13.5px; font-weight: 600; color: var(--ink-3); padding: 0 12px 3px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; color: var(--ink-2); font-weight: 500; text-decoration: none; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }
.main { min-width: 0; padding-bottom: 72px; }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg); display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding-block: 24px 10px; }
.top h1 { font-family: var(--font-display); font-weight: 700; font-size: 32px; line-height: 1.1; letter-spacing: -0.02em; text-wrap: balance; margin-right: auto; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-desc { color: var(--ink-2); max-width: 62ch; margin: 0 0 20px; }
.yearsw { display: inline-flex; align-items: center; gap: 2px; border: 1.5px solid var(--rule); border-radius: 11px; background: var(--surface); }
.yearsw .num { padding: 0 6px; font-weight: 600; }
.tabs { display: none; }
.view { display: flex; flex-direction: column; gap: 20px; }

@media (max-width: 880px) {
  .app { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .side { display: none; }
  .main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  .top { padding-block: 16px 8px; }
  .top h1 { font-size: 26px; }
  .page-desc { margin-bottom: 16px; }
  .tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; inset: auto 0 0 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--rule); padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
  .tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px; border: 0; border-radius: 10px; background: none; color: var(--ink-2); font-size: 12.5px; font-weight: 500; text-decoration: none; min-width: 0; }
  .tab .ic { width: 24px; height: 24px; }
  .tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tab[aria-current="page"] { color: var(--brand-strong); font-weight: 600; }
}

/* ---------- avisos fijos de la página ---------- */
.banner { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius); background: var(--info-soft); color: var(--ink); margin-bottom: 18px; }
.banner .ic { color: var(--info); }
.banner p { flex: 1 1 260px; min-width: 0; }
.banner.warn { background: var(--warn-soft); }
.banner.warn .ic { color: var(--warn); }
.banner strong { font-weight: 600; }

/* ---------- inicio ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tile { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 16px 18px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); text-align: left; font-weight: 600; font-size: 17px; }
.tile:hover { border-color: var(--brand); }
.tile-ic { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; flex: none; border-radius: 14px; background: var(--brand-soft); color: var(--brand-strong); }
.tile-ic .ic { width: 25px; height: 25px; }
.tile-txt { min-width: 0; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.fact { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 18px 20px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); text-align: left; }
.fact:hover { border-color: var(--brand); }
.fact-label { font-weight: 500; color: var(--ink-2); }
.fact-value { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.fact-text { font-size: 14.5px; color: var(--ink-2); }
.fact.bad .fact-text { color: var(--bad); font-weight: 500; }
.todos { display: flex; flex-direction: column; }
.todo { display: flex; align-items: center; gap: 12px; padding: 13px 2px; border: 0; border-bottom: 1px solid var(--rule); background: none; text-align: left; font-weight: 500; }
.todo:last-child { border-bottom: 0; }
.todo:hover { color: var(--brand-strong); }
.todo .ic:first-child { color: var(--brand-strong); }
.todo.bad .ic:first-child { color: var(--bad); }
.todo .ic:last-child { width: 18px; height: 18px; color: var(--ink-3); }
@media (max-width: 880px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; font-size: 16px; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .fact-value { font-size: 27px; }
}

/* ---------- barra de filtros ---------- */
.toolbar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.toolbar .searchbox { margin-left: auto; }
.toolbar > .grow { flex: 1 1 300px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 40px; padding: 7px 15px; border-radius: 999px; border: 1.5px solid var(--rule); background: var(--surface); color: var(--ink-2); font-size: 15px; font-weight: 500; white-space: nowrap; }
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .n { margin-left: 7px; font-size: 13.5px; opacity: .7; font-variant-numeric: tabular-nums; }
.searchbox { display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1.5px solid var(--rule); border-radius: 11px; background: var(--field); color: var(--ink-3); min-width: 0; flex: 0 1 260px; }
.searchbox input[type="search"] { border: 0; border-radius: 0; background: transparent; padding: 9px 0; min-height: 0; width: 100%; min-width: 0; color: var(--ink); outline: 0; }
.searchbox:focus-within { outline: 2.5px solid var(--brand); outline-offset: 1px; }
.sel-wrap { flex: 0 1 280px; min-width: 0; }
@media (max-width: 720px) { .toolbar .searchbox, .toolbar .sel-wrap { flex: 1 1 100%; margin-left: 0; } }

/* ---------- superficies ---------- */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card.pad { padding: 20px 22px; }
.sec-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.sec-head h2 { font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.01em; margin-right: auto; }
.cols2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.cols2.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1020px) { .cols2, .cols2.even { grid-template-columns: minmax(0, 1fr); } .todo-card { order: -1; } }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 16px 18px; min-width: 0; }
.kpi-label { font-size: 14.5px; font-weight: 500; color: var(--ink-2); }
.kpi-value { font-size: 25px; font-weight: 600; letter-spacing: -0.02em; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.kpi .progress { margin-top: 8px; }
@media (max-width: 880px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .kpi-value { font-size: 21px; } }

/* ---------- tablas ---------- */
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 14px; font-weight: 600; color: var(--ink-2); padding: 12px 16px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.tbl td { padding: 14px 16px; border-bottom: 1px solid var(--rule); vertical-align: middle; white-space: nowrap; }
.tbl td.c-main, .tbl td.wrap, .tbl td.c-full { white-space: normal; }
.tbl td.c-main { min-width: 150px; font-weight: 600; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl th.num, .tbl td.num { text-align: right; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl tr.click:focus-visible { outline: 2.5px solid var(--brand); outline-offset: -2px; }
.tbl tfoot td { border-top: 1px solid var(--rule); border-bottom: 0; font-weight: 600; }
.tbl .sub { display: block; font-size: 14px; font-weight: 400; color: var(--ink-2); }
.tbl td.c-pill > * + * { margin-left: 6px; }
@media (max-width: 1100px) { .tbl th.c-hide, .tbl td.c-hide { display: none; } .tbl th, .tbl td { padding-inline: 12px; } }
@media (max-width: 720px) {
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tfoot { display: block; }
  .tbl tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
  .tbl tbody tr:last-child { border-bottom: 0; }
  .tbl td, .tbl td.c-main, .tbl td.wrap { display: block; padding: 0; border: 0; min-width: 0; white-space: normal; }
  .tbl td.num { text-align: left; }
  .tbl td.c-main { grid-column: 1; grid-row: 1; }
  .tbl td.c-amt { grid-column: 2; grid-row: 1; text-align: right; font-weight: 600; white-space: nowrap; }
  .tbl td.c-sub { grid-column: 1; font-size: 14.5px; color: var(--ink-2); }
  .tbl td.c-pill { grid-column: 2; grid-row: 2; justify-self: end; white-space: nowrap; }
  .tbl td.c-hide { display: none; }
  .tbl td.c-full { grid-column: 1 / -1; padding-top: 6px; }
  .tbl tfoot tr { border-top: 1px solid var(--rule); border-bottom: 0; }
}

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 14px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 17px; border-radius: 11px; border: 1.5px solid var(--rule); background: var(--surface); color: var(--ink); font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--ink-3); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); border-color: var(--brand); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); border-color: transparent; }
.btn.sm { min-height: 36px; padding: 4px 12px; font-size: 14.5px; border-radius: 9px; }
.btn.sm .ic { width: 17px; height: 17px; }
.btn.busy { opacity: .6; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.danger:hover { color: var(--bad); }
.file-btn { display: inline-flex; }

/* ---------- formularios ---------- */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.fld { display: flex; flex-direction: column; gap: 6px; grid-column: span 2; min-width: 0; }
.fld.half { grid-column: span 1; }
.lbl { font-size: 15px; font-weight: 600; }
input[type="text"], input[type="email"], input[type="tel"], input[type="date"], input[type="search"], select, textarea { width: 100%; min-width: 0; min-height: 46px; padding: 10px 13px; border: 1.5px solid var(--rule); border-radius: 11px; background: var(--field); color: var(--ink); }
textarea { resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.fld.has-err input, .fld.has-err select, .fld.has-err textarea { border-color: var(--bad); }
.hint { font-size: 14px; color: var(--ink-2); font-weight: 400; }
.err { font-size: 14px; color: var(--bad); font-weight: 500; }
.fld.check { flex-direction: row; align-items: flex-start; gap: 11px; cursor: pointer; font-weight: 500; }
.fld.check input { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--brand); flex: none; }
.fld.check .hint { display: block; }
.form > .fld.check.half { align-self: center; }
.form-sec { grid-column: 1 / -1; font-family: var(--font-display); font-size: 18px; font-weight: 700; padding-top: 14px; border-top: 1px solid var(--rule); margin-top: 4px; }
.form-note { grid-column: 1 / -1; font-size: 14.5px; color: var(--ink-2); }
input.right { text-align: right; font-variant-numeric: tabular-nums; }
details.more { grid-column: 1 / -1; border-top: 1px solid var(--rule); padding-top: 6px; min-width: 0; }
details.more > summary { display: inline-flex; align-items: center; gap: 10px; padding: 9px 6px; border-radius: 9px; cursor: pointer; list-style: none; font-weight: 600; color: var(--brand-strong); }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+"; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand-soft); font-weight: 700; line-height: 1; }
details.more[open] > summary::before { content: "\2212"; }
details.more > .form { margin-top: 10px; }

/* ---------- ventanas ---------- */
dialog.sheet { border: 0; padding: 0; background: var(--surface); color: var(--ink); border-radius: 18px; box-shadow: var(--shadow); width: min(100% - 32px, 620px); max-width: none; max-height: calc(100% - 32px); overflow: hidden; }
dialog.sheet[open] { display: flex; flex-direction: column; }
dialog.sheet.sm { width: min(100% - 32px, 440px); }
dialog.sheet.lg { width: min(100% - 32px, 940px); }
dialog.sheet.full { width: min(100% - 32px, 1180px); height: calc(100% - 32px); }
dialog.sheet::backdrop { background: rgb(8 16 12 / .55); }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 14px 24px; border-bottom: 1px solid var(--rule); }
.sheet-head h2 { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin-right: auto; min-width: 0; text-wrap: balance; }
.sheet-body { padding: 22px 24px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 14px 24px; border-top: 1px solid var(--rule); }
.confirm-text { color: var(--ink-2); }
@media (max-width: 720px) {
  dialog.sheet, dialog.sheet.lg, dialog.sheet.full { width: 100%; height: 100%; max-height: 100%; border-radius: 0; margin: 0; }
  dialog.sheet.sm { width: min(100% - 32px, 440px); height: auto; max-height: calc(100% - 32px); border-radius: 18px; margin: auto; }
  dialog.sheet:not(.sm) .sheet-head { padding: calc(12px + env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); }
  dialog.sheet:not(.sm) .sheet-body { padding: 18px max(16px, env(safe-area-inset-right, 0px)) 18px max(16px, env(safe-area-inset-left, 0px)); }
  dialog.sheet:not(.sm) .sheet-foot { padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
  .sheet-foot .btn { flex: 1 1 auto; }
  .sheet-head h2 { font-size: 20px; }
}

.toast { position: fixed; inset: auto 0 calc(24px + env(safe-area-inset-bottom, 0px)) 0; margin: 0 auto; width: fit-content; max-width: min(100% - 32px, 520px); border: 0; padding: 12px 18px; border-radius: 12px; background: var(--ink); color: var(--bg); font-weight: 600; box-shadow: var(--shadow); transition: opacity .2s; }
.toast.nopop { z-index: 50; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 48px 20px; border: 1.5px dashed var(--rule); border-radius: var(--radius); color: var(--ink-2); }
.empty > .ic { width: 36px; height: 36px; color: var(--ink-3); }
.empty-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--ink); }
.empty-text { max-width: 50ch; }
.empty .btn, .empty .file-btn { margin-top: 12px; }

.kv { display: flex; flex-direction: column; }
.kv-row { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--rule); }
.kv-row:last-child { border-bottom: 0; }
.kv-row dt { color: var(--ink-2); min-width: 0; }
.kv-row dd { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kv-row.strong dt, .kv-row.strong dd { font-weight: 700; color: var(--ink); }
.kv-row.txt dd { white-space: normal; overflow-wrap: anywhere; }

/* ---------- documento en papel (factura / oferta) ---------- */
.doc-view { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.doc-side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; }
.side-block { display: flex; flex-direction: column; gap: 8px; }
.side-total { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
.actions-col { display: flex; flex-direction: column; gap: 8px; }
.actions-col .btn { justify-content: flex-start; }
@media (max-width: 880px) { .doc-view { grid-template-columns: minmax(0, 1fr); } .doc-side { position: static; order: -1; } .actions-col { flex-direction: row; flex-wrap: wrap; } }
.paper-wrap { container-type: inline-size; width: 100%; max-width: 820px; margin: 0 auto; }
.paper { position: relative; background: var(--paper); color: var(--paper-ink); font-family: "IBM Plex Sans", Arial, sans-serif; font-size: clamp(6.4px, 1.5cqw, 12.4px); line-height: 1.45; min-height: 141cqw; padding: 6.5em 7.5em 5em; display: flex; flex-direction: column; border-radius: 3px; box-shadow: 0 0 0 1px rgb(0 0 0 / .08), var(--shadow); overflow: hidden; }
.p-head { display: flex; justify-content: space-between; gap: 3em; }
.p-logo img { max-width: 20em; max-height: 8em; display: block; }
.p-logo strong { font-size: 1.9em; font-weight: 700; }
.p-co { text-align: right; color: var(--paper-mute); font-size: .9em; }
.p-co strong { display: block; color: var(--paper-ink); font-size: 1.08em; }
.p-co span { display: block; }
.p-addr { display: flex; justify-content: space-between; gap: 3em; margin-top: 5em; }
.p-to strong { display: block; font-size: 1.08em; }
.p-to span { display: block; }
.p-meta { display: grid; grid-template-columns: auto auto; gap: .3em 2.4em; align-content: start; }
.p-meta dt { color: var(--paper-mute); }
.p-meta dd { text-align: right; font-variant-numeric: tabular-nums; }
.p-title { font-size: 2em; font-weight: 700; margin-top: 2.6em; letter-spacing: -0.01em; color: var(--paper-ink); }
.p-lines { width: 100%; border-collapse: collapse; margin-top: 1.6em; }
.p-lines th { text-align: left; font-size: .86em; font-weight: 600; color: var(--paper-mute); padding: 0 0 .6em; border-bottom: 1.5px solid var(--paper-rule); white-space: nowrap; }
.p-lines td { padding: .7em 0; border-bottom: 1px solid var(--paper-rule); vertical-align: top; }
.p-lines th.r, .p-lines td.r { text-align: right; padding-left: 1.4em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.p-lines td.d { white-space: pre-wrap; overflow-wrap: anywhere; }
.p-totals { margin: 1.4em 0 0 auto; width: 52%; min-width: 22em; }
.p-totals div { display: flex; justify-content: space-between; gap: 2em; padding: .28em 0; color: var(--paper-mute); }
.p-totals div span:last-child { color: var(--paper-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.p-totals div.g { border-top: 1.5px solid var(--paper-ink); margin-top: .5em; padding-top: .6em; font-size: 1.2em; font-weight: 700; color: var(--paper-ink); }
.p-notes { margin-top: 3em; color: var(--paper-mute); display: flex; flex-direction: column; gap: .7em; white-space: pre-wrap; }
.p-foot { margin-top: auto; padding-top: 3em; }
.p-foot p { border-top: 1px solid var(--paper-rule); padding-top: .9em; font-size: .82em; color: var(--paper-mute); }
.p-mark { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 9em; font-weight: 700; letter-spacing: .08em; color: rgb(0 0 0 / .06); transform: rotate(-28deg); pointer-events: none; }

/* ---------- editor de líneas ---------- */
.lines { display: flex; flex-direction: column; gap: 8px; }
.line-head, .line { display: grid; grid-template-columns: minmax(0, 1fr) 86px 116px 140px 118px 40px; gap: 8px; align-items: center; }
.line-head { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.line-head span.r { text-align: right; }
.line .amt { text-align: right; font-weight: 600; }
.add-line { margin-top: 10px; }
@media (max-width: 880px) {
  .line-head { display: none; }
  .line { grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 12px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--bg); }
  .line > .l-desc { grid-column: 1 / -1; }
  .line > .l-qty { grid-column: span 1; }
  .line > .l-price { grid-column: span 1; }
  .line > .l-vat { grid-column: span 2; }
  .line > .amt { grid-column: span 3; text-align: left; align-self: center; }
  .line > .del { justify-self: end; }
}
.doc-foot { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; margin-top: 20px; align-items: start; }
.doc-foot > details.more { grid-column: auto; border-top: 0; padding-top: 0; }
@media (max-width: 880px) { .doc-foot { grid-template-columns: minmax(0, 1fr); } .doc-foot > .card { order: -1; } }
.edit-sec { margin-top: 24px; }

/* ---------- horas ---------- */
.timer { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.timer-clock { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.timer .grow { display: flex; gap: 10px; flex-wrap: wrap; }
.timer .grow > * { flex: 1 1 160px; min-width: 0; }
.timer.on { border-color: var(--brand); }
.progress { height: 9px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.week-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 6px 2px 8px; }
.week-head h3 { font-size: 16px; font-weight: 600; }
.week-head .num { font-weight: 600; }

/* ---------- gráfico ---------- */
.chart-box { width: 100%; min-width: 0; }
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font-body); font-size: 12.5px; fill: var(--ink-2); }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .rev { fill: var(--brand); }
.chart .cost { fill: var(--ink-3); }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14.5px; color: var(--ink-2); margin-top: 8px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 7px; }
.legend .rev { background: var(--brand); }
.legend .cost { background: var(--ink-3); }

/* ---------- bonnetjes ---------- */
.box-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.box-item { position: relative; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.box-item:hover { border-color: var(--brand); }
.box-open { display: flex; flex-direction: column; width: 100%; border: 0; padding: 0; background: none; text-align: left; }
.box-open p { padding: 10px 12px; font-size: 14.5px; color: var(--ink-2); }
.box-del { position: absolute; top: 6px; right: 6px; background: var(--surface); }
.thumb { aspect-ratio: 3 / 4; width: 100%; max-width: 100%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--ink-3); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .ic { width: 36px; height: 36px; }
.att { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.att .thumb { width: 64px; flex: none; border-radius: 8px; border: 1px solid var(--rule); }
.att-open { border: 0; padding: 0; background: none; border-radius: 8px; }
.att-name { flex: 1 1 120px; min-width: 0; overflow-wrap: anywhere; font-size: 14.5px; }
.att-mark { display: inline-flex; color: var(--ink-3); }
.att-mark .ic { width: 17px; height: 17px; }
.doc-img { display: block; width: 100%; max-width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 4px; background: #fff; }
.preview-img { display: block; max-width: 100%; max-height: 60vh; margin: 0 auto 14px; border-radius: 8px; border: 1px solid var(--rule); }
.drop { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 28px 16px; border: 1.5px dashed var(--rule); border-radius: var(--radius); background: var(--surface); }
.drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop > .ic { width: 30px; height: 30px; color: var(--ink-3); }

/* ---------- bank ---------- */
.bank-prop { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
.bank-txt { flex: 1 1 210px; min-width: 0; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bank-acts { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.bank-tbl td.c-full { min-width: 300px; }
@media (max-width: 720px) { .bank-tbl td.c-full { min-width: 0; } }

/* ---------- btw-aangifte ---------- */
.vat-sec td { background: var(--surface-2); font-size: 14px; font-weight: 600; color: var(--ink-2); padding-block: 9px; }
.vat-rub { display: inline-block; min-width: 2.3em; font-weight: 700; color: var(--brand-strong); }
.vat-total { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.vat-total .num { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
.vat-meta { margin-top: 14px; }
.vat-meta .grow { flex: 1 1 240px; }
.bank-row { margin-top: 12px; }
.bank-row input { flex: 0 1 190px; }
@media (max-width: 720px) {
  .tbl tr.vat-sec { display: block; padding: 0; }
  .tbl tr.vat-sec td { padding: 9px 16px; }
  .vat-tbl td[data-label]:not(:empty)::before { content: attr(data-label) " "; color: var(--ink-2); font-weight: 400; }
}

/* ---------- instellingen ---------- */
.set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
@media (max-width: 1020px) { .set-grid { grid-template-columns: minmax(0, 1fr); } }
.set-card { display: flex; flex-direction: column; gap: 16px; }
.set-card h2 { font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.set-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.logo-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo-prev { width: 130px; height: 64px; border: 1px solid var(--rule); border-radius: 10px; background: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden; color: #6B7479; font-size: 13px; }
.logo-prev img { max-width: 100%; max-height: 100%; }
.plain-list { margin: 0; padding-left: 20px; color: var(--ink-2); display: flex; flex-direction: column; gap: 6px; }

.welcome { max-width: 660px; margin: 10px auto 0; display: flex; flex-direction: column; gap: 18px; }
.welcome h2 { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
.menu-list { display: flex; flex-direction: column; gap: 2px; }
.menu-list .nav-label { padding-top: 12px; }
.send-box { display: flex; flex-direction: column; gap: 16px; }
.copy-row { display: flex; gap: 8px; align-items: flex-start; }
.copy-row > :first-child { flex: 1 1 auto; min-width: 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
