/* MySmartInvoice – page styles (documents, workflow, dashboard, settings, branding). Tokens only (theme.css). */
/* semantic buttons (functional list: create/save/finish = success, delete = red, PDF/info = blue/violet, back = light secondary).
   Design system: primary action = solid blue; success = teal (dark text – white on teal fails WCAG); errors = semantic red. */
.btn-success { background: var(--success-fill); border-color: var(--success-fill); color: #062A24; }
.btn-success:hover { background: color-mix(in srgb, var(--success-fill) 88%, black); border-color: color-mix(in srgb, var(--success-fill) 88%, black); }
.btn-danger-solid { background: var(--danger-fill); border-color: var(--danger-fill); color: #fff; }
.btn-danger-solid:hover { background: color-mix(in srgb, var(--danger-fill) 88%, black); }
.btn-info { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 30%, transparent); color: var(--info); }
.btn-info:hover { background: color-mix(in srgb, var(--info) 16%, var(--surface)); }
.btn-violet { background: var(--violet-bg); border-color: color-mix(in srgb, var(--violet) 30%, transparent); color: var(--violet); }
.btn-back { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); }
.btn-back:hover { background: var(--surface-3); }

/* status pills (text + dot + colour; never colour alone) */
.st { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 16%, transparent); letter-spacing: .005em; }
.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 20%, transparent); }
.st-all { background: var(--st-all-bg); color: var(--st-all); } .st-draft { background: var(--st-draft-bg); color: var(--st-draft); }
.st-pending, .st-open, .st-sent, .st-partial { background: var(--warn-bg); color: var(--warn); }
.st-accepted, .st-finished, .st-paid { background: var(--ok-bg); color: var(--ok); }
.st-rejected, .st-cancelled, .st-overdue { background: var(--err-bg); color: var(--err); }
.st-invoiced { background: var(--violet-bg); color: var(--violet); }
/* status filter pills with counts */
.pills { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px calc(var(--pad) + 4px); border-bottom: 1px solid var(--border); }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font: 600 var(--fs-sm)/1 var(--font); color: var(--text-2); cursor: pointer; transition: border-color var(--dur-fast), background var(--dur-fast); }
.pill:hover { border-color: var(--border-strong); }
.pill b { font-weight: 700; font-size: 12px; padding: 2px 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.pill.active { border-color: var(--accent); background: var(--accent-50); color: var(--accent-text); }
.pill.p-draft b { background: var(--st-draft-bg); color: var(--st-draft); } .pill.p-pending b, .pill.p-open b, .pill.p-sent b, .pill.p-partial b { background: var(--warn-bg); color: var(--warn); }
.pill.p-accepted b, .pill.p-paid b, .pill.p-finished b { background: var(--ok-bg); color: var(--ok); } .pill.p-rejected b, .pill.p-cancelled b, .pill.p-overdue b { background: var(--err-bg); color: var(--err); }
.pill.p-invoiced b { background: var(--violet-bg); color: var(--violet); }

/* document editor */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; align-items: start; }
@media (max-width: 1150px) { .doc-layout { grid-template-columns: minmax(0, 1fr); } }
.doc-status-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.doc-status-bar .num { font-weight: 700; font-size: var(--fs-lg); }
.lock-note { display: flex; gap: 8px; align-items: center; color: var(--text-2); font-size: var(--fs-sm); }
.lines-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.lines { width: 100%; border-collapse: collapse; min-width: 900px; }
.lines td:nth-child(2) { min-width: 240px; }
.lines th { font-size: 12px; color: var(--text-3); font-weight: 600; text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.lines td { padding: 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.lines td.num, .lines th.num { text-align: right; }
.lines input, .lines select, .lines textarea { height: 38px; font-size: var(--fs-sm); padding: 0 8px; }
.lines .c-qty input, .lines .c-price input, .lines .c-disc input { text-align: right; font-variant-numeric: tabular-nums; }
.lines textarea { min-height: 38px; height: 38px; padding: 8px; }
.lines .c-pos { width: 44px; color: var(--text-3); padding-top: 14px; } .lines .c-qty { width: 92px; } .lines .c-unit { width: 110px; } .lines .c-price { width: 120px; }
.lines .c-disc { width: 76px; } .lines .c-tax { width: 150px; } .lines .c-total { width: 116px; padding-top: 14px; font-weight: 600; white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; } .lines .c-act { width: 40px; }
.lines.readonly td { padding: 10px 6px; }
.lines.readonly { min-width: 0; }
.totals { margin-left: auto; width: min(380px, 100%); display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: var(--fs); }
.totals .lbl { color: var(--text-2); } .totals .val { text-align: right; font-variant-numeric: tabular-nums; }
.totals .grand { font-weight: 700; font-size: var(--fs-lg); border-top: 2px solid var(--text); padding-top: 8px; }
.num, .tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.legal-notes { font-size: var(--fs-sm); color: var(--text-2); border: 1px solid var(--border); padding: 8px 12px; background: var(--surface-2); border-radius: var(--radius); }
.missing { display: flex; flex-direction: column; gap: 6px; }

/* workflow side navigation (Offer → Invoice → Delivery → Service report → Invoice fine) */
.wf { display: flex; flex-direction: column; gap: 4px; padding: 10px; }
.wf-step { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius); color: var(--text-2); font-size: var(--fs-sm); position: relative; }
.wf-step .ico { color: var(--text-3); }
.wf-step.here { background: var(--accent-50); color: var(--accent-text); font-weight: 600; } .wf-step.here .ico { color: var(--accent); }
.wf-step.done .ico { color: var(--success-fill); }
.wf-step:not(:last-child)::after { content: ""; position: absolute; left: 19px; bottom: -6px; width: 2px; height: 8px; background: var(--border-strong); }
.wf-docs { display: flex; flex-direction: column; gap: 2px; margin: 0 0 4px 38px; }
.wf-docs a { font-size: var(--fs-xs); }
.side-card + .side-card { margin-top: 16px; }

/* home: welcome card with a restrained brand accent (gradient only as a thin bar + soft tint) */
.hero-home { padding: 28px; border-radius: var(--radius-lg); color: var(--text); background: radial-gradient(700px 300px at 100% 0%, color-mix(in srgb, var(--brand-cyan) 12%, transparent), transparent 70%), var(--surface);
  border: 1px solid var(--border); margin-bottom: 20px; position: relative; overflow: hidden; box-shadow: var(--shadow-sm); }
.hero-home::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 4px; background: var(--brand-gradient); }
.hero-home h1 { color: var(--text); } .hero-home p { color: var(--text-2); max-width: 640px; margin-top: 8px; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.quick a { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.quick a:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.quick .q-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-50); color: var(--accent); }
.quick b { font-size: var(--fs); } .quick span { color: var(--text-3); font-size: var(--fs-sm); }
@media (max-width: 560px) { .quick { grid-template-columns: minmax(0, 1fr); } .hero-home { padding: 20px; } }

/* dashboard (design-system sample: KPI cards, primary CTA + soft secondary, recent list) */
.dash-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: var(--space-4); }
.kpi-row { margin-bottom: var(--space-4); }
.kpi .kpi-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-50); color: var(--accent); margin-bottom: 6px; }
.kpi .kpi-ico .ico { width: 18px; height: 18px; }
.kpi.tone-ok .kpi-ico { background: var(--success-bg); color: var(--success); } .kpi.tone-warn .kpi-ico { background: var(--warn-bg); color: var(--warn); }
.kpi.tone-err .kpi-ico { background: var(--err-bg); color: var(--err); }
.kpi-compact .kpi { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; row-gap: 0; align-items: center; padding: 14px 18px; }
.kpi-compact .kpi .kpi-ico { grid-row: span 2; margin: 0; }
.kpi-compact .kpi .value { font-size: 22px; }
.dash-panels { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-4); margin-bottom: var(--space-4); }
@media (max-width: 1000px) { .dash-panels { grid-template-columns: minmax(0, 1fr); } }

/* settings landing / category cards */
.cards-sel { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cards-sel button { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-align: left; color: var(--text); font: 600 var(--fs-sm)/1.2 var(--font); }
.cards-sel button.active { border-color: var(--accent); box-shadow: var(--focus-ring); }
.cards-sel .ico { color: var(--accent); }
.cards-sel small { color: var(--text-3); font-size: var(--fs-xs); }

/* combined (collections): two lists side by side */
.dual { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 1000px) { .dual { grid-template-columns: minmax(0, 1fr); } }
.pick-list { max-height: 520px; overflow-y: auto; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.pick-row:last-child { border-bottom: 0; }
.pick-row .grow { min-width: 0; } .pick-row .t { font-weight: 600; } .pick-row .s { color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* charts / chips / timeline */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart .bar.b2 { fill: var(--brand-teal); }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); min-width: 0; }
.tl li > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.tl li:last-child { border-bottom: 0; }
.tl .when { color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; min-width: 96px; }
.chg { font-size: var(--fs-xs); color: var(--text-3); }
.chg code { font-size: 11px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } }
.req-list li { margin: 4px 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: var(--fs-sm); } .kv dt { color: var(--text-3); } .kv dd { margin: 0; }
.matrix th, .matrix td { text-align: center; } .matrix td:first-child, .matrix th:first-child { text-align: left; }
.pdf-frame { width: 100%; height: 75vh; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-3); }
.footer-legal { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; padding: 18px; font-size: var(--fs-xs); color: var(--text-3); }
@media (max-width: 700px) { .content { padding: 12px; } .page-head .actions { width: 100%; } .doc-status-bar { padding: 10px; } }
/* collapsible nav groups */
.nav-group summary { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 8px 10px; border-radius: var(--radius); color: var(--sidebar-fg); font-weight: 500; font-size: var(--fs-sm); cursor: pointer; list-style: none; transition: background-color var(--dur-fast); }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary:hover { background: var(--sidebar-hover); color: var(--text); }
.nav-group summary .ico { color: var(--sidebar-fg-muted); } .nav-group summary .chev { margin-left: auto; width: 16px; height: 16px; transition: transform var(--dur-fast); }
.nav-group:not([open]) summary .chev { transform: rotate(-90deg); }
.nav a.sub { padding-left: 38px; min-height: 34px; } .nav a.sub .ico { display: none; }

@media (max-width: 700px) {
  .topbar .btn-success span, .topbar .btn-primary span { display: none; } .topbar .btn-success.btn-sm, .topbar .btn-primary.btn-sm { width: 36px; padding: 0; }
  .grid.g3, .grid.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi .value { font-size: 20px; } .kpi { padding: 14px; }
  .doc-status-bar [data-actions] { margin-left: 0; width: 100%; }
}
@media (max-width: 380px) { .grid.g3, .grid.g4 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- appearance + document branding settings ---------- */
.accent-swatches { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.brand-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .brand-layout { grid-template-columns: minmax(0, 1fr); } }
.tpl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 560px) { .tpl-grid { grid-template-columns: minmax(0, 1fr); } }
.tpl-card { display: flex; flex-direction: column; gap: 8px; }
.tpl-card [data-pic] { display: block; }
.tpl-card .tpl-pic { display: block; width: 100%; aspect-ratio: 210 / 150; border-radius: 8px; background: #fff; border: 1px solid var(--border); position: relative; overflow: hidden; }
.tpl-card b { font-size: var(--fs-sm); } .tpl-card small { color: var(--text-3); font-size: var(--fs-xs); line-height: 1.35; }
.tpl-pic i { position: absolute; display: block; border-radius: 2px; }
.color-field { display: flex; gap: 8px; align-items: center; }
.color-field input[type=text] { font-family: ui-monospace, monospace; text-transform: uppercase; max-width: 130px; }
.preview-pane { position: sticky; top: 80px; }
.preview-pane .pdf-frame { height: min(78vh, 900px); }
@media (max-width: 1100px) { .preview-pane { position: static; } .preview-pane .pdf-frame { height: 70vh; } }
/* radio-based segmented control + swatches (keyboard: native radios, visible focus) */
.seg-opt { position: relative; display: inline-flex; }
.seg-opt span { display: inline-flex; align-items: center; padding: 7px 12px; border-radius: calc(var(--radius) - 3px); font: 600 var(--fs-sm)/1 var(--font); color: var(--text-2); cursor: pointer; white-space: nowrap; transition: background var(--dur-fast), color var(--dur-fast); }
.seg-opt input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
.seg-opt input:disabled + span { color: var(--disabled-fg); cursor: not-allowed; }
.swatch-opt { position: relative; display: inline-flex; cursor: pointer; }
.swatch-opt .swatch { display: grid; place-items: center; color: var(--text-2); }
.swatch-opt input:checked + .swatch { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.swatch-opt input:focus-visible + .swatch { outline: 2px solid var(--focus); outline-offset: 4px; }
.swatch-opt input:disabled + .swatch { opacity: .45; cursor: not-allowed; }
.swatch-inherit { background: var(--surface-3); } .swatch-inherit svg { width: 15px; height: 15px; }
.swatch-custom { background: conic-gradient(#e11d48, #f59e0b, #16a34a, #0ea5e9, #6d28d9, #e11d48); }
.accent-swatches input[type=color] { width: 40px; height: 32px; }
.appearance-sample { background: var(--surface-2); }
.tpl-card { position: relative; cursor: pointer; }
.tpl-card input:checked ~ b { color: var(--accent-text); }
.tpl-card:has(input:checked) { border-color: var(--accent); box-shadow: var(--focus-ring); }
.tpl-card:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
