/* Sapienic Material kit: Material 3 Expressive (tokens, shapes, spring motion, components) in Sapienic's colors:
   the Material Theme Builder scheme (material-color-utilities, tonal spot) from the brand palette, navy #000C4D as
   primary, orange #E36225 as tertiary, a quiet navy-gray as secondary and navy-tinted neutrals; green #4D8249 for
   "good". Light primary is the navy palette's tone 30 (a step deeper than the builder's 40, closer to the brand). Shared by /workspace (businesses), /partner (resellers) and /admin (Sapienic staff). No external fonts or icons.
   Numbers follow the M3 Expressive design tokens (androidx compose material3 tokens): the shape scale with its
   "increased" steps, button sizes and press/selected shape morphs, connected button groups, the emphasized type
   weights and the expressive spring motion scheme, written as CSS linear() curves sampled from those springs. */

:root {
  color-scheme: light dark;
  --md-primary: #37427f;
  --md-on-primary: #ffffff;
  --md-primary-container: #dee0ff;
  --md-on-primary-container: #37427f;
  --md-secondary-container: #dfe1f9;
  --md-on-secondary-container: #434659;
  --md-tertiary: #a63c00;
  --md-tertiary-container: #ffdbce;
  --md-error: #ba1a1a;
  --md-error-container: #ffdad6;
  --md-on-error-container: #93000a;
  --md-warn: #885200;
  --md-warn-container: #ffdcbb;
  --md-good: #366a34;
  --md-good-container: #b7f2ad;
  --md-info: #515b92;
  --md-info-container: #dee0ff;
  --md-surface: #fbf8fd;
  --md-surface-dim: #dcd9de;
  --md-surface-container-lowest: #ffffff;
  --md-surface-container-low: #f6f2f7;
  --md-surface-container: #f0edf1;
  --md-surface-container-high: #eae7ec;
  --md-surface-container-highest: #e4e1e6;
  --md-on-surface: #1b1b1f;
  --md-on-surface-variant: #46464f;
  --md-outline: #767680;
  --md-outline-variant: #c6c5d0;
  --md-scrim: rgb(0 0 0 / 0.32);
  --md-inverse-surface: #303034;
  --md-inverse-on-surface: #f3f0f4;
  --md-chart-1: #37427f;
  --md-chart-2: #ca5012;
  --md-chart-3: #42763f;
  --md-chart-4: #73768b;
  --md-secondary: #5b5d72;
  --md-on-secondary: #ffffff;
  --md-on-tertiary: #ffffff;
  --md-on-tertiary-container: #7e2c00;
  --md-on-error: #ffffff;
  --md-surface-bright: #fbf8fd;
  --md-inverse-primary: #bac3ff;
  --md-app-bg: #f0edf1;
  --md-shape-xs: 4px;
  --md-shape-sm: 8px;
  --md-shape-md: 12px;
  --md-shape-lg: 16px;
  --md-shape-lg-inc: 20px;
  --md-shape-xl: 28px;
  --md-shape-xl-inc: 32px;
  --md-shape-xxl: 48px;
  --md-shape-full: 999px;
  --md-elev-1: 0 1px 2px rgb(0 0 0 / 0.18), 0 1px 3px 1px rgb(0 0 0 / 0.08);
  --md-elev-2: 0 1px 2px rgb(0 0 0 / 0.2), 0 2px 6px 2px rgb(0 0 0 / 0.1);
  --md-elev-3: 0 4px 8px 3px rgb(0 0 0 / 0.1), 0 1px 3px rgb(0 0 0 / 0.2);
  --md-font: "Roboto Flex", Roboto, "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --md-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --md-ease: cubic-bezier(0.2, 0, 0, 1);
  /* Expressive motion scheme. Spatial springs (shape, size, position) overshoot a little; effects springs (colour,
     opacity) don't. Sampled from damping/stiffness: spatial fast 0.6/800, default 0.8/380, slow 0.8/200; effects
     fast 1/3800, default 1/1600, slow 1/800. */
  --md-motion-spatial-fast: linear(0, 0.072, 0.238, 0.44, 0.638, 0.806, 0.934, 1.021, 1.071, 1.092, 1.093, 1.081, 1.063, 1.044, 1.026, 1.012, 1.002, 0.995, 0.992, 0.991, 0.992, 0.993, 0.995, 0.997, 1);
  --md-motion-spatial-fast-ms: 350ms;
  --md-motion-spatial: linear(0, 0.048, 0.161, 0.301, 0.444, 0.576, 0.69, 0.784, 0.858, 0.913, 0.953, 0.98, 0.997, 1.008, 1.013, 1.015, 1.015, 1.013, 1.011, 1.009, 1.007, 1.005, 1.004, 1.003, 1);
  --md-motion-spatial-ms: 420ms;
  --md-motion-spatial-slow: linear(0, 0.047, 0.157, 0.294, 0.435, 0.567, 0.681, 0.775, 0.85, 0.906, 0.947, 0.976, 0.995, 1.006, 1.012, 1.015, 1.015, 1.014, 1.012, 1.01, 1.008, 1.006, 1.004, 1.003, 1);
  --md-motion-spatial-slow-ms: 570ms;
  --md-motion-effects-fast: linear(0, 0.051, 0.162, 0.293, 0.421, 0.537, 0.635, 0.716, 0.782, 0.833, 0.874, 0.905, 0.929, 0.947, 0.961, 0.971, 0.979, 0.984, 0.988, 0.992, 0.994, 0.996, 0.997, 0.998, 1);
  --md-motion-effects-fast-ms: 140ms;
  --md-motion-effects: linear(0, 0.053, 0.167, 0.301, 0.431, 0.547, 0.645, 0.726, 0.791, 0.841, 0.881, 0.911, 0.934, 0.951, 0.964, 0.973, 0.981, 0.986, 0.99, 0.992, 0.995, 0.996, 0.997, 0.998, 1);
  --md-motion-effects-ms: 220ms;
  /* Shorthands: a shape morph and a colour/state-layer change. */
  --md-morph: border-radius var(--md-motion-spatial-fast-ms) var(--md-motion-spatial-fast);
  --md-fade: var(--md-motion-effects-fast-ms) var(--md-motion-effects-fast);
  --topbar: 64px;
  --rail: 256px;
  --assist: 380px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --md-primary: #bac3ff;
    --md-on-primary: #1f2b67;
    --md-primary-container: #37427f;
    --md-on-primary-container: #dee0ff;
    --md-secondary-container: #434659;
    --md-on-secondary-container: #dfe1f9;
    --md-tertiary: #ffb598;
    --md-tertiary-container: #7e2c00;
    --md-error: #ffb4ab;
    --md-error-container: #93000a;
    --md-on-error-container: #ffdad6;
    --md-warn: #ffb869;
    --md-warn-container: #673d00;
    --md-good: #9bd593;
    --md-good-container: #1d511e;
    --md-info: #bac3ff;
    --md-info-container: #394379;
    --md-surface: #131316;
    --md-surface-dim: #131316;
    --md-surface-container-lowest: #0e0e11;
    --md-surface-container-low: #1b1b1f;
    --md-surface-container: #1f1f23;
    --md-surface-container-high: #2a2a2d;
    --md-surface-container-highest: #353438;
    --md-on-surface: #e4e1e6;
    --md-on-surface-variant: #c6c5d0;
    --md-outline: #90909a;
    --md-outline-variant: #46464f;
    --md-inverse-surface: #e4e1e6;
    --md-inverse-on-surface: #303034;
    --md-chart-1: #bac3ff;
    --md-chart-2: #ff8c5b;
    --md-chart-3: #8ec786;
    --md-chart-4: #a8aac1;
    --md-secondary: #c3c5dd;
    --md-on-secondary: #2c2f42;
    --md-on-tertiary: #591c00;
    --md-on-tertiary-container: #ffdbce;
    --md-on-error: #690005;
    --md-surface-bright: #39393c;
    --md-inverse-primary: #4f5a99;
    --md-app-bg: #0e0e11;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 400 14px/20px var(--md-font); color: var(--md-on-surface); background: var(--md-app-bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 24px; height: 24px; flex: none; fill: currentColor; }
svg.i.sm { width: 20px; height: 20px; }
svg.i.xs { width: 18px; height: 18px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--md-on-surface-variant); }
.mono { font-family: var(--md-mono); font-size: 12.5px; }
.nw { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--md-primary); outline-offset: 2px; }

/* Type scale */
.display-s { font-size: 36px; line-height: 44px; font-weight: 400; margin: 0; }
.headline-m { font-size: 28px; line-height: 36px; font-weight: 400; margin: 0; }
.headline-s { font-size: 24px; line-height: 32px; font-weight: 400; margin: 0; }
.title-l { font-size: 22px; line-height: 28px; font-weight: 400; margin: 0; }
.title-m { font-size: 16px; line-height: 24px; font-weight: 500; letter-spacing: 0.15px; margin: 0; }
.title-s { font-size: 14px; line-height: 20px; font-weight: 500; letter-spacing: 0.1px; margin: 0; }
.label-l { font-size: 14px; line-height: 20px; font-weight: 500; letter-spacing: 0.1px; }
.label-m { font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: 0.5px; }
.body-s { font-size: 12px; line-height: 16px; letter-spacing: 0.4px; }
.body-l { font-size: 16px; line-height: 24px; letter-spacing: 0.25px; }
.emph:is(.display-s, .headline-m, .headline-s, .title-l, .body-l, .body-s) { font-weight: 500; }
.emph:is(.title-m, .title-s, .label-l, .label-m) { font-weight: 700; }
/* Page titles use the emphasized headline: the one hero line on each screen. */
.page-head h1.headline-s { font-weight: 500; }

/* State layers */
.st { position: relative; overflow: hidden; }
.st::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity var(--md-fade); pointer-events: none; border-radius: inherit; }
.st:hover::after { opacity: 0.08; }
.st:active::after, .st:focus-visible::after { opacity: 0.12; }

/* Buttons */
.btn { --r: var(--md-shape-full); --r-press: var(--md-shape-sm); --r-sel: var(--md-shape-md); display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--r); border: 0; cursor: pointer; font-weight: 500; font-size: 14px; letter-spacing: 0.1px; text-decoration: none; white-space: nowrap; position: relative; overflow: hidden; background: transparent; flex-shrink: 0; transition: var(--md-morph), background-color var(--md-fade), box-shadow var(--md-fade); }
.btn::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity var(--md-fade); }
.btn:active:not(:disabled) { border-radius: var(--r-press); }
.btn.square { --r: var(--md-shape-md); }
.btn[aria-pressed="true"] { border-radius: var(--r-sel); background: var(--md-primary); color: var(--md-on-primary); }
.btn.square[aria-pressed="true"] { border-radius: var(--md-shape-full); }
.btn:hover::after { opacity: 0.08; }
.btn:active::after { opacity: 0.12; }
.btn:disabled { opacity: 0.38; cursor: default; }
.btn:disabled::after { opacity: 0; }
.btn svg.i { width: 18px; height: 18px; margin-left: -8px; }
.btn.filled { background: var(--md-primary); color: var(--md-on-primary); }
.btn.filled:hover { box-shadow: var(--md-elev-1); }
.btn.tonal { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
.btn.outlined { border: 1px solid var(--md-outline); color: var(--md-primary); padding: 0 15px; }
.btn.text { color: var(--md-primary); padding: 0 12px; }
.btn.text svg.i { margin-left: -4px; }
.btn.danger { background: var(--md-error); color: #fff; }
.btn.text.danger { background: none; color: var(--md-error); }
/* XS */
.btn.sm { height: 32px; padding: 0 12px; gap: 4px; font-size: 14px; }
.btn.sm.outlined { padding: 0 11px; }
.btn.sm.text { padding: 0 8px; }
.btn.sm svg.i { margin-left: -2px; }
/* M: the main action of a screen (sign in, an empty state's next step). */
.btn.md { --r-press: var(--md-shape-md); --r-sel: var(--md-shape-lg); height: 56px; padding: 0 24px; font-size: 16px; line-height: 24px; letter-spacing: 0.15px; }
.btn.md.square { --r: var(--md-shape-lg); }
.btn.md.outlined { padding: 0 23px; }
.btn.md svg.i { width: 24px; height: 24px; margin-left: -4px; }
/* L */
.btn.lg { --r-press: var(--md-shape-lg); --r-sel: var(--md-shape-xl); height: 96px; padding: 0 48px; gap: 12px; font-size: 24px; line-height: 32px; font-weight: 400; }
.btn.lg.square { --r: var(--md-shape-xl); }
.btn.lg svg.i { width: 32px; height: 32px; margin-left: 0; }
.icon-btn { width: 40px; height: 40px; border-radius: var(--md-shape-full); border: 0; background: transparent; display: inline-grid; place-items: center; cursor: pointer; color: var(--md-on-surface-variant); position: relative; overflow: hidden; flex: none; text-decoration: none; transition: var(--md-morph), background-color var(--md-fade); }
.icon-btn::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity var(--md-fade); }
.icon-btn:hover::after { opacity: 0.08; }
.icon-btn:active:not(:disabled)::after { opacity: 0.12; }
.icon-btn:active:not(:disabled) { border-radius: var(--md-shape-sm); }
.icon-btn[aria-pressed="true"] { background: var(--md-secondary-container); color: var(--md-on-secondary-container); border-radius: var(--md-shape-md); }
.icon-btn:disabled { opacity: 0.38; cursor: default; }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm svg.i { width: 20px; height: 20px; }
.fab { display: inline-flex; align-items: center; gap: 12px; height: 56px; padding: 0 20px 0 16px; border-radius: var(--md-shape-lg); border: 0; cursor: pointer; background: var(--md-primary-container); color: var(--md-on-primary-container); font-weight: 500; font-size: 16px; box-shadow: var(--md-elev-1); position: relative; overflow: hidden; text-decoration: none; transition: var(--md-morph), box-shadow var(--md-fade); }
.fab::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity var(--md-fade); }
.fab:active { border-radius: var(--md-shape-md); }
.fab:hover { box-shadow: var(--md-elev-2); }
.fab:hover::after { opacity: 0.08; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 16px; border-radius: var(--md-shape-sm); border: 1px solid var(--md-outline-variant); background: transparent; font-size: 14px; font-weight: 500; color: var(--md-on-surface-variant); cursor: pointer; text-decoration: none; position: relative; overflow: hidden; white-space: nowrap; }
.chip::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity var(--md-fade); }
.chip:hover::after { opacity: 0.08; }
.chip[aria-pressed="true"], .chip.on { background: var(--md-secondary-container); color: var(--md-on-secondary-container); border-color: transparent; }
.chip svg.i { width: 18px; height: 18px; margin-left: -6px; }
.chip.assist { border-radius: var(--md-shape-sm); }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: var(--md-shape-xs); font-size: 11px; font-weight: 500; letter-spacing: 0.5px; background: var(--md-surface-container-highest); color: var(--md-on-surface-variant); white-space: nowrap; }
.badge.warn { background: var(--md-warn-container); color: var(--md-warn); }
.badge.err { background: var(--md-error-container); color: var(--md-on-error-container); }
.badge.good { background: var(--md-good-container); color: var(--md-good); }
.badge.info { background: var(--md-info-container); color: var(--md-info); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--md-outline); flex: none; }
.dot.good { background: var(--md-good); }
.dot.warn { background: var(--md-warn); }
.dot.err { background: var(--md-error); }
.dot.info { background: var(--md-info); }

/* Shell */
.shell { display: grid; grid-template-rows: var(--topbar) 1fr; grid-template-columns: var(--rail) 1fr auto; height: 100vh; }
.shell.rail-collapsed { --rail: 80px; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 4px; padding: 0 8px 0 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 0 12px 0 4px; min-width: calc(var(--rail) - 60px); }
/* Sapienic's lockup (kit.js brandLockup): Sapi's face, the wordmark in Sapienic Mono with the orange dot, the product. */
@font-face { font-family: "Sapienic Mono"; font-style: normal; font-weight: 800; font-display: swap; src: url("/assets/fonts/sapienic-mono-latin-800-normal.woff2") format("woff2"); }
.brand-face { width: 32px; height: 32px; flex: none; display: block; }
.brand-word { height: 20px; width: auto; aspect-ratio: 432 / 80; flex: none; display: block; overflow: visible; }
.brand-word text { font: 800 100px "Sapienic Mono", var(--md-mono); fill: var(--md-on-surface); }
.brand-word .bw-dot { fill: #e36225; }
.brand-product { font-size: 22px; line-height: 28px; color: var(--md-on-surface-variant); white-space: nowrap; }
.shell.rail-collapsed .brand { min-width: 0; }
.search { flex: 1; max-width: 720px; min-width: 0; position: relative; }
.search-box { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 8px 0 4px; border-radius: var(--md-shape-full); background: var(--md-surface-container-high); transition: background 0.15s, box-shadow 0.15s; }
.search-box:focus-within, .search.open .search-box { background: var(--md-surface-container-lowest); box-shadow: var(--md-elev-1); }
.search.open .search-box { border-radius: 24px 24px 0 0; }
.search-box input { flex: 1; border: 0; background: transparent; outline: none; font-size: 16px; height: 100%; min-width: 0; }
.search-box kbd { font: 500 11px var(--md-mono); color: var(--md-on-surface-variant); border: 1px solid var(--md-outline-variant); border-radius: 4px; padding: 1px 6px; }
.search-pop { position: absolute; left: 0; right: 0; top: 48px; background: var(--md-surface-container-lowest); border-radius: 0 0 24px 24px; box-shadow: var(--md-elev-2); padding: 8px 0 12px; z-index: 40; max-height: 70vh; overflow: auto; }
.search-pop .grp { padding: 8px 20px 4px; font-size: 12px; font-weight: 500; color: var(--md-on-surface-variant); letter-spacing: 0.5px; }
.search-pop .opt { display: flex; align-items: center; gap: 16px; padding: 8px 20px; cursor: pointer; text-decoration: none; }
.search-pop .opt svg.i { color: var(--md-on-surface-variant); width: 20px; height: 20px; }
.search-pop .opt[aria-selected="true"], .search-pop .opt:hover { background: var(--md-surface-container-high); }
.search-pop .opt small { color: var(--md-on-surface-variant); margin-left: auto; font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; padding-left: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--md-tertiary); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 500; flex: none; border: 0; cursor: pointer; }
.avatar.lg { width: 40px; height: 40px; font-size: 16px; }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.org-switch { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: var(--md-shape-full); border: 1px solid var(--md-outline-variant); background: transparent; cursor: pointer; font-weight: 500; max-width: 260px; }
.org-switch span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The nav fits the window: compact rows, groups you're not in fold on short windows (kit.js fitNav), and no scroll
   bar. If a very short window still can't fit it, it scrolls with the wheel or keyboard, without a bar. */
.nav { overflow-y: auto; overflow-x: hidden; min-width: 0; padding: 4px 12px 8px 8px; display: flex; flex-direction: column; gap: 0; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav .fab { margin: 0 0 8px 0; align-self: flex-start; flex: none; } /* flex: none keeps it 56px tall when the drawer is shorter than its items */
.nav-item { display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 12px 0 16px; border-radius: var(--md-shape-full); text-decoration: none; color: var(--md-on-surface-variant); font-weight: 500; font-size: 14px; position: relative; overflow: hidden; flex: none; border: 0; background: transparent; cursor: pointer; text-align: left; }
.nav-item::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity var(--md-fade); }
.nav-item { transition: background-color var(--md-fade); }
.nav-item:hover::after { opacity: 0.08; }
.nav-item[aria-current="page"] { background: var(--md-secondary-container); color: var(--md-on-secondary-container); font-weight: 700; }
.nav-item .count { margin-left: auto; font-size: 12px; font-weight: 700; }
.nav-item svg.i { width: 20px; height: 20px; }
.nav-sub .nav-item { height: 30px; padding-left: 48px; font-size: 13.5px; }
/* Collapsible groups (Communications, Business): a quiet label row that folds its items. */
.nav-group { display: flex; align-items: center; gap: 8px; width: 100%; height: 30px; margin-top: 6px; padding: 0 12px 0 16px; border: 0; background: transparent; border-radius: var(--md-shape-full); color: var(--md-on-surface-variant); font: 500 12px/16px var(--md-font); letter-spacing: 0.5px; cursor: pointer; text-align: left; flex: none; transition: background-color var(--md-fade); }
.nav-group:hover { background: var(--md-surface-container-high); }
.nav-group[data-here] { cursor: default; }
.nav-group[data-here]:hover { background: transparent; }
.nav-group span { flex: 1; }
.nav-group svg.i { transition: transform var(--md-motion-spatial-fast-ms) var(--md-motion-spatial-fast); }
.nav-group[aria-expanded="false"] svg.i { transform: rotate(-90deg); }
.nav-group[data-here] svg.i { opacity: 0.4; }
.nav-group-items { display: flex; flex-direction: column; flex: none; }
.nav-group-items[hidden] { display: none; }
.shell.rail-collapsed .nav-group span, .shell.rail-collapsed .nav-group svg.i { display: none; }
.shell.rail-collapsed .nav-group { width: auto; height: 1px; margin: 8px 16px; padding: 0; background: var(--md-outline-variant); pointer-events: none; }
.shell.rail-collapsed .nav-group-items[hidden] { display: flex; }
.nav-head { padding: 18px 16px 6px; font-size: 12px; font-weight: 500; letter-spacing: 0.5px; color: var(--md-on-surface-variant); text-transform: none; }
.nav-divider { height: 1px; background: var(--md-outline-variant); margin: 8px 16px; flex: none; }
.shell.rail-collapsed .nav-item { justify-content: center; padding: 0; width: 56px; margin-left: 4px; }
.shell.rail-collapsed .nav-item > span, .shell.rail-collapsed .nav-item .count, .shell.rail-collapsed .nav-head, .shell.rail-collapsed .nav-sub, .shell.rail-collapsed .fab span { display: none; }
.shell.rail-collapsed .fab { padding: 0; width: 56px; justify-content: center; }

.main { overflow: hidden; display: flex; flex-direction: column; min-width: 0; padding: 0 16px 16px 0; }
.panel { flex: 1; background: var(--md-surface); border-radius: var(--md-shape-lg-inc); overflow: auto; min-height: 0; position: relative; }
.panel.flush { display: flex; flex-direction: column; overflow: hidden; }
.page { padding: 24px 32px 48px; max-width: 1280px; }
.page.narrow { max-width: 920px; }
.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .grow h1 { margin: 0; }
.page-head > .grow { flex: 1 1 280px; min-width: min(280px, 100%); }
.page-head p { margin: 4px 0 0; color: var(--md-on-surface-variant); }
.crumbs { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--md-on-surface-variant); margin-bottom: 6px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 8px 16px; min-height: 48px; border-bottom: 1px solid var(--md-outline-variant); flex: none; }
.toolbar .sep { width: 1px; height: 24px; background: var(--md-outline-variant); margin: 0 4px; }
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--md-outline-variant); overflow-x: auto; flex: none; }
.tab { height: 48px; padding: 0 20px; border: 0; background: transparent; display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--md-on-surface-variant); cursor: pointer; position: relative; text-decoration: none; white-space: nowrap; }
.tab:hover { background: var(--md-surface-container-low); }
.tab[aria-selected="true"] { color: var(--md-primary); }
.tab[aria-selected="true"]::before { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--md-primary); }
.tab .badge { height: 18px; }

/* Cards and grids */
.card { background: var(--md-surface-container-low); border-radius: var(--md-shape-md); padding: 16px 20px; }
.card.outlined { background: var(--md-surface); border: 1px solid var(--md-outline-variant); }
.card.elevated { background: var(--md-surface-container-low); box-shadow: var(--md-elev-1); }
.card.flush { padding: 0; overflow: hidden; }
.card > header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.card.flush > header { padding: 16px 20px 4px; margin: 0; }
.card > header h2, .card > header h3 { margin: 0; font-size: 16px; line-height: 24px; font-weight: 500; flex: 1; }
.card > header a { font-weight: 500; text-decoration: none; color: var(--md-primary); font-size: 14px; }
.card > header a:hover { text-decoration: underline; }
.grid { display: grid; gap: 16px; }
.grid > *, .stack > * { min-width: 0; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
@media (max-width: 1100px) { .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.three, .grid.side { grid-template-columns: 1fr; } }

.kpi { padding: 16px 20px; border-radius: var(--md-shape-lg); background: var(--md-surface-container-low); display: flex; flex-direction: column; gap: 4px; text-decoration: none; }
.kpi span { color: var(--md-on-surface-variant); font-size: 13px; font-weight: 500; }
.kpi b { font-size: 28px; line-height: 36px; font-weight: 500; }
.kpi small { color: var(--md-on-surface-variant); font-size: 12px; }
.kpi.warn b { color: var(--md-warn); }
.kpi.err b { color: var(--md-error); }

/* Search-Console-style metric toggles */
.metric-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-radius: var(--md-shape-lg) var(--md-shape-lg) 0 0; overflow: hidden; }
.metric-tile { border: 0; text-align: left; padding: 16px 20px 18px; cursor: pointer; background: var(--md-surface-container-high); color: var(--md-on-surface-variant); display: flex; flex-direction: column; gap: 6px; position: relative; transition: background-color var(--md-fade), color var(--md-fade); }
.metric-tile .lbl { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }
.metric-tile .lbl i { width: 18px; height: 18px; border-radius: 3px; border: 2px solid currentColor; display: grid; place-items: center; font-style: normal; font-size: 12px; }
.metric-tile b { font-size: 34px; line-height: 40px; font-weight: 500; }
.metric-tile small { font-size: 12px; }
.metric-tile[aria-pressed="true"] { color: var(--md-on-primary); }
.metric-tile[aria-pressed="true"] .lbl i::before { content: "✓"; }
.metric-tile[data-c="1"][aria-pressed="true"] { background: var(--md-chart-1); }
.metric-tile[data-c="2"][aria-pressed="true"] { background: var(--md-chart-2); }
.metric-tile[data-c="3"][aria-pressed="true"] { background: var(--md-chart-3); }
.metric-tile[data-c="4"][aria-pressed="true"] { background: var(--md-chart-4); }
.chart-card { border: 1px solid var(--md-outline-variant); border-top: 0; border-radius: 0 0 var(--md-shape-lg) var(--md-shape-lg); padding: 16px 20px 8px; background: var(--md-surface); }
.chart { width: 100%; height: 260px; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--md-outline-variant); stroke-width: 1; }
.chart text { fill: var(--md-on-surface-variant); font-size: 11px; }
.chart-x { position: absolute; left: 0; right: 0; bottom: 4px; height: 16px; pointer-events: none; }
.chart-x span { position: absolute; transform: translateX(-50%); font-size: 11px; line-height: 16px; color: var(--md-on-surface-variant); white-space: nowrap; }
.chart-x span.first { transform: none; }
.chart-x span.last { transform: translateX(-100%); }
.chart .hover-line { stroke: var(--md-outline); stroke-dasharray: 3 3; }
.chart-tip { position: absolute; pointer-events: none; background: var(--md-inverse-surface); color: var(--md-inverse-on-surface); border-radius: var(--md-shape-xs); padding: 6px 10px; font-size: 12px; white-space: nowrap; z-index: 5; }
@media (max-width: 1000px) { .metric-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Lists and tables */
.list { list-style: none; margin: 0; padding: 0; }
.li { display: flex; align-items: center; gap: 16px; padding: 10px 20px; min-height: 56px; text-decoration: none; position: relative; }
.li.two { min-height: 64px; }
a.li:hover, button.li:hover, .li.click:hover { background: var(--md-surface-container-high); cursor: pointer; }
button.li { width: 100%; border: 0; background: transparent; text-align: left; }
.li .t { font-size: 15px; line-height: 22px; }
.li .s { font-size: 13px; line-height: 18px; color: var(--md-on-surface-variant); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .r { text-align: right; font-size: 13px; color: var(--md-on-surface-variant); flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.li .lead-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--md-secondary-container); color: var(--md-on-secondary-container); display: grid; place-items: center; flex: none; }
.li .lead-icon svg.i { width: 20px; height: 20px; }
.list > li + li { border-top: 1px solid var(--md-outline-variant); }
.list.plain > li + li { border-top: 0; }
.empty { padding: 48px 24px; text-align: center; color: var(--md-on-surface-variant); }
.empty svg.i { width: 48px; height: 48px; opacity: 0.6; margin-bottom: 8px; }
.empty h3 { color: var(--md-on-surface); font-weight: 500; font-size: 22px; margin: 0 0 8px; }
.empty p { margin: 0 auto; max-width: 460px; }
.empty .btn { margin-top: 16px; }

.table-wrap { overflow: auto; }
/* A table placed straight in a card (cards clip their corners): let the card scroll sideways instead of cutting
   off the last columns on a phone. */
.card:has(> table.dt) { overflow-x: auto; }
table.dt { width: 100%; border-collapse: collapse; font-size: 14px; }
table.dt th { text-align: left; font-weight: 500; font-size: 12px; letter-spacing: 0.3px; color: var(--md-on-surface-variant); padding: 0 16px; height: 48px; border-bottom: 1px solid var(--md-outline-variant); white-space: nowrap; position: sticky; top: 0; background: var(--md-surface); z-index: 1; user-select: none; }
table.dt th.sort { cursor: pointer; }
table.dt th.sort:hover { color: var(--md-on-surface); }
table.dt th[aria-sort] { color: var(--md-on-surface); }
table.dt th[aria-sort="ascending"]::after { content: " ↑"; }
table.dt th[aria-sort="descending"]::after { content: " ↓"; }
table.dt td { padding: 0 16px; height: 52px; border-bottom: 1px solid var(--md-outline-variant); vertical-align: middle; }
table.dt td.wrap { padding-top: 10px; padding-bottom: 10px; height: auto; }
table.dt td.num, table.dt th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.dt tr.click { cursor: pointer; }
table.dt tbody tr:hover { background: var(--md-surface-container-low); }
table.dt td .s { color: var(--md-on-surface-variant); font-size: 12.5px; }
table.dt input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--md-primary); }
.bar-cell { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.bar-cell .track { flex: 1; height: 8px; border-radius: 4px; background: var(--md-surface-container-highest); overflow: hidden; }
.bar-cell .fill { height: 100%; background: var(--md-on-surface-variant); border-radius: 4px; }
.bar-cell.you .fill { background: var(--md-primary); }
.table-foot { display: flex; align-items: center; justify-content: flex-end; gap: 16px; padding: 8px 16px; color: var(--md-on-surface-variant); font-size: 13px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 4px; position: relative; }
.field > span { font-size: 12px; font-weight: 500; color: var(--md-on-surface-variant); letter-spacing: 0.4px; padding-left: 2px; }
.field input, .field select, .field textarea { height: 48px; border: 1px solid var(--md-outline); border-radius: var(--md-shape-xs); padding: 0 14px; background: transparent; font-size: 15px; outline: none; width: 100%; }
.field textarea { height: auto; padding: 12px 14px; resize: vertical; line-height: 22px; }
.field input:focus, .field select:focus, .field textarea:focus { border: 2px solid var(--md-primary); padding-left: 13px; }
.field textarea:focus { padding: 11px 13px; }
.field small { font-size: 12px; color: var(--md-on-surface-variant); padding-left: 2px; }
.field select option { background: var(--md-surface); }
.form-grid { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--md-primary); }
.switch { position: relative; display: inline-flex; width: 52px; height: 32px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 16px; background: var(--md-surface-container-highest); border: 2px solid var(--md-outline); transition: background-color var(--md-fade), border-color var(--md-fade); }
.switch i::before { content: ""; position: absolute; width: 16px; height: 16px; left: 6px; top: 6px; border-radius: 50%; background: var(--md-outline); transition: left var(--md-motion-spatial-fast-ms) var(--md-motion-spatial-fast), top var(--md-motion-spatial-fast-ms) var(--md-motion-spatial-fast), width var(--md-motion-spatial-fast-ms) var(--md-motion-spatial-fast), height var(--md-motion-spatial-fast-ms) var(--md-motion-spatial-fast), background-color var(--md-fade); }
.switch:active input:not(:disabled) + i::before { width: 28px; height: 28px; left: 0; top: 0; }
.switch:active input:checked:not(:disabled) + i::before { left: 20px; }
.switch input:checked + i { background: var(--md-primary); border-color: var(--md-primary); }
.switch input:checked + i::before { width: 24px; height: 24px; left: 22px; top: 2px; background: var(--md-on-primary); }
.switch input:disabled + i { opacity: 0.38; }
.switch input:focus-visible + i { outline: 2px solid var(--md-primary); outline-offset: 2px; }
.form-error { color: var(--md-error); font-size: 13px; margin: 0; }
/* Button groups (segmented): one connected bar; options share the width; the chosen one fills and goes bold, keeping
   its shape and size so nothing jumps. Inner corners tighten a little while pressed (Expressive). */
.segmented { display: inline-flex; gap: 2px; }
.segmented button { flex: 1 1 0; min-width: max-content; justify-content: center; height: 40px; padding: 0 16px; border: 0; background: var(--md-surface-container-highest); color: var(--md-on-surface); cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; border-radius: var(--md-shape-xs); position: relative; overflow: hidden; transition: var(--md-morph), background-color var(--md-fade), color var(--md-fade); }
.segmented button::after { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity var(--md-fade); }
.segmented button:hover::after { opacity: 0.08; }
.segmented button:first-child { border-top-left-radius: var(--md-shape-full); border-bottom-left-radius: var(--md-shape-full); }
.segmented button:last-child { border-top-right-radius: var(--md-shape-full); border-bottom-right-radius: var(--md-shape-full); }
.segmented button:only-child { border-radius: var(--md-shape-full); }
.segmented button:not(:first-child):active { border-top-left-radius: 2px; border-bottom-left-radius: 2px; }
.segmented button:not(:last-child):active { border-top-right-radius: 2px; border-bottom-right-radius: 2px; }
.segmented button[aria-pressed="true"] { background: var(--md-primary); color: var(--md-on-primary); }

/* Dialogs, menus, snackbars */
dialog.dlg { border: 0; padding: 0; border-radius: var(--md-shape-xl); background: var(--md-surface-container-high); color: var(--md-on-surface); width: min(560px, calc(100vw - 48px)); max-height: calc(100vh - 48px); box-shadow: var(--md-elev-3); }
dialog.dlg.wide { width: min(760px, calc(100vw - 48px)); }
dialog.dlg::backdrop { background: var(--md-scrim); }
dialog.dlg form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.dlg-head { padding: 24px 24px 16px; }
.dlg-head h2 { margin: 0; font-size: 24px; line-height: 32px; font-weight: 400; }
.dlg-head p { margin: 8px 0 0; color: var(--md-on-surface-variant); }
.dlg-body { padding: 0 24px; overflow: auto; display: flex; flex-direction: column; gap: 16px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 24px; }
.menu { position: fixed; z-index: 60; min-width: 200px; background: var(--md-surface-container); border-radius: var(--md-shape-lg); box-shadow: var(--md-elev-2); padding: 4px; }
.menu button, .menu a { display: flex; align-items: center; gap: 12px; width: 100%; height: 44px; padding: 0 12px; border: 0; border-radius: var(--md-shape-md); background: transparent; cursor: pointer; text-align: left; text-decoration: none; font-size: 14px; transition: background-color var(--md-fade); }
.menu button:hover, .menu a:hover { background: var(--md-surface-container-highest); }
.menu .sep { height: 1px; background: var(--md-outline-variant); margin: 4px 8px; }
.menu .menu-head { padding: 12px 16px; display: flex; gap: 12px; align-items: center; }
.snackbar { position: fixed; left: 24px; bottom: 24px; z-index: 80; background: var(--md-inverse-surface); color: var(--md-inverse-on-surface); border-radius: var(--md-shape-xs); min-height: 48px; padding: 6px 8px 6px 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--md-elev-3); max-width: 560px; font-size: 14px; animation: snack-in var(--md-motion-spatial-ms) var(--md-motion-spatial); }
.snackbar.err { background: var(--md-error-container); color: var(--md-on-error-container); }
.snackbar .btn.text { color: var(--md-inverse-primary, #c8c8c5); }
@keyframes snack-in { from { transform: translateY(12px); opacity: 0; } }
.tooltip { position: fixed; z-index: 90; background: var(--md-inverse-surface); color: var(--md-inverse-on-surface); font-size: 12px; padding: 4px 8px; border-radius: var(--md-shape-xs); pointer-events: none; white-space: nowrap; }
.banner { display: flex; gap: 16px; align-items: center; padding: 12px 20px; border-radius: var(--md-shape-md); background: var(--md-info-container); color: var(--md-info); }
.banner.warn { background: var(--md-warn-container); color: var(--md-warn); }
.banner.good { background: var(--md-good-container); color: var(--md-good); }
.banner .grow { color: var(--md-on-surface); }
/* A banner with a button wraps the button under its text when the row is narrow, instead of squeezing the text. */
.banner { flex-wrap: wrap; }
.banner .grow { flex: 1 1 220px; min-width: 0; }
.progress { height: 4px; display: flex; gap: 2px; }
.progress > i { display: block; flex: none; height: 100%; background: var(--md-primary); border-radius: 2px; transition: width var(--md-motion-spatial-ms) var(--md-motion-spatial); }
.progress::after { content: ""; flex: 1; min-width: 0; border-radius: 2px; background: radial-gradient(circle at calc(100% - 2px) 50%, var(--md-primary) 2px, transparent 2.5px), var(--md-surface-container-highest); }
.loading-bar { position: absolute; top: 0; left: 0; right: 0; height: 3px; overflow: hidden; z-index: 5; }
.loading-bar::before { content: ""; position: absolute; height: 100%; width: 40%; background: var(--md-primary); animation: load-slide 1.1s var(--md-ease) infinite; }
@keyframes load-slide { from { left: -40%; } to { left: 100%; } }
.skeleton { padding: 32px; color: var(--md-on-surface-variant); }

/* Assistant side panel */
.assist { width: 0; overflow: hidden; transition: width var(--md-motion-spatial-ms) var(--md-motion-spatial); display: flex; }
.shell.assist-open .assist { width: var(--assist); }
.assist-inner { width: calc(var(--assist) - 16px); flex: none; display: flex; flex-direction: column; background: var(--md-surface); border-radius: var(--md-shape-lg-inc); margin: 0 16px 16px 0; overflow: hidden; }
.assist-head { display: flex; align-items: center; gap: 8px; padding: 12px 8px 12px 16px; border-bottom: 1px solid var(--md-outline-variant); }
.assist-head .title-m { flex: 1; }
.sapi-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--md-tertiary-container); color: var(--md-tertiary); display: grid; place-items: center; flex: none; }
.sapi-mark svg.i { width: 18px; height: 18px; }
.assist-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 92%; padding: 10px 14px; border-radius: var(--md-shape-lg-inc); font-size: 14px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--md-primary); color: var(--md-on-primary); border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--md-surface-container-high); border-bottom-left-radius: 4px; }
.msg.bot ul { margin: 6px 0 0; padding-left: 18px; white-space: normal; }
.msg.bot li { margin: 2px 0; }
.msg a { color: inherit; font-weight: 500; }
.msg-card { align-self: stretch; border: 1px solid var(--md-outline-variant); border-radius: var(--md-shape-md); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--md-surface); }
.msg-card .label-m { color: var(--md-on-surface-variant); text-transform: uppercase; letter-spacing: 0.8px; }
.msg-card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.msg-card dt { color: var(--md-on-surface-variant); }
.msg-card dd { margin: 0; overflow-wrap: anywhere; }
.msg-card .field input, .msg-card .field select, .msg-card .field textarea { height: 40px; font-size: 14px; }
.msg-card .field textarea { height: auto; }
.msg-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.assist-suggest { padding: 8px 16px 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.assist-suggest .chip { height: 30px; font-size: 13px; padding: 0 12px; }
.assist-input { margin: 8px 12px 12px; display: flex; align-items: flex-end; gap: 4px; border-radius: var(--md-shape-xl); background: var(--md-surface-container-high); padding: 4px 4px 4px 16px; }
.assist-input textarea { flex: 1; border: 0; outline: none; background: transparent; resize: none; font-size: 15px; line-height: 22px; padding: 9px 0; max-height: 140px; }
.assist-note { font-size: 11px; color: var(--md-on-surface-variant); text-align: center; padding: 0 16px 10px; }
.typing { align-self: flex-start; color: var(--md-on-surface-variant); font-size: 13px; padding: 4px 6px; }

/* Sapi, the helper in the corner (buddy.js): the mascot and a speech bubble. Pops in once, tilts once per tip. */
.buddy { position: fixed; right: 20px; bottom: 16px; z-index: 65; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: none; }
.buddy[hidden] { display: none; }
.buddy > * { pointer-events: auto; }
.buddy-fig { width: 92px; height: 104px; border: 0; padding: 0; background: transparent; cursor: pointer; border-radius: var(--md-shape-lg); display: grid; place-items: end center; }
.buddy-fig img { width: 88px; height: 104px; display: block; transform-origin: 30% 92%; filter: drop-shadow(0 2px 3px rgb(0 0 0 / 0.18)); transition: transform var(--md-motion-spatial-fast-ms) var(--md-motion-spatial-fast); }
.buddy-fig:hover img { transform: translateY(-3px); }
.buddy-fig:active img { transform: translateY(0) scale(0.96); }
.buddy.arrive .buddy-fig img { animation: buddy-in var(--md-motion-spatial-slow-ms) var(--md-motion-spatial-slow) both; }
.buddy.talking .buddy-fig img { animation: buddy-tilt 700ms var(--md-motion-spatial) both; }
@keyframes buddy-in { from { transform: translateY(40px) scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes buddy-tilt { 0% { transform: rotate(0); } 35% { transform: rotate(-7deg); } 100% { transform: rotate(0); } }
.buddy-bubble { position: relative; width: min(300px, calc(100vw - 40px)); background: var(--md-surface-container-lowest); color: var(--md-on-surface); border-radius: var(--md-shape-xl) var(--md-shape-xl) var(--md-shape-xs) var(--md-shape-xl); box-shadow: var(--md-elev-3); padding: 14px 16px 10px; margin-right: 34px; animation: bubble-in var(--md-motion-spatial-ms) var(--md-motion-spatial) both; transform-origin: 100% 100%; }
@keyframes bubble-in { from { transform: scale(0.85); opacity: 0; } }
.buddy-text { margin: 0 24px 10px 0; font-size: 14px; line-height: 20px; }
.buddy-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.buddy-x { position: absolute; top: 6px; right: 6px; }
.buddy-hide { border: 0; background: transparent; color: var(--md-on-surface-variant); font-size: 12px; padding: 8px 0 0; cursor: pointer; text-decoration: underline; }
.sapi-mark.face { background: transparent; }
.sapi-mark.face img { width: 28px; height: 28px; display: block; }
@media (prefers-color-scheme: dark) { .buddy-fig img { filter: drop-shadow(0 0 1.5px rgb(255 255 255 / 0.7)) drop-shadow(0 2px 4px rgb(0 0 0 / 0.5)); } }
@media (max-width: 720px) { .buddy { right: 10px; bottom: 10px; } .buddy-fig { width: 56px; height: 64px; } .buddy-fig img { width: 50px; height: 59px; } .shell.nav-open ~ .buddy { display: none; } }

/* Guided tour coach marks */
.tour-ring { position: fixed; z-index: 70; border-radius: var(--md-shape-md); box-shadow: 0 0 0 4px var(--md-primary), 0 0 0 9999px rgb(0 0 0 / 0.35); pointer-events: none; transition: all var(--md-motion-spatial-ms) var(--md-motion-spatial); }
.tour-pop { position: fixed; z-index: 71; width: 320px; background: var(--md-surface-container-high); border-radius: var(--md-shape-xl); box-shadow: var(--md-elev-3); padding: 16px 20px; }
.tour-pop h3 { margin: 0 0 6px; font-size: 16px; font-weight: 500; }
.tour-pop p { margin: 0; color: var(--md-on-surface-variant); }
.tour-pop .msg-actions { margin-top: 14px; justify-content: flex-end; }
.tour-pop .step { font-size: 12px; color: var(--md-on-surface-variant); margin-right: auto; align-self: center; }

/* Setup checklist */
.checklist { display: flex; flex-direction: column; }
.checklist .item { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--md-outline-variant); }
.checklist .item:first-child { border-top: 0; }
.checklist .tick { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--md-outline); display: grid; place-items: center; flex: none; font-size: 13px; }
.checklist .item.done .tick { background: var(--md-good); border-color: var(--md-good); color: #fff; }
.checklist .item.done .t { color: var(--md-on-surface-variant); text-decoration: line-through; }

/* Sign-in */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--md-app-bg); }
.auth-card { width: min(450px, 100%); background: var(--md-surface); border-radius: var(--md-shape-xl-inc); padding: 40px; display: flex; flex-direction: column; gap: 20px; border: 1px solid var(--md-outline-variant); }
.auth-card .brand { padding: 0; min-width: 0; }
.auth-card h1 { margin: 8px 0 0; font-size: 28px; line-height: 36px; font-weight: 500; }
.auth-card form .btn.filled[type="submit"], .auth-card > .btn.filled { --r-press: var(--md-shape-md); height: 56px; font-size: 16px; }
.auth-card .switch-links { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--md-on-surface-variant); }

@media (max-width: 900px) {
  .shell { --rail: 80px; }
  .shell .nav-item > span, .shell .nav-item .count, .shell .nav-head, .shell .nav-sub, .shell .fab span { display: none; }
  .shell .nav-item { justify-content: center; padding: 0; width: 56px; }
  .shell .fab { padding: 0; width: 56px; justify-content: center; }
  .brand-product { display: none; }
  .shell .nav-group span, .shell .nav-group svg.i { display: none; }
  .shell .nav-group { width: auto; height: 1px; margin: 8px 16px; padding: 0; background: var(--md-outline-variant); pointer-events: none; }
  .shell .nav-group-items[hidden] { display: flex; }
  .shell.assist-open .assist { position: fixed; right: 0; top: var(--topbar); bottom: 0; z-index: 50; }
  .page { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Phones: the drawer slides over the page, the top bar keeps search and the account, panels take the full width. */
@media (max-width: 720px) {
  .shell, .shell.rail-collapsed { grid-template-columns: minmax(0, 1fr); --rail: 280px; } /* minmax: content never widens the page */
  .topbar { padding: 0 4px; gap: 0; }
  .brand { display: none; }
  .search-box { height: 44px; }
  .search-box kbd, [data-help] { display: none; }
  .top-actions { padding-left: 4px; flex: none; }
  .hide-phone { display: none; }
  .nav { position: fixed; top: var(--topbar); left: 0; bottom: 0; width: 280px; z-index: 46; background: var(--md-surface-container-low); transform: translateX(-100%); transition: transform var(--md-motion-spatial-ms) var(--md-motion-spatial); padding-top: 12px; }
  .shell.nav-open .nav { transform: none; box-shadow: var(--md-elev-3); }
  .shell .nav .nav-item, .shell.rail-collapsed .nav .nav-item { justify-content: flex-start; padding: 0 12px 0 16px; width: auto; margin-left: 0; }
  .shell .nav .nav-item > span, .shell .nav .nav-item .count, .shell .nav .nav-head, .shell .nav .nav-sub, .shell .nav .fab span { display: inline; }
  .shell .nav .nav-sub { display: block; }
  .shell .nav .nav-head { display: block; }
  .shell .nav .nav-group { height: 36px; margin: 10px 0 0; padding: 0 12px 0 16px; background: transparent; pointer-events: auto; }
  .shell .nav .nav-group span, .shell .nav .nav-group svg.i { display: inline; }
  .shell .nav .nav-group span { flex: 1; }
  .shell .nav .nav-group-items[hidden] { display: none; }
  .shell .nav .fab { width: auto; padding: 0 20px 0 16px; }
  .shell.nav-open::after { content: ""; position: fixed; inset: var(--topbar) 0 0 0; background: var(--md-scrim); z-index: 45; }
  .main { grid-column: 1; grid-row: 2; padding: 0 6px 6px; min-height: 0; }
  .assist { grid-column: 1; grid-row: 2; }
  .shell.assist-open .assist { position: fixed; left: 0; right: 0; top: var(--topbar); bottom: 0; width: auto; z-index: 50; }
  .assist-inner { width: 100%; margin: 0 6px 6px; }
  .page { padding: 16px 14px 96px; } /* bottom room so Sapi never sits on the last control */
  body:has(.shell.nav-open) .buddy { display: none; }
  .grid.two, .grid.three, .grid.side { grid-template-columns: 1fr; }
  .page-head { gap: 10px; }
  .page-head > .row-gap { width: 100%; }
  .metric-tile { padding: 12px 14px; }
  .metric-tile b { font-size: 26px; line-height: 32px; }
  dialog.dlg { width: calc(100vw - 24px); }
  .snackbar { left: 12px; right: 12px; bottom: 12px; }
  .tour-pop { width: calc(100vw - 24px); }
}
