/*
 * Mesura — demonstração fictícia criada pela Zenite Web (backoffice / ERP de gestão).
 * Estilos próprios e isolados (não partilham CSS com o site). Sem dependências externas.
 * Tipos de letra locais: Public Sans e JetBrains Mono (SIL OFL 1.1, ver ../fonts/OFL-1.1.txt).
 * Ícones: Tabler Icons (MIT), ver img/sprite.svg.
 */

@font-face { font-family: "Public Sans"; src: url("../fonts/public-sans-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Public Sans"; src: url("../fonts/public-sans-latin-ext-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2"); font-weight: 100 800; font-style: normal; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin-ext-wght-normal.woff2") format("woff2"); font-weight: 100 800; font-style: normal; font-display: swap; unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Public Sans Fallback"; src: local("Arial"); size-adjust: 103%; ascent-override: 93%; descent-override: 23%; line-gap-override: 0%; }
@font-face { font-family: "Mono Fallback"; src: local("Courier New"); size-adjust: 98%; ascent-override: 102%; descent-override: 30%; line-gap-override: 0%; }

/* ---------- tokens: light (default), dark by system preference, explicit choice overrides both ---------- */
:root {
  color-scheme: light;
  --bg: #f2f4f3;
  --surface: #ffffff;
  --surface-2: #f7f9f8;
  --surface-3: #eaf0ee;
  --ink: #12201e;
  --ink-2: #33423f;
  --muted: #55645f;
  --line: #dce3e0;
  --edge: #6f7f7a;
  --primary: #0a6b66;
  --primary-ink: #ffffff;
  --primary-soft: #ddf1ee;
  --primary-soft-ink: #0a5753;
  --amber-soft: #fdefd2;
  --amber-ink: #8a4f00;
  --danger: #b3261e;
  --danger-soft: #fbe4e1;
  --ok: #1b7a4b;
  --ok-soft: #ddf3e6;
  --info: #1f5fa8;
  --side-bg: #0f2523;
  --side-ink: #d6e4e1;
  --side-muted: #9fb8b3;
  --side-hover: #19332f;
  --side-on: #17413b;
  --side-accent: #3dd6c6;
  --c1: #0a6b66;
  --c2: #d97706;
  --c3: #3b6fd6;
  --c4: #7a5195;
  --c5: #55645f;
  --shadow: 0 1px 2px rgba(18, 32, 30, 0.06), 0 8px 24px -12px rgba(18, 32, 30, 0.14);
  --ring: #0a6b66;
  --zebra: rgba(18, 32, 30, 0.025);
  --skel-a: #e6ece9;
  --skel-b: #f3f6f4;

  --f-body: "Public Sans", "Public Sans Fallback", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --f-mono: "JetBrains Mono", "Mono Fallback", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --side-w: 264px;
  --top-h: 64px;
  --strip-h: 56px;
  --row-h: 52px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c1514; --surface: #121e1d; --surface-2: #17262a; --surface-3: #1d2f2e;
    --ink: #e6eeec; --ink-2: #c4d3cf; --muted: #9fb1ac; --line: #243533; --edge: #6f8681;
    --primary: #3dd6c6; --primary-ink: #06201d; --primary-soft: #17302e; --primary-soft-ink: #7be8dc;
    --amber-soft: #3a2a08; --amber-ink: #f5b84b; --danger: #ff8a80; --danger-soft: #3f1a18; --ok: #5dd39e; --ok-soft: #133224; --info: #7db7ff;
    --side-bg: #091110; --side-ink: #cfe0dc; --side-muted: #8fa8a3; --side-hover: #12201f; --side-on: #17302e; --side-accent: #3dd6c6;
    --c1: #3dd6c6; --c2: #f5b84b; --c3: #7db7ff; --c4: #c9a2e8; --c5: #9fb1ac;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px -14px rgba(0, 0, 0, 0.6);
    --ring: #3dd6c6; --zebra: rgba(255, 255, 255, 0.03); --skel-a: #1a2b2a; --skel-b: #223735;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1514; --surface: #121e1d; --surface-2: #17262a; --surface-3: #1d2f2e;
  --ink: #e6eeec; --ink-2: #c4d3cf; --muted: #9fb1ac; --line: #243533; --edge: #6f8681;
  --primary: #3dd6c6; --primary-ink: #06201d; --primary-soft: #17302e; --primary-soft-ink: #7be8dc;
  --amber-soft: #3a2a08; --amber-ink: #f5b84b; --danger: #ff8a80; --danger-soft: #3f1a18; --ok: #5dd39e; --ok-soft: #133224; --info: #7db7ff;
  --side-bg: #091110; --side-ink: #cfe0dc; --side-muted: #8fa8a3; --side-hover: #12201f; --side-on: #17302e; --side-accent: #3dd6c6;
  --c1: #3dd6c6; --c2: #f5b84b; --c3: #7db7ff; --c4: #c9a2e8; --c5: #9fb1ac;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px -14px rgba(0, 0, 0, 0.6);
  --ring: #3dd6c6; --zebra: rgba(255, 255, 255, 0.03); --skel-a: #1a2b2a; --skel-b: #223735;
}
:root[data-density="compact"] { --row-h: 40px; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 16px); scroll-padding-bottom: calc(var(--strip-h) + 24px); }
body { margin: 0; padding-bottom: var(--strip-h); background: var(--bg); color: var(--ink-2); font: 400 0.9375rem/1.5 var(--f-body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: clip; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3 { margin: 0; color: var(--ink); font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; text-wrap: balance; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.45rem, 1.15rem + 1.2vw, 1.9rem); letter-spacing: -0.025em; }
h2 { font-size: 1rem; }
h3 { font-size: 0.9375rem; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--primary); text-underline-offset: 3px; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--primary); color: var(--primary-ink); }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
.side :focus-visible, .strip :focus-visible { outline-color: var(--side-accent); }
.num, .mono, td.n, th.n { font-family: var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.vh { position: absolute !important; width: 1px; height: 1px; max-width: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 0.75rem; top: -4rem; z-index: 300; padding: 0.7rem 1.1rem; background: var(--ink); color: var(--bg); border-radius: 8px; text-decoration: none; font-weight: 600; }
.skip:focus { top: 0.75rem; }
.i { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: calc(100vh - var(--strip-h)); transition: grid-template-columns 0.3s var(--ease); }
html[data-collapsed="true"] .app { --side-w: 76px; }
.side { position: sticky; top: 0; height: calc(100vh - var(--strip-h)); height: calc(100dvh - var(--strip-h)); display: flex; flex-direction: column; background: var(--side-bg); color: var(--side-ink); z-index: 120; overflow: hidden; }
.side-head { display: flex; align-items: center; gap: 0.7rem; min-height: var(--top-h); padding: 0 1.1rem; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.side-brand { display: flex; align-items: center; gap: 0.7rem; color: #fff; text-decoration: none; min-width: 0; }
.mark { width: 34px; height: 34px; flex: none; }
.brand-name { display: grid; line-height: 1.15; min-width: 0; }
.brand-name b { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.03em; }
.brand-name small { font-size: 0.72rem; color: var(--side-muted); font-weight: 500; white-space: nowrap; }
.side-nav { flex: 1; overflow-y: auto; padding: 1rem 0.75rem; display: grid; gap: 1.1rem; align-content: start; }
.side-group h2 { padding: 0 0.7rem 0.4rem; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--side-muted); }
.side-group ul { display: grid; gap: 2px; }
.nav-link { position: relative; display: flex; align-items: center; gap: 0.75rem; min-height: 44px; padding: 0.4rem 0.7rem; border-radius: 10px; color: var(--side-ink); text-decoration: none; font-weight: 500; transition: background-color 0.2s, color 0.2s; }
.nav-link:hover { background: var(--side-hover); color: #fff; }
.nav-link[aria-current="page"] { background: var(--side-on); color: #fff; font-weight: 600; }
.nav-link[aria-current="page"]::before { content: ""; position: absolute; left: -0.75rem; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--side-accent); }
.nav-link .i { width: 1.3em; height: 1.3em; }
.nav-badge { margin-left: auto; padding: 0.05rem 0.5rem; border-radius: 999px; background: var(--side-accent); color: #06201d; font: 700 0.6875rem var(--f-mono); }
.side-foot { padding: 0.75rem; border-top: 1px solid rgba(255, 255, 255, 0.08); display: grid; gap: 0.5rem; }
.side-note { padding: 0.7rem 0.75rem; border-radius: 10px; background: var(--side-hover); font-size: 0.8125rem; color: var(--side-ink); line-height: 1.4; }
.side-collapse { display: flex; align-items: center; gap: 0.75rem; min-height: 44px; padding: 0.4rem 0.7rem; border: 0; border-radius: 10px; background: transparent; color: var(--side-ink); font-weight: 500; text-align: left; }
.side-collapse:hover { background: var(--side-hover); color: #fff; }
.side-collapse .i-exp { display: none; }
html[data-collapsed="true"] .side-collapse .i-exp { display: block; }
html[data-collapsed="true"] .side-collapse .i-col { display: none; }
@media (min-width: 960px) {
  html[data-collapsed="true"] .nav-label, html[data-collapsed="true"] .brand-name, html[data-collapsed="true"] .side-group h2, html[data-collapsed="true"] .side-note, html[data-collapsed="true"] .nav-badge { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  html[data-collapsed="true"] .side-head { padding-inline: 0; justify-content: center; }
  html[data-collapsed="true"] .nav-link, html[data-collapsed="true"] .side-collapse { justify-content: center; padding-inline: 0; }
  html[data-collapsed="true"] .nav-link[aria-current="page"]::before { left: -0.75rem; }
  html[data-collapsed="true"] .side-nav { overflow: visible; }
  .nav-link[data-tip]:hover::after, .nav-link[data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%); z-index: 10; padding: 0.35rem 0.65rem; border-radius: 8px; background: var(--ink); color: var(--bg); font-size: 0.8125rem; font-weight: 600; white-space: nowrap; pointer-events: none; }
  html:not([data-collapsed="true"]) .nav-link[data-tip]::after { display: none; }
}

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; gap: 0.6rem; min-height: var(--top-h); padding: 0 clamp(0.75rem, 2.5vw, 2rem); background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); transition: background-color 0.2s, border-color 0.2s, transform 0.15s; }
.icon-btn:hover { background: var(--surface-3); border-color: var(--edge); }
.icon-btn:active { transform: scale(0.96); }
.menu-btn .i-close { display: none; }
.menu-btn[aria-expanded="true"] .i-menu { display: none; }
.menu-btn[aria-expanded="true"] .i-close { display: block; }
.top-search { position: relative; flex: 1; max-width: 26rem; }
.top-search .i { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.top-search input { width: 100%; min-height: 44px; padding: 0.5rem 3.2rem 0.5rem 2.5rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); }
.top-search input::placeholder { color: var(--muted); opacity: 1; }
.top-search kbd { position: absolute; right: 0.6rem; top: 50%; transform: translateY(-50%); }
.top-spacer { flex: 1; }
.top-tools { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-btn .i-sun { display: block; } :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; } }
.user { display: none; align-items: center; gap: 0.6rem; padding: 0.25rem 0.75rem 0.25rem 0.3rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); min-height: 44px; }
.user img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.user span { display: grid; line-height: 1.15; font-size: 0.8125rem; }
.user b { color: var(--ink); font-weight: 600; }
.user small { color: var(--muted); font-size: 0.75rem; }
kbd { display: inline-block; min-width: 1.6em; padding: 0.05em 0.4em; border: 1px solid var(--edge); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); color: var(--ink); font: 600 0.75rem/1.4 var(--f-mono); text-align: center; }
@media (min-width: 1100px) { .user { display: inline-flex; } }
.scrim { position: fixed; inset: 0; z-index: 110; background: rgba(6, 14, 13, 0.55); opacity: 0; visibility: hidden; transition: opacity 0.25s, visibility 0s 0.25s; }
.scrim.is-on { opacity: 1; visibility: visible; transition: opacity 0.25s; }

@media (max-width: 959px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: var(--strip-h); width: min(300px, 86vw); height: auto; transform: translateX(-102%); visibility: hidden; transition: transform 0.3s var(--ease), visibility 0s 0.3s; box-shadow: 12px 0 40px -10px rgba(0, 0, 0, 0.5); }
  .side.is-open { transform: none; visibility: visible; transition: transform 0.3s var(--ease); }
  .side-collapse { display: none; }
  html[data-collapsed="true"] .app { --side-w: 264px; }
  .top-search kbd { display: none; }
  .top-search input { padding-right: 0.75rem; }
}
@media (max-width: 599px) { .top-search { display: none; } }
@media (min-width: 960px) { .menu-btn { display: none; } }
/* without scripts the navigation is simply a block above the content */
html:not(.js) .app { grid-template-columns: minmax(0, 1fr); }
html:not(.js) .side { position: static; height: auto; transform: none; visibility: visible; box-shadow: none; }
html:not(.js) .side-collapse, html:not(.js) .menu-btn, html:not(.js) .theme-btn { display: none; }
html:not(.js) .side-nav { display: flex; flex-wrap: wrap; padding: 0.5rem 0.75rem; }
html:not(.js) .side-foot { display: none; }

/* ---------- strip (demonstration) ---------- */
.strip { position: fixed; inset: auto 0 0 0; z-index: 200; min-height: var(--strip-h); background: #0f2523; color: #d6e4e1; font-size: 0.875rem; line-height: 1.3; padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid rgba(255, 255, 255, 0.12); }
.strip-in { display: flex; align-items: center; gap: 0.75rem; min-height: var(--strip-h); padding: 0.4rem clamp(0.75rem, 2.5vw, 2rem); }
.strip-back { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(214, 228, 225, 0.4); flex: none; text-decoration: none; transition: background-color 0.2s; }
.strip-back:hover { background: rgba(255, 255, 255, 0.12); }
.strip-back .i { transform: scaleX(-1); }
.strip-text { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.6rem; }
.strip-text > a { flex: none; display: inline-flex; }
.strip-text img { width: 28px; height: 28px; flex: none; background: #f2f4f3; border-radius: 8px; padding: 3px; }
.strip-by { display: none; }
.strip a { color: inherit; }
.strip-cta { display: inline-flex; align-items: center; min-height: 40px; padding: 0.4rem 1.1rem; border-radius: 10px; background: #3dd6c6; color: #06201d !important; font-weight: 700; text-decoration: none; white-space: nowrap; transition: background-color 0.2s; }
.strip-cta:hover { background: #7be8dc; }
.strip-repo { display: none; }
@media (max-width: 359px) { .strip-in { gap: 0.5rem; } .strip-cta { padding-inline: 0.75rem; font-size: 0.8rem; } .strip-text > a { display: none; } }
@media (min-width: 720px) {
  .strip { font-size: 0.9375rem; }
  .strip-by { display: inline; }
  .strip-by::before { content: "·"; margin-inline: 0.6rem; opacity: 0.6; }
  .strip-repo { display: inline-flex; align-items: center; min-height: 40px; padding: 0.4rem 1.1rem; border: 1px solid rgba(214, 228, 225, 0.4); border-radius: 10px; text-decoration: none; font-weight: 500; transition: background-color 0.2s; }
  .strip-repo:hover { background: rgba(255, 255, 255, 0.12); }
  .strip-back { display: none; }
}

/* ---------- page ---------- */
.page { width: 100%; max-width: 1480px; margin-inline: auto; padding: clamp(1rem, 2.5vw, 2rem); display: grid; gap: clamp(1rem, 2vw, 1.5rem); align-content: start; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.75rem 1.25rem; position: relative; padding-bottom: 1rem; }
.page-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 7px; background: repeating-linear-gradient(90deg, var(--edge) 0 1px, transparent 1px 8px), repeating-linear-gradient(90deg, var(--edge) 0 1px, transparent 1px 40px); background-size: 100% 4px, 100% 7px; background-repeat: no-repeat; background-position: 0 0, 0 0; opacity: 0.5; }
.page-head p { margin-top: 0.25rem; color: var(--muted); }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.crumbs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.4rem; font-size: 0.8125rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 0.35rem; color: var(--edge); }
.crumbs a { color: var(--ink-2); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); min-width: 0; }
.card-pad { padding: clamp(0.9rem, 1.6vw, 1.25rem); }
.card-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin-bottom: 0.9rem; }
.card-h p { font-size: 0.8125rem; color: var(--muted); }
.grid { display: grid; gap: clamp(0.75rem, 1.6vw, 1.25rem); }
.g-kpi { grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), 1fr)); }
.g-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
@media (min-width: 1100px) { .g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } .g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 760px) and (max-width: 1099px) { .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-3 > :first-child { grid-column: 1 / -1; } }

/* ---------- buttons, chips, fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 44px; padding: 0.5rem 1rem; border: 1px solid transparent; border-radius: 12px; font-weight: 600; font-size: 0.9375rem; line-height: 1.2; text-decoration: none; transition: background-color 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s; overflow-wrap: anywhere; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--primary); color: var(--primary-ink); }
.btn--primary:hover { box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--primary) 70%, transparent); filter: brightness(1.06); }
.btn--ghost { background: var(--surface); border-color: var(--edge); color: var(--ink); }
.btn--ghost:hover { background: var(--surface-3); }
.btn--danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); }
.btn--sm { min-height: 36px; padding: 0.3rem 0.75rem; font-size: 0.875rem; border-radius: 10px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; }
.spin { display: none; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
.is-sending .spin { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.12rem 0.6rem 0.12rem 0.45rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; line-height: 1.4; white-space: nowrap; background: var(--surface-3); color: var(--ink); }
.chip .i { width: 1em; height: 1em; stroke-width: 2.2; }
.chip--ok { background: var(--ok-soft); color: var(--ok); }
.chip--warn { background: var(--amber-soft); color: var(--amber-ink); }
.chip--bad { background: var(--danger-soft); color: var(--danger); }
.chip--info { background: var(--primary-soft); color: var(--primary-soft-ink); }
.chip--muted { background: var(--surface-3); color: var(--ink-2); }
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--edge); border-radius: 12px; background: var(--surface); max-width: 100%; }
.seg label { position: relative; display: block; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 38px; padding: 0.25rem 0.9rem; border-radius: 9px; font-weight: 600; font-size: 0.875rem; color: var(--ink-2); white-space: nowrap; transition: background-color 0.2s, color 0.2s; }
.seg input:checked + span { background: var(--primary); color: var(--primary-ink); }
.seg input:focus-visible + span { outline: 3px solid var(--ring); outline-offset: 2px; }
.seg input:not(:checked) + span:hover { background: var(--surface-3); }
.chipset { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chipb { display: inline-flex; align-items: center; gap: 0.45rem; min-height: 40px; padding: 0.25rem 0.85rem; border: 1px solid var(--edge); border-radius: 999px; background: var(--surface); color: var(--ink); font-weight: 600; font-size: 0.875rem; transition: background-color 0.2s, color 0.2s, border-color 0.2s; }
.chipb:hover { background: var(--surface-3); }
.chipb[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.chipb b { font: 600 0.75rem var(--f-mono); padding: 0 0.4rem; border-radius: 999px; background: var(--surface-3); color: var(--ink); }
.chipb[aria-pressed="true"] b { background: var(--primary-ink); color: var(--primary); }
.field { display: grid; gap: 0.35rem; align-content: start; min-width: 0; }
.field > label, .field .lbl, .fieldset legend { font-weight: 600; color: var(--ink); font-size: 0.875rem; }
.field > label span, .lbl span { font-weight: 400; color: var(--muted); }
.in { width: 100%; min-height: 44px; padding: 0.5rem 0.75rem; border: 1px solid var(--edge); border-radius: 10px; background: var(--surface); color: var(--ink); transition: border-color 0.2s, box-shadow 0.2s; }
select.in { padding-right: 2rem; }
textarea.in { min-height: 6rem; resize: vertical; }
.in:hover { border-color: var(--ink-2); }
.in:focus-visible { outline: 3px solid var(--ring); outline-offset: 1px; border-color: var(--ink); }
.in.n { text-align: right; }
.hint { font-size: 0.8125rem; color: var(--muted); }
.count { font-size: 0.75rem; color: var(--muted); text-align: right; }
.err { display: none; align-items: flex-start; gap: 0.35rem; color: var(--danger); font-size: 0.8125rem; font-weight: 600; }
.has-err > .err, .has-err .err { display: flex; }
.err .i { margin-top: 0.1em; }
.has-err .in { border-color: var(--danger); background: var(--danger-soft); }
.fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.opts { display: grid; gap: 0.5rem; }
.opt { position: relative; display: flex; align-items: flex-start; gap: 0.65rem; padding: 0.7rem 0.85rem; min-height: 44px; border: 1px solid var(--edge); border-radius: 12px; background: var(--surface); color: var(--ink); cursor: pointer; transition: border-color 0.2s, background-color 0.2s; }
.opt:hover { border-color: var(--ink-2); }
.opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.opt:has(input:focus-visible) { outline: 3px solid var(--ring); outline-offset: 2px; }
.opt input { width: 20px; height: 20px; margin: 0.1rem 0 0; accent-color: var(--primary); flex: none; }
.opt small { display: block; color: var(--muted); font-size: 0.8125rem; }
.check { display: flex; gap: 0.65rem; align-items: flex-start; }
.check input { width: 22px; height: 22px; margin: 0.1rem 0 0; accent-color: var(--primary); flex: none; }
.check label { font-weight: 400; color: var(--ink-2); }
.summary-err { display: none; padding: 0.9rem 1.1rem; border: 1px solid var(--danger); border-radius: 12px; background: var(--danger-soft); color: var(--danger); }
.summary-err.is-on { display: block; }
.summary-err h2 { font-size: 0.9375rem; color: var(--danger); margin-bottom: 0.3rem; }
.summary-err li { margin-top: 0.15rem; }
.summary-err a { color: inherit; font-weight: 600; }

/* ---------- KPI ---------- */
.kpi { position: relative; display: grid; gap: 0.25rem; padding: 1rem 1.1rem 0.9rem; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: repeating-linear-gradient(90deg, var(--edge) 0 1px, transparent 1px 8px); opacity: 0.35; }
.kpi h2 { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-top: 0.15rem; }
.kpi h2 .i { color: var(--primary); }
.kpi-v { font: 700 clamp(1.5rem, 1.1rem + 1.2vw, 2rem)/1.15 var(--f-mono); letter-spacing: -0.045em; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-d { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.6rem; font-size: 0.8125rem; color: var(--muted); }
.delta { display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.05rem 0.45rem 0.05rem 0.3rem; border-radius: 6px; font: 600 0.75rem var(--f-mono); }
.delta .i { width: 1em; height: 1em; stroke-width: 2.4; }
.delta--up { background: var(--ok-soft); color: var(--ok); }
.delta--down { background: var(--danger-soft); color: var(--danger); }
.delta--flat { background: var(--surface-3); color: var(--ink-2); }
.spark { width: 100%; height: 34px; margin-top: 0.35rem; overflow: visible; }
.spark path { fill: none; stroke: var(--c1); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- charts ---------- */
.chart-wrap { position: relative; }
.chart { position: relative; outline-offset: 4px; border-radius: 10px; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart text { font: 500 11px var(--f-mono); fill: var(--muted); }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .tick { stroke: var(--edge); stroke-width: 1; }
.chart .l1 { fill: none; stroke: var(--c1); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .l2 { fill: none; stroke: var(--c2); stroke-width: 2.5; stroke-dasharray: 7 5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--c1); opacity: 0.12; }
.chart .cross { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .dot1 { fill: var(--surface); stroke: var(--c1); stroke-width: 2.5; }
.chart .dot2 { fill: var(--surface); stroke: var(--c2); stroke-width: 2.5; }
.chart .hit { fill: transparent; }
.tip { position: absolute; z-index: 5; min-width: 9.5rem; padding: 0.55rem 0.7rem; border: 1px solid var(--edge); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); font-size: 0.8125rem; pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity 0.15s, transform 0.15s; }
.tip.is-on { opacity: 1; transform: none; }
.tip b { display: block; color: var(--ink); margin-bottom: 0.25rem; }
.tip div { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.tip .sw { display: inline-block; width: 18px; height: 0; margin-right: 0.4rem; vertical-align: middle; border-top: 3px solid var(--c1); }
.tip .sw2 { border-top: 3px dashed var(--c2); }
.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; margin-bottom: 0.6rem; font-size: 0.8125rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 0.45rem; }
.legend i { display: inline-block; width: 22px; height: 0; border-top: 3px solid var(--c1); }
.legend i.d { border-top: 3px dashed var(--c2); }
.chart-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.chart-summary { margin-top: 0.85rem; padding: 0.7rem 0.85rem; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 0.875rem; color: var(--ink-2); }
.alt-table { margin-top: 0.85rem; }
.alt-table[hidden] { display: none; }
.js .chart-alt-nojs { display: none; }
.bars { display: grid; gap: 0.75rem; }
.bars li { display: grid; gap: 0.3rem; }
.bars .row { display: flex; justify-content: space-between; gap: 0.75rem; font-size: 0.875rem; color: var(--ink); }
.bars .row b { font: 600 0.8125rem var(--f-mono); letter-spacing: -0.02em; white-space: nowrap; }
.bar { height: 10px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; height: 100%; width: calc(var(--w, 0) * 1%); border-radius: 6px; background: var(--bc, var(--c1)); transform-origin: left; }
.bars li:nth-child(2) { --bc: var(--c3); } .bars li:nth-child(3) { --bc: var(--c2); } .bars li:nth-child(4) { --bc: var(--c4); } .bars li:nth-child(5) { --bc: var(--c5); }
.donut-box { display: grid; gap: 1rem; justify-items: center; }
.donut { position: relative; width: 168px; height: 168px; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 20; }
.donut .bg { stroke: var(--surface-3); }
.donut-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.donut-c b { font: 700 1.6rem var(--f-mono); letter-spacing: -0.05em; color: var(--ink); }
.donut-c span { font-size: 0.75rem; color: var(--muted); }
.dlegend { width: 100%; display: grid; gap: 0.4rem; }
.dlegend li { display: grid; grid-template-columns: 14px 1fr auto auto; gap: 0.6rem; align-items: center; font-size: 0.875rem; color: var(--ink); }
.dlegend i { width: 14px; height: 14px; border-radius: 4px; background: var(--sc); }
.dlegend b { font: 600 0.8125rem var(--f-mono); }
.dlegend small { color: var(--muted); font: 500 0.75rem var(--f-mono); min-width: 3.2rem; text-align: right; }

/* ---------- lists, timeline, meters ---------- */
.list li { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0; border-top: 1px solid var(--line); min-width: 0; }
.list li:first-child { border-top: 0; padding-top: 0.2rem; }
.list .ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-3); color: var(--ink); flex: none; }
.list .tx { flex: 1; min-width: 0; color: var(--ink); font-weight: 600; }
.list .tx small { display: block; font-weight: 400; color: var(--muted); font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; }
.list .end { text-align: right; flex: none; }
.timeline { position: relative; display: grid; gap: 1rem; padding-left: 1.6rem; }
.timeline::before { content: ""; position: absolute; left: 0.5rem; top: 0.4rem; bottom: 0.4rem; width: 0; border-left: 2px dashed var(--edge); }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: -1.6rem; top: 0.25rem; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--primary); }
.timeline li.is-todo::before { border-color: var(--edge); border-style: dashed; }
.timeline b { color: var(--ink); display: block; }
.timeline small { color: var(--muted); }
.meter { display: block; height: 8px; min-width: 70px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; width: calc(var(--w, 0) * 1%); border-radius: 5px; background: var(--ok); }
.meter.is-low i { background: var(--c2); }
.meter.is-out i { background: var(--danger); }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; border: 1px solid var(--line); }
.cell-who { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.cell-who span { display: grid; line-height: 1.2; min-width: 0; }
.cell-who b { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.cell-who small { color: var(--muted); font-size: 0.75rem; }
.ini { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-soft-ink); font: 700 0.75rem var(--f-mono); flex: none; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1.25rem; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }

/* ---------- data table ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.9rem; padding: 0.9rem clamp(0.9rem, 1.6vw, 1.25rem); border-bottom: 1px solid var(--line); }
.tb-search { position: relative; flex: 1 1 14rem; max-width: 22rem; }
.tb-search .i { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.tb-search input { padding-left: 2.4rem; }
.toolbar .field-inline { display: flex; align-items: center; gap: 0.5rem; }
.toolbar .field-inline label { font-size: 0.8125rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.toolbar select.in { min-height: 40px; padding-block: 0.3rem; }
.tb-end { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.menu-d { position: relative; }
.menu-d summary { list-style: none; }
.menu-d summary::-webkit-details-marker { display: none; }
.menu-d[open] summary { background: var(--surface-3); }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; display: grid; gap: 2px; min-width: 15rem; padding: 0.4rem; border: 1px solid var(--edge); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.menu-pop button { display: flex; align-items: center; gap: 0.6rem; min-height: 44px; padding: 0.4rem 0.7rem; border: 0; border-radius: 8px; background: transparent; color: var(--ink); text-align: left; font-weight: 500; }
.menu-pop button:hover { background: var(--surface-3); }
.menu-pop p { padding: 0.4rem 0.7rem 0.2rem; font-size: 0.75rem; color: var(--muted); }
.bulk { display: none; align-items: center; flex-wrap: wrap; gap: 0.6rem 0.9rem; padding: 0.6rem clamp(0.9rem, 1.6vw, 1.25rem); background: var(--primary-soft); color: var(--primary-soft-ink); border-bottom: 1px solid var(--line); font-weight: 600; }
.bulk.is-on { display: flex; animation: slidedown 0.25s var(--ease) both; }
.bulk .btn--ghost { background: var(--surface); }
.tablewrap { position: relative; overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; contain: paint; }
.tablewrap:focus-visible { outline-offset: -3px; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.875rem; }
.tbl caption { text-align: left; padding: 0.9rem clamp(0.9rem, 1.6vw, 1.25rem) 0.4rem; font-weight: 700; color: var(--ink); }
.tbl th, .tbl td { padding: 0.35rem 0.85rem; height: var(--row-h); text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); color: var(--ink); }
.tbl thead th { position: sticky; top: 0; z-index: 2; height: 44px; background: var(--surface-2); color: var(--muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--edge); }
.tbl th.n, .tbl td.n { text-align: right; white-space: nowrap; }
.tbl td.dim { color: var(--ink-2); }
.tbl tbody tr { transition: background-color 0.15s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr.is-sel { background: var(--primary-soft); }
.tbl tbody tr[hidden] { display: none; }
.tbl td a.rowlink { font-weight: 600; text-decoration: none; }
.tbl td a.rowlink:hover { text-decoration: underline; }
.tbl .sel { width: 52px; padding-inline: 0.4rem; text-align: center; }
.tbl .sel label { display: inline-grid; place-items: center; width: 40px; height: 40px; cursor: pointer; }
.tbl .sel input { width: 20px; height: 20px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.sortbtn { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 36px; padding: 0.2rem 0.4rem; margin-left: -0.4rem; border: 0; border-radius: 8px; background: transparent; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; }
th.n .sortbtn { margin-left: 0; margin-right: -0.4rem; }
.sortbtn:hover { background: var(--surface-3); color: var(--ink); }
.sortbtn .i { width: 1em; height: 1em; opacity: 0.55; }
th[aria-sort="ascending"] .sortbtn, th[aria-sort="descending"] .sortbtn { color: var(--ink); }
th[aria-sort] .sortbtn .i { opacity: 1; }
.tbl .num-col { font-family: var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; padding: 0.8rem clamp(0.9rem, 1.6vw, 1.25rem); border-top: 1px solid var(--line); font-size: 0.875rem; color: var(--muted); }
.pager nav { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.pager button { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 0.5rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: 600 0.8125rem var(--f-mono); }
.pager button:hover:not([disabled]) { background: var(--surface-3); }
.pager button[aria-current="page"] { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.pager button[disabled] { opacity: 0.45; cursor: not-allowed; }
.pager .field-inline { display: flex; align-items: center; gap: 0.5rem; }
.tot-line { font-weight: 600; color: var(--ink); }
.state { display: none; padding: clamp(2rem, 6vw, 4rem) 1.5rem; text-align: center; justify-items: center; gap: 0.6rem; }
.state.is-on { display: grid; }
.state .big { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: var(--surface-3); color: var(--ink); margin-bottom: 0.4rem; }
.state--err .big { background: var(--danger-soft); color: var(--danger); }
.state h2, .state h3 { font-size: 1.1rem; }
.state p { max-width: 32rem; color: var(--muted); }
.state .btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 0.6rem; }
.skel { display: none; }
.is-loading .skel { display: table-row-group; }
.is-loading .real { display: none; }
.skel td { height: var(--row-h); }
.skel td i { display: block; height: 12px; width: var(--sw, 70%); border-radius: 6px; background: linear-gradient(90deg, var(--skel-a), var(--skel-b), var(--skel-a)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skel td.n i { margin-left: auto; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- forms: invoice ---------- */
.form-grid { display: grid; gap: 1rem; }
@media (min-width: 640px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid .full { grid-column: 1 / -1; } }
@media (min-width: 1100px) { .form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.split { display: grid; gap: clamp(0.75rem, 1.6vw, 1.25rem); align-items: start; }
@media (min-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr) 22rem; } }
.lines-t { width: 100%; border-collapse: separate; border-spacing: 0; }
.lines-t th { text-align: left; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding: 0.4rem 0.4rem; }
.lines-t th.n { text-align: right; }
.lines-t td { padding: 0.35rem 0.3rem; vertical-align: top; }
.lines-t td.tot { text-align: right; font: 600 0.9375rem var(--f-mono); padding-top: 0.85rem; white-space: nowrap; color: var(--ink); }
.lines-t td .err { margin-top: 0.25rem; }
.lines-wrap { overflow-x: auto; }
.lines-t { min-width: 640px; }
.sum { position: sticky; top: calc(var(--top-h) + 16px); }
.sum dl { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem 1rem; margin: 0; }
.sum dt { color: var(--ink-2); }
.sum dd { margin: 0; text-align: right; font: 600 0.9375rem var(--f-mono); color: var(--ink); }
.sum .total-l { font-weight: 700; color: var(--ink); font-size: 1.05rem; border-top: 1px solid var(--edge); padding-top: 0.7rem; margin-top: 0.2rem; }
.sum .total-v { font-size: 1.4rem; border-top: 1px solid var(--edge); padding-top: 0.5rem; margin-top: 0.2rem; }
.success { display: none; text-align: center; padding: clamp(1.5rem, 4vw, 3rem) 1rem; justify-items: center; gap: 0.6rem; }
.is-done .success { display: grid; }
.is-done .form-body { display: none; }
.big-check { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.big-check svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.sim-note { display: flex; gap: 0.5rem; align-items: flex-start; justify-content: center; font-size: 0.875rem; color: var(--muted); text-align: left; }
.sim-note .i { margin-top: 0.15em; flex: none; }
.sim-banner { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.75rem 1rem; border: 1px dashed var(--edge); border-radius: 12px; background: var(--surface); color: var(--ink-2); font-size: 0.875rem; }
.sim-banner .i { margin-top: 0.15em; flex: none; color: var(--primary); }
.success dl { text-align: left; margin: 0.6rem 0; padding: 1rem 1.1rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); min-width: min(100%, 22rem); }

/* ---------- toast, dialog ---------- */
.toasts { position: fixed; z-index: 250; right: clamp(0.75rem, 2vw, 1.5rem); bottom: calc(var(--strip-h) + 1rem); display: grid; gap: 0.5rem; max-width: min(24rem, calc(100vw - 1.5rem)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.75rem 0.9rem; border-radius: 12px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow); font-size: 0.875rem; font-weight: 500; animation: toast-in 0.35s var(--ease) both; pointer-events: auto; }
.toast .i { margin-top: 0.1em; color: var(--primary); filter: brightness(1.2); }
.toast.is-out { animation: toast-out 0.25s ease both; }
dialog { width: min(34rem, calc(100vw - 1.5rem)); max-height: calc(100vh - 2rem); padding: 0; border: 1px solid var(--edge); border-radius: 18px; background: var(--surface); color: var(--ink-2); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.55); overflow: auto; }
dialog::backdrop { background: rgba(6, 14, 13, 0.6); }
dialog[open] { animation: pop-in 0.25s var(--ease) both; }
.dlg-h { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.dlg-b { padding: 1rem 1.25rem 1.25rem; }
.keys { width: 100%; border-collapse: collapse; }
.keys th, .keys td { padding: 0.55rem 0; border-bottom: 1px solid var(--line); text-align: left; font-weight: 500; color: var(--ink); }
.keys td:last-child { text-align: right; white-space: nowrap; }
.keys kbd + kbd { margin-left: 0.25rem; }
.keys .then { color: var(--muted); font-size: 0.75rem; margin-inline: 0.25rem; }

/* ---------- motion (only with scripts and when allowed) ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes slidedown { from { opacity: 0; transform: translateY(-6px); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes draw { from { stroke-dashoffset: 1; } }
@keyframes growx { from { transform: scaleX(0); } }
@keyframes fadein { from { opacity: 0; } }
.chart .draw { stroke-dasharray: 1; stroke-dashoffset: 0; }
.chart .l2.draw { stroke-dasharray: 7 5; }
.rv .page > * { animation: rise 0.55s var(--ease) both; }
.rv .page > :nth-child(2) { animation-delay: 0.06s; } .rv .page > :nth-child(3) { animation-delay: 0.12s; } .rv .page > :nth-child(4) { animation-delay: 0.18s; } .rv .page > :nth-child(5) { animation-delay: 0.24s; }
.rv .kpi .spark path { stroke-dasharray: 1; animation: draw 1.1s 0.3s var(--ease) both; }
.rv .chart .l1.draw { stroke-dasharray: 1; animation: draw 1.4s 0.15s var(--ease) both; }
.rv .chart .l2.draw { animation: fadein 0.8s 1s both; }
.rv .chart .area { animation: fadein 0.9s 0.8s both; }
.rv .bar i { animation: growx 0.9s 0.2s var(--ease) both; }
.rv .meter i { animation: growx 0.9s 0.2s var(--ease) both; transform-origin: left; }
.rv .donut .seg { animation: fadein 0.6s both; animation-delay: calc(var(--i, 0) * 120ms); }
.rv .tbl tbody tr { animation: fadein 0.4s both; animation-delay: calc(min(var(--ri, 0), 12) * 25ms); }
.rv .side-nav .nav-link { animation: fadein 0.4s both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .skel td i { background: var(--skel-a); }
}
@media print { .strip, .side, .top, .scrim, .toasts { display: none; } body { padding: 0; } .app { display: block; } }

/* progressive enhancement helpers */
html:not(.js) .js-only { display: none !important; }
.js-only[hidden], [hidden].js-fallback { display: none !important; }
.field-inline select.in { width: auto; }
@media (max-width: 520px) { .tb-search { max-width: none; } .toolbar .field-inline { width: 100%; } .toolbar .field-inline select.in { flex: 1; max-width: none !important; } }
.side-close { display: none; }
@media (max-width: 959px) { .side-close { display: inline-grid !important; } }
.kpi-v, .num-col, td.n, .sum dd, .bars .row b, .dlegend b, .tip b.mono, .lines-t td.tot { word-spacing: -0.28em; }
.split { grid-template-columns: minmax(0, 1fr); }
.split > *, .grid > *, .page > * { min-width: 0; }
@media (min-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr) 22rem; } }
.toolbar .field-inline { min-width: 0; }
.toolbar select.in { min-width: 0; max-width: 100%; text-overflow: ellipsis; }
@media (max-width: 599px) { .toolbar .field-inline { flex: 1 1 100%; } .toolbar .field-inline select.in { flex: 1; width: 100%; max-width: none !important; } }
.lines-wrap { contain: paint; }

.app-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; margin-top: auto; padding: 1.25rem clamp(1rem, 2.5vw, 2rem) 1.5rem; border-top: 1px solid var(--line); font-size: 0.8125rem; color: var(--muted); }
.app-foot p:first-child { max-width: 52rem; }
.app-foot .made { display: inline-flex; align-items: center; gap: 0.6rem; }
.app-foot .made img { width: 104px; height: auto; background: #f2f4f3; padding: 5px 9px; border-radius: 8px; }
[data-invoice] { min-height: 34rem; }
