/* ============================================================================
   Inaya ERP · design system
   The same visual language as Obrinex's Avishkar HRMS and Hall of Harmony CRM:
   one brand hue drives every token (OKLCH), frosted cards float over a still
   aurora, generous radii, Plus Jakarta Sans. For a metal works the hue is
   steel blue (258) with a molten-amber accent.
   ========================================================================== */

@font-face {
  font-family: "Jakarta"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/fonts/jakarta-latin.woff2") format("woff2");
  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: "Jakarta"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url("/fonts/jakarta-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, 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;
}

:root {
  --brand: oklch(0.52 0.17 258);
  --accent-brand: oklch(0.80 0.16 70);
  --bg: oklch(0.985 0.006 258);
  --fg: oklch(0.19 0.025 258);
  --card: oklch(1 0.002 258 / 0.86);
  --card-solid: oklch(0.995 0.003 258);
  --popover: oklch(0.995 0.003 258);
  --primary: oklch(0.52 0.17 258);
  --primary-fg: oklch(0.99 0.005 258);
  --muted-bg: oklch(0.956 0.011 258);
  --muted: oklch(0.50 0.026 258);           /* muted text */
  --accent: oklch(0.94 0.02 258);
  --border: oklch(0.905 0.012 258);
  --input: oklch(0.88 0.015 258);
  --destructive: oklch(0.57 0.21 25);
  --success: oklch(0.57 0.14 152);
  --success-fg: #fff;
  --warning: oklch(0.76 0.16 72);
  --warning-ink: oklch(0.50 0.12 62);
  --info: oklch(0.56 0.15 245);
  --violet: oklch(0.53 0.19 295);
  --glow: oklch(0.52 0.17 258 / 0.32);
  --aurora-1: oklch(0.90 0.055 258);
  --aurora-2: oklch(0.935 0.05 72);
  --aurora-3: oklch(0.93 0.04 205);
  --sidebar: oklch(1 0.002 258 / 0.72);
  --shadow-soft: 0 1px 2px oklch(0 0 0 / 0.04), 0 8px 24px -12px oklch(0 0 0 / 0.12);
  --shadow-lift: 0 1px 2px oklch(0 0 0 / 0.06), 0 22px 50px -20px oklch(0 0 0 / 0.28);
  --shadow-glow: 0 0 0 1px var(--glow), 0 12px 32px -12px var(--glow);
  --viz-1: #257de0; --viz-2: #f47230; /* validated: dataviz palette slots 1-2 */
  --age-1: #84b9f3; --age-2: #519ced; --age-3: #257de0; --age-4: #1b64be; --age-5: #0f4a96; /* ordinal ramp */
  --viz-grid: color-mix(in oklch, var(--fg) 8%, transparent);
  --r-xl: 1.25rem; --r-2xl: 1.5rem; --r-3xl: 1.75rem;
  --side: 268px; --side-c: 76px; --top: 64px;
  --font: "Jakarta", ui-sans-serif, system-ui, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  /* aliases kept for older inline styles */
  --red: var(--destructive); --green: var(--success); --blue: var(--info); --text: var(--fg); --line: var(--border);
  color-scheme: light;
}
[data-theme="dark"] {
  --brand: oklch(0.70 0.16 258);
  --accent-brand: oklch(0.80 0.15 72);
  --bg: oklch(0.145 0.016 258);
  --fg: oklch(0.955 0.01 258);
  --card: oklch(0.205 0.017 258 / 0.74);
  --card-solid: oklch(0.205 0.017 258);
  --popover: oklch(0.22 0.017 258);
  --primary: oklch(0.70 0.15 258);
  --primary-fg: oklch(0.16 0.02 258);
  --muted-bg: oklch(0.255 0.016 258);
  --muted: oklch(0.72 0.02 258);
  --accent: oklch(0.27 0.03 258);
  --border: oklch(1 0 0 / 0.10);
  --input: oklch(1 0 0 / 0.15);
  --destructive: oklch(0.70 0.18 22);
  --success: oklch(0.74 0.14 152);
  --success-fg: oklch(0.17 0.03 152);
  --warning: oklch(0.80 0.15 80);
  --warning-ink: oklch(0.83 0.13 80);
  --info: oklch(0.74 0.12 245);
  --violet: oklch(0.75 0.14 295);
  --glow: oklch(0.70 0.16 258 / 0.42);
  --aurora-1: oklch(0.33 0.08 258);
  --aurora-2: oklch(0.30 0.06 72);
  --aurora-3: oklch(0.29 0.05 205);
  --sidebar: oklch(0.175 0.016 258 / 0.72);
  --shadow-soft: 0 1px 2px oklch(0 0 0 / 0.3), 0 8px 24px -12px oklch(0 0 0 / 0.5);
  --shadow-lift: 0 1px 2px oklch(0 0 0 / 0.4), 0 22px 50px -20px oklch(0 0 0 / 0.7);
  --viz-1: #338ced; --viz-2: #e76624;
  --age-1: #1757ac; --age-2: #2370cd; --age-3: #338ced; --age-4: #6aabf1; --age-5: #9dc8f7;
  color-scheme: dark;
}

/* ------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--fg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
/* the still aurora behind everything */
body::before { content: ""; position: fixed; inset: -20%; z-index: -1; pointer-events: none; opacity: .9;
  background:
    radial-gradient(40% 40% at 20% 18%, var(--aurora-1) 0%, transparent 70%),
    radial-gradient(35% 35% at 82% 26%, var(--aurora-2) 0%, transparent 70%),
    radial-gradient(45% 45% at 52% 88%, var(--aurora-3) 0%, transparent 70%); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { letter-spacing: -0.02em; margin: 0; }
h1 { font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1rem; font-weight: 700; margin-bottom: .8rem; letter-spacing: -0.01em; }
h3 { font-size: .92rem; font-weight: 650; }
p { margin: .4rem 0 .8rem; }
small, .muted { color: var(--muted); }
code { font: 12px ui-monospace, "Cascadia Code", Consolas, monospace; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
svg.i { flex-shrink: 0; vertical-align: middle; }
::selection { background: var(--glow); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: color-mix(in oklch, var(--muted) 30%, transparent); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in oklch, var(--muted) 50%, transparent); }
:focus-visible { outline: 2px solid color-mix(in oklch, var(--primary) 60%, transparent); outline-offset: 2px; }
.text-gradient { background: linear-gradient(120deg, var(--brand), var(--accent-brand));
  background: linear-gradient(120deg in oklch, var(--brand), var(--accent-brand)); /* no grey band in the middle */
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-box-decoration-break: clone; box-decoration-break: clone; }

/* ------------------------------------------------------------ shell */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side); z-index: 30; display: flex; flex-direction: column;
  background: var(--sidebar); border-right: 1px solid color-mix(in oklch, var(--border) 80%, transparent);
  backdrop-filter: blur(22px) saturate(1.5); -webkit-backdrop-filter: blur(22px) saturate(1.5);
  transition: width .28s cubic-bezier(.2,.8,.2,1), transform .28s cubic-bezier(.2,.8,.2,1); }
.side-head { height: var(--top); flex-shrink: 0; display: flex; align-items: center; padding: 0 1rem; border-bottom: 1px solid color-mix(in oklch, var(--border) 60%, transparent); }
.brand { display: flex; align-items: center; gap: .7rem; min-width: 0; color: var(--fg); }
.brand:hover { text-decoration: none; }
.logo { width: 36px; height: 36px; flex-shrink: 0; display: block; border-radius: 27.5%; box-shadow: 0 6px 18px -8px var(--glow); }
.brand-text { min-width: 0; line-height: 1.2; }
.brand-text b { display: block; font-size: 14.5px; font-weight: 750; letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { display: block; font-size: 11px; white-space: nowrap; }
.side-nav { flex: 1; overflow-y: auto; padding: 1rem .75rem; scrollbar-width: thin; scrollbar-color: transparent transparent; }
.side-nav:hover { scrollbar-color: color-mix(in oklch, var(--muted) 35%, transparent) transparent; } /* only shows if a very short window still needs it */
.side-nav .sec { margin: 1.1rem 0 .4rem; padding: 0 .75rem; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: color-mix(in oklch, var(--muted) 85%, transparent); white-space: nowrap; }
.side-nav .sec:first-child { margin-top: 0; }
.side-nav a { position: relative; display: flex; align-items: center; gap: .75rem; margin-bottom: 2px; padding: .52rem .75rem; border-radius: 12px;
  font-size: 13.5px; font-weight: 550; color: color-mix(in oklch, var(--fg) 82%, transparent); white-space: nowrap; transition: background .15s, color .15s; }
.side-nav a .i { color: var(--muted); transition: color .15s; }
.side-nav a:hover { background: var(--accent); color: var(--fg); text-decoration: none; }
.side-nav a:hover .i { color: var(--fg); }
.side-nav a.active { color: var(--primary); background: color-mix(in oklch, var(--primary) 10%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--primary) 20%, transparent); }
.side-nav a.active .i { color: var(--primary); }
.side-nav a .count { margin-left: auto; padding: 0 7px; border-radius: 99px; font-size: 10.5px; font-weight: 750; line-height: 18px;
  background: color-mix(in oklch, var(--destructive) 12%, transparent); color: var(--destructive); }
.side-foot { flex-shrink: 0; padding: .75rem; border-top: 1px solid color-mix(in oklch, var(--border) 60%, transparent); }
.side-foot .collapse-btn { display: flex; align-items: center; gap: .55rem; width: 100%; padding: .5rem .75rem; border: 0; border-radius: 10px; background: none;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.side-foot .collapse-btn:hover { background: var(--accent); color: var(--fg); }

.topbar { position: fixed; top: 0; right: 0; left: var(--side); height: var(--top); z-index: 20; display: flex; align-items: center; padding: 0 2rem;
  background: color-mix(in oklch, var(--bg) 78%, transparent); border-bottom: 1px solid color-mix(in oklch, var(--border) 60%, transparent);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); transition: left .28s cubic-bezier(.2,.8,.2,1); }
/* same width as the page content below it, so the search box lines up with the page title on wide screens */
.topbar-in { display: flex; align-items: center; gap: .6rem; width: 100%; max-width: 1440px; margin: 0 auto; }
.topbar .spacer { flex: 1; }
.brand-mini { display: none; }
.menu-btn { display: none !important; }
.search-btn { display: flex; align-items: center; gap: .55rem; flex: 1; max-width: 30rem; height: 40px; padding: 0 .55rem 0 .8rem; border-radius: 12px; cursor: pointer;
  border: 1px solid color-mix(in oklch, var(--border) 80%, transparent); background: color-mix(in oklch, var(--card-solid) 72%, transparent);
  font: inherit; font-size: 13.5px; color: var(--muted); transition: border-color .15s, color .15s; }
.search-btn:hover { border-color: color-mix(in oklch, var(--primary) 40%, transparent); color: var(--fg); }
.search-btn > span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: .3rem; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; padding: 0; border: 0; border-radius: 12px;
  background: transparent; color: var(--fg); cursor: pointer; transition: background .15s; }
.icon-btn:hover { background: var(--muted-bg); }
.icon-btn .dot-count { position: absolute; top: 3px; right: 3px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px; display: grid; place-items: center;
  font-size: 10px; font-weight: 750; background: var(--destructive); color: #fff; box-shadow: 0 0 0 2px var(--bg); }
.pop-wrap { position: relative; }
.avatar-btn { display: flex; align-items: center; gap: .55rem; margin-left: .2rem; padding: 4px 10px 4px 4px; border: 0; border-radius: 12px; background: transparent;
  font: inherit; color: var(--fg); cursor: pointer; text-align: left; }
.avatar-btn:hover { background: var(--muted-bg); }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 99px; font-size: 12px; font-weight: 750;
  color: var(--primary); background: color-mix(in oklch, var(--primary) 12%, transparent); box-shadow: 0 0 0 2px color-mix(in oklch, var(--primary) 22%, transparent); }
.avatar-btn .who { line-height: 1.2; }
.avatar-btn .who b { display: block; max-width: 160px; font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar-btn .who small { display: block; font-size: 11px; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; width: 17rem; padding: .4rem; border-radius: 18px;
  background: var(--popover); border: 1px solid var(--border); box-shadow: var(--shadow-lift); animation: pop-in .16s cubic-bezier(.2,.8,.2,1); }
.menu-pop.wide { width: 22rem; }
.menu-pop .menu-label { padding: .55rem .7rem .45rem; }
.menu-pop .menu-label b { display: block; font-size: 13.5px; }
.menu-pop .menu-label small { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.menu-pop .menu-item { display: flex; align-items: center; gap: .65rem; width: 100%; padding: .55rem .7rem; border: 0; border-radius: 11px; background: none;
  font: inherit; font-size: 13.5px; font-weight: 500; color: var(--fg); text-align: left; cursor: pointer; }
.menu-pop .menu-item:hover { background: var(--muted-bg); text-decoration: none; }
.menu-pop .menu-item .i { color: var(--muted); }
.menu-pop .menu-item .grow { flex: 1; min-width: 0; }
.menu-pop .menu-item .grow small { display: block; font-size: 12px; }
.menu-pop .menu-item .meta { margin-left: auto; font-size: 12px; font-weight: 700; white-space: nowrap; }
.menu-pop .menu-item.danger, .menu-pop .menu-item.danger .i { color: var(--destructive); }
.menu-pop .menu-sep { height: 1px; margin: .35rem .25rem; background: var(--border); }
.menu-pop .menu-empty { padding: 1rem .7rem; font-size: 13px; color: var(--muted); text-align: center; }

main { margin-left: var(--side); min-height: 100vh; padding: calc(var(--top) + 1.5rem) 2rem 3rem; outline: none; transition: margin-left .28s cubic-bezier(.2,.8,.2,1); }
main > * { max-width: 1440px; margin-left: auto; margin-right: auto; }
main.page-in > * { animation: rise .38s cubic-bezier(.2,.8,.2,1) both; }
/* the sign-in screens are exactly one window tall: sliding them in would flash a scrollbar (their card animates instead) */
main.page-in > .auth, main.page-in > .auth-only-main { animation: none; }
.loading { display: grid; place-items: center; min-height: 42vh; }
.spinner { width: 30px; height: 30px; border-radius: 99px; border: 3px solid color-mix(in oklch, var(--primary) 18%, transparent); border-top-color: var(--primary);
  animation: spin .75s linear infinite, fade-in .3s .15s both; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; border-color: color-mix(in oklch, currentColor 30%, transparent); border-top-color: currentColor; animation: spin .75s linear infinite; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.qtile { display: flex; align-items: center; gap: .85rem; padding: 1rem 1.1rem; border-radius: var(--r-2xl); color: var(--fg); background: var(--card);
  border: 1px solid color-mix(in oklch, var(--border) 80%, transparent); box-shadow: var(--shadow-soft); transition: transform .2s cubic-bezier(.2,.8,.2,1), box-shadow .2s; }
.qtile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); text-decoration: none; }
.qtile b { display: block; font-size: 14px; font-weight: 700; }
.qtile small { display: block; font-size: 12px; color: var(--muted); }
.card-head h3 { margin: 0; }
.menu-pop .menu-empty .i { color: var(--success); }
.scrim { display: none; }
.bottom-nav { display: none; }

@media (min-width: 901px) {
  body.side-collapsed { --side: var(--side-c); }
  body.side-collapsed .brand-text, body.side-collapsed .side-nav .sec, body.side-collapsed .side-nav a span,
  body.side-collapsed .side-nav a .count, body.side-collapsed .collapse-btn span { display: none; }
  body.side-collapsed .side-head { justify-content: center; padding: 0; }
  body.side-collapsed .side-nav a { justify-content: center; padding: .6rem 0; }
  body.side-collapsed .side-nav a + .sec { display: block; height: 1px; margin: .7rem .6rem; padding: 0; overflow: hidden; color: transparent; background: var(--border); }
  body.side-collapsed .side-foot .collapse-btn { justify-content: center; padding: .55rem 0; }
}
/* Laptop screens: the menu gets denser as the window gets shorter, so every item fits without scrolling the sidebar.
   Below 1000px the footer becomes one row; below 920px the items tighten; below about 710px the group names become thin dividers. */
@media (min-width: 901px) and (max-height: 1000px) {
  .side-foot { display: flex; align-items: center; gap: .25rem; padding: .45rem .75rem; }
  .side-foot .collapse-btn { width: auto; flex-shrink: 0; padding: .45rem .55rem; }
  .side-foot .collapse-btn span { display: none; }
}
@media (min-width: 901px) and (max-height: 920px) {
  .side-nav { padding: .5rem .75rem; }
  .side-nav .sec { margin: .6rem 0 .15rem; }
  .side-nav a { padding: .32rem .75rem; margin-bottom: 1px; line-height: 1.35; }
  body.side-collapsed .side-nav a { padding: .42rem 0; }
  body.side-collapsed .side-nav a + .sec { margin: .4rem .6rem; }
}
@media (min-width: 901px) and (max-height: 709px) {
  .side-nav .sec { display: block; height: 1px; margin: .4rem .6rem; padding: 0; overflow: hidden; color: transparent; background: var(--border); }
}
@media (min-width: 901px) and (max-height: 653px) {
  .side-nav a { padding: .24rem .75rem; }
  body.side-collapsed .side-nav a { padding: .3rem 0; }
}
@media (min-width: 901px) and (max-height: 610px) {
  .side-nav { padding: .35rem .75rem; }
  .side-nav a { padding: .19rem .75rem; }
  .side-foot { padding: .2rem .75rem; }
  .side-foot .collapse-btn { padding: .32rem .5rem; }
}

body.no-shell .topbar, body.no-shell .sidebar, body.no-shell .bottom-nav { display: none !important; }
body.no-shell main { margin: 0; padding: 0; }
body.no-shell main > * { max-width: none; }

/* ------------------------------------------------------------ page head & layout */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head > div:first-child { min-width: 0; }
.page-head .eyebrow { margin-bottom: .35rem; font-size: 11.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .12em; color: var(--primary); }
.page-head h1 { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .65rem; }
.page-head .sub { margin-top: .35rem; max-width: 52rem; font-size: 14px; color: var(--muted); }
.back-link { display: inline-flex; align-items: center; gap: .3rem; margin-bottom: .5rem; font-size: 12.5px; font-weight: 650; color: var(--muted); }
.back-link:hover { color: var(--fg); text-decoration: none; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }

.card { margin-bottom: 1rem; padding: 1.25rem 1.35rem; border-radius: var(--r-3xl); background: var(--card);
  border: 1px solid color-mix(in oklch, var(--border) 80%, transparent); box-shadow: var(--shadow-soft); }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { margin: 0; padding: 1.15rem 1.35rem .8rem; }
.card.flush > .card-head { margin: 0; padding: 1.15rem 1.35rem .8rem; }
.card > h2 { display: flex; align-items: center; gap: .5rem; }
.card > h2 .i, .card-head h2 .i { color: var(--primary); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .9rem; }
.card-head h2 { display: flex; align-items: center; gap: .5rem; margin: 0; }
.card-head > a { display: inline-flex; align-items: center; gap: .25rem; font-size: 12.5px; font-weight: 650; white-space: nowrap; }
.card-head .desc { margin-top: 2px; font-size: 12px; color: var(--muted); font-weight: 500; }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid > .card { margin-bottom: 0; }
.grid + .card, .grid + .grid, .stats + .grid, .card + .grid { margin-top: 1rem; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.toolbar .grow { flex: 1; min-width: 220px; }
.toolbar input.grow, input[type=search] { padding-left: 2.35rem; background-repeat: no-repeat; background-position: .8rem center; background-size: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b8496' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E"); }
.toolbar input[type=date] { width: auto; }
.tabs, .chips { display: inline-flex; flex-wrap: wrap; gap: 2px; max-width: 100%; padding: 4px; margin-bottom: 1rem; border-radius: 14px;
  background: color-mix(in oklch, var(--muted-bg) 85%, transparent); border: 1px solid color-mix(in oklch, var(--border) 60%, transparent); }
.chips { margin-bottom: 0; }
.tabs a, .chip { display: inline-flex; align-items: center; gap: .35rem; padding: .4rem .85rem; border: 0; border-radius: 10px; background: none;
  font: inherit; font-size: 13px; font-weight: 650; color: var(--muted); white-space: nowrap; cursor: pointer; transition: background .15s, color .15s; }
.tabs a:hover, .chip:hover { color: var(--fg); text-decoration: none; }
.tabs a.active, .chip.active { background: var(--card-solid); color: var(--fg); box-shadow: 0 1px 2px oklch(0 0 0 / .08), 0 0 0 1px color-mix(in oklch, var(--border) 70%, transparent); }
.tabs .n { font-size: 11px; font-weight: 750; padding: 0 6px; border-radius: 99px; background: color-mix(in oklch, var(--primary) 12%, transparent); color: var(--primary); }

/* ------------------------------------------------------------ forms */
label { display: block; margin-bottom: .35rem; font-size: 12.5px; font-weight: 650; color: color-mix(in oklch, var(--fg) 82%, transparent); }
input, select, textarea { width: 100%; min-height: 40px; padding: .55rem .8rem; font: inherit; font-size: 14px; color: var(--fg); background-color: var(--card-solid);
  border: 1px solid var(--input); border-radius: 12px; outline: none; transition: border-color .15s, box-shadow .15s, background-color .15s; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in oklch, var(--primary) 30%, var(--input)); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 18%, transparent); }
input::placeholder, textarea::placeholder { color: color-mix(in oklch, var(--muted) 70%, transparent); }
select { appearance: none; -webkit-appearance: none; padding-right: 2.2rem; background-repeat: no-repeat; background-position: right .7rem center; background-size: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b8496' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; min-height: 0; padding: 0; margin: 0; accent-color: var(--primary); flex-shrink: 0; box-shadow: none; }
input[type=date] { min-width: 0; }
input[readonly] { background-color: var(--muted-bg); color: var(--muted); }
textarea { min-height: 86px; resize: vertical; line-height: 1.45; }
.field { min-width: 0; margin-bottom: .95rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 1rem; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid .span2 { grid-column: span 2; }
.check { display: inline-flex; align-items: center; gap: .55rem; margin: 0; font-size: 13.5px; font-weight: 550; cursor: pointer; }
.hint { margin-top: .3rem; font-size: 12px; color: var(--muted); }
.err-text { color: var(--destructive); font-size: 12.5px; font-weight: 600; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-radius: 13px; background: color-mix(in oklch, var(--muted-bg) 85%, transparent);
  border: 1px solid color-mix(in oklch, var(--border) 60%, transparent); }
.seg label { position: relative; margin: 0; padding: .38rem .85rem; border-radius: 9px; font-size: 13px; font-weight: 650; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.seg label:hover { color: var(--fg); }
.seg input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--card-solid); color: var(--primary); box-shadow: 0 1px 2px oklch(0 0 0 / .08), 0 0 0 1px color-mix(in oklch, var(--primary) 25%, transparent); }
.input-icon { position: relative; }
.input-icon > .i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { height: 46px; padding-left: 2.5rem; }
.input-icon input.has-toggle { padding-right: 2.9rem; }
.input-icon .pw-toggle { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; color: var(--muted); }
.party-input { position: relative; }
.party-hint { margin-top: .3rem; font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; height: 38px; padding: 0 .95rem; border-radius: 12px;
  border: 1px solid var(--border); background: var(--card-solid); color: var(--fg); box-shadow: 0 1px 2px oklch(0 0 0 / .05);
  font: inherit; font-size: 13.5px; font-weight: 650; white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .06s, filter .15s; }
.btn:hover { background: var(--muted-bg); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn .i { margin-left: -2px; }
.btn.primary { border-color: transparent; background: var(--primary); color: var(--primary-fg); box-shadow: var(--shadow-glow); }
.btn.primary:hover { background: color-mix(in oklch, var(--primary) 88%, black); }
.btn.success { border-color: transparent; background: var(--success); color: var(--success-fg);
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--success) 30%, transparent), 0 12px 30px -14px color-mix(in oklch, var(--success) 70%, transparent); }
.btn.success:hover { filter: brightness(.95); }
.btn.danger { color: var(--destructive); border-color: color-mix(in oklch, var(--destructive) 30%, var(--border)); }
.btn.danger:hover { background: color-mix(in oklch, var(--destructive) 8%, var(--card-solid)); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--muted-bg); }
.btn.small { height: 32px; padding: 0 .7rem; border-radius: 10px; font-size: 12.5px; }
.btn.block { width: 100%; height: 46px; font-size: 15px; border-radius: 13px; }
.btn.link { height: auto; padding: .2rem .3rem; border: 0; background: none; box-shadow: none; color: var(--primary); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
kbd { padding: 1px 6px; border-radius: 6px; font: 600 10.5px ui-monospace, Consolas, monospace; color: var(--muted);
  background: var(--muted-bg); border: 1px solid var(--border); }
.btn.primary kbd, .btn.success kbd { color: inherit; background: rgb(255 255 255 / .18); border-color: rgb(255 255 255 / .3); }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th { padding: .7rem 1rem; text-align: left; white-space: nowrap; font-size: 12px; font-weight: 650; color: var(--muted);
  background: color-mix(in oklch, var(--muted-bg) 55%, transparent); border-bottom: 1px solid var(--border); }
table.data td { padding: .78rem 1rem; vertical-align: middle; border-bottom: 1px solid color-mix(in oklch, var(--border) 70%, transparent); }
table.data th:first-child, table.data td:first-child { padding-left: 1.35rem; }
table.data th:last-child, table.data td:last-child { padding-right: 1.35rem; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .12s; }
table.data tr.click { cursor: pointer; }
table.data tbody tr:hover td { background: color-mix(in oklch, var(--primary) 4%, transparent); }
table.data tfoot td { font-weight: 750; background: color-mix(in oklch, var(--muted-bg) 55%, transparent); border-top: 1px solid var(--border); border-bottom: 0; }
table.data th.num { text-align: right; }
table.data .sub { margin-top: 1px; font-size: 12px; color: var(--muted); }
table.data tr.void td { color: var(--muted); text-decoration: line-through; }
table.data td input, table.data td select { min-height: 34px; padding: .35rem .6rem; font-size: 13.5px; border-radius: 10px; }
table.data td select { padding-right: 1.9rem; background-position: right .5rem center; }
.modal table.data th:first-child, .modal table.data td:first-child, .card:not(.flush) table.data th:first-child, .card:not(.flush) table.data td:first-child { padding-left: .9rem; }
.modal table.data th:last-child, .modal table.data td:last-child, .card:not(.flush) table.data th:last-child, .card:not(.flush) table.data td:last-child { padding-right: .9rem; }
.card:not(.flush) .table-wrap, .modal .table-wrap { border: 1px solid color-mix(in oklch, var(--border) 80%, transparent); border-radius: 16px; }
.card:not(.flush) .table-wrap table.data th:first-child { border-top-left-radius: 15px; }
.empty { display: flex; flex-direction: column; align-items: center; gap: .55rem; padding: 2.2rem 1rem; text-align: center; font-size: 13.5px; color: var(--muted); }
.empty .tile { width: 46px; height: 46px; border-radius: 16px; background: color-mix(in oklch, var(--primary) 10%, transparent); color: var(--primary); }
td > .empty { padding: 1.6rem .5rem; }

/* ------------------------------------------------------------ badges, notes, key-values */
.badge { display: inline-flex; align-items: center; gap: .38rem; padding: 2px 9px 2px 8px; border-radius: 99px; vertical-align: middle; white-space: nowrap;
  font-size: 11.5px; font-weight: 700; line-height: 1.55; letter-spacing: 0; color: var(--muted); background: var(--muted-bg); box-shadow: inset 0 0 0 1px var(--border); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.badge.plain::before { display: none; }
.badge.blue { color: var(--info); background: color-mix(in oklch, var(--info) 10%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--info) 25%, transparent); }
.badge.green { color: var(--success); background: color-mix(in oklch, var(--success) 12%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--success) 26%, transparent); }
.badge.red { color: var(--destructive); background: color-mix(in oklch, var(--destructive) 10%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--destructive) 25%, transparent); }
.badge.orange { color: var(--warning-ink); background: color-mix(in oklch, var(--warning) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--warning) 34%, transparent); }
.badge.purple { color: var(--violet); background: color-mix(in oklch, var(--violet) 10%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--violet) 25%, transparent); }
.badge.brand { color: var(--primary); background: color-mix(in oklch, var(--primary) 10%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--primary) 25%, transparent); }
h1 .badge { font-size: 12px; }

.note { display: flex; align-items: flex-start; gap: .6rem; margin-bottom: 1rem; padding: .8rem 1rem; border-radius: 16px; font-size: 13.5px;
  color: var(--warning-ink); background: color-mix(in oklch, var(--warning) 12%, var(--card-solid)); border: 1px solid color-mix(in oklch, var(--warning) 35%, transparent); }
.note > .i { margin-top: 1px; }
.note > div { min-width: 0; }
.note.info { color: color-mix(in oklch, var(--info) 80%, var(--fg)); background: color-mix(in oklch, var(--info) 8%, var(--card-solid)); border-color: color-mix(in oklch, var(--info) 25%, transparent); }
.note.ok { color: color-mix(in oklch, var(--success) 80%, var(--fg)); background: color-mix(in oklch, var(--success) 9%, var(--card-solid)); border-color: color-mix(in oklch, var(--success) 26%, transparent); }
.note.danger { color: var(--destructive); background: color-mix(in oklch, var(--destructive) 8%, var(--card-solid)); border-color: color-mix(in oklch, var(--destructive) 25%, transparent); }
p.note { display: block; }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .65rem 1.4rem; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); font-weight: 550; }
.kv dd { margin: 0; font-weight: 650; min-width: 0; overflow-wrap: anywhere; }
.totals { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.totals td { padding: .38rem 0; }
.totals td:first-child { color: var(--muted); font-weight: 550; }
.totals td:last-child { text-align: right; font-weight: 600; }
.totals tr.grand td { padding-top: .8rem; border-top: 1px solid var(--border); font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; color: var(--fg); }
.totals tr.bal td { font-weight: 750; color: var(--destructive); }

/* ------------------------------------------------------------ line editor */
table.lines { width: 100%; min-width: 880px; border-collapse: collapse; font-size: 13.5px; }
table.lines th { padding: .55rem .35rem; text-align: left; white-space: nowrap; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); border-bottom: 1px solid var(--border); }
table.lines td { padding: .3rem .35rem; vertical-align: middle; }
table.lines tbody.line { border-bottom: 1px solid color-mix(in oklch, var(--border) 70%, transparent); transition: background .15s; }
table.lines tbody.line:focus-within { background: color-mix(in oklch, var(--primary) 4%, transparent); }
table.lines input, table.lines select { min-height: 36px; padding: .4rem .55rem; font-size: 13.5px; border-radius: 10px; }
table.lines select { padding-right: 1.9rem; background-position: right .5rem center; }
table.lines .c-no { width: 30px; text-align: center; color: var(--muted); font-weight: 650; }
table.lines .c-hsn { width: 88px; } table.lines .c-qty { width: 80px; } table.lines .c-unit { width: 84px; }
table.lines .c-rate { width: 108px; } table.lines .c-disc { width: 66px; } table.lines .c-gst { width: 80px; }
table.lines .c-amt { width: 116px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
table.lines .c-del { width: 36px; text-align: center; }
table.lines td.num input { text-align: right; }
table.lines [data-f="name"] { min-width: 220px; font-weight: 600; }
table.lines [data-f="hsn_sac"] { min-width: 76px; } table.lines [data-f="qty"] { min-width: 66px; }
table.lines [data-f="unit"] { min-width: 76px; } table.lines [data-f="rate"] { min-width: 92px; }
table.lines [data-f="discount_pct"] { min-width: 54px; } table.lines [data-f="gst_rate"] { min-width: 72px; }
table.lines tr.spec td { padding-top: 0; padding-bottom: .55rem; }
.spec-row { display: grid; grid-template-columns: 120px 180px 1fr auto; gap: .4rem; align-items: center; }
.spec-row input { min-height: 30px !important; padding: .28rem .55rem !important; font-size: 12.5px !important; border-radius: 9px !important; }
.link-tag { display: inline-flex; align-items: center; gap: .2rem; padding: 2px 8px; border-radius: 99px; white-space: nowrap; font-size: 11.5px; font-weight: 650;
  color: var(--primary); background: color-mix(in oklch, var(--primary) 10%, transparent); }
.link-tag button { padding: 0 0 0 .2rem; border: 0; background: none; color: inherit; font-size: 13px; cursor: pointer; }
.save-cat { display: flex; align-items: center; gap: .35rem; margin: 0; font-size: 12px; font-weight: 550; white-space: nowrap; color: var(--muted); }
.save-cat select { width: auto; min-height: 30px !important; padding: .15rem 1.7rem .15rem .5rem !important; font-size: 12px !important; border-radius: 9px; }
.del-line { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 9px; background: none;
  color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.del-line:hover { color: var(--destructive); background: color-mix(in oklch, var(--destructive) 10%, transparent); }
.lines-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; padding-top: .8rem; }

/* ------------------------------------------------------------ job stepper */
.stepper { display: flex; margin: 0 0 1rem; padding: 1.1rem .5rem .9rem; border-radius: var(--r-3xl); background: var(--card);
  border: 1px solid color-mix(in oklch, var(--border) 80%, transparent); box-shadow: var(--shadow-soft); }
.stepper .step { position: relative; flex: 1; padding-top: 2rem; text-align: center; font-size: 12.5px; font-weight: 650; color: var(--muted); }
.stepper .step::before { content: ""; position: absolute; top: .2rem; left: 50%; z-index: 1; width: 22px; height: 22px; margin-left: -11px; border-radius: 99px;
  background: var(--card-solid); border: 2px solid color-mix(in oklch, var(--muted) 35%, transparent); }
.stepper .step::after { content: ""; position: absolute; top: .9rem; left: -50%; right: 50%; height: 2px; background: color-mix(in oklch, var(--muted) 25%, transparent); }
.stepper .step:first-child::after { display: none; }
.stepper .step.done { color: var(--success); }
.stepper .step.done::before { border-color: var(--success); background: var(--success) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 12px no-repeat; }
.stepper .step.done::after, .stepper .step.current::after { background: var(--success); }
.stepper .step.current { color: var(--primary); font-weight: 750; }
.stepper .step.current::before { border-color: var(--primary); background: var(--primary); box-shadow: 0 0 0 5px color-mix(in oklch, var(--primary) 16%, transparent); }

/* ------------------------------------------------------------ dashboard */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { --tone: var(--muted); position: relative; display: block; overflow: hidden; padding: 1.2rem 1.25rem 1.15rem; border-radius: var(--r-3xl); color: var(--fg);
  background: var(--card); border: 1px solid color-mix(in oklch, var(--border) 80%, transparent); box-shadow: var(--shadow-soft);
  transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s; }
.stat::after { content: ""; position: absolute; right: -40px; bottom: -40px; width: 140px; height: 140px; border-radius: 99px; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in oklch, var(--tone) 16%, transparent), transparent); }
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); text-decoration: none; }
.stat .top { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.stat .label { font-size: 12.5px; font-weight: 650; color: var(--muted); }
.stat .value { margin-top: .45rem; font-size: 1.7rem; font-weight: 750; line-height: 1.1; letter-spacing: -0.03em; white-space: nowrap; }
/* lakh-size amounts (₹12,34,567) shrink a little in narrow cards instead of being cut off */
@supports (container-type: inline-size) {
  .stat { container-type: inline-size; }
  .stat .value { font-size: clamp(1.15rem, 18.5cqi - 10px, 1.7rem); } /* cqi: the card's content width */
}
.stat .hint { position: relative; z-index: 1; margin-top: .55rem; font-size: 12px; color: var(--muted); }
.stat .hint b { color: var(--fg); font-weight: 700; }
.tile { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 14px; color: var(--tone, var(--muted));
  background: color-mix(in oklch, var(--tone, var(--muted)) 12%, transparent); }
.tile.sm { width: 32px; height: 32px; border-radius: 11px; }
.tone-primary { --tone: var(--primary); } .tone-success { --tone: var(--success); } .tone-warning { --tone: var(--warning-ink); }
.tone-danger { --tone: var(--destructive); } .tone-info { --tone: var(--info); } .tone-violet { --tone: var(--violet); } .tone-amber { --tone: oklch(0.66 0.15 66); }
.tone-muted { --tone: var(--muted); }
.stat.tone-success .value { color: var(--success); } .stat.tone-danger .value { color: var(--destructive); }
.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 1.25rem; align-items: stretch; margin-bottom: 1rem; padding: 1.25rem 1.4rem;
  border-radius: var(--r-3xl); color: #fff; box-shadow: var(--shadow-lift);
  background: radial-gradient(120% 140% at 100% 0%, oklch(0.62 0.17 250 / .9) 0%, transparent 55%), radial-gradient(80% 120% at 0% 100%, oklch(0.72 0.15 66 / .55) 0%, transparent 55%), linear-gradient(135deg, oklch(0.36 0.12 262), oklch(0.27 0.09 262)); }
.hero::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background-image: linear-gradient(to right, rgb(255 255 255 / .08) 1px, transparent 1px), linear-gradient(to bottom, rgb(255 255 255 / .08) 1px, transparent 1px);
  background-size: 28px 28px; mask-image: radial-gradient(ellipse at 70% 30%, black 20%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse at 70% 30%, black 20%, transparent 75%); }
.hero > * { position: relative; }
.hero a { color: #fff; }
.hero .k { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: rgb(255 255 255 / .72); }
.hero .big { margin: .3rem 0 .2rem; font-size: 2.6rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; }
.hero .line { font-size: 13.5px; color: rgb(255 255 255 / .82); }
.hero .line b { color: #fff; }
.hero-cells { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.hero-cell { display: block; padding: .72rem .95rem; border-radius: 18px; color: #fff; background: rgb(255 255 255 / .09); border: 1px solid rgb(255 255 255 / .14);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); transition: background .15s, transform .2s; }
.hero-cell:hover { background: rgb(255 255 255 / .15); text-decoration: none; transform: translateY(-1px); }
.hero-cell small { display: block; font-size: 11.5px; font-weight: 650; color: rgb(255 255 255 / .7); }
.hero-cell b { display: block; margin-top: .2rem; font-size: 1.15rem; font-weight: 750; letter-spacing: -0.02em; }
.hero-cell span { display: block; margin-top: .1rem; font-size: 11.5px; color: rgb(255 255 255 / .7); }
.hero-link { display: inline-flex; align-items: center; gap: .35rem; margin-top: .85rem; padding: .45rem .85rem; border-radius: 11px; font-size: 12.5px; font-weight: 650; color: #fff; background: rgb(255 255 255 / .12); border: 1px solid rgb(255 255 255 / .16); }
.hero-link:hover { background: rgb(255 255 255 / .2); text-decoration: none; }
.hero-cell .bad { font-style: normal; font-weight: 750; color: #ffc4c4; }
.progress { height: 8px; margin: .75rem 0 .35rem; border-radius: 99px; overflow: hidden; background: rgb(255 255 255 / .16); }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, oklch(0.80 0.16 70), oklch(0.86 0.13 90)); }
.date-filter { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.date-filter input[type=date] { width: auto; height: 40px; }
.date-filter .chips { padding: 3px; }   /* 40px tall, like the date boxes and the button beside it */
.date-filter .btn { height: 40px; }
.panel-row, .list-item { display: flex; align-items: center; gap: .75rem; margin-bottom: .45rem; padding: .65rem .85rem; border-radius: 16px; color: var(--fg);
  background: color-mix(in oklch, var(--card-solid) 65%, transparent); border: 1px solid color-mix(in oklch, var(--border) 45%, transparent); transition: background .15s, border-color .15s; }
.panel-row:last-child, .list-item:last-child { margin-bottom: 0; }
a.panel-row:hover, a.list-item:hover { background: color-mix(in oklch, var(--primary) 6%, var(--card-solid)); border-color: color-mix(in oklch, var(--primary) 20%, transparent); text-decoration: none; }
.panel-row .main, .list-item .main { flex: 1; min-width: 0; }
.panel-row .t { font-size: 13.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-row .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-row .aside { flex-shrink: 0; text-align: right; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.panel-row .aside small { display: block; font-size: 11.5px; font-weight: 550; }
.list-item .main > div:first-child { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .muted { font-size: 12px; }
.count-pill { padding: 0 8px; border-radius: 99px; font-size: 11px; font-weight: 750; line-height: 20px; color: var(--tone, var(--primary)); background: color-mix(in oklch, var(--tone, var(--primary)) 12%, transparent); }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-family: var(--font); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .base { stroke: color-mix(in oklch, var(--fg) 22%, transparent); }
.chart g.col { outline: none; }
.chart-tip .v { font-weight: 750; color: var(--fg); }
.chart-tip .k { width: 12px; height: 3px; border-radius: 2px; }
.table-view { margin-top: .8rem; font-size: 12.5px; }
.table-view summary { cursor: pointer; color: var(--muted); font-weight: 650; width: max-content; }
.table-view summary:hover { color: var(--fg); }
.table-view .table-wrap { margin-top: .6rem; }
.chart .gl { stroke: var(--viz-grid); }
.chart .bar { transition: opacity .15s; }
.chart g.col { cursor: default; }
.chart g.col rect.hit { fill: transparent; transition: fill .15s; }
.chart g.col:hover rect.hit, .chart g.col:focus-visible rect.hit { fill: color-mix(in oklch, var(--fg) 5%, transparent); }
.chart g.col:hover .bar, .chart g.col:focus-visible .bar { opacity: .85; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; padding: .55rem .7rem; border-radius: 12px; font-size: 12px; background: var(--popover);
  border: 1px solid var(--border); box-shadow: var(--shadow-lift); white-space: nowrap; transform: translate(-50%, calc(-100% - 8px)); }
.chart-tip b { display: block; margin-bottom: .2rem; }
.chart-tip span { display: flex; align-items: center; gap: .4rem; }
.chart-tip i { width: 8px; height: 8px; border-radius: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.aging { display: grid; gap: .75rem; }
.aging .row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 108px; align-items: center; gap: .7rem; font-size: 12.5px; }
.aging .row span { font-weight: 600; color: var(--muted); }
.aging .bar { height: 10px; border-radius: 99px; background: var(--muted-bg); overflow: hidden; }
.aging .bar i { display: block; height: 100%; border-radius: inherit; }
.aging .row.zero span, .aging .row.zero .amt { color: color-mix(in oklch, var(--muted) 70%, transparent); font-weight: 550; }
.aging .amt { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.split-bar { display: flex; height: 10px; margin: .4rem 0 .8rem; border-radius: 99px; overflow: hidden; background: var(--muted-bg); }
.split-bar i { display: block; height: 100%; }

/* ------------------------------------------------------------ modals & toasts */
.modal-back { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 1rem; overflow-y: auto;
  background: color-mix(in oklch, oklch(0.2 0.03 258) 34%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade-in .16s ease; }
.modal { display: flex; flex-direction: column; width: min(560px, 100%); max-height: calc(100vh - 2rem); border-radius: 26px;
  background: color-mix(in oklch, var(--card-solid) 94%, transparent); border: 1px solid var(--border); box-shadow: var(--shadow-lift);
  -webkit-backdrop-filter: blur(28px) saturate(1.6); backdrop-filter: blur(28px) saturate(1.6); animation: modal-in .24s cubic-bezier(.2,.8,.2,1); }
.modal.wide { width: min(1020px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.3rem 1.5rem .4rem; }
.modal-head h2 { margin: 0; font-size: 1.12rem; }
.modal-body { padding: .8rem 1.5rem 1.3rem; overflow-y: auto; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; padding: 1rem 1.5rem; border-radius: 0 0 26px 26px;
  border-top: 1px solid color-mix(in oklch, var(--border) 70%, transparent); background: color-mix(in oklch, var(--muted-bg) 45%, transparent); }
#toasts { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 90; display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; pointer-events: none; }
.toast { display: flex; align-items: center; gap: .6rem; max-width: 440px; padding: .78rem 1rem; border-radius: 16px; font-size: 13.5px; font-weight: 550; pointer-events: auto;
  color: var(--fg); background: var(--popover); border: 1px solid var(--border); box-shadow: var(--shadow-lift); animation: toast-in .28s cubic-bezier(.2,.8,.2,1); }
.toast .i { color: var(--info); }
.toast.ok .i { color: var(--success); }
.toast.error { border-color: color-mix(in oklch, var(--destructive) 35%, var(--border)); }
.toast.error .i { color: var(--destructive); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes float { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(0, -12px, 0); } }
@keyframes drift { 0% { transform: translate3d(-4%, -6%, 0) scale(1); } 50% { transform: translate3d(6%, 4%, 0) scale(1.08); } 100% { transform: translate3d(-2%, 8%, 0) scale(1.02); } }
.rise > * { animation: rise .5s cubic-bezier(.2,.8,.2,1) both; }
.rise > *:nth-child(2) { animation-delay: .04s; } .rise > *:nth-child(3) { animation-delay: .08s; } .rise > *:nth-child(4) { animation-delay: .12s; }
.rise > *:nth-child(5) { animation-delay: .16s; } .rise > *:nth-child(6) { animation-delay: .2s; } .rise > *:nth-child(7) { animation-delay: .24s; } .rise > *:nth-child(8) { animation-delay: .28s; }

/* ------------------------------------------------------------ command palette */
.cmdk-back { place-items: start center; }
.cmdk { width: min(640px, 100%); margin-top: 12vh; overflow: hidden; border-radius: 22px; background: color-mix(in oklch, var(--card-solid) 94%, transparent);
  border: 1px solid var(--border); box-shadow: var(--shadow-lift); -webkit-backdrop-filter: blur(28px) saturate(1.6); backdrop-filter: blur(28px) saturate(1.6); animation: modal-in .2s cubic-bezier(.2,.8,.2,1); }
.cmdk-input { display: flex; align-items: center; gap: .6rem; padding: 0 1.1rem; border-bottom: 1px solid var(--border); color: var(--muted); }
.cmdk-input input { height: 56px; border: 0; box-shadow: none !important; background: transparent; padding: 0; font-size: 15.5px; }
.cmdk-list { max-height: 55vh; overflow-y: auto; padding: .45rem; }
.cmdk-group { padding: .6rem .7rem .3rem; font-size: 10.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.cmdk-item { display: flex; align-items: center; gap: .75rem; padding: .6rem .7rem; border-radius: 12px; color: var(--fg); cursor: pointer; }
.cmdk-item:hover { text-decoration: none; }
.cmdk-item .i { color: var(--muted); }
.cmdk-item .t { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item .t small { margin-left: .4rem; font-weight: 500; }
.cmdk-item .r { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cmdk-item.on { background: color-mix(in oklch, var(--primary) 10%, transparent); color: var(--primary); }
.cmdk-item.on .i { color: var(--primary); }
.cmdk-empty { padding: 2rem 1rem; text-align: center; font-size: 13.5px; color: var(--muted); }
.cmdk-foot { display: flex; flex-wrap: wrap; gap: .4rem 1rem; padding: .6rem 1rem; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--border); background: color-mix(in oklch, var(--muted-bg) 45%, transparent); }

/* ------------------------------------------------------------ sign-in, setup, password */
/* The sign-in screen always fits the window. The brand panel is exactly one window tall and leaves out its
   decorative parts on shorter screens; the form column centres the card in the window. */
.auth { display: flex; min-height: 100vh; min-height: 100dvh; }
.auth-brand { position: sticky; top: 0; isolation: isolate; display: flex; flex-direction: column; justify-content: space-between; gap: 1.25rem;
  width: 52%; height: 100vh; height: 100dvh; padding: clamp(1.5rem, 5.5vh, 3rem) clamp(2rem, 4vw, 3.5rem); overflow: hidden;
  border-right: 1px solid color-mix(in oklch, var(--border) 60%, transparent); }
.auth-body { width: 100%; max-width: 32rem; }
.auth-brand::before, .auth-brand::after { content: ""; position: absolute; inset: -20%; z-index: -2; pointer-events: none;
  background: radial-gradient(40% 40% at 20% 20%, var(--aurora-1) 0%, transparent 70%), radial-gradient(35% 35% at 80% 30%, var(--aurora-2) 0%, transparent 70%), radial-gradient(45% 45% at 50% 85%, var(--aurora-3) 0%, transparent 70%);
  animation: drift 18s ease-in-out infinite alternate; }
.auth-brand::after { opacity: .55; animation-duration: 26s; animation-direction: alternate-reverse; }
.auth-brand .grid-fade { position: absolute; inset: 0; z-index: -1; opacity: .7; pointer-events: none;
  background-image: linear-gradient(to right, color-mix(in oklch, var(--border) 70%, transparent) 1px, transparent 1px), linear-gradient(to bottom, color-mix(in oklch, var(--border) 70%, transparent) 1px, transparent 1px);
  background-size: 32px 32px; mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%); }
.auth-brand .brand .logo { width: 44px; height: 44px; border-radius: 13px; }
.auth-brand .brand-text b { font-size: 17px; }
.auth-brand .brand-text small { font-size: 12px; }
.auth-copy .eyebrow { display: inline-flex; align-items: center; gap: .4rem; margin-bottom: clamp(.7rem, 2vh, 1rem); padding: .3rem .75rem; border-radius: 99px; font-size: 12px; font-weight: 700; color: var(--primary);
  background: color-mix(in oklch, var(--primary) 9%, var(--card-solid)); border: 1px solid color-mix(in oklch, var(--primary) 20%, transparent); }
.auth-copy h1 { font-size: clamp(2rem, min(3.1vw, 5.4vh), 2.7rem); line-height: 1.08; letter-spacing: -0.035em; font-weight: 800; }
.auth-copy h1 .text-gradient { display: inline-block; padding-bottom: .06em; }
.auth-copy p { margin: clamp(.6rem, 2vh, 1rem) 0 0; font-size: 15.5px; color: var(--muted); }
.feature-chips { display: grid; grid-template-columns: repeat(2, minmax(0, auto)); gap: .65rem; margin: clamp(1rem, 3.2vh, 1.8rem) 0 0; padding: 0; list-style: none; }
.feature-chips li { display: flex; align-items: center; gap: .55rem; padding: .6rem .8rem; border-radius: 16px; font-size: 13px; font-weight: 600;
  background: var(--card); border: 1px solid color-mix(in oklch, var(--border) 80%, transparent); box-shadow: var(--shadow-soft); }
.feature-chips li .i { color: var(--primary); }
.auth-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; font-size: 12px; color: var(--muted); }
.auth-foot a { font-weight: 700; color: var(--fg); }
.mock { position: relative; height: 210px; margin-top: clamp(1.25rem, 3.5vh, 2rem); }
.mock-card { position: absolute; padding: .9rem 1rem; border-radius: 20px; background: var(--card); border: 1px solid color-mix(in oklch, var(--border) 80%, transparent);
  box-shadow: var(--shadow-lift); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); animation: float 8s ease-in-out infinite; }
.mock-card.a { left: 0; top: 0; width: 60%; }
/* overlaps only the empty lower-right corner of card a, so no bar is hidden */
.mock-card.b { right: 0; top: 100px; width: 50%; animation-delay: -3s; }
.mock-card .mk { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: 11.5px; color: var(--muted); font-weight: 650; }
.mock-card .mv { margin-top: .3rem; font-size: 1.35rem; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.mock-card .ms { margin-top: .15rem; font-size: 11.5px; color: var(--muted); }
.mock-bars { display: flex; align-items: flex-end; gap: 5px; height: 42px; margin-top: .6rem; }
.mock-bars i { flex: 1; border-radius: 4px 4px 2px 2px; background: color-mix(in oklch, var(--primary) 70%, transparent); }
.mock-bars i:nth-child(even) { background: color-mix(in oklch, var(--accent-brand) 85%, transparent); }
.mock-steps { display: flex; gap: 4px; margin-top: .7rem; }
.mock-steps i { flex: 1; height: 6px; border-radius: 99px; background: var(--muted-bg); }
.mock-steps i.on { background: var(--success); } .mock-steps i.now { background: var(--primary); }
.auth-main { position: relative; flex: 1; min-width: 0; display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: clamp(1rem, 5vh, 2.5rem) 1.25rem; }
.auth-tools { position: absolute; top: 1rem; right: 1rem; }
.auth-card { width: 100%; max-width: 430px; padding: 2.2rem; border-radius: var(--r-3xl); background: color-mix(in oklch, var(--card-solid) 80%, transparent);
  border: 1px solid color-mix(in oklch, var(--border) 90%, transparent); box-shadow: var(--shadow-lift);
  -webkit-backdrop-filter: blur(28px) saturate(1.6); backdrop-filter: blur(28px) saturate(1.6); animation: modal-in .5s cubic-bezier(.2,.8,.2,1); }
.auth-card.wide { max-width: 760px; }
.auth-card h2 { margin: 0; font-size: 1.55rem; letter-spacing: -0.025em; }
.auth-card .lead { margin: .3rem 0 1.6rem; font-size: 14px; color: var(--muted); }
.auth-card .mobile-brand { display: none; margin-bottom: 1.5rem; }
.auth-card .field { margin-bottom: 1.05rem; }
.auth-error { display: flex; align-items: flex-start; gap: .5rem; margin-bottom: 1rem; padding: .65rem .85rem; border-radius: 12px; font-size: 13.5px; font-weight: 550; color: var(--destructive);
  background: color-mix(in oklch, var(--destructive) 10%, transparent); animation: pop-in .2s ease; }
.auth-error .i { margin-top: 1px; }
.caps { display: flex; align-items: center; gap: .35rem; margin-top: .4rem; font-size: 12px; font-weight: 650; color: var(--warning-ink); }
.dev-credit { margin: 1.6rem 0 .4rem; text-align: center; font-size: 12px; color: var(--muted); }
.dev-credit a { font-weight: 700; color: var(--fg); }
.made-by { margin-top: 1.4rem; text-align: center; font-size: 12px; color: var(--muted); }
.made-by a { font-weight: 750; }
.auth-only-main { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: clamp(1rem, 4vh, 2rem) 1rem; }
/* Shorter windows: the brand panel keeps the headline and either the preview cards or the feature list,
   and the sign-in card tightens its spacing, so nothing needs scrolling down to about 540px of height. */
@media (max-height: 839px) { .auth-brand .feature-chips { display: none; } }
@media (max-height: 679px) { .auth-brand .mock { display: none; } .auth-brand .feature-chips { display: grid; } }
@media (max-height: 499px) { .auth-brand .feature-chips { display: none; } }
.auth-tile { margin-bottom: 1rem; }
@media (max-height: 700px) { .auth-tile { display: none; } }
@media (max-height: 760px) {
  .auth-card { padding: 1.6rem 1.9rem; }
  .auth-card .lead { margin-bottom: 1.15rem; }
  .auth-card .field { margin-bottom: .8rem; }
  .auth-card .mobile-brand { margin-bottom: 1rem; }
  .made-by { margin-top: 1rem; }
}

/* ------------------------------------------------------------ e-invoice */
.qr-box { padding: 10px; border-radius: 16px; background: #fff; border: 1px solid var(--border); line-height: 0; }
.qr-box svg { display: block; width: 140px; height: 140px; }
.irn { font: 600 11.5px ui-monospace, Consolas, monospace; overflow-wrap: anywhere; color: var(--fg); }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; overflow-wrap: anywhere; }
button.qr-box { appearance: none; flex-shrink: 0; cursor: zoom-in; transition: box-shadow .15s, transform .15s; }
button.qr-box:hover { box-shadow: 0 6px 18px oklch(0 0 0 / .1); transform: translateY(-1px); }
.einv-card .qr-box svg { width: 118px; height: 118px; }
.einv-top { display: flex; gap: 1rem; align-items: flex-start; }
.einv-meta { display: grid; gap: .65rem; flex: 1; min-width: 0; margin: 0; font-size: 13px; }
.einv-meta dt { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.einv-meta dd { margin: .1rem 0 0; font-weight: 650; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.einv-irn { margin-top: .9rem; padding: .65rem .8rem .75rem; border-radius: 12px; border: 1px solid var(--border); background: var(--muted-bg); }
.einv-irn-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.einv-irn .irn { display: block; margin-top: .25rem; font-size: 12px; line-height: 1.55; word-break: break-all; }
.einv-state { display: flex; gap: .75rem; align-items: flex-start; margin-bottom: .9rem; font-size: 13.5px; }
.einv-state > .i { flex-shrink: 0; margin-top: 2px; color: var(--warning); }
.einv-off { display: flex; align-items: center; gap: .85rem; font-size: 13.5px; }
.einv-off > .i { flex-shrink: 0; color: var(--muted); }
.einv-off > div { flex: 1; min-width: 0; }
.einv-card .note { margin: .9rem 0 0; }
.einv-card .note + .actions, .einv-card #einvIssues + .actions { margin-top: .9rem; }
.einv-issues ul { margin: .35rem 0 0; padding-left: 1.1rem; }
.einv-issues li { margin: .2rem 0; }
.einv-notes { list-style: none; margin: .7rem 0 0; padding: 0; font-size: 12.5px; color: var(--muted); }
.einv-notes li { display: flex; gap: .4rem; align-items: flex-start; margin: .2rem 0; }
.einv-notes .i { flex-shrink: 0; margin-top: 2px; }
.einv-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .6rem .8rem; margin-top: 1rem; padding-top: .85rem; border-top: 1px dashed var(--border); font-size: 12.5px; }
.einv-card.is-test { border-color: color-mix(in oklch, var(--destructive) 38%, transparent); }
.qr-zoom { display: grid; place-items: center; }
.qr-zoom svg { width: min(340px, 78vw); height: auto; padding: 8px; border-radius: 14px; background: #fff; }
.einv-check { display: flex; gap: .7rem; align-items: flex-start; margin-top: .9rem; padding: .85rem 1rem; border-radius: 16px; font-size: 13px;
  border: 1px solid color-mix(in oklch, var(--primary) 24%, transparent); background: color-mix(in oklch, var(--primary) 6%, var(--card-solid)); }
.einv-check > .i { flex-shrink: 0; margin-top: 1px; color: var(--primary); }
.einv-check .note { margin: .7rem 0 0; }
.badges { display: inline-flex; flex-wrap: wrap; gap: .3rem; }
.i.spin { animation: spin 1s linear infinite; }
.sub-head { margin: 1.5rem 0 .75rem; font-size: 14px; font-weight: 750; letter-spacing: -0.01em; }
.einv-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.mode-opt { position: relative; display: flex; gap: .75rem; align-items: flex-start; margin: 0; padding: .95rem 1rem; border-radius: 16px; cursor: pointer;
  border: 1px solid var(--border); background: var(--card-solid); transition: border-color .15s, box-shadow .15s; }
.mode-opt:hover { border-color: color-mix(in oklch, var(--primary) 40%, var(--border)); }
.mode-opt input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.mode-opt:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 16%, transparent); }
.mode-opt:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.mode-ic { display: grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; color: var(--primary); background: color-mix(in oklch, var(--primary) 12%, transparent); }
.mode-opt b { display: block; font-size: 13.5px; }
.mode-opt small { display: block; margin-top: .2rem; font-size: 12px; line-height: 1.45; color: var(--muted); font-weight: 500; }
.small-check { margin-top: .4rem; font-size: 12px; font-weight: 500; color: var(--muted); }
.einv-rules { margin: 0; padding-left: 1.1rem; font-size: 13.5px; line-height: 1.55; }
.einv-rules li { margin: .3rem 0; }
@media (max-width: 1100px) { .einv-modes { grid-template-columns: minmax(0, 1fr); } }
pre.json { max-height: 360px; margin: 0; padding: .85rem 1rem; overflow: auto; border-radius: 14px; font: 12px/1.5 ui-monospace, Consolas, monospace; background: var(--muted-bg); border: 1px solid var(--border); white-space: pre; }

/* ------------------------------------------------------------ misc */
.history { position: relative; display: grid; gap: .1rem; }
.history .h-row { --dot: var(--primary); position: relative; padding: 0 0 .95rem 1.35rem; font-size: 13px; }
.history .h-row.good { --dot: var(--success); }
.history .h-row.bad { --dot: var(--destructive); }
.history .h-row::before { content: ""; position: absolute; left: 2px; top: .38rem; width: 10px; height: 10px; border-radius: 99px; background: var(--card-solid);
  border: 2px solid var(--dot); box-shadow: 0 0 0 3px color-mix(in oklch, var(--dot) 14%, transparent); }
.history .h-row::after { content: ""; position: absolute; left: 7px; top: 1.2rem; bottom: .15rem; width: 1px; background: var(--border); }
.history .h-row:last-child { padding-bottom: 0; }
.history .h-row:last-child::after { display: none; }
.history .h-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .5rem; }
.history .h-top b { font-weight: 700; }
.history .h-meta { font-size: 12px; color: var(--muted); }
.history .h-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: .4rem; }
.kvc { display: inline-flex; align-items: baseline; gap: .3rem; max-width: 100%; padding: 2px 8px; border-radius: 8px; font-size: 11.5px; font-weight: 650;
  color: var(--fg); background: var(--muted-bg); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--border) 60%, transparent); overflow-wrap: anywhere; }
.kvc i { font-style: normal; font-weight: 550; color: var(--muted); }
.audit-details .h-chips { margin-top: 0; }
.h-chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* ------------------------------------------------------------ editors, lists and cards added with the redesign */
.doc-editor { display: grid; gap: 1rem; }
.doc-editor > .card, .editor-foot > .card { margin-bottom: 0; }
.editor-foot { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1rem; align-items: start; }
.editor-foot.solo > .totals-card { grid-column: 2; }
.totals-card { position: sticky; top: calc(var(--top) + 1rem); }
.live-total { font-size: 13px; color: var(--muted); white-space: nowrap; }
.live-total b { color: var(--fg); font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.lines-wrap { margin: 0 -.35rem; }
table.lines th.c-item { min-width: 260px; }
table.data.doc-lines th, table.data.doc-lines td { padding-left: .55rem; padding-right: .55rem; }
table.data.doc-lines td.c-item { min-width: 200px; width: 36%; }
table.data.doc-lines .c-no { width: 36px; color: var(--muted); }
table.data td.num { white-space: nowrap; }
.row-actions { display: flex; gap: .35rem; justify-content: flex-end; }
.who-cell { display: inline-flex; align-items: center; gap: .7rem; min-width: 0; vertical-align: middle; }
.who-cell > div, .who-cell > span:last-child { min-width: 0; }
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; border-radius: 15px; }
h1 .who-cell { gap: .8rem; }
.list-item .aside { flex-shrink: 0; text-align: right; font-variant-numeric: tabular-nums; }
.list-item .t { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .s { margin-top: 2px; font-size: 12px; color: var(--muted); }
.acct-hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
.acct-hero .hero-cells { align-content: center; }
hr { border: 0; height: 1px; background: var(--border); margin: 1rem 0; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1280px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor-foot { grid-template-columns: minmax(0, 1fr); }
  .editor-foot.solo > .totals-card { grid-column: auto; }
  .totals-card { position: static; }
}
/* Line editor on tablets and phones: each line becomes a small form instead of a wide table row. */
@media (max-width: 760px) {
  .lines-wrap { margin: 0; overflow: visible; }
  table.lines { display: block; min-width: 0; }
  table.lines thead { display: none; }
  table.lines tbody.line { display: block; position: relative; padding: .85rem 0 .7rem; }
  table.lines tbody.line > tr { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .55rem .5rem; }
  table.lines td { display: block; width: auto !important; min-width: 0; padding: 0; text-align: left; }
  table.lines td.c-no { display: none; }
  table.lines td.c-item { grid-column: 1 / -1; padding-right: 42px; }
  table.lines td.c-del { position: absolute; top: .85rem; right: 0; width: 36px; }
  table.lines td.c-del .del-line { width: 36px; height: 36px; margin-top: 18px; background: var(--muted-bg); }
  table.lines td.c-hsn, table.lines td.c-qty, table.lines td.c-unit, table.lines td.c-rate, table.lines td.c-disc, table.lines td.c-gst { grid-column: span 2; }
  table.lines td.c-amt { grid-column: 1 / -1; padding: .15rem .1rem 0; text-align: right; font-size: 14px; }
  table.lines td.c-amt:empty { display: none; }
  table.lines td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 3px; font-size: 11px; font-weight: 650; color: var(--muted); }
  table.lines td.c-amt::before { display: inline; margin-right: .45rem; font-weight: 600; }
  table.lines [data-f]:not([type=checkbox]) { width: 100%; min-width: 0 !important; }
  .save-cat select { flex: 1 1 140px; }
  table.lines tr.spec { margin-top: .55rem; }
  table.lines tr.spec td { grid-column: 1 / -1; }
  .spec-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .spec-row > input[data-f="description"], .spec-row > span { grid-column: 1 / -1; }
  .save-cat { flex-wrap: wrap; white-space: normal; }
}
/* Data tables on phones: each row becomes a card with labelled values (labels come from App.labelTables). */
@media (max-width: 640px) {
  table.data.stack { display: block; }
  table.data.stack thead { display: none; }
  table.data.stack tbody, table.data.stack tfoot { display: block; }
  table.data.stack tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem 1rem; padding: .9rem 1rem;
    border-bottom: 1px solid color-mix(in oklch, var(--border) 70%, transparent); }
  table.data.stack.stack-3 tr { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  table.data.stack tbody tr:last-child { border-bottom: 0; }
  table.data.stack tr.solo { display: block; }
  table.data.stack td, table.data.stack tfoot td { display: block; min-width: 0; padding: 0 !important; border: 0 !important; text-align: left; background: none !important; white-space: normal; }
  table.data.stack td.num { text-align: left; }
  table.data.stack td[data-label]:not([data-label=""])::before { content: attr(data-label); display: block; margin-bottom: 1px; font-size: 11px; font-weight: 600; color: var(--muted); }
  table.data.stack td.stack-title { grid-column: 1 / -1; font-size: 14px; font-weight: 700; }
  table.data.stack td.stack-title .sub, table.data.stack td.stack-title .badge { font-weight: 550; }
  table.data.stack td.stack-title::before { display: none !important; }
  table.data.stack td[data-label=""] { grid-column: 1 / -1; }
  table.data.stack td.stack-hide, table.data.stack .hide-sm { display: none !important; }
  table.data.stack tbody tr:hover td { background: none; }
  table.data.stack tbody tr.click:active { background: color-mix(in oklch, var(--primary) 5%, transparent); }
  table.data.stack tfoot tr { background: color-mix(in oklch, var(--muted-bg) 60%, transparent); }
  table.data.stack .row-actions { justify-content: flex-start; }
  table.data.stack td input.alloc { max-width: 100%; }
  .card:not(.flush) .table-wrap:has(table.stack) { border-radius: 16px; }
}
@media (max-width: 1023px) {
  .auth-brand { display: none; }
  .auth-card .mobile-brand { display: flex; }
}
@media (max-width: 900px) {
  :root { --top: 60px; }
  .sidebar { width: 280px; transform: translateX(-105%); background: var(--card-solid); box-shadow: var(--shadow-lift); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: color-mix(in oklch, oklch(0.2 0.03 258) 35%, transparent); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
  .topbar { left: 0; padding: 0 .6rem; }
  .topbar-in { gap: .25rem; }
  .menu-btn { display: inline-grid !important; }
  .brand-mini { display: flex; align-items: center; gap: .5rem; min-width: 0; color: var(--fg); font-weight: 750; font-size: 14.5px; letter-spacing: -0.015em; }
  .brand-mini:hover { text-decoration: none; }
  .brand-mini .logo { width: 30px; height: 30px; border-radius: 9px; }
  .brand-mini span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .spacer { order: 1; } .search-btn { order: 2; } .top-actions { order: 3; }
  .search-btn { flex: 0 0 40px; width: 40px; padding: 0; justify-content: center; border-color: transparent; background: transparent; color: var(--fg); }
  .search-btn > span, .search-btn kbd, .avatar-btn .who { display: none; }
  .avatar-btn { padding: 4px; margin-left: 0; }
  .menu-pop, .menu-pop.wide { position: fixed; top: calc(var(--top) + 6px); left: .6rem; right: .6rem; width: auto; }
  main { margin-left: 0; padding: calc(var(--top) + 1rem) .9rem calc(92px + env(safe-area-inset-bottom)); }
  .bottom-nav { position: fixed; left: .6rem; right: .6rem; bottom: calc(.6rem + env(safe-area-inset-bottom)); z-index: 24; display: flex; height: 62px; padding: 0 .3rem;
    border-radius: 22px; background: color-mix(in oklch, var(--card-solid) 86%, transparent); border: 1px solid var(--border); box-shadow: var(--shadow-lift);
    -webkit-backdrop-filter: blur(24px) saturate(1.6); backdrop-filter: blur(24px) saturate(1.6); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; margin: 6px 2px; border-radius: 16px;
    font-size: 10.5px; font-weight: 700; color: var(--muted); }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav a.active { color: var(--primary); background: color-mix(in oklch, var(--primary) 10%, transparent); }
  .page-head { margin-bottom: 1.1rem; align-items: flex-start; }
  h1 { font-size: 1.35rem; }
  .card { padding: 1rem; border-radius: 22px; }
  .card.flush > h2, .card.flush > .card-head { padding: 1rem 1rem .7rem; }
  table.data th, table.data td { padding: .6rem .6rem; }
  table.data th:first-child, table.data td:first-child { padding-left: 1rem; }
  table.data th:last-child, table.data td:last-child { padding-right: 1rem; }
  .hide-sm { display: none; }
  .grid.two, .grid.three { grid-template-columns: minmax(0, 1fr); }
  .stats, .stats.three { gap: .65rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: .95rem 1rem; border-radius: 22px; }
  .stat .value { font-size: 1.3rem; }
  .stat .tile { width: 34px; height: 34px; border-radius: 12px; }
  .hero { padding: 1.15rem; }
  .hero .big { font-size: 2.3rem; }
  .spec-row { grid-template-columns: 1fr 1fr; }
  .form-grid .span2 { grid-column: 1 / -1; }
  .btn kbd { display: none; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
  .kv dd { margin-bottom: .55rem; }
  #toasts { left: .75rem; right: .75rem; bottom: calc(80px + env(safe-area-inset-bottom)); align-items: stretch; }
  .einv { grid-template-columns: minmax(0, 1fr); }
  .aging .row { grid-template-columns: 80px minmax(0, 1fr) 96px; }
  /* Tabs and date presets scroll sideways in one line instead of wrapping into a block. */
  .tabs, .chips { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tabs::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
  .tabs a, .chip { flex-shrink: 0; white-space: nowrap; }
  .date-filter { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: .5rem; }
  .date-filter > .chips { grid-column: 1 / -1; }
  .date-filter > .muted, .date-filter > span:not(.chips) { display: none; }
  .date-filter input[type=date] { width: 100%; min-width: 0; padding-left: .65rem; padding-right: .5rem; font-size: 13.5px; }
  .toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .toolbar > .grow, .toolbar > .check, .toolbar > .btn, .toolbar > select:only-of-type:first-child { grid-column: 1 / -1; }
  .toolbar > span.muted { display: none; }
  .toolbar input[type=date], .toolbar select { width: 100% !important; max-width: none !important; min-width: 0; }
  .acct-hero .hero-cells { grid-template-columns: minmax(0, 1fr); }
  .live-total b { font-size: 14px; }
}
@media (max-width: 480px) {
  .stat .label { font-size: 11.5px; }
  .stat .value { font-size: 1.12rem; }
  .stat .hint { font-size: 11px; }
  .stat .tile { display: none; }
  .auth-card { padding: 1.5rem; }
  .page-head .actions .btn { flex: 1 1 auto; }
  /* the dashboard's Apply button shows just its filter icon, leaving room for both dates */
  .date-filter #dfGo { width: 40px; padding: 0; gap: 0; font-size: 0; }
  .date-filter #dfGo .i { margin: 0; }
}
@media (max-width: 340px) { .stats, .stats.three { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media print {
  html, body { background: #fff; }
  body::before, .topbar, .sidebar, .bottom-nav, #toasts, .actions, .toolbar, .tabs { display: none !important; }
  main { margin: 0; padding: 0; }
  .card, .stat, .stepper { box-shadow: none; background: #fff; border-color: #ddd; break-inside: avoid; }
}
