
/* =====================================================================
   DESIGN SYSTEM
   - Theme presets  : html[data-preset="atelier|ledger|bloom|noir|studio|northbound"]
   - Light / dark   : html[data-theme="light|dark"]
   - Layout presets : html[data-layout="sidebar|topbar|rail|portal"]
   - Motion         : html[data-motion="full|subtle|off"]
   - Density        : html[data-density="comfortable|compact"]
   Accent comes from the preset unless Settings → Accent color is set (--primary).
   Components only use tokens — never hard-coded colors.
   ===================================================================== */
:root {
  --primary: #A64C27;
  --on-primary: #fff;
  --primary-600: color-mix(in srgb, var(--primary) 86%, #000);
  --primary-ink: color-mix(in srgb, var(--primary) 80%, #000); /* accent used as TEXT on tinted backgrounds (badges, chips) */
  --primary-50: color-mix(in srgb, var(--primary) 9%, var(--surface));
  --primary-100: color-mix(in srgb, var(--primary) 18%, var(--surface));
  --ring: color-mix(in srgb, var(--primary) 32%, transparent);

  /* Status colors: text versions are dark enough for 4.5:1 on their own tinted backgrounds */
  --success: #166534; --success-bg: color-mix(in srgb, #15803D 11%, var(--surface));
  --warning: #854D0E; --warning-bg: color-mix(in srgb, #CA8A04 13%, var(--surface));
  --danger:  #B23A0A; --danger-bg:  color-mix(in srgb, #DC2626 10%, var(--surface));
  --info:    #1D4ED8; --info-bg:    color-mix(in srgb, #2563EB 10%, var(--surface));

  --font-body: 'Manrope', system-ui, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --display-weight: 600; --display-tracking: -.02em;
  --label-case: uppercase; --label-tracking: .09em; --label-size: 11px;

  --radius-sm: 7px; --radius: 10px; --radius-lg: 14px; --radius-xl: 20px; --btn-radius: 10px; --input-radius: 10px;
  --shadow-sm: 0 1px 0 rgba(30, 26, 21, .04);
  --shadow: 0 6px 18px -10px rgba(60, 40, 20, .28);
  --shadow-lg: 0 24px 60px -20px rgba(40, 25, 10, .35), 0 6px 14px -8px rgba(40, 25, 10, .18);
  --card-hover-shadow: 0 16px 40px -18px rgba(60, 40, 20, .35);

  /* Type scale — the ONLY font sizes components may use.
     page title --fs-xl · section heading (h2) --fs-lg · subheading (h3) --fs-md · body --fs
     label / button --fs-sm · help, meta, captions --fs-xs · mono micro labels (table heads, sections) --fs-micro */
  --fs-scale: 1; /* personal text size (data-text) multiplies every size below */
  --fs-micro: calc(11px * var(--fs-scale)); --fs-xs: calc(12px * var(--fs-scale)); --fs-sm: calc(13px * var(--fs-scale)); --fs: calc(14px * var(--fs-scale));
  --fs-md: calc(16px * var(--fs-scale)); --fs-lg: calc(20px * var(--fs-scale)); --fs-xl: calc(30px * var(--fs-scale));
  --lh-tight: 1.15; --lh: 1.55;
  /* Spacing scale (4px grid) — gaps, paddings and margins come from here. */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  /* Controls — every input, select, date field and button shares these heights. */
  --control-h: 40px; --control-h-sm: 32px; --cell-h: 36px; --control-px: 13px;
  --chev-inset: 12px;   /* distance from the right border to a chevron / calendar icon — never less */
  --icon-size: 18px; --icon-size-sm: 16px; --icon-size-lg: 22px; --icon-stroke: 1.75;
  --touch: 24px;        /* minimum hit area (WCAG 2.2 AA); 44px on touch screens, see Responsive */
  /* Layers */
  --z-sticky: 20; --z-nav: 40; --z-modal: 100; --z-pop: 130; --z-toast: 140; --z-progress: 150;
  /* Breakpoints (media queries cannot read variables — keep these three in sync):
     phone ≤ 600px · tablet ≤ 860px (drawer nav, single-column forms) · desktop ≥ 1180px */
  --sidebar-w: 252px; --rail-w: 88px; --topbar-h: 64px; --pad: 28px; --row-h: 50px;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .5, 1);
  --rise: 14px; --dur: 1;
  --chart-1: var(--primary); --chart-2: #2F5D50; --chart-3: #C9A227; --chart-4: #6B4E71; --chart-5: #3E6E8E; --chart-6: #8C7B6B; --chart-7: #A63D40; --chart-8: #5B7553;
  --bg-pattern: none;
}

/* ---------------------------- Preset: ATELIER (warm editorial, default) ---------------------------- */
[data-preset="atelier"] {
  --bg: #F4F0E8; --surface: #FFFDF8; --surface-2: #FAF6EE; --surface-hover: #F1EBDF;
  --border: #E6DED0; --border-strong: #D3C6B1; --text: #1E1A15; --text-2: #4A4238; --muted: #716759;
  --sidebar-bg: #EFE9DD; --sidebar-text: #4A4238; --sidebar-muted: #696054; --sidebar-hover: #E6DECF;
  --sidebar-active-bg: #1E1A15; --sidebar-active-text: #FFFDF8; --sidebar-border: #E2D9C9;
  --topbar-bg: color-mix(in srgb, #F4F0E8 82%, transparent);
  --bg-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.25 0 0 0 0 0.15 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-preset="atelier"][data-theme="dark"] {
  --primary: #E07A4B;
  --bg: #16120E; --surface: #1F1A15; --surface-2: #1A1612; --surface-hover: #2A231C;
  --border: #30281F; --border-strong: #46392C; --text: #F3ECE0; --text-2: #D2C6B4; --muted: #9F917D;
  --sidebar-bg: #110E0B; --sidebar-text: #CFC3B1; --sidebar-muted: #91836D; --sidebar-hover: #1F1A15;
  --sidebar-active-bg: #F3ECE0; --sidebar-active-text: #16120E; --sidebar-border: #241E18;
  --topbar-bg: color-mix(in srgb, #16120E 80%, transparent);
  --shadow: 0 10px 24px -12px rgba(0,0,0,.7); --shadow-lg: 0 30px 70px -20px rgba(0,0,0,.8); --card-hover-shadow: 0 18px 44px -18px rgba(0,0,0,.85);
}

/* ---------------------------- Preset: LEDGER (precise, finance/corporate) ---------------------------- */
[data-preset="ledger"] {
  --primary: #1E4FD8;
  --font-body: 'IBM Plex Sans', system-ui, sans-serif; --font-display: 'IBM Plex Sans', system-ui, sans-serif; --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --display-weight: 600; --display-tracking: -.015em; --label-tracking: .07em;
  --radius-sm: 3px; --radius: 4px; --radius-lg: 6px; --radius-xl: 8px; --btn-radius: 4px; --input-radius: 4px;
  --bg: #EDF0F4; --surface: #FFFFFF; --surface-2: #F6F8FA; --surface-hover: #EEF2F7;
  --border: #DCE2EA; --border-strong: #C2CBD7; --text: #0E1A2B; --text-2: #37475D; --muted: #5E6D83;
  --sidebar-bg: #0E1A2B; --sidebar-text: #C3CDDC; --sidebar-muted: #8290A6; --sidebar-hover: #172741;
  --sidebar-active-bg: #1E4FD8; --sidebar-active-text: #FFFFFF; --sidebar-border: #0E1A2B;
  --topbar-bg: color-mix(in srgb, #FFFFFF 90%, transparent);
  --shadow-sm: 0 1px 0 rgba(14,26,43,.05); --shadow: 0 4px 12px -6px rgba(14,26,43,.22); --card-hover-shadow: 0 8px 22px -12px rgba(14,26,43,.32);
  --chart-2: #0EA5A4; --chart-3: #F59E0B; --chart-4: #64748B; --chart-5: #9333EA; --chart-6: #DC2626; --chart-7: #0369A1; --chart-8: #65A30D;
}
[data-preset="ledger"][data-theme="dark"] {
  --primary: #5B8CFF;
  --bg: #08101C; --surface: #0E1828; --surface-2: #0B1422; --surface-hover: #142236;
  --border: #1C2B42; --border-strong: #2A3D5A; --text: #E3E9F2; --text-2: #B7C3D6; --muted: #8093AE;
  --sidebar-bg: #060C16; --sidebar-hover: #101C2E; --sidebar-border: #060C16; --topbar-bg: color-mix(in srgb, #0E1828 88%, transparent);
  --shadow: 0 6px 16px -8px rgba(0,0,0,.7); --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.8); --card-hover-shadow: 0 10px 26px -12px rgba(0,0,0,.8);
}

/* ---------------------------- Preset: BLOOM (warm, friendly, rounded) ---------------------------- */
[data-preset="bloom"] {
  --primary: #C8411A;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif; --font-display: 'Bricolage Grotesque', 'Plus Jakarta Sans', sans-serif;
  --display-weight: 700; --display-tracking: -.025em; --label-case: none; --label-tracking: 0; --label-size: 12px;
  --radius-sm: 10px; --radius: 14px; --radius-lg: 20px; --radius-xl: 28px; --btn-radius: 999px; --input-radius: 14px;
  --bg: #FFF5EE; --surface: #FFFFFF; --surface-2: #FFF9F5; --surface-hover: #FFEFE5;
  --border: #F6E1D5; --border-strong: #ECCAB8; --text: #2A1A15; --text-2: #5D453E; --muted: #7A6158;
  --sidebar-bg: #FFFFFF; --sidebar-text: #5D453E; --sidebar-muted: #8C6E63; --sidebar-hover: #FFF1E9;
  --sidebar-active-bg: color-mix(in srgb, var(--primary) 14%, #fff); --sidebar-active-text: var(--primary-ink); --sidebar-border: transparent;
  --topbar-bg: color-mix(in srgb, #FFF5EE 84%, transparent);
  --shadow-sm: 0 2px 6px -2px rgba(228,87,46,.10); --shadow: 0 12px 28px -14px rgba(228,87,46,.30);
  --shadow-lg: 0 30px 70px -24px rgba(120,40,20,.35); --card-hover-shadow: 0 22px 44px -20px rgba(228,87,46,.40);
  --chart-2: #F2A541; --chart-3: #3DA5D9; --chart-4: #73BFB8; --chart-5: #C86FD2; --chart-6: #5B5F97; --chart-7: #F07167; --chart-8: #8AB17D;
}
[data-preset="bloom"][data-theme="dark"] {
  --primary: #FF7A52;
  --bg: #1A1110; --surface: #241816; --surface-2: #1F1513; --surface-hover: #301F1C;
  --border: #3A2622; --border-strong: #523631; --text: #FBEDE7; --text-2: #DDC3BA; --muted: #A88D84;
  --sidebar-bg: #241816; --sidebar-text: #DDC3BA; --sidebar-muted: #B39A90; --sidebar-hover: #301F1C; --sidebar-active-bg: color-mix(in srgb, var(--primary) 22%, #241816); --sidebar-active-text: #FFD3C2;
  --topbar-bg: color-mix(in srgb, #1A1110 84%, transparent);
  --shadow: 0 14px 30px -14px rgba(0,0,0,.7); --shadow-lg: 0 30px 70px -24px rgba(0,0,0,.8); --card-hover-shadow: 0 22px 44px -20px rgba(0,0,0,.85);
}

/* ---------------------------- Preset: NOIR (bold, high contrast) ---------------------------- */
[data-preset="noir"] {
  --primary: #111111;
  --font-body: 'DM Sans', system-ui, sans-serif; --font-display: 'Space Grotesk', 'DM Sans', sans-serif; --font-mono: 'Space Mono', ui-monospace, monospace;
  --display-weight: 600; --display-tracking: -.035em;
  --radius-sm: 4px; --radius: 6px; --radius-lg: 8px; --radius-xl: 12px; --btn-radius: 6px; --input-radius: 6px;
  --accent-2: #C6F04D;
  --bg: #ECECE6; --surface: #F8F8F3; --surface-2: #F1F1EB; --surface-hover: #E6E6DF;
  --border: #D9D9D1; --border-strong: #BDBDB4; --text: #0B0B0C; --text-2: #34342F; --muted: #696961;
  --sidebar-bg: #0B0B0C; --sidebar-text: #CFCFC8; --sidebar-muted: #84847B; --sidebar-hover: #1A1A1C;
  --sidebar-active-bg: var(--accent-2); --sidebar-active-text: #0B0B0C; --sidebar-border: #0B0B0C;
  --topbar-bg: color-mix(in srgb, #ECECE6 86%, transparent);
  --shadow-sm: none; --shadow: 4px 4px 0 rgba(11,11,12,.9); --card-hover-shadow: 6px 6px 0 #0B0B0C; --shadow-lg: 10px 10px 0 rgba(11,11,12,.9);
  --chart-2: #7C8F2E; --chart-3: #3B82F6; --chart-4: #F472B6; --chart-5: #F59E0B; --chart-6: #6E6E66; --chart-7: #0EA5E9; --chart-8: #A855F7;
  --bg-pattern: linear-gradient(rgba(11,11,12,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(11,11,12,.035) 1px, transparent 1px);
}
[data-preset="noir"][data-theme="dark"] {
  --primary: #C6F04D;
  --bg: #0A0A0B; --surface: #131315; --surface-2: #0F0F11; --surface-hover: #1C1C1F;
  --border: #252528; --border-strong: #3A3A3F; --text: #F5F5EF; --text-2: #C9C9C2; --muted: #8A8A84;
  --sidebar-bg: #0A0A0B; --sidebar-border: #1C1C1F; --sidebar-hover: #161618;
  --topbar-bg: color-mix(in srgb, #0A0A0B 82%, transparent);
  --shadow: 0 0 0 1px #252528; --card-hover-shadow: 0 0 0 1px var(--primary), 0 0 28px -8px color-mix(in srgb, var(--primary) 55%, transparent);
  --shadow-lg: 0 30px 80px -20px rgba(0,0,0,.9);
  --chart-2: #7DD3FC; --chart-3: #F472B6; --chart-4: #FBBF24; --chart-5: #A78BFA; --chart-6: #F5F5EF;
  --bg-pattern: linear-gradient(rgba(255,255,255,.028) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.028) 1px, transparent 1px);
}

/* ---------------------------- Preset: STUDIO (quiet monochrome) ---------------------------- */
[data-preset="studio"] {
  --primary: #0A0A0A;
  --font-body: 'Geist', system-ui, sans-serif; --font-display: 'Geist', system-ui, sans-serif; --font-mono: 'Geist Mono', ui-monospace, monospace;
  --display-weight: 600; --display-tracking: -.04em; --label-case: none; --label-tracking: 0; --label-size: 12px;
  --radius-sm: 6px; --radius: 8px; --radius-lg: 10px; --radius-xl: 14px; --btn-radius: 8px; --input-radius: 8px;
  --bg: #FFFFFF; --surface: #FFFFFF; --surface-2: #FAFAFA; --surface-hover: #F4F4F5;
  --border: #EAEAEA; --border-strong: #D4D4D8; --text: #0A0A0A; --text-2: #3F3F46; --muted: #67676F;
  --sidebar-bg: #FAFAFA; --sidebar-text: #3F3F46; --sidebar-muted: #6B6B74; --sidebar-hover: #F0F0F1;
  --sidebar-active-bg: #FFFFFF; --sidebar-active-text: #0A0A0A; --sidebar-border: #EAEAEA;
  --topbar-bg: color-mix(in srgb, #FFFFFF 85%, transparent);
  --shadow-sm: none; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 0 0 1px rgba(0,0,0,.04); --card-hover-shadow: 0 0 0 1px #D4D4D8, 0 8px 24px -12px rgba(0,0,0,.18);
  --shadow-lg: 0 20px 50px -16px rgba(0,0,0,.25), 0 0 0 1px rgba(0,0,0,.05);
  --chart-2: #737373; --chart-3: #A3A3A3; --chart-4: #2563EB; --chart-5: #D4D4D4; --chart-6: #DC2626; --chart-7: #525252; --chart-8: #16A34A;
}
[data-preset="studio"][data-theme="dark"] {
  --primary: #FAFAFA;
  --bg: #0A0A0A; --surface: #0F0F10; --surface-2: #121213; --surface-hover: #1A1A1C;
  --border: #232326; --border-strong: #34343A; --text: #FAFAFA; --text-2: #C9C9CF; --muted: #8B8B93;
  --sidebar-bg: #0A0A0A; --sidebar-text: #C9C9CF; --sidebar-muted: #8E8E96; --sidebar-hover: #161618; --sidebar-active-bg: #1A1A1C; --sidebar-active-text: #FAFAFA; --sidebar-border: #1A1A1C;
  --topbar-bg: color-mix(in srgb, #0A0A0A 85%, transparent);
  --shadow: 0 0 0 1px #232326; --card-hover-shadow: 0 0 0 1px #3A3A40; --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.9), 0 0 0 1px #232326;
  --chart-2: #A3A3A3; --chart-3: #737373; --chart-4: #60A5FA;
}
/* ---------------------------- Preset: NORTHBOUND (North Bound Content: logo orange, light sidebar, rounded, friendly) ----------------------------
   Logo orange #FD6D12 is used for marks, highlights, charts and tints. Fills that carry white text use #C94C08
   (readability guard: 4.65:1 with white). Dark mode uses a lighter orange with dark text (7.7:1). */
[data-preset="northbound"] {
  --brand: #FD6D12; --danger: #C42B1C; --danger-bg: color-mix(in srgb, #DC2626 10%, var(--surface)); /* red, never confused with the orange */
  --primary: #C94C08; --on-primary: #FFFFFF; --primary-600: #A83F06; --primary-ink: #B04306;
  --primary-50: #FFF3EA; --primary-100: #FFE3CF; --ring: color-mix(in srgb, #FD6D12 36%, transparent);
  --font-body: 'Nunito Sans', system-ui, sans-serif; --font-display: 'Poppins', 'Nunito Sans', sans-serif; --font-mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --display-weight: 600; --display-tracking: -.015em; --label-case: none; --label-tracking: 0; --label-size: 12px;
  --radius-sm: 10px; --radius: 14px; --radius-lg: 18px; --radius-xl: 24px; --btn-radius: 12px; --input-radius: 12px;
  --bg: #FBF8F5; --surface: #FFFFFF; --surface-2: #F7F3EF; --surface-hover: #FFF3EA;
  --border: #EEE6DF; --border-strong: #DCD0C6; --text: #1F2430; --text-2: #4A5060; --muted: #5E6472;
  --sidebar-bg: #FFFFFF; --sidebar-text: #2E3340; --sidebar-muted: #6A6F7C; --sidebar-hover: #FFF3EA;
  --sidebar-active-bg: #C94C08; --sidebar-active-text: #FFFFFF; --sidebar-border: #EEE6DF;
  --topbar-bg: color-mix(in srgb, #FFFFFF 90%, transparent);
  --shadow-sm: 0 1px 2px rgba(31,36,48,.06); --shadow: 0 8px 22px -14px rgba(31,36,48,.22);
  --shadow-lg: 0 28px 64px -24px rgba(31,36,48,.32), 0 6px 14px -8px rgba(31,36,48,.12); --card-hover-shadow: 0 16px 34px -18px rgba(201,76,8,.30);
  --chart-1: #FD6D12; --chart-2: #1F2430; --chart-3: #F2A541; --chart-4: #3B82B6; --chart-5: #7C8794; --chart-6: #2F9E6E; --chart-7: #B04306; --chart-8: #FFB27A;
}
[data-preset="northbound"][data-theme="dark"] {
  --brand: #FF8A3D;
  --primary: #FF8A3D; --on-primary: #14161C; --primary-600: #FFA266; --primary-ink: #FFAA70;
  --primary-50: color-mix(in srgb, #FF8A3D 12%, #1A1D24); --primary-100: color-mix(in srgb, #FF8A3D 22%, #1A1D24);
  --bg: #121419; --surface: #1A1D24; --surface-2: #16191F; --surface-hover: #232731;
  --border: #2A2E38; --border-strong: #3A3F4B; --text: #F2EEEA; --text-2: #C8C4C0; --muted: #A3A0A0;
  --sidebar-bg: #16191F; --sidebar-text: #D7D3CF; --sidebar-muted: #A3A0A0; --sidebar-hover: #232731;
  --sidebar-active-bg: #FF8A3D; --sidebar-active-text: #14161C; --sidebar-border: #232731;
  --topbar-bg: color-mix(in srgb, #121419 86%, transparent);
  --shadow: 0 10px 24px -12px rgba(0,0,0,.7); --shadow-lg: 0 30px 70px -20px rgba(0,0,0,.8); --card-hover-shadow: 0 18px 44px -18px rgba(0,0,0,.85);
  --chart-2: #E8E2DC; --chart-7: #FFB27A;
}
[data-preset="northbound"] .btn-primary { font-weight: 700; }
[data-preset="northbound"] .kpi-icon { background: color-mix(in srgb, var(--kpi-c, var(--brand)) 14%, var(--surface)); color: var(--kpi-ink, var(--primary-ink)); }
[data-preset="northbound"] .nav-indicator { box-shadow: 0 6px 14px -8px color-mix(in srgb, var(--primary) 70%, transparent); }
[data-preset="northbound"] .nav-section { color: var(--sidebar-muted); }
[data-preset="northbound"] #brandName { white-space: normal; line-height: 1.15; font-size: var(--fs-md); font-weight: 700; overflow: visible; text-overflow: clip; font-family: var(--font-display); }
[data-theme="dark"] {
  --success: #4ADE80; --warning: #FACC15; --danger: #FB7185; --info: #7DA8FF;
}
[data-density="compact"] { --pad: 18px; --row-h: 40px; --fs: calc(13px * var(--fs-scale)); }
[data-motion="subtle"] { --rise: 5px; }
[data-motion="off"] *, [data-motion="off"] *::before, [data-motion="off"] *::after { animation: none !important; transition: none !important; }

/* =========================== Base =========================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font-body); font-size: var(--fs); color: var(--text); background-color: var(--bg); background-image: var(--bg-pattern); background-size: auto, 28px 28px, 28px 28px;
  -webkit-font-smoothing: antialiased; line-height: 1.5; transition: background-color .4s ease, color .4s ease; }
[data-preset="noir"] body { background-size: 28px 28px; }
a { color: var(--primary-ink); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: var(--display-tracking); }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--primary) 25%, transparent); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.icon { width: var(--icon-size); height: var(--icon-size); flex: none; stroke: currentColor; fill: none; stroke-width: var(--icon-stroke); stroke-linecap: round; stroke-linejoin: round; transition: transform .3s var(--ease-out); }
.icon-sm { width: var(--icon-size-sm); height: var(--icon-size-sm); } .icon-lg { width: var(--icon-size-lg); height: var(--icon-size-lg); }
.muted { color: var(--muted); } .small { font-size: var(--fs-sm); } .xs { font-size: var(--fs-xs); }
.mono, .num, .kpi-value, .dt td.num, .totals dd { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: var(--fs-xs); }
.eyebrow { font-family: var(--font-mono); font-size: var(--label-size); letter-spacing: var(--label-tracking); text-transform: var(--label-case); color: var(--muted); }
.row { display: flex; align-items: center; gap: 8px; } .grow { flex: 1; min-width: 0; } .wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: 16px; }
.right { margin-left: auto; } .nowrap { white-space: nowrap; } .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }

/* =========================== Motion primitives =========================== */
@keyframes rise { from { opacity: 0; transform: translateY(var(--rise)); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes slide { from { transform: translateX(48px); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 45%, transparent); } 50% { box-shadow: 0 0 0 4px transparent; } }
@keyframes growY { from { transform: scaleY(0); } }
@keyframes growX { from { transform: scaleX(0); } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.reveal > * { animation: rise .6s var(--ease-out) both; }
.reveal > :nth-child(2) { animation-delay: .05s; } .reveal > :nth-child(3) { animation-delay: .1s; } .reveal > :nth-child(4) { animation-delay: .15s; }
.reveal > :nth-child(5) { animation-delay: .2s; } .reveal > :nth-child(6) { animation-delay: .25s; } .reveal > :nth-child(n+7) { animation-delay: .3s; }
.page-enter { animation: rise .5s var(--ease-out) both; }
[data-motion="subtle"] .reveal > * { animation-duration: .35s; }

/* =========================== App shell =========================== */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--sidebar-bg); color: var(--sidebar-text); border-right: 1px solid var(--sidebar-border); position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column; z-index: 40; transition: transform .45s var(--ease-out), width .35s var(--ease-out); }
[data-preset="bloom"] .sidebar { inset: 12px auto 12px 12px; border-radius: var(--radius-xl); box-shadow: var(--shadow); width: calc(var(--sidebar-w) - 12px); }
.brand { height: var(--topbar-h); display: flex; align-items: center; gap: 11px; padding: 0 20px; font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: var(--display-tracking); font-size: var(--fs-md); color: inherit; }
.brand-logo { width: 34px; height: 34px; border-radius: calc(var(--radius) - 1px); background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: var(--fs); overflow: hidden; flex: none;
  transition: transform .5s var(--ease-spring), border-radius .4s; }
.brand:hover .brand-logo { transform: rotate(-8deg) scale(1.06); border-radius: 50%; }
[data-preset="noir"] .brand-logo { background: var(--accent-2, var(--primary)); color: #0B0B0C; }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-logo.has-img { background: transparent; border-radius: 0; }
.brand-logo.has-img img { object-fit: contain; }
.brand:hover .brand-logo.has-img { transform: scale(1.06); border-radius: 0; }
.brand-logo .mk-on-dark, [data-theme="dark"] .brand-logo .mk-on-light { display: none; }
[data-theme="dark"] .brand-logo .mk-on-dark { display: block; }
.nav { flex: 1; overflow-y: auto; padding: 8px 12px 16px; position: relative; }
.nav-section { font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: .12em; text-transform: uppercase; color: var(--sidebar-muted); padding: 18px 10px 7px; }
.nav-item { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; background: none; border-radius: var(--radius);
  color: var(--sidebar-text); cursor: pointer; text-align: left; font-weight: 500; transition: color .25s, background .25s; }
.nav-item:hover { background: var(--sidebar-hover); text-decoration: none; }
.nav-item:hover .icon { transform: translateX(2px) rotate(-4deg); }
.nav-item.active { color: var(--sidebar-active-text); background: transparent; }
.nav-item.active:hover { background: transparent; }
.nav-indicator { position: absolute; left: 12px; right: 12px; top: 0; height: 0; border-radius: var(--radius); background: var(--sidebar-active-bg); z-index: 0; pointer-events: none;
  transition: transform .5s var(--ease-spring), height .3s var(--ease-out), opacity .2s; opacity: 0; }
[data-preset="ledger"] .nav-indicator, [data-preset="studio"] .nav-indicator { box-shadow: var(--shadow); }
[data-preset="noir"][data-theme="light"] .nav-indicator { box-shadow: 3px 3px 0 #000; }
.sidebar-foot { padding: 14px 20px; font-size: var(--fs-xs); color: var(--sidebar-muted); border-top: 1px solid color-mix(in srgb, var(--sidebar-text) 12%, transparent); }
.app.collapsed .sidebar { width: var(--rail-w); }
.app.collapsed .sidebar .label, .app.collapsed .nav-section, .app.collapsed .brand-name, .app.collapsed .sidebar-foot { display: none; }
.app.collapsed .nav-item { justify-content: center; }
.app.collapsed .main { margin-left: var(--rail-w); }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; transition: margin .35s var(--ease-out); }
[data-preset="bloom"] .main { margin-left: calc(var(--sidebar-w) + 12px); }
.topbar { height: var(--topbar-h); background: var(--topbar-bg); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; padding: 0 var(--pad); position: sticky; top: 0; z-index: 30; }
[data-preset="bloom"] .topbar { border-bottom-color: transparent; }
.topbar-brand { display: none; align-items: center; gap: 10px; white-space: nowrap; flex: none; font-family: var(--font-display); font-weight: var(--display-weight); font-size: var(--fs-md); letter-spacing: var(--display-tracking); margin-right: 8px; }
.topnav { display: none; align-items: center; gap: 2px; position: relative; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav .nav-item { width: auto; padding: 8px 12px; color: var(--text-2); white-space: nowrap; }
.topnav .nav-item:hover { background: var(--surface-hover); }
.topnav .nav-item.active { color: var(--text); }
.topnav .nav-sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; flex: none; }
.topnav .nav-indicator { left: 0; right: auto; top: auto; bottom: -12px; height: 2px !important; border-radius: 2px; background: var(--primary); box-shadow: none;
  transition: transform .5s var(--ease-spring), width .4s var(--ease-out); }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); min-width: 0; }
.breadcrumb a, .breadcrumb button { color: var(--muted); background: none; border: 0; min-height: var(--touch); padding: 2px 6px; margin: 0 -6px; border-radius: var(--radius-sm); font: inherit; cursor: pointer; transition: color .2s, background .2s; }
.breadcrumb button:hover { background: var(--surface-hover); }
.breadcrumb button:hover { color: var(--text); }
.breadcrumb .current { color: var(--text); font-weight: 600; }
.global-search { position: relative; margin-left: auto; width: min(320px, 36vw); transition: width .4s var(--ease-out); }
.global-search:focus-within { width: min(420px, 46vw); }
.global-search input { width: 100%; height: var(--control-h); padding: 0 12px 0 36px; border: 1px solid var(--border); border-radius: var(--btn-radius); background: var(--surface-2); transition: border-color .2s, box-shadow .2s, background .2s; }
.global-search input:focus { outline: none; background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.global-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.global-search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; background: var(--surface); }
.search-results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); max-height: 60vh; overflow: auto; z-index: 50; padding: 6px; animation: pop .25s var(--ease-out); }
.view:focus { outline: none; }
.view { padding: var(--pad); flex: 1; max-width: 1440px; width: 100%; margin: 0 auto; }
.footer { padding: 16px var(--pad); color: var(--muted); font-size: var(--fs-xs); display: flex; gap: 14px; flex-wrap: wrap; }
.sidebar-backdrop { display: none; }
.bottom-nav { display: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 700; font-size: var(--fs-xs); flex: none; transition: transform .35s var(--ease-spring), box-shadow .3s; }
#userBtn:hover .avatar { transform: scale(1.08); box-shadow: 0 0 0 3px var(--ring); }

/* ---------- Layout: TOPBAR ---------- */
[data-layout="topbar"] .sidebar, [data-layout="portal"] .sidebar { display: none; }
[data-layout="topbar"] .main, [data-layout="portal"] .main { margin-left: 0; }
[data-layout="topbar"] .topbar-brand, [data-layout="portal"] .topbar-brand { display: flex; }
[data-layout="topbar"] .topnav, [data-layout="portal"] .topnav { display: flex; }
[data-layout="topbar"] #menuBtn, [data-layout="portal"] #menuBtn, [data-layout="topbar"] .breadcrumb, [data-layout="portal"] .breadcrumb { display: none; }
[data-layout="topbar"] .global-search { width: min(240px, 24vw); }
/* ---------- Layout: RAIL (icon rail, dense) ---------- */
[data-layout="rail"] .sidebar { width: var(--rail-w); }
[data-layout="rail"] .main { margin-left: var(--rail-w); }
[data-preset="bloom"][data-layout="rail"] .sidebar { width: calc(var(--rail-w) - 8px); }
[data-preset="bloom"][data-layout="rail"] .main { margin-left: calc(var(--rail-w) + 12px); }
[data-layout="rail"] .brand { justify-content: center; padding: 0; }
[data-layout="rail"] .brand-name, [data-layout="rail"] .nav-section, [data-layout="rail"] .sidebar-foot { display: none; }
[data-layout="rail"] .nav { padding: 10px 8px; }
[data-layout="rail"] .nav-item { flex-direction: column; gap: 4px; padding: 10px 4px; font-size: var(--fs-micro); text-align: center; justify-content: center; }
[data-layout="rail"] .nav-item .label { line-height: 1.15; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-layout="rail"] .nav-indicator { left: 8px; right: 8px; }
[data-layout="rail"] .nav-group-gap { height: 10px; }
[data-layout="rail"] #menuBtn { display: none; }
/* ---------- Layout: PORTAL (customer-facing) ---------- */
[data-layout="portal"] .view { max-width: 1120px; padding-top: 40px; }
[data-layout="portal"] .topbar { height: 72px; }
[data-layout="portal"] .footer { justify-content: center; max-width: 1120px; margin: 0 auto; width: 100%; }
[data-layout="portal"] .page-head h1 { font-size: 40px; }

/* =========================== Page header =========================== */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .eyebrow { margin-bottom: 8px; display: flex; gap: 10px; align-items: center; }
.page-head .eyebrow::before { content: ""; width: 18px; height: 1.5px; background: var(--primary); display: inline-block; }
.page-head h1 { font-size: var(--fs-xl); }
.page-head h1 em { font-style: italic; color: var(--primary-ink); }
[data-preset="ledger"] .page-head h1 em, [data-preset="studio"] .page-head h1 em, [data-preset="noir"] .page-head h1 em { font-style: normal; }
[data-preset="noir"] .page-head h1 em { background: var(--accent-2, var(--primary)); color: #0B0B0C; padding: 0 .18em; }
[data-preset="noir"][data-theme="dark"] .page-head h1 em { background: none; color: var(--primary-ink); }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 62ch; }
.page-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* =========================== Buttons =========================== */
.btn { position: relative; overflow: hidden; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--control-h); min-width: var(--touch); padding: 0 16px; border-radius: var(--btn-radius);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap;
  transition: background .2s, border-color .2s, box-shadow .3s var(--ease-out), transform .3s var(--ease-spring), color .2s; }
.btn:hover { background: var(--surface-hover); border-color: color-mix(in srgb, var(--text) 25%, var(--border-strong)); text-decoration: none; }
.btn:hover .icon { transform: scale(1.1); }
.btn:active { transform: scale(.96); transition-duration: .08s; }
.btn:disabled, .btn[aria-busy="true"] { opacity: .6; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 6px 16px -8px color-mix(in srgb, var(--primary) 70%, transparent); }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 12px 24px -10px color-mix(in srgb, var(--primary) 75%, transparent); }
.btn-primary::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.28) 48%, transparent 66%); transform: translateX(-120%); transition: transform .8s var(--ease-out); }
.btn-primary:hover::after { transform: translateX(120%); }
[data-preset="noir"] .btn-primary { box-shadow: 3px 3px 0 color-mix(in srgb, var(--text) 85%, transparent); }
[data-preset="noir"] .btn-primary:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 color-mix(in srgb, var(--text) 85%, transparent); }
[data-preset="noir"][data-theme="dark"] .btn-primary { box-shadow: 0 0 0 0 transparent; }
[data-preset="noir"][data-theme="dark"] .btn-primary:hover { box-shadow: 0 0 24px -4px color-mix(in srgb, var(--primary) 70%, transparent); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-success:hover, .btn-danger:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-hover); border-color: transparent; color: var(--text); }
.btn-sm { height: var(--control-h-sm); padding: 0 11px; font-size: var(--fs-xs); }
.btn-icon { width: var(--control-h); padding: 0; } .btn-icon.btn-sm { width: var(--control-h-sm); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--primary); }
.btn[aria-busy="true"]::before { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.ripple { position: absolute; border-radius: 50%; pointer-events: none; background: currentColor; opacity: .22; transform: scale(0); animation: ripple .65s var(--ease-out) forwards; z-index: -1; }
.icon-badge { position: relative; overflow: visible; }
.icon-badge .dot { position: absolute; top: 3px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff; font-size: var(--fs-micro); font-weight: 700; display: grid; place-items: center;
  box-shadow: 0 0 0 2px var(--surface); animation: pop .4s var(--ease-spring); }
#notifBtn:hover .icon { animation: ring .6s ease; }
@keyframes ring { 20% { transform: rotate(14deg); } 40% { transform: rotate(-12deg); } 60% { transform: rotate(8deg); } 80% { transform: rotate(-4deg); } }
#themeBtn:hover .icon { transform: rotate(40deg); }

/* =========================== Cards & KPI =========================== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); transition: box-shadow .4s var(--ease-out), transform .4s var(--ease-out), border-color .3s; }
.card.lift:hover, .kpi:hover { box-shadow: var(--card-hover-shadow); transform: translateY(-3px); }
[data-preset="noir"] .card { box-shadow: none; }
[data-preset="noir"][data-theme="light"] .card { border-color: #0B0B0C; }
.card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { font-size: var(--fs-md); }
[data-preset="ledger"] .card-head :is(h2, h3), [data-preset="studio"] .card-head :is(h2, h3) { font-size: var(--fs); }
.card-body { padding: 20px; }
.grid { display: grid; gap: 18px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-dash { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1180px) { .grid-dash { grid-template-columns: 1fr; } }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.kpi { position: relative; overflow: hidden; padding: 20px; display: flex; flex-direction: column; gap: 14px; cursor: pointer; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-icon { width: 38px; height: 38px; border-radius: var(--radius); display: grid; place-items: center; background: var(--primary-50); color: var(--primary-ink); flex: none; transition: transform .5s var(--ease-spring); }
.kpi:hover .kpi-icon { transform: rotate(-8deg) scale(1.08); }
.kpi.danger .kpi-icon { background: var(--danger-bg); color: var(--danger); }
.kpi-label { font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.kpi-value { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-display); font-size: 30px; font-weight: var(--display-weight); letter-spacing: var(--display-tracking); line-height: 1.05; }
.kpi-go { color: var(--muted); opacity: 0; transform: translateX(-6px); transition: .35s var(--ease-out); }
.kpi:hover .kpi-go { opacity: 1; transform: none; }
/* preset KPI personalities */
[data-preset="atelier"] .kpi-value { font-size: 36px; font-weight: 500; font-variation-settings: "opsz" 72; }
[data-preset="atelier"] .kpi-icon { background: transparent; border: 1px solid var(--border-strong); }
[data-preset="atelier"] .kpi::after { content: ""; position: absolute; left: 20px; right: 20px; bottom: 0; height: 2px; background: var(--primary); transform: scaleX(0); transform-origin: left; transition: transform .6s var(--ease-out); }
[data-preset="atelier"] .kpi:hover::after { transform: scaleX(1); }
[data-preset="ledger"] .kpi { border-left: 3px solid var(--primary); }
[data-preset="ledger"] .kpi.danger { border-left-color: var(--danger); }
[data-preset="ledger"] .kpi-value { font-family: var(--font-mono); font-size: 26px; font-weight: 500; letter-spacing: -.03em; }
[data-preset="ledger"] .kpi-label { text-transform: uppercase; letter-spacing: .07em; font-size: var(--fs-micro); }
[data-preset="bloom"] .kpi { border: 0; background: color-mix(in srgb, var(--kpi-c, var(--primary)) 11%, var(--surface)); }
[data-preset="bloom"] .kpi-label { color: var(--text-2); }
[data-preset="bloom"] .kpi-icon { background: var(--kpi-c, var(--primary)); color: #fff; border-radius: 50%; }
[data-preset="bloom"] .kpis > :nth-child(2) { --kpi-c: var(--chart-3); } [data-preset="bloom"] .kpis > :nth-child(3) { --kpi-c: var(--chart-2); }
[data-preset="bloom"] .kpis > :nth-child(4) { --kpi-c: var(--chart-4); } [data-preset="bloom"] .kpis > :nth-child(5) { --kpi-c: var(--chart-5); }
[data-preset="bloom"] .kpi.danger { --kpi-c: var(--danger); }
[data-preset="noir"] .kpi-value { font-size: 40px; letter-spacing: -.05em; }
[data-preset="noir"] .kpi-label { font-family: var(--font-mono); text-transform: uppercase; font-size: var(--fs-micro); letter-spacing: .1em; }
[data-preset="noir"] .kpi-icon { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
[data-preset="noir"][data-theme="light"] .kpi:hover { box-shadow: 6px 6px 0 #0B0B0C; transform: translate(-2px, -2px); }
[data-preset="studio"] .kpi-icon { background: transparent; color: var(--muted); width: 22px; height: 22px; }
[data-preset="studio"] .kpi-value { font-size: 30px; }

/* =========================== Alerts, badges, chips =========================== */
.alert { display: flex; gap: 12px; align-items: center; padding: 13px 16px; border-radius: var(--radius); font-size: var(--fs-sm); border: 1px solid color-mix(in srgb, currentColor 18%, transparent); transition: transform .3s var(--ease-out); }
.alert:hover { transform: translateX(3px); }
.alert-info { background: var(--info-bg); color: var(--info); } .alert-warning { background: var(--warning-bg); color: var(--warning); }
.dt-wrap:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--radius); }
.alert-danger { background: var(--danger-bg); color: var(--danger); } .alert-success { background: var(--success-bg); color: var(--success); }
.alert button { margin-left: auto; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 99px; font-size: var(--fs-xs); font-weight: 600; background: var(--surface-hover); color: var(--text-2); white-space: nowrap; line-height: 20px; }
[data-preset="ledger"] .badge { border-radius: 3px; } [data-preset="noir"] .badge { border-radius: 3px; font-family: var(--font-mono); font-size: var(--fs-micro); text-transform: uppercase; letter-spacing: .04em; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.plain::before { display: none; }
.badge-blue::before, .badge-amber::before { animation: pulse 2.2s ease-in-out infinite; }
.badge-gray, .badge-slate { background: var(--surface-hover); color: var(--muted); }
.badge-blue { background: var(--info-bg); color: var(--info); } .badge-green { background: var(--success-bg); color: var(--success); }
.badge-amber { background: var(--warning-bg); color: var(--warning); } .badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-primary { background: var(--primary-50); color: var(--primary-ink); }
[data-theme="dark"] { --primary-ink: color-mix(in srgb, var(--primary) 62%, #fff); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; background: var(--primary-50); color: var(--primary-ink); font-size: var(--fs-xs); font-weight: 600; animation: pop .3s var(--ease-spring); }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; display: flex; }

/* =========================== Forms =========================== */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 18px; }
.form-section { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding-top: 8px; margin-top: 4px; }
.form-section::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.form-section:first-child { margin-top: 0; padding-top: 0; }
.field { display: flex; flex-direction: column; gap: 7px; grid-column: 1 / -1; min-width: 0; }
.field.half { grid-column: span 1; }
.field label, .field .label { font-weight: 600; font-size: var(--fs-sm); color: var(--text-2); }
.field .req { color: var(--primary-ink); margin-left: 3px; }
.input, .select, .textarea, .sel-btn { width: 100%; height: var(--control-h); padding: 0 var(--control-px); border: 1px solid var(--border-strong); border-radius: var(--input-radius); background: var(--surface);
  color: var(--text); font: inherit; line-height: var(--control-h); transition: border-color .2s, box-shadow .25s var(--ease-out), background .2s; }
.input:hover, .select:hover, .textarea:hover, .sel-btn:hover, .date:hover .date-text { border-color: color-mix(in srgb, var(--text) 30%, var(--border-strong)); }
/* Textareas grow downwards only, inside limits, so nobody can stretch a form sideways. */
.textarea { height: auto; min-height: 96px; max-height: 360px; padding: 10px var(--control-px); line-height: var(--lh); resize: vertical; }
.input:focus, .select:focus, .textarea:focus, .sel-btn:focus-visible, .sel.open .sel-btn, .date.open .date-text { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.input::placeholder, .textarea::placeholder { color: color-mix(in srgb, var(--muted) 85%, transparent); }
.input[readonly], .input:disabled, .select:disabled, .textarea:disabled, .sel-btn:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.field.invalid .input, .field.invalid .select, .field.invalid .textarea, .field.invalid .sel-btn { border-color: var(--danger); animation: shake .35s ease; }
.field.invalid .input:focus, .field.invalid .sel-btn:focus-visible { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 22%, transparent); }
/* Native select fallback (data-native="true"): same box, themed chevron with a proper inset. */
.select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: calc(var(--chev-inset) + var(--icon-size-sm) + 10px);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--chev-inset) center; background-size: var(--icon-size-sm); }
input[type=number].input { -moz-appearance: textfield; }
input[type=number].input::-webkit-inner-spin-button, input[type=number].input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=search].input::-webkit-search-cancel-button { -webkit-appearance: none; }
@keyframes shake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
.field .help { font-size: var(--fs-xs); color: var(--muted); }
.field .error { font-size: var(--fs-xs); color: var(--danger); font-weight: 600; }
.field .error:not(:empty) { animation: rise .25s var(--ease-out); }
.input-group { position: relative; display: flex; }
.input-group .prefix { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: var(--fs-sm); font-weight: 600; pointer-events: none; font-family: var(--font-mono); }
.input-group .input { padding-left: 46px; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.checklist { display: flex; flex-direction: column; gap: 10px; }
.checklist-progress { margin-top: 2px; }
.cl-view { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cl-view li { display: flex; align-items: center; gap: 8px; }
.cl-view li.done { color: var(--text); } .cl-view li.todo { color: var(--text-muted); }
.cl-view .cl-dot { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; border: 1.5px solid var(--border-strong, var(--border)); font-size: 11px; }
.cl-view .cl-dot .icon-xs { width: 12px; height: 12px; }
.cl-view li.done .cl-dot { background: var(--success, #15803d); border-color: transparent; color: #fff; }
.cl-bar { height: 6px; border-radius: 99px; background: var(--surface-2, var(--border)); overflow: hidden; margin-top: 4px; }
.cl-bar > span { display: block; height: 100%; background: var(--primary); }
.cl-editor { display: flex; flex-direction: column; gap: 8px; }
.cl-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) minmax(0, 230px) auto; gap: 8px; align-items: center; }
.cl-num { font-size: var(--fs-sm); color: var(--text-muted); text-align: right; }
.cl-tools { gap: 2px; }
.cl-row .sel { min-width: 0; }
@media (max-width: 640px) { .cl-row { grid-template-columns: 22px minmax(0, 1fr); } .cl-row .sel, .cl-row select, .cl-row .cl-tools { grid-column: 2; } }
.roles-grid { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .roles-grid { grid-template-columns: 1fr; } }
.role-list .role-item { text-align: left; width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius, 10px); padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; color: var(--text); font: inherit; }
.role-list .role-item.on { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-50); }
.role-list .role-item:disabled { cursor: default; opacity: .75; }
.role-row { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); align-items: start; }
.role-row:first-child { border-top: 0; }
@media (max-width: 700px) { .role-row { grid-template-columns: 1fr; } }
.role-mod { display: flex; flex-direction: column; gap: 6px; }
.role-chips { gap: 6px; }
.role-chip { border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); border-radius: 99px; padding: 5px 12px; font: inherit; font-size: var(--fs-xs); font-weight: 600; cursor: pointer; min-height: 30px; }
.role-chip.on { background: var(--primary-50); border-color: var(--primary); color: var(--primary-ink); }
.role-chip:disabled { opacity: .45; cursor: not-allowed; }
.role-fields { border: 1px solid var(--border); border-radius: var(--radius, 10px); padding: 8px 12px; }
.role-fields summary { cursor: pointer; padding: 4px 0; }
.role-field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 220px); gap: 10px; align-items: center; padding: 6px 0; }
.role-field .sel { min-width: 0; }
.role-savebar { position: sticky; bottom: 12px; margin-top: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius, 10px); box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,.12)); z-index: 5; }
@media (max-width: 860px) { .role-savebar { bottom: 88px; flex-wrap: wrap; } }
.role-warn { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.role-menu { display: grid; gap: 8px; margin: 6px 0 12px; }
.btn-reason { font-size: var(--fs-xs, 12px); color: var(--text-muted); max-width: 46ch; }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 99px; transition: background .3s; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .45s var(--ease-spring), width .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch:active span::after { width: 22px; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 4px var(--ring); }
.multi { display: flex; flex-wrap: wrap; gap: 8px; }
.multi label { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 99px; cursor: pointer; font-size: var(--fs-sm); transition: .2s; }
.multi label:hover { border-color: var(--primary); }
.multi input:checked + span { color: var(--primary-ink); font-weight: 600; }
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 26px; text-align: center; color: var(--muted); cursor: pointer; transition: .25s var(--ease-out); display: grid; gap: 6px; justify-items: center; }
.dropzone .icon { width: 26px; height: 26px; }
.dropzone.drag, .dropzone:hover { border-color: var(--primary); background: var(--primary-50); color: var(--primary-ink); }
.dropzone.drag .icon, .dropzone:hover .icon { transform: translateY(-4px); }
.color-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.swatch-input { width: 52px; height: 40px; padding: 4px; border-radius: var(--input-radius); border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; }

/* ---------- Line items editor ---------- */
.lines { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.lines table { width: 100%; border-collapse: collapse; }
.lines th { text-align: left; font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 10px 10px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-weight: 500; }
.lines td { padding: 6px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.lines tr.line { animation: rise .35s var(--ease-out); }
.lines tr.line.removing { transition: opacity .25s, transform .25s; opacity: 0; transform: translateX(16px); }
.lines .input, .lines .sel-btn, .lines .date-text { height: var(--cell-h); line-height: var(--cell-h); padding-left: 10px; border-color: transparent; background: transparent; }
.lines .sel-btn:hover, .lines .date:hover .date-text { border-color: var(--border); background: var(--surface-2); }
.lines .input:hover { border-color: var(--border); background: var(--surface-2); }
.lines .input:focus { background: var(--surface); }
.lines td.invalid .input, .lines td.invalid .sel-btn, .lines td.invalid .date-text { border-color: var(--danger); }
.lines .cell-error { font-size: var(--fs-micro); color: var(--danger); padding: 0 10px 4px; }
.lines .num, .lines th.num { text-align: right; }
.lines .line-total { padding: 10px 10px 0; line-height: var(--cell-h); text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lines .drag { width: 24px; color: var(--muted); cursor: grab; padding-top: 15px; text-align: center; }
.lines-foot { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; padding: 12px; flex-wrap: wrap; background: var(--surface-2); }
.totals { margin: 0; display: grid; grid-template-columns: auto auto; gap: 6px 28px; min-width: 240px; font-size: var(--fs-sm); }
.totals dt { color: var(--muted); } .totals dd { margin: 0; text-align: right; font-weight: 600; }
.totals .grand { font-family: var(--font-display); font-size: 20px; color: var(--text); border-top: 1px solid var(--border); padding-top: 8px; margin-top: 2px; }
.totals .base { font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }

/* =========================== Data table =========================== */
.dt-toolbar { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.dt-search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.dt-search input { padding-left: 36px; }
.dt-search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.dt-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.dt-filters .sel { width: auto; min-width: 150px; max-width: 210px; }
.dt-filters .sel-btn { font-size: var(--fs-sm); }
.dt-filter-btn, .dt-filter-clear { display: none; }
.dt-filter-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-size: var(--fs-micro); font-weight: 700; margin-left: 2px; }
@media (max-width: 860px) {
  .dt-toolbar { gap: 8px; padding: 12px; }
  .dt-toolbar .dt-search { flex: 1 1 100%; min-width: 0; }
  .dt-toolbar > .row.right { margin-left: 0; width: 100%; flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .dt-toolbar > .row.right::-webkit-scrollbar { display: none; }
  .dt-toolbar > .row.right > * { flex: 0 0 auto; }
  .dt-toolbar > .row.right .sel { width: auto; min-width: 104px; }
  .dt-filter-btn { display: inline-flex; }
  .dt-toolbar.has-active-filters .dt-filter-btn { border-color: var(--primary); color: var(--primary-ink); }
  .dt-toolbar.has-filter-btn .dt-filters { display: none; order: 3; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-top: 4px; }
  .dt-toolbar.has-filter-btn.filters-open .dt-filters { display: grid; animation: rise .2s var(--ease-out); }
  .dt-filters .sel { min-width: 0; max-width: none; width: 100%; }
  .dt-toolbar.has-filter-btn .dt-filter-clear { display: inline-flex; grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 340px) { .dt-toolbar.has-filter-btn .dt-filters { grid-template-columns: 1fr; } }
.dt-wrap { overflow-x: auto; }
table.dt { width: 100%; border-collapse: separate; border-spacing: 0; }
.dt th { text-align: left; font-family: var(--font-mono); font-size: var(--fs-micro); font-weight: 500; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; }
.dt th.sortable { cursor: pointer; user-select: none; transition: color .2s; }
.dt th.sortable:hover { color: var(--text); }
.dt th .arrow { opacity: .35; margin-left: 4px; display: inline-block; transition: transform .3s var(--ease-spring); }
.dt th[aria-sort] .arrow { opacity: 1; color: var(--primary-ink); }
.dt td { padding: 0 16px; height: var(--row-h); border-bottom: 1px solid var(--border); vertical-align: middle; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt tbody tr { transition: background .2s, box-shadow .25s; animation: fade .4s ease both; }
.dt tbody tr.clickable { cursor: pointer; }
.dt tbody tr.clickable:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; background: var(--surface-hover); }
.dt tbody tr:hover { background: var(--surface-hover); box-shadow: inset 3px 0 0 var(--primary); }
[data-preset="ledger"] .dt tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 70%, var(--surface)); }
[data-preset="ledger"] .dt tbody tr:hover { background: var(--surface-hover); }
.dt tbody tr:last-child td { border-bottom: 0; }
.dt td.num, .dt th.num { text-align: right; }
[data-preset="ledger"] .dt td.num { font-family: var(--font-mono); font-size: var(--fs-sm); }
.dt td.actions { width: 1%; text-align: right; overflow: visible; }
.dt td.actions .btn { opacity: .45; transition: opacity .2s; } .dt tr:hover td.actions .btn { opacity: 1; }
.dt-foot { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; font-size: var(--fs-sm); color: var(--muted); }
.pager { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.skeleton { background: linear-gradient(90deg, var(--surface-hover), var(--surface-2), var(--surface-hover)); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 6px; height: 12px; }
/* segmented control (view switcher) */
.seg { display: inline-flex; position: relative; padding: 3px; border-radius: calc(var(--btn-radius) + 3px); background: var(--surface-hover); border: 1px solid var(--border); }
.seg button { position: relative; z-index: 1; border: 0; background: none; padding: 6px 12px; border-radius: var(--btn-radius); font-size: var(--fs-xs); font-weight: 600; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: color .25s; }
.seg button[aria-pressed="true"] { color: var(--text); }
.seg .thumb { position: absolute; top: 3px; bottom: 3px; left: 0; border-radius: var(--btn-radius); background: var(--surface); box-shadow: var(--shadow); transition: transform .45s var(--ease-spring), width .35s var(--ease-out); }

/* =========================== Board (kanban) =========================== */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.board-col { background: color-mix(in srgb, var(--surface-2) 60%, transparent); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px; min-height: 160px; transition: background .25s, border-color .25s, transform .3s var(--ease-out); }
.board-col.over { background: var(--primary-50); border-color: var(--primary); border-style: dashed; transform: scale(1.01); }
.board-col-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 10px; font-weight: 700; font-family: var(--font-display); }
.board-col-head .count { margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--muted); }
.board-list { display: grid; gap: 8px; min-height: 40px; }
.board-card { text-align: left; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 13px; cursor: grab; display: grid; gap: 6px;
  transition: transform .35s var(--ease-spring), box-shadow .3s, border-color .2s; animation: rise .45s var(--ease-out) both; }
.board-card:hover { transform: translateY(-2px) rotate(-.4deg); box-shadow: var(--card-hover-shadow); border-color: var(--border-strong); }
.board-card.dragging { opacity: .55; transform: rotate(2.5deg) scale(1.02); cursor: grabbing; }
.board-card .title { font-weight: 600; }
.board-card .meta { display: flex; gap: 8px; align-items: center; justify-content: space-between; font-size: var(--fs-xs); color: var(--muted); }

/* =========================== Calendar =========================== */
.cal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.cal-head h3 { font-size: var(--fs-lg); min-width: 170px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 10px; border-bottom: 1px solid var(--border); }
.cal-day { min-height: 112px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 8px; display: flex; flex-direction: column; gap: 4px; transition: background .2s; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day:hover { background: var(--surface-2); }
.cal-day.other { background: color-mix(in srgb, var(--surface-2) 55%, transparent); color: var(--muted); }
.cal-day .d { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--muted); }
.cal-day.today .d { background: var(--primary); color: var(--on-primary); border-radius: 99px; width: 24px; height: 24px; display: grid; place-items: center; }
.cal-item { border: 0; text-align: left; font-size: var(--fs-micro); font-weight: 600; padding: 3px 7px; border-radius: 6px; cursor: pointer; background: var(--primary-50); color: var(--primary-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: transform .25s var(--ease-spring), filter .2s; animation: pop .35s var(--ease-out) both; }
.cal-item:hover { transform: translateX(2px); filter: brightness(.96); }
.cal-more { font-size: var(--fs-micro); color: var(--muted); padding-left: 4px; }

/* =========================== Empty, tabs, timeline, detail =========================== */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .illus { width: 132px; height: 96px; margin: 0 auto 14px; display: block; animation: float 5s ease-in-out infinite; }
.empty h3 { color: var(--text); font-size: var(--fs-md); font-weight: 700; margin-bottom: 4px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab { position: relative; padding: 11px 14px; border: 0; background: none; cursor: pointer; color: var(--muted); font-weight: 600; white-space: nowrap; transition: color .2s; }
.tab:hover { color: var(--text); }
.tab::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); transform: scaleX(0); transition: transform .45s var(--ease-spring); }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after { transform: scaleX(1); }
.tab .count { font-family: var(--font-mono); font-size: var(--fs-micro); background: var(--surface-hover); border-radius: 99px; padding: 1px 7px; margin-left: 5px; }
[role="tabpanel"] > * { animation: rise .4s var(--ease-out) both; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 26px; animation: rise .45s var(--ease-out) both; }
.timeline li:nth-child(2) { animation-delay: .04s; } .timeline li:nth-child(3) { animation-delay: .08s; } .timeline li:nth-child(n+4) { animation-delay: .12s; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: -6px; width: 1.5px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 1px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 26px; }
.detail-grid .full { grid-column: 1 / -1; }
.detail-label { font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.detail-value { word-break: break-word; white-space: pre-wrap; }
.record-hero { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.record-hero .amount { margin-left: auto; text-align: right; }
.record-hero .amount b { display: block; font-family: var(--font-display); font-size: 26px; font-weight: var(--display-weight); letter-spacing: var(--display-tracking); }

/* =========================== Modals, drawers, menus, toasts =========================== */
.overlay { position: fixed; inset: 0; background: color-mix(in srgb, #0b0805 48%, transparent); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .25s ease; }
.overlay.closing { animation: fade .2s ease reverse forwards; }
.modal { background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: 100%; max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .42s var(--ease-spring); border: 1px solid var(--border); }
[data-preset="noir"][data-theme="light"] .modal { border-color: #0B0B0C; }
.modal-sm { max-width: 440px; } .modal-md { max-width: 620px; } .modal-lg { max-width: 860px; } .modal-xl { max-width: 1080px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: var(--fs-lg); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 24px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-xl) var(--radius-xl); position: sticky; bottom: 0; flex-wrap: wrap; }
.overlay.drawer { justify-content: flex-end; padding: 10px; }
.overlay.drawer .modal { height: calc(100vh - 20px); max-height: none; max-width: 760px; animation: slide .5s var(--ease-out); }
.menu { position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 6px; min-width: 210px; z-index: 120; animation: pop .25s var(--ease-out); transform-origin: top right; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border: 0; background: none; border-radius: var(--radius-sm); cursor: pointer; text-align: left; color: var(--text); transition: background .15s, padding .25s var(--ease-out); }
.menu-item:hover { background: var(--surface-hover); padding-left: 14px; }
.menu-item.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.notif-panel { width: min(390px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; padding: 0; }
.notif { display: flex; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .2s; }
.notif:hover { background: var(--surface-hover); }
.notif.unread { background: var(--primary-50); }
.notif .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 7px; flex: none; animation: pulse 2s infinite; color: var(--primary-ink); }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; max-width: calc(100vw - 40px); }
.toast { position: relative; overflow: hidden; display: flex; gap: 10px; align-items: flex-start; background: var(--text); color: var(--surface); padding: 13px 16px 15px; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); min-width: 270px; max-width: 420px;
  animation: toastIn .5s var(--ease-spring); font-size: var(--fs-sm); }
.toast::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--primary); transform-origin: left; animation: countdown var(--life, 3.2s) linear forwards; }
.toast.out { transition: opacity .3s, transform .3s; opacity: 0; transform: translateX(24px); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px) scale(.96); } }
.toast.success .icon { color: #4ADE80; } .toast.error .icon { color: #FB7185; } .toast.warning .icon { color: #FACC15; }
.loading-screen { display: grid; place-items: center; min-height: 60vh; color: var(--muted); }
.spinner { width: 30px; height: 30px; border: 2.5px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }

/* =========================== Charts =========================== */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: var(--fs-micro); font-family: var(--font-mono); }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 2 4; }
.chart .bar { transition: opacity .2s, filter .2s; cursor: default; }
.chart .bar:hover { filter: brightness(1.1) saturate(1.1); }
.chart:hover .bar:not(:hover) { opacity: .55; }
.chart .bar-v { transform-box: fill-box; transform-origin: 50% 100%; animation: growY .9s var(--ease-out) both; }
.chart .bar-h { transform-box: fill-box; transform-origin: 0 50%; animation: growX .9s var(--ease-out) both; }
.chart .line-path { stroke-dasharray: 1; animation: draw 1.4s var(--ease-out) both; }
.chart .area { animation: fade 1.2s .3s ease both; }
.chart .pt { transform-box: fill-box; transform-origin: center; animation: pop .5s var(--ease-spring) both; transition: transform .25s var(--ease-spring); }
.chart .pt:hover { transform: scale(1.5); }
.chart .seg-arc { transform-box: view-box; transform-origin: 130px 130px; animation: arcIn .8s var(--ease-out) both; transition: transform .35s var(--ease-spring); }
.chart .seg-arc:hover { transform: scale(1.04); }
@keyframes arcIn { from { opacity: 0; transform: rotate(-30deg) scale(.85); } }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: var(--fs-xs); color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-tip { position: fixed; pointer-events: none; background: var(--text); color: var(--surface); font-size: var(--fs-xs); padding: 6px 10px; border-radius: 8px; z-index: 300; white-space: nowrap; box-shadow: var(--shadow); font-family: var(--font-mono); }

/* =========================== Login =========================== */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.login-art { position: relative; overflow: hidden; background: var(--sidebar-bg); color: var(--sidebar-text); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art h1 { font-size: 44px; max-width: 12ch; color: var(--sidebar-active-bg); }
[data-preset="bloom"] .login-art h1, [data-preset="studio"] .login-art h1 { color: var(--text); }
.login-art.has-illustration { background: var(--surface); color: var(--text); border-right: 1px solid var(--border); }
.login-art.has-illustration + .login-form { background: var(--surface-2); }
.login-art.has-illustration h1 { color: var(--text); max-width: 16ch; }
.login-art.has-illustration .login-eyebrow { color: var(--primary-ink); }
.login-illustration { width: 100%; max-height: 46vh; object-fit: contain; border-radius: var(--radius-lg); }
.login-art .brand-logo.has-img { width: 44px; height: 44px; }
.login-art.has-photo { background-color: #111; background-size: cover; background-position: center; color: #fff; }
.login-art.has-photo::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.3) 28%, rgba(0,0,0,.55) 50%, rgba(0,0,0,.85) 100%); }
.login-art.has-photo > * { position: relative; }
.login-art.has-photo h1, [data-preset] .login-art.has-photo h1 { color: #fff; text-shadow: 0 2px 18px rgba(0,0,0,.45); }
.login-art.has-photo .login-eyebrow { opacity: .9; }
@media (max-width: 860px) { .login-art.has-photo { display: flex; min-height: 220px; padding: 24px; gap: 16px; } .login-art.has-photo h1 { font-size: 26px; max-width: none; } .login-art.has-photo .xs { display: none; } }
.login-art .orb { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .9; animation: float 9s ease-in-out infinite; }
.login-form { display: grid; place-items: center; align-content: center; padding: 24px; }
.login .card { width: 100%; max-width: 400px; padding: 34px; animation: pop .6s var(--ease-spring); }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-art { display: none; } }
@media (max-width: 860px) {
  .login-art.has-illustration { display: flex; padding: 20px 20px 4px; gap: 12px; }
  .login-art.has-illustration h1 { font-size: 24px; max-width: none; }
  .login-art.has-illustration .login-illustration { max-height: 170px; }
  .login-art.has-illustration > .xs, .login-art.has-illustration .login-eyebrow { display: none; }
  .login-art.has-illustration { border-right: 0; border-bottom: 1px solid var(--border); }
}

/* =========================== Responsive =========================== */
@media (max-width: 1024px) { .global-search kbd { display: none; } }
@media (max-width: 860px) {
  :root { --pad: 16px; }
  .sidebar, [data-preset="bloom"] .sidebar { transform: translateX(-110%); box-shadow: var(--shadow-lg); width: 286px; inset: 0 auto 0 0; border-radius: 0; display: flex !important; }
  [data-layout="rail"] .sidebar { width: 286px; }
  [data-layout] .sidebar .brand-name, [data-layout] .sidebar .nav-section, [data-layout] .sidebar .sidebar-foot { display: revert; }
  [data-layout="rail"] .nav-item { flex-direction: row; font-size: var(--fs); text-align: left; justify-content: flex-start; padding: 9px 12px; gap: 12px; }
  [data-layout="rail"] .brand { justify-content: flex-start; padding: 0 20px; }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: color-mix(in srgb, #0b0805 45%, transparent); z-index: 35; animation: fade .3s; }
  .main, .app.collapsed .main, [data-layout] .main, [data-preset="bloom"] .main { margin-left: 0; }
  .app.collapsed .sidebar { width: 286px; }
  .app.collapsed .sidebar .label, .app.collapsed .nav-section, .app.collapsed .brand-name, .app.collapsed .sidebar-foot { display: revert; }
  .app.collapsed .nav-item { justify-content: flex-start; }
  .topnav, [data-layout] .topnav { display: none; }
  [data-layout] .topbar-brand { display: none; }
  [data-layout] #menuBtn { display: inline-flex; }
  .global-search, [data-layout] .global-search, .global-search:focus-within { width: auto; flex: 1; }
  .breadcrumb { display: none; }
  .bottom-nav { display: flex; position: fixed; left: 10px; right: 10px; bottom: 10px; height: 62px; padding: 0 4px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px);
    border: 1px solid var(--border); border-radius: calc(var(--radius-xl) + 4px); box-shadow: var(--shadow-lg); z-index: 30; margin-bottom: env(safe-area-inset-bottom); }
  .bottom-nav button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: var(--fs-micro); font-weight: 600; color: var(--text-2); cursor: pointer; transition: color .2s, transform .3s var(--ease-spring); }
  .bottom-nav button:active { transform: scale(.9); }
  .bottom-nav button.active { color: var(--primary-ink); }
  .bottom-nav button.active .icon { transform: translateY(-2px) scale(1.1); }
  .view { padding-bottom: 96px; }
  [data-layout="portal"] .view { padding-top: var(--pad); }
  .footer { padding-bottom: 92px; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  :root { --control-h: 44px; --control-h-sm: 40px; --cell-h: 40px; --touch: 44px; }
  .nav-item { min-height: var(--touch); }
  .input, .select, .textarea, .sel-btn, .sel-search, .date-text { font-size: 16px; } /* 16px stops iOS zooming into fields */
  .sel-pop { max-width: calc(100vw - 16px); }
  .kpis { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi { padding: 15px; gap: 10px; }
  .kpi-value, [data-preset] .kpi-value { font-size: 22px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .field.half { grid-column: 1 / -1; }
  .page-head h1, [data-layout="portal"] .page-head h1 { font-size: 26px; }
  .page-actions { margin-left: 0; width: 100%; }
  .modal { border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-height: 92vh; animation: sheetUp .5s var(--ease-out); }
  @keyframes sheetUp { from { transform: translateY(40%); opacity: 0; } }
  .overlay:not(.drawer) { align-items: flex-end; padding: 0; }
  .overlay.drawer { padding: 0; }
  .overlay.drawer .modal { max-width: 100%; height: 100vh; border-radius: 0; }
  .modal-foot { border-radius: 0; }
  .modal-foot .btn { flex: 1 1 auto; }
  .btn:not(.btn-icon) { white-space: normal; height: auto; min-height: var(--control-h); padding-block: 8px; line-height: 1.25; text-align: center; } /* long labels (other languages) wrap instead of being cut */
  .btn-sm:not(.btn-icon) { min-height: var(--control-h-sm); padding-block: 5px; } /* grow to fill, but wrap to a new row before a label gets cut */
  .toasts { left: 12px; right: 12px; bottom: 84px; }
  table.dt.cards thead { display: none; }
  table.dt.cards, table.dt.cards tbody, table.dt.cards tr, table.dt.cards td { display: block; width: 100%; }
  table.dt.cards tr { padding: 13px 16px; border-bottom: 1px solid var(--border); }
  table.dt.cards td { height: auto; padding: 3px 0; border: 0; max-width: none; display: flex; gap: 12px; white-space: normal; }
  table.dt.cards td::before { content: attr(data-label); flex: 0 0 38%; color: var(--muted); font-size: var(--fs-micro); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .06em; }
  table.dt.cards td.primary-cell { font-weight: 600; font-size: var(--fs-md); }
  table.dt.cards td.primary-cell::before, table.dt.cards td.actions::before { display: none; }
  table.dt.cards td.actions { justify-content: flex-end; }
  table.dt.cards td.num { text-align: left; justify-content: flex-start; } /* card rows: label left, value left — same as every other row */
  .dt-search { max-width: none; }
  .lines thead { display: none; }
  .lines tr.line { display: grid; grid-template-columns: 1fr 1fr; padding: 8px; border-bottom: 1px solid var(--border); }
  .lines tr.line td { border: 0; padding: 2px; }
  .lines tr.line td.desc { grid-column: 1 / -1; }
  .lines .drag { display: none; }
  .cal-day { min-height: 70px; padding: 4px; } .cal-item { font-size: var(--fs-micro); padding: 2px 4px; }
  .board { grid-auto-columns: 82%; scroll-snap-type: x mandatory; } .board-col { scroll-snap-align: start; }
}
/* =========================== Personal display options (user prefs; never change the brand) =========================== */
html[data-text="large"] { --fs-scale: 1.125; --control-h: 44px; --row-h: 54px; }
html[data-text="larger"] { --fs-scale: 1.25; --control-h: 48px; --control-h-sm: 38px; --row-h: 58px; }
html[data-contrast="high"][data-theme][data-preset] {
  --text-2: color-mix(in srgb, var(--text) 90%, var(--surface));
  --muted: color-mix(in srgb, var(--text) 78%, var(--surface));
  --border: color-mix(in srgb, var(--text) 32%, var(--surface));
  --border-strong: color-mix(in srgb, var(--text) 55%, var(--surface));
  --sidebar-muted: var(--sidebar-text);
  --ring: color-mix(in srgb, var(--primary) 60%, transparent);
  --bg-pattern: none;
}
html[data-contrast="high"] :focus-visible { outline-width: 3px; outline-offset: 3px; }
html[data-contrast="high"] .card, html[data-contrast="high"] .kpi { box-shadow: none; border: 1px solid var(--border-strong); }

/* theme switch: circular reveal (View Transitions API) */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: vtReveal .7s var(--ease-out); }
@keyframes vtReveal { from { clip-path: circle(0 at var(--vt-x, 90%) var(--vt-y, 30px)); } to { clip-path: circle(150vmax at var(--vt-x, 90%) var(--vt-y, 30px)); } }
@media print {
  .sidebar, .topbar, .bottom-nav, .footer, .page-actions, .dt-toolbar, .dt-foot, .btn, #__previewBar { display: none !important; }
  .main { margin: 0 !important; } .card { box-shadow: none; } body { background: #fff; }
}

/* =========================== Themed controls (Js_Controls) =========================== */
.sel, .date { position: relative; width: 100%; min-width: 0; }
.sel-native { position: absolute !important; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
.sel-btn { display: flex; align-items: center; gap: var(--sp-2); padding-right: var(--chev-inset); text-align: left; cursor: pointer; line-height: 1.2; }
.sel-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-btn.placeholder .sel-value { color: var(--muted); }
.sel-chev, .date-icon { flex: none; display: grid; place-items: center; width: var(--icon-size-sm); height: var(--icon-size-sm); color: var(--muted); transition: transform .3s var(--ease-spring), color .2s; }
.sel.open .sel-chev { transform: rotate(180deg); color: var(--primary-ink); }
.sel-btn:hover .sel-chev { color: var(--text-2); }
.sel-sm { width: auto; min-width: 84px; } .sel-sm .sel-btn { height: var(--control-h-sm); font-size: var(--fs-sm); padding-left: 10px; padding-right: 10px; }
.sel-pop { position: fixed; z-index: var(--z-pop); background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: var(--sp-1); display: flex; flex-direction: column; overflow: hidden; animation: popIn .18s var(--ease-out); transform-origin: top center; font-size: var(--fs); }
.sel-pop.up { transform-origin: bottom center; }
.sel-pop.out { animation: popOut .14s ease forwards; }
@keyframes popIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes popOut { to { opacity: 0; transform: translateY(-4px) scale(.98); } }
.sel-search-wrap { position: relative; display: flex; align-items: center; padding: var(--sp-1); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-1); }
.sel-search-wrap .icon { position: absolute; left: calc(var(--sp-1) + 10px); color: var(--muted); }
.sel-search { width: 100%; height: var(--control-h-sm); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 10px 0 34px; background: var(--surface-2); color: var(--text); font: inherit; }
.sel-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.sel-list { overflow-y: auto; overscroll-behavior: contain; min-height: 0; flex: 1; }
.sel-opt { display: flex; align-items: center; gap: var(--sp-2); min-height: 36px; padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; transition: background .12s; }
.sel-opt.active { background: var(--surface-hover); }
.sel-opt[aria-selected="true"] { font-weight: 600; color: var(--primary-ink); }
.sel-opt[aria-selected="true"] .icon { color: var(--primary-ink); }
.sel-opt.placeholder { color: var(--muted); }
.sel-opt[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.sel-empty { padding: 12px; color: var(--muted); font-size: var(--fs-sm); text-align: center; }
.date { cursor: pointer; }
.date-text { padding-right: calc(var(--chev-inset) + var(--icon-size-sm) + 10px); cursor: pointer; }
.date-text:focus { cursor: text; }
.date-icon { position: absolute; right: var(--chev-inset); top: 50%; margin-top: calc(var(--icon-size-sm) / -2); pointer-events: none; }
.date.open .date-icon { color: var(--primary-ink); }
.date.bad .date-text { border-color: var(--danger); }
.date.disabled, .sel.disabled { cursor: not-allowed; }
.sel-pop.dp { width: 320px; min-width: 0 !important; padding: var(--sp-3); gap: var(--sp-2); }
.dp-head { display: flex; align-items: center; gap: var(--sp-2); }
.dp-title { flex: 1; text-align: center; font-weight: 700; font-size: var(--fs); }
.dp-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.dp-grid th { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); padding: 4px 0 6px; text-align: center; }
.dp-grid td { padding: 1px; text-align: center; }
.dp-day { width: 100%; aspect-ratio: 1; max-height: 38px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); font: inherit; font-size: var(--fs-sm); cursor: pointer; font-variant-numeric: tabular-nums;
  transition: background .12s, color .12s, transform .2s var(--ease-spring); }
.dp-day:hover { background: var(--surface-hover); }
.dp-day:active { transform: scale(.92); }
.dp-day.out { color: var(--muted); opacity: .6; }
.dp-day.today { box-shadow: inset 0 0 0 1px var(--border-strong); font-weight: 700; }
.dp-day.selected { background: var(--primary); color: var(--on-primary); font-weight: 700; box-shadow: none; }
.dp-day:disabled { opacity: .3; cursor: not-allowed; text-decoration: line-through; }
.dp-day:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.dp-foot { display: flex; align-items: center; gap: var(--sp-2); justify-content: flex-end; border-top: 1px solid var(--border); padding-top: var(--sp-2); }
.dp-time-wrap { display: flex; align-items: center; gap: var(--sp-2); margin-right: auto; color: var(--muted); }
.dp-time { width: 76px; height: var(--control-h-sm); line-height: var(--control-h-sm); text-align: center; font-variant-numeric: tabular-nums; padding: 0 8px; }

/* Global progress bar for in-flight server calls (App.api) */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: var(--z-progress); pointer-events: none; opacity: 0; transition: opacity .2s; overflow: hidden; }
.progress.on { opacity: 1; }
.progress::after { content: ""; position: absolute; top: 0; bottom: 0; width: 40%; background: var(--primary); border-radius: 3px; animation: progress 1.1s var(--ease-out) infinite; }
@keyframes progress { from { left: -40%; } to { left: 100%; } }

/* Small utilities — use these instead of inline styles */
.m-0 { margin: 0; } .mt-1 { margin-top: var(--sp-1); } .mb-3 { margin-bottom: var(--sp-3); } .mb-4 { margin-bottom: var(--sp-4); } .spacer-4 { height: var(--sp-4); }
.items-start { align-items: flex-start; } .min-0 { min-width: 0; } .strong { font-weight: 600; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--text); cursor: pointer; text-align: left; max-width: 100%; }
.link-btn:hover { color: var(--primary-ink); text-decoration: underline; text-underline-offset: 3px; }
.empty-text { margin: 0 0 var(--sp-4); }
.board-empty { padding: 10px 6px; }
.file-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
.file-row.inactive { opacity: .6; }
.file-icon { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: var(--radius); background: var(--primary-50); color: var(--primary-ink); }
.preset-tile { padding: 0; text-align: left; cursor: pointer; overflow: hidden; }
.preset-tile.selected { outline: 2px solid var(--primary); outline-offset: 2px; }
.preset-mini { height: 92px; display: flex; background: var(--tile-bg); border-bottom: 1px solid var(--border); }
.preset-mini-side { width: 30%; background: var(--tile-side); display: grid; gap: 5px; align-content: start; padding: 12px 8px; }
.preset-mini-side span { height: 5px; border-radius: 3px; background: rgba(127,127,127,.35); }
.preset-mini-side span.accent { height: 6px; width: 70%; background: var(--tile-accent); }
.preset-mini-side span.short { width: 80%; }
.preset-mini-main { flex: 1; padding: 12px; color: var(--tile-ink); font-family: var(--tile-font); font-size: 30px; font-weight: 600; line-height: 1; display: flex; align-items: flex-end; justify-content: space-between; }
.preset-mini-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--tile-accent); box-shadow: 0 0 0 3px var(--tile-bg), 0 0 0 4px rgba(127,127,127,.3); }
.preset-tile-body { padding: 12px 14px; }
.preset-tile-name { font-weight: 700; display: flex; align-items: center; gap: var(--sp-2); }
@media (prefers-reduced-motion: reduce) { .progress::after { animation-duration: 3s; } }
.avatar-lg { width: 56px; height: 56px; font-size: var(--fs-lg); }
.profile-name { font-weight: 700; font-size: var(--fs-lg); }
.login-form h2 { font-size: var(--fs-xl); }
.swatch-dot { width: 14px; height: 14px; border-radius: 4px; display: inline-block; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
/* menus, profile, settings tiles */
.menu-head { padding: var(--sp-3) 14px; border-bottom: 1px solid var(--border); }
.menu-foot { padding: var(--sp-2); }
.menu-user { padding: var(--sp-2) 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-empty { padding: 10px; }
.w-full { width: 100%; } .mt-2 { margin-top: var(--sp-2); } .mt-4 { margin-top: var(--sp-4); } .gap-4 { gap: var(--sp-4); }
.notif .dot.read { background: transparent; animation: none; }
.lines-empty { padding: 14px; }
td[data-cell="line"] { padding: 10px; }
.layout-tile { padding: var(--sp-3); text-align: left; cursor: pointer; color: var(--text); }
.layout-tile.selected { outline: 2px solid var(--primary); outline-offset: 2px; }
.layout-tile-name { font-weight: 700; margin-top: 10px; }
.tiles-lg { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.tiles-md { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.login-eyebrow { color: inherit; opacity: .7; margin-bottom: 14px; }
.kpi, .kpi > * { min-width: 0; } /* lets App.fitText shrink long KPI numbers instead of spilling out */
.hex-field { display: flex; gap: var(--sp-2); align-items: center; }
.hex-swatch { width: var(--control-h); height: var(--control-h); flex: none; padding: 3px; border: 1px solid var(--border-strong); border-radius: var(--input-radius); background: var(--surface); cursor: pointer; }
.hex-swatch::-webkit-color-swatch-wrapper { padding: 0; } .hex-swatch::-webkit-color-swatch { border: 0; border-radius: calc(var(--input-radius) - 3px); }
.hex-text { font-family: var(--font-mono); text-transform: uppercase; }
.hex-text::placeholder { text-transform: none; font-family: var(--font-body); }
.hex-swatch.is-empty::-webkit-color-swatch { background: repeating-linear-gradient(45deg, var(--surface-2) 0 4px, var(--surface) 4px 8px) !important; }
.hex-swatch.is-empty::-moz-color-swatch { background: repeating-linear-gradient(45deg, var(--surface-2) 0 4px, var(--surface) 4px 8px) !important; }
/* =========================== Brand theme studio (Js_ThemeStudio) =========================== */
.ts-tile { padding: 0; overflow: hidden; }
.ts-tile.selected { outline: 2px solid var(--primary); outline-offset: 2px; }
.ts-tile-top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-3); min-height: 72px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.ts-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.ts-swatches span { width: 28px; height: 28px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12), 0 0 0 2px var(--surface); }
.ts-preset span:nth-child(1) { background: var(--primary); } .ts-preset span:nth-child(2) { background: var(--sidebar-bg); } .ts-preset span:nth-child(3) { background: var(--bg); }
.ts-assign { border-top: 1px solid var(--border); padding-top: var(--sp-4); }
.ts-builder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--sp-6); align-items: start; }
.ts-right { position: sticky; top: 0; }
.ts-import { border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); padding: var(--sp-4); }
.ts-paste { min-height: 64px; }
.ts-found { display: grid; gap: 6px; }
.ts-found-row { display: flex; align-items: center; gap: var(--sp-2); }
.ts-chip { width: 24px; height: 24px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.ts-preview { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--font-body); transition: background .3s, color .3s; }
.ts-mock { display: grid; grid-template-columns: 150px minmax(0, 1fr); min-height: 320px; }
.ts-mock-side { background: var(--sidebar-bg); color: var(--sidebar-text); padding: var(--sp-3); display: grid; align-content: start; gap: 4px; border-right: 1px solid var(--sidebar-border); }
.ts-mock-brand { display: flex; align-items: center; gap: var(--sp-2); font-family: var(--font-display); font-weight: 700; margin-bottom: var(--sp-2); }
.ts-mock-brand .brand-logo { width: 26px; height: 26px; font-size: var(--fs-xs); }
.ts-mock-side .nav-section { padding: var(--sp-2) 6px 2px; }
.ts-mock-nav { display: flex; align-items: center; gap: var(--sp-2); padding: 7px 10px; border-radius: var(--radius-sm); font-size: var(--fs-sm); }
.ts-mock-nav.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); font-weight: 600; }
.ts-mock-main { padding: var(--sp-4); display: grid; gap: 10px; align-content: start; }
.ts-mock-title { font-family: var(--font-display); font-size: var(--fs-lg); }
.ts-mock-row { display: flex; gap: 10px; align-items: center; }
.ts-mock-row .input { flex: 1; min-width: 0; }
.ts-mock-kpi { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 10px 12px; }
.ts-mock-num { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 700; }
.ts-mock-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-3); display: grid; gap: 6px; }
.ts-mock-bars { display: flex; align-items: flex-end; gap: 6px; height: 64px; }
.ts-mock-bars span { flex: 1; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.ts-score { display: grid; gap: var(--sp-2); }
.ts-score-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.ts-score-head .icon { color: var(--success); }
.ts-score-list { list-style: none; margin: var(--sp-2) 0 0; padding: 0; display: grid; }
.ts-score-list li { display: flex; align-items: center; gap: var(--sp-2); padding: 6px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.ts-score-list li .icon { color: var(--success); }
.ts-adj { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.ts-adj i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
details summary { cursor: pointer; color: var(--text-2); }
@media (max-width: 860px) { .ts-builder { grid-template-columns: 1fr; } .ts-right { position: static; } .ts-mock { grid-template-columns: 1fr; } .ts-mock-side { display: none; } }
.empty-cell { height: auto; }
input[type=checkbox]:not(.switch input) { accent-color: var(--primary); width: 16px; height: 16px; }
.menu.menu-wide { min-width: 280px; max-width: min(360px, calc(100vw - 16px)); }
.menu-list { max-height: 60vh; overflow-y: auto; display: grid; gap: 2px; }
.menu-row { display: flex; align-items: center; gap: 4px; }
.menu-row .menu-item { min-width: 0; }
.col-row { padding: 2px 4px 2px 10px; }
.col-row .check { font-size: var(--fs-sm); padding: 6px 0; }
.menu-pad { padding: 6px 10px 4px; }
.dt th .arrow .icon { vertical-align: -3px; }
.dash-edit-list { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.dash-edit-row { display: flex; align-items: center; gap: 4px; padding: 4px 8px 4px 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.dash-edit-row:last-child { border-bottom: 0; }
.dash-edit-row.off { background: var(--surface-2); color: var(--muted); }
.dash-edit-row .check { padding: 6px 0; }
.code-chip { font-family: var(--font-mono); font-size: var(--fs-xs); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1px 6px; color: var(--text-2); }
/* =========================== Right-to-left languages (html[dir="rtl"], set by Js_I18n) =========================== */
[dir="rtl"] .sidebar { inset: 0 0 0 auto; border-right: 0; border-left: 1px solid var(--sidebar-border); }
[dir="rtl"][data-preset="bloom"] .sidebar { inset: 12px 12px 12px auto; }
[dir="rtl"] .main { margin-left: 0; margin-right: var(--sidebar-w); }
[dir="rtl"] .app.collapsed .main, [dir="rtl"][data-layout="rail"] .main { margin-left: 0; margin-right: var(--rail-w); }
[dir="rtl"][data-preset="bloom"] .main { margin-left: 0; margin-right: calc(var(--sidebar-w) + 12px); }
[dir="rtl"][data-preset="bloom"][data-layout="rail"] .main { margin-left: 0; margin-right: calc(var(--rail-w) + 12px); }
[dir="rtl"][data-layout="topbar"] .main, [dir="rtl"][data-layout="portal"] .main { margin-right: 0; }
[dir="rtl"] .right, [dir="rtl"] .page-actions, [dir="rtl"] .global-search, [dir="rtl"] .pager, [dir="rtl"] .alert button, [dir="rtl"] .board-col-head .count, [dir="rtl"] .record-hero .amount { margin-left: 0; margin-right: auto; }
[dir="rtl"] .nav-item, [dir="rtl"] .dt th, [dir="rtl"] .lines th, [dir="rtl"] .board-card, [dir="rtl"] .cal-item, [dir="rtl"] .menu-item, [dir="rtl"] .sel-btn, [dir="rtl"] .link-btn { text-align: right; }
[dir="rtl"] .dt td.num, [dir="rtl"] .dt th.num, [dir="rtl"] .lines .num, [dir="rtl"] .record-hero .amount { text-align: left; }
[dir="rtl"] .btn-primary::after { transform: translateX(120%); } [dir="rtl"] .btn-primary:hover::after { transform: translateX(-120%); } /* the shine waits on the overflow side that does not scroll */
[dir="rtl"] table.dt.cards td.num { text-align: right; } /* card rows follow the reading start like every other row */
[dir="rtl"] .global-search .icon, [dir="rtl"] .dt-search .icon { left: auto; right: 12px; }
[dir="rtl"] .global-search input, [dir="rtl"] .dt-search input { padding-left: 12px; padding-right: 36px; }
[dir="rtl"] .global-search kbd { right: auto; left: 8px; }
[dir="rtl"] .input-group .prefix { left: auto; right: 13px; }
[dir="rtl"] .input-group .input { padding-left: var(--control-px); padding-right: 46px; }
[dir="rtl"] .select { padding-right: var(--control-px); padding-left: calc(var(--chev-inset) + var(--icon-size-sm) + 10px); background-position: left var(--chev-inset) center; }
[dir="rtl"] .sel-btn { padding-right: var(--control-px); padding-left: var(--chev-inset); }
[dir="rtl"] .date-text { padding-right: var(--control-px); padding-left: calc(var(--chev-inset) + var(--icon-size-sm) + 10px); }
[dir="rtl"] .date-icon { right: auto; left: var(--chev-inset); }
[dir="rtl"] .field .req { margin-left: 0; margin-right: 3px; }
[dir="rtl"] .dt th .arrow { margin-left: 0; margin-right: 4px; }
[dir="rtl"] .switch span::after { left: auto; right: 3px; }
[dir="rtl"] .switch input:checked + span::after { transform: translateX(-18px); }
[dir="rtl"] .timeline li::before { left: auto; right: 6px; } [dir="rtl"] .timeline li::after { left: auto; right: 1px; }
[dir="rtl"] .timeline li { padding: 0 26px 18px 0; }
[dir="rtl"] .toasts { right: auto; left: 20px; }
[dir="rtl"][data-preset="ledger"] .kpi { border-left: 0; border-right: 3px solid var(--primary); }
[dir="rtl"] .menu-item:hover { padding-left: 11px; padding-right: 14px; }
[dir="rtl"] .i-chevron-right, [dir="rtl"] .i-chevron-left, [dir="rtl"] .i-arrow, [dir="rtl"] .i-logout { transform: scaleX(-1); }
[dir="rtl"] .nav-item:hover .icon { transform: translateX(-2px) rotate(4deg); }
@media (max-width: 860px) {
  [dir="rtl"] .sidebar, [dir="rtl"][data-preset="bloom"] .sidebar { transform: translateX(110%); inset: 0 0 0 auto; }
  [dir="rtl"] .app.nav-open .sidebar { transform: none; }
  [dir="rtl"] .main, [dir="rtl"] .app.collapsed .main, [dir="rtl"][data-layout] .main, [dir="rtl"][data-preset="bloom"] .main { margin-right: 0; }
}
.card-head .right.row, .card-head .right { flex-wrap: wrap; justify-content: flex-end; }
/* ---------- Offline app: sync status + "needs your choice" (Js_Offline; only shown in the installed app) ---------- */
.sync-chip { gap: 6px; padding: 0 10px; white-space: nowrap; font-size: var(--fs-sm); }
.sync-chip .icon { width: var(--icon-size-sm); height: var(--icon-size-sm); }
.sync-chip.sync-ok .icon { color: var(--success); }
.sync-chip.sync-warning { color: var(--warning); background: var(--warning-bg); }
.sync-chip.sync-info { color: var(--info); background: var(--info-bg); }
.sync-chip.is-syncing .icon { animation: spin 1s linear infinite; }
@media (prefers-reduced-motion: reduce) { .sync-chip.is-syncing .icon { animation: none; } }
@media (max-width: 860px) { .sync-chip { width: var(--control-h); padding: 0; justify-content: center; } .sync-chip .sync-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }
.sync-summary { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--sp-4); }
@media (max-width: 640px) { .sync-summary { grid-template-columns: 1fr; } }
.sync-problem { gap: var(--sp-3); padding: var(--sp-4); }
.sync-problem-head { align-items: flex-start; }
.sync-actions { justify-content: flex-end; flex-wrap: wrap; }
.sync-diff td { vertical-align: middle; }
@media (max-width: 480px) { .topbar:has(.sync-chip) #themeBtn { display: none; } } /* room for search on small phones; light/dark stays in My profile */
.sync-pick { display: flex; align-items: center; gap: 8px; cursor: pointer; min-height: var(--touch); overflow-wrap: anywhere; }
.sync-pick input { accent-color: var(--primary); flex: none; }
.sync-storage { display: grid; gap: var(--sp-1); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.sync-storage.is-risk { border-color: color-mix(in srgb, var(--warning) 35%, var(--border)); background: var(--warning-bg); }
.install-steps { margin: 0; padding-left: 1.4em; display: grid; gap: var(--sp-2); }
[dir="rtl"] .install-steps { padding-left: 0; padding-right: 1.4em; }
.overlay.lock-screen { backdrop-filter: blur(8px); background: color-mix(in srgb, var(--bg) 88%, transparent); }

/* ---------------- NFS Content OS: filters, approvals, progress stepper, budget exports, preview ---------------- */
.nfs-filters { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.nfs-filter { width: 240px; max-width: 100%; }
.nfs-act { text-align: right; white-space: nowrap; }
.brand-dot { width: 10px; height: 10px; border-radius: 99px; flex: none; display: inline-block; }
.stage-sum { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.stage-chip { display: inline-flex; align-items: center; gap: var(--sp-2); padding: var(--sp-1) var(--sp-3) var(--sp-1) var(--sp-1); border: 1px solid var(--border); border-radius: 99px; background: var(--surface); font-size: var(--fs-sm); }
.progress-list { list-style: none; margin: 0; padding: 0; }
.progress-row { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(0, 2fr); gap: var(--sp-4); align-items: center; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); cursor: pointer; min-height: var(--touch); }
.progress-row:last-child { border-bottom: 0; }
.progress-row:hover { background: var(--surface-hover); }
.progress-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.progress-main { min-width: 0; display: flex; flex-direction: column; gap: var(--sp-1); }
.progress-main strong { overflow-wrap: anywhere; }
.progress-steps { min-width: 0; display: flex; align-items: center; gap: var(--sp-3); }
.step-now { display: none; }
.stepper { list-style: none; margin: 0; padding: 0; display: flex; flex: 1; min-width: 0; }
.step { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); color: var(--muted); font-size: var(--fs-micro); text-align: center; }
.step::before { content: ''; position: absolute; top: 5px; left: -50%; right: 50%; height: 2px; background: var(--border); }
.step:first-child::before { display: none; }
.step-dot { width: 12px; height: 12px; border-radius: 99px; border: 2px solid var(--border-strong); background: var(--surface); position: relative; z-index: 1; }
.step-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.step.done .step-dot { background: var(--success); border-color: var(--success); }
.step.done::before, .step.current::before, .step.warn::before { background: var(--success); }
.step.current { color: var(--text); font-weight: 600; }
.step.current .step-dot { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-50); }
.step.warn { color: var(--text); font-weight: 600; }
.step.warn .step-dot { background: var(--warning); border-color: var(--warning); }
.export-row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; padding-bottom: var(--sp-3); border-bottom: 1px solid var(--border); }
.preview-links { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.preview-caption { white-space: pre-wrap; margin-bottom: var(--sp-4); padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-3); }
.media-tile { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.media-frame { aspect-ratio: 4 / 5; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.media-frame img, .media-frame video { width: 100%; height: 100%; object-fit: contain; display: block; background: var(--surface-2); }
/* AI assistant */
.ai-review .ai-row { display: grid; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.ai-review .ai-row:last-child { border-bottom: 0; }
.ai-label { font-weight: 600; }
.ai-list { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: var(--fs-sm); color: var(--text-2); }
.ai-block { display: grid; gap: 6px; }
.ai-hook { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); font-size: var(--fs-sm); }
.ai-picks { display: grid; gap: 8px; }
.ai-beats td { vertical-align: top; white-space: normal; max-width: none; height: auto; padding-block: 8px; }
.ai-pick input[type=radio] { margin-top: 4px; accent-color: var(--primary); }
.ai-pick { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.ai-pick:hover { border-color: var(--border-strong); }
.ai-pick-title { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 2px; }
.ai-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.ai-step { position: relative; display: grid; gap: 4px; justify-items: start; text-align: left; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; transition: border-color .2s, transform .2s var(--ease-out); min-height: 44px; }
.ai-step:hover { border-color: var(--primary); transform: translateY(-2px); }
.ai-step .icon { color: var(--primary-ink); }
.ai-step-num { position: absolute; top: 10px; right: 12px; font-family: var(--font-mono); font-size: var(--fs-micro); color: var(--muted); }
.ai-step-title { font-weight: 700; font-family: var(--font-display); }
.ai-quick-btn { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: none; color: var(--text); font: inherit; cursor: pointer; min-height: 44px; }
.ai-quick-btn:hover { border-color: var(--primary); background: var(--primary-50); }
.ai-quick-btn span { display: grid; gap: 2px; }
@media (max-width: 860px) { .ai-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* AI studio steps act as start buttons */
.ai-step-go { color: var(--primary-ink); display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.ai-step:hover .ai-step-go .icon { transform: translateX(3px); }

/* Feedback pinned on previews */
.media-tile.fb-tile { position: relative; }
.fb-layer { position: absolute; left: 0; right: 0; top: 0; aspect-ratio: 4 / 5; pointer-events: none; }
.media-frame.fb-target { cursor: crosshair; }
.fb-pin { position: absolute; transform: translate(-50%, -50%); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--on-primary);
  font-size: var(--fs-micro); font-weight: 700; box-shadow: 0 0 0 3px color-mix(in srgb, var(--surface) 85%, transparent), var(--shadow-sm); cursor: default; pointer-events: auto; }
.fb-pin.done { background: var(--success); }
.fb-video-bar { padding: 6px 10px; border-top: 1px solid var(--border); }
.fb-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.fb-item.done { opacity: .6; }
.fb-num { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-50); color: var(--primary-ink); font-size: var(--fs-micro); font-weight: 700; }

/* Workload */
.wl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.wl-count { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 700; }
.wl-count.danger { color: var(--danger); } .wl-count.warning { color: var(--warning); } .wl-count.ok { color: var(--success); }
.wl-bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.wl-bar span { display: block; height: 100%; border-radius: 99px; }
.wl-bar .danger { background: var(--danger); } .wl-bar .warning { background: var(--warning); } .wl-bar .ok { background: var(--success); }
.wl-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.wl-list { gap: 2px; margin-inline: -8px; }
.wl-item { display: flex; flex-direction: column; gap: 1px; width: 100%; min-height: 44px; justify-content: center; text-align: left; padding: 6px 8px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); font: inherit; cursor: pointer; }
.wl-item:hover { background: var(--surface-2); }
.wl-title { font-weight: 600; color: var(--primary-ink); }
.wl-late { color: var(--danger); }

/* Asset library */
.asset-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.asset-bar .sel { width: auto; min-width: 180px; }
@media (max-width: 600px) { .asset-bar .sel { flex: 1 1 140px; min-width: 0; } }
.asset-bar .dt-search { flex: 1 1 260px; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.asset-tile { display: grid; gap: 6px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; cursor: pointer; text-align: left; font: inherit; color: var(--text); transition: transform .2s var(--ease-out), border-color .2s; }
.asset-tile:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.asset-meta { display: grid; gap: 1px; padding: 0 10px 10px; min-width: 0; }
.asset-view { aspect-ratio: auto; min-height: 280px; max-height: 70vh; }
@media (max-width: 600px) { .asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* First-time tour */
.tour { display: grid; gap: 14px; justify-items: start; }
.tour-icon { width: 52px; height: 52px; border-radius: var(--radius); display: grid; place-items: center; background: var(--primary-50); color: var(--primary-ink); }
.tour-dots { display: flex; gap: 6px; }
.tour-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.tour-dots span.on { background: var(--primary); width: 18px; border-radius: 99px; }

/* Board cards with media (Content, Shoots) */
.bc-media { display: grid; gap: 4px; margin: -4px -5px 2px; border-radius: calc(var(--radius) - 3px); overflow: hidden; }
.bc-media.loading { aspect-ratio: 16 / 10; background: linear-gradient(90deg, var(--surface-2), var(--surface-hover), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.bc-media.n1 { grid-template-columns: 1fr; } .bc-media.n2 { grid-template-columns: 1fr 1fr; }
.bc-media.bc-link { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: var(--surface-2); color: var(--muted); font-size: var(--fs-xs); margin: 0; border-radius: var(--radius-sm); }
.bc-tile { position: relative; aspect-ratio: 4 / 5; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.bc-media.n1 .bc-tile { aspect-ratio: 16 / 10; }
.bc-tile img, .bc-tile video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.bc-ph { color: var(--muted); display: grid; place-items: center; }
.bc-play { position: absolute; left: 8px; bottom: 8px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--text) 70%, transparent); color: var(--surface); }
.bc-more { position: absolute; right: 8px; bottom: 8px; padding: 1px 8px; border-radius: 99px; background: color-mix(in srgb, var(--text) 70%, transparent); color: var(--surface); font-size: var(--fs-micro); font-weight: 700; }
.bc-text { color: var(--text-2); font-size: var(--fs-sm); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.bc-tag { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; font-size: var(--fs-micro); font-weight: 600; line-height: 18px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-tag-a { background: color-mix(in srgb, var(--info) 16%, var(--surface)); color: color-mix(in srgb, var(--info) 80%, var(--text)); }
.bc-tag-b { background: color-mix(in srgb, var(--success) 16%, var(--surface)); color: color-mix(in srgb, var(--success) 75%, var(--text)); }
.bc-tag-c { background: color-mix(in srgb, var(--warning) 20%, var(--surface)); color: color-mix(in srgb, var(--warning) 55%, var(--text)); }
.media-frame { position: relative; }
.media-frame .media-open { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); }
.media-tile figcaption { display: flex; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); overflow-wrap: anywhere; }
@media (max-width: 860px) {
  .progress-row { grid-template-columns: 1fr; gap: var(--sp-2); }
  .stepper .step-label { display: none; }
  .step-now { display: inline-flex; flex: none; }
  .nfs-filter { width: 100%; }
  .dt.cards td.nfs-act { text-align: left; }
}
@media (min-width: 861px) {
  .lines { overflow-x: auto; }
  .lines td.desc { min-width: 200px; }
}
/* Phones: compact list toolbar, page head and list cards (after the 860px rules so these win) */
@media (max-width: 600px) {
  .dt-col-btn { display: none; } /* phone lists are cards: no columns to choose */
  /* phone list cards: two short columns (label above value) instead of one long column */
  table.dt.cards tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; row-gap: 6px; position: relative; padding: 12px 14px; }
  table.dt.cards td { flex-direction: column; align-items: flex-start; gap: 1px; padding: 0; min-width: 0; overflow-wrap: anywhere; }
  table.dt.cards td::before { flex: none; }
  table.dt.cards td.primary-cell { grid-column: 1 / -1; padding-right: 40px; }
  table.dt.cards td.actions { position: absolute; top: 8px; right: 8px; width: auto; padding: 0; }
  table.dt.cards td.dt-updated { display: none; }
  .page-head { gap: 12px; margin-bottom: 16px; }
  .page-actions { gap: 8px; }
  .page-actions > .pa-icon { width: var(--control-h); min-width: var(--control-h); padding: 0; gap: 0; justify-content: center; }
  .page-actions > .pa-icon .pa-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .page-actions > .btn-primary { flex: 1 1 100%; justify-content: center; }
}

/* ---------------- Brand mascots (Js_Mascot) ---------------- */
.mascot-stage { position: fixed; left: 16px; bottom: 20px; z-index: 190; display: flex; align-items: flex-end; gap: var(--sp-2); pointer-events: none;
  opacity: 0; transform: translateY(24px) scale(.9); transition: opacity .25s var(--ease-out), transform .45s var(--ease-spring); }
.mascot-stage.show { opacity: 1; transform: none; }
.mascot-stage.is-phone { left: auto; right: 8px; bottom: auto; top: calc(var(--topbar-h) + 6px); align-items: center; }
.mascot-hit { pointer-events: auto; border: 0; padding: 0; background: none; cursor: pointer; border-radius: var(--radius-lg); line-height: 0; position: relative; order: -1; }
.mascot-stage.is-phone .mascot-hit { order: 1; }
.mascot-hit:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.mascot-sprite { background-repeat: no-repeat; background-position: 0 0; image-rendering: auto; filter: drop-shadow(0 6px 10px rgba(0,0,0,.18)); }
.mascot-bubble { pointer-events: auto; position: relative; max-width: 240px; margin-bottom: 46px; padding: 8px 12px; border-radius: var(--radius-lg); background: var(--surface);
  color: var(--text); border: 1px solid color-mix(in srgb, var(--mascot-accent, var(--primary)) 40%, var(--border)); box-shadow: var(--shadow); font-size: var(--fs-sm); line-height: 1.35; }
.mascot-bubble b { color: var(--mascot-accent, var(--primary-ink)); font-weight: 700; }
.mascot-stage.is-phone .mascot-bubble { margin-bottom: 0; max-width: calc(100vw - 120px); }
.mascot-confetti { position: absolute; left: 52px; bottom: 60px; width: 0; height: 0; pointer-events: none; }
.mascot-stage.is-phone .mascot-confetti { left: auto; right: 38px; bottom: 30px; }
.mascot-confetti i { position: absolute; width: 7px; height: 11px; border-radius: 2px; opacity: 0; animation: mascotConfetti 1.2s var(--ease-out) forwards; }
@keyframes mascotConfetti { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--r)); } }
[data-motion="off"] .mascot-stage { transition: opacity .15s linear; transform: none; }
[data-motion="off"] .mascot-confetti { display: none; }
.mascot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--sp-3); margin-top: var(--sp-3); }
.mascot-cell { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: var(--sp-2); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2);
  color: var(--text-2); cursor: pointer; font: inherit; text-transform: capitalize; min-height: 44px; }
.mascot-cell:hover { border-color: var(--primary); color: var(--text); }
.mascot-cell:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.mascot-cell-art { width: 96px; height: 96px; display: grid; place-items: center; color: var(--text-2); }
@media print { .mascot-stage { display: none; } }

/* ---------------- Install app (Js_Install) ---------------- */
.install-steps-pic { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); }
.install-step { display: grid; grid-template-columns: 26px 40px 1fr; align-items: center; gap: var(--sp-3); padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); }
.install-step-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: var(--fs-xs); }
.install-step-ic { width: 40px; height: 40px; border-radius: var(--radius); display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--primary-ink); }
.install-step-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: var(--fs-sm); overflow-wrap: anywhere; }
.install-login { display: flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-2); padding-top: var(--sp-4); border-top: 1px solid var(--border); }
.install-login-ic { width: 36px; height: 36px; flex: none; border-radius: var(--radius); display: grid; place-items: center; background: var(--primary-50); color: var(--primary-ink); }

/* ======================================================================
   North Bound Content additions: hub tabs, More details, growing textareas,
   Overview / Calendar, sign-in mockup panel, signatures. Tokens only.
   ====================================================================== */
h1.sr-only { font-size: var(--fs-xl); }
/* sidebar fits 1280×720: compact items, no scroll */
[data-preset="northbound"] .nav { padding: 6px 12px 10px; }
[data-preset="northbound"] .nav-item { padding: 8px 12px; font-weight: 600; }
[data-preset="northbound"] .nav-group-gap { height: 4px; }
[data-preset="northbound"] .nav-section { padding-top: 10px; padding-bottom: 4px; }
[data-preset="northbound"] .sidebar-foot { padding-top: 8px; padding-bottom: 8px; }
/* hub tab strip */
.hub-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 var(--sp-5); padding: 4px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); width: fit-content; max-width: 100%; }
.hub-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 14px; border: 0; border-radius: var(--radius); background: transparent; color: var(--text-2); font-weight: 600; cursor: pointer; transition: background .15s, color .15s; }
.hub-tab:hover { background: var(--surface-hover); color: var(--text); }
.hub-tab.active { background: var(--primary-50); color: var(--primary-ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 30%, transparent); }
.hub-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (max-width: 600px) { .hub-tabs { width: 100%; } .hub-tab { flex: 1 1 auto; justify-content: center; padding: 6px 10px; } }
@media (pointer: coarse) { .hub-tab { min-height: var(--touch); } }
.nb-hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-4); }
.nb-hub-tile { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4); text-align: left; cursor: pointer; border: 1px solid var(--border); color: var(--text); font: inherit; }
.nb-hub-tile:hover { border-color: var(--border-strong); box-shadow: var(--card-hover-shadow); }
.nb-hub-t { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
/* forms: More details + growing textareas (no inner scrollbars) */
.form-more-row { grid-column: 1 / -1; }
.form-more-toggle .icon { transition: transform .2s; }
.form-more-toggle.open .icon { transform: rotate(180deg); }
.form-more { display: contents; }
.textarea.autogrow { resize: none; overflow: hidden; max-height: none; min-height: 72px; }
/* sign-in: app mockup floating on a light brand panel */
.login-art.has-mockup { background: radial-gradient(120% 90% at 85% 10%, color-mix(in srgb, var(--brand, var(--primary)) 22%, var(--surface)) 0%, var(--primary-50) 42%, var(--surface-2) 100%); color: var(--text); border-right: 1px solid var(--border); gap: var(--sp-5); }
.login-art.has-mockup h1 { color: var(--text); max-width: 18ch; font-size: clamp(28px, 3vw, 40px); }
.login-art.has-mockup .login-eyebrow { color: var(--primary-ink); }
.login-sub { margin: 10px 0 0; color: var(--text-2); max-width: 44ch; }
.login-legal { opacity: .7; }
.login-mockup { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; }
.login-mockup img { width: 100%; max-width: 680px; max-height: 46vh; object-fit: contain; border-radius: var(--radius-lg); box-shadow: 0 30px 60px -26px rgba(31,36,48,.45); animation: nb-float 7s ease-in-out infinite; }
@keyframes nb-float { 0%, 100% { transform: translateY(0) rotate(-.4deg); } 50% { transform: translateY(-10px) rotate(.4deg); } }
[data-motion="off"] .login-mockup img { animation: none; }
@media (prefers-reduced-motion: reduce) { .login-mockup img { animation: none; } }
@media (max-width: 860px) {
  .login-art.has-mockup { display: flex; padding: 20px 20px 8px; gap: 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .login-art.has-mockup h1 { font-size: 24px; max-width: none; }
  .login-art.has-mockup .login-sub, .login-art.has-mockup .login-legal, .login-art.has-mockup .login-eyebrow { display: none; }
  .login-mockup img { max-height: 180px; }
}
/* calendar (Overview + Calendar page) */
.nb-cal { padding: var(--sp-4); margin-bottom: var(--sp-5); }
.nb-cal-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.nb-cal-title { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.nb-cal-title h2 { font-size: var(--fs-lg); margin: 0; }
.nb-cal-tools { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.nb-cal-nav { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--border); border-radius: var(--radius); padding: 2px; background: var(--surface); }
.nb-range { font-weight: 600; font-size: var(--fs-sm); padding: 0 6px; min-width: 150px; text-align: center; }
.nb-brand-wrap { min-width: 170px; }
.nb-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.nb-day { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.nb-day-head { display: flex; flex-direction: column; align-items: center; padding: 6px 0; border-radius: var(--radius); }
.nb-day-head strong { font-family: var(--font-display); }
.nb-day-head span { font-size: var(--fs-xs); color: var(--muted); }
.nb-day-head.today { background: var(--primary-50); color: var(--primary-ink); }
.nb-day-head.today span { color: var(--primary-ink); }
.nb-day-empty { display: grid; place-items: center; min-height: 120px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--muted); font-size: var(--fs-xs); }
.nb-card { display: flex; flex-direction: column; text-align: left; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; overflow: hidden; transition: border-color .15s, box-shadow .2s, transform .2s; min-width: 0; }
.nb-card:hover { border-color: var(--border-strong); box-shadow: var(--card-hover-shadow); transform: translateY(-2px); }
.nb-card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--ring); }
.nb-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.nb-card-body { display: flex; flex-direction: column; gap: 6px; padding: 10px; min-width: 0; }
.nb-card-title { font-weight: 700; font-size: var(--fs-sm); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nb-card-status { margin-top: 2px; }
.nb-thumb { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.nb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nb-thumb-ph { color: color-mix(in srgb, var(--brand, var(--primary)) 55%, var(--muted)); }
.nb-play { position: absolute; right: 8px; bottom: 8px; width: 26px; height: 26px; border-radius: 99px; display: grid; place-items: center; background: rgba(255,255,255,.92); color: #1F2430; }
.nb-chan { position: absolute; left: 8px; top: 8px; font-size: var(--fs-micro); font-weight: 800; padding: 3px 6px; border-radius: 8px; background: rgba(255,255,255,.94); color: #1F2430; letter-spacing: .02em; }
.nb-brand { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-2); min-width: 0; }
.nb-brand-sel { width: 100%; }
.nb-more { border: 0; background: none; color: var(--primary-ink); font-weight: 700; font-size: var(--fs-xs); cursor: pointer; padding: 4px; border-radius: var(--radius-sm); text-align: left; }
.nb-more:hover { background: var(--primary-50); }
.nb-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.nb-month-wd { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); text-align: center; padding: 4px 0; }
.nb-month-cell { min-height: 104px; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; background: var(--surface); }
.nb-month-cell.out { background: var(--surface-2); }
.nb-month-cell.today { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.nb-month-n { font-size: var(--fs-xs); font-weight: 700; color: var(--text-2); }
.nb-chip { display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0; min-height: 28px; border: 0; border-radius: 8px; background: var(--surface-2); color: var(--text); padding: 4px 6px; font: inherit; font-size: var(--fs-xs); cursor: pointer; text-align: left; }
.nb-chip:hover { background: var(--primary-50); }
.nb-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.nb-list-day { display: grid; grid-template-columns: 90px 1fr; gap: var(--sp-3); align-items: start; }
.nb-list-date { display: flex; flex-direction: column; padding-top: 8px; }
.nb-list-date span { color: var(--muted); font-size: var(--fs-xs); }
.nb-list-items { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.nb-list-row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; width: 100%; text-align: left; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.nb-list-row:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.nb-list-t { font-weight: 600; flex: 1 1 200px; min-width: 0; }
/* overview panels (video script · shooting checklist · approval) */
.nb-panels, .nb-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-5); }
.nb-panel, .nb-col { display: flex; flex-direction: column; min-width: 0; }
.nb-panel-head { display: flex; align-items: center; gap: 10px; padding: var(--sp-4) var(--sp-4) var(--sp-3); border-bottom: 1px solid var(--border); }
.nb-panel-head h2 { font-size: var(--fs-md); margin: 0; }
.nb-panel-ic { width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary-ink); }
.nb-panel-body { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); flex: 1; min-width: 0; }
.nb-panel-foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); margin-top: auto; padding: 0 var(--sp-3) var(--sp-3); }
.nb-panel-body > .nb-panel-foot { padding: 0; }
.nb-script { margin: 0; display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-3); background: var(--surface-2); }
.nb-script-row { display: grid; grid-template-columns: 112px 1fr; gap: 10px; }
.nb-script dt { font-weight: 700; font-size: var(--fs-sm); }
.nb-script dd { margin: 0; font-size: var(--fs-sm); overflow-wrap: anywhere; }
.nb-check { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.nb-check-row { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: var(--fs-sm); }
.nb-check-row input { width: 20px; height: 20px; accent-color: var(--primary); flex: none; cursor: pointer; }
.nb-appr { display: grid; grid-template-columns: 132px 1fr; gap: var(--sp-3); align-items: start; }
.nb-appr-media .nb-thumb { border-radius: var(--radius); aspect-ratio: 4 / 3; }
.nb-appr-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.nb-appr-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.nb-clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-2); }
.nb-appr-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); margin-top: auto; }
.nb-col-list { display: flex; flex-direction: column; padding: var(--sp-2) var(--sp-3); gap: 2px; flex: 1; }
.nb-col-row { display: flex; align-items: center; gap: var(--sp-2); width: 100%; border: 0; background: none; color: var(--text); font: inherit; text-align: left; padding: 8px; border-radius: var(--radius-sm); cursor: pointer; }
.nb-col-row:hover { background: var(--surface-hover); }
.nb-col-row > .grow { display: flex; flex-direction: column; }
.nb-col-t { font-weight: 600; font-size: var(--fs-sm); }
.nb-col-empty { padding: 8px; }
@media (max-width: 1180px) { .nb-panels, .nb-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .nb-week { grid-template-columns: 1fr; }
  .nb-day { display: grid; grid-template-columns: 64px 1fr; align-items: start; gap: 8px; }
  .nb-day > .nb-card, .nb-day > .nb-more, .nb-day > .nb-day-empty { grid-column: 2; }
  .nb-day-empty { min-height: 44px; }
  .nb-card { flex-direction: row; }
  .nb-card .nb-thumb { width: 104px; flex: none; aspect-ratio: 1; }
  .nb-panels, .nb-cols { grid-template-columns: 1fr; }
  .nb-month { gap: 3px; } .nb-month-cell { min-height: 64px; padding: 4px; } .nb-chip .truncate { display: none; } .nb-chip { justify-content: center; }
  .nb-list-day { grid-template-columns: 1fr; }
  .nb-range { min-width: 0; }
}
@media (pointer: coarse) { .nb-chip, .nb-more { min-height: 32px; } }
@media (max-width: 600px) { .nb-appr { grid-template-columns: 96px 1fr; } .nb-cal-tools { width: 100%; } .nb-brand-wrap { flex: 1 1 100%; } }
/* boards fit the desktop width (phones still swipe the columns) */
@media (min-width: 861px) { .board { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); overflow-x: visible; } }
/* request slip signatures */
.nb-sign-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--sp-3); }
.nb-sign { padding: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); }
.nb-sign.done { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.nb-sign-head { display: flex; flex-direction: column; }
.nb-sign-img { height: 70px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); display: grid; place-items: center; background: #FFFFFF; overflow: hidden; }
.nb-sign-img img { max-height: 66px; max-width: 100%; }
.nb-pad { border: 1px solid var(--border-strong); border-radius: var(--radius); background: #FFFFFF; padding: 6px; }
.nb-pad-canvas { display: block; width: 100%; height: auto; aspect-ratio: 520 / 170; touch-action: none; cursor: crosshair; }
.nb-pad-line { border-top: 1px solid #9AA0A6; margin: 0 12px; padding-top: 4px; font-size: var(--fs-xs); color: #5E6472; }
