/*
 * Company design system — the shared look of Workify CRM, Dialify (Leads),
 * CFO AI and High Ticket Closers. Generated into each app by `sync.mjs`;
 * edit it in /Volumes/T9/Code/Company Design, never in an app.
 *
 * Plain CSS on `--ds-*` variables (tokens.css), so it works the same under
 * Tailwind 3 or 4. Dark mode = a `.dark` class on <html>.
 */

/* ── Type ─────────────────────────────────────────────────────────────── */
.ds-page-title { font-size: 1.25rem; line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; }
.ds-title { font-size: 0.8125rem; line-height: 1.2; font-weight: 600; letter-spacing: -0.005em; }
.ds-label { font-size: 0.656rem; line-height: 1; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ds-muted-foreground); }
.ds-num { font-weight: 600; line-height: 1.1; letter-spacing: -0.025em; font-variant-numeric: tabular-nums lining-nums; }
.ds-muted { color: var(--ds-muted-foreground); }

/* ── App shell ────────────────────────────────────────────────────────── */
.ds-shell { display: flex; height: 100dvh; width: 100%; overflow: hidden; background: var(--ds-background); color: var(--ds-foreground); font-family: var(--ds-font-sans); }
.ds-shell *, .ds-shell *::before, .ds-shell *::after { box-sizing: border-box; }
.ds-shell-main { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.ds-shell-content {
  display: flex; flex: 1; flex-direction: column; overflow-y: auto; overscroll-behavior-y: contain;
  padding: 12px 12px calc(84px + env(safe-area-inset-bottom));
  scrollbar-width: thin; scrollbar-color: color-mix(in oklab, var(--ds-muted-foreground) 35%, transparent) transparent;
}
@media (min-width: 640px) { .ds-shell-content { padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); } }
@media (min-width: 1024px) { .ds-shell-content { padding: 16px; } }

.ds-sidebar {
  display: none; width: var(--ds-rail-w); flex-shrink: 0; flex-direction: column;
  border-right: 1px solid var(--ds-sidebar-border); background: var(--ds-sidebar); color: var(--ds-sidebar-foreground);
}
@media (min-width: 1024px) { .ds-sidebar { display: flex; } }
@media (min-width: 1280px) { .ds-sidebar { width: var(--ds-sidebar-w); } }

.ds-brand { display: flex; height: 64px; flex-shrink: 0; align-items: center; justify-content: center; padding: 0 4px; }
@media (min-width: 1280px) { .ds-brand { justify-content: flex-start; padding: 0 20px; } }
.ds-brand a { display: inline-flex; align-items: center; color: var(--ds-sidebar-foreground); text-decoration: none; }
.ds-brand img { display: block; width: auto; }
.ds-brand .ds-brand-mark { height: 24px; max-width: 44px; object-fit: contain; }
.ds-brand .ds-brand-full { display: none; height: 28px; max-width: 160px; object-fit: contain; object-position: left center; }
/* A client company's logo: taller, fitted, on a white plate in dark mode. */
.ds-brand img.ds-logo-plate.ds-brand-full { height: 40px; }
.ds-brand img.ds-logo-plate.ds-brand-mark { height: 32px; }
.ds-topbar img.ds-logo-plate { max-width: 140px; object-fit: contain; }
.dark img.ds-logo-plate { border-radius: 6px; background: #fff; padding: 3px 6px; }
@media (min-width: 1280px) { .ds-brand .ds-brand-mark { display: none; } .ds-brand .ds-brand-full { display: block; } }
.ds-wordmark { white-space: nowrap; font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-size: 13px; }
@media (min-width: 1280px) { .ds-wordmark { font-size: 26px; } }
.dark .ds-brand img.ds-invert-dark, .dark .ds-topbar img.ds-invert-dark { filter: invert(1); }
.dark .ds-only-light, :root:not(.dark) .ds-only-dark { display: none !important; }

.ds-sidebar-top { flex-shrink: 0; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 4px; }
.ds-nav { display: flex; min-height: 0; flex: 1; flex-direction: column; overflow-y: auto; padding: 0 8px 8px; scrollbar-width: thin; }
.ds-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ds-nav ul ul { margin-top: 2px; }
@media (min-width: 1280px) { .ds-nav ul ul { padding-left: 12px; } }
/* A hairline above the first item of each new menu section. */
.ds-nav li.ds-section { position: relative; margin-top: 12px; }
.ds-nav li.ds-section::before { content: ''; position: absolute; left: 8px; right: 8px; top: -7px; height: 1px; background: var(--ds-sidebar-border); }

/* One row style for menu items and footer rows: 36px, 13px medium. */
.ds-row {
  position: relative; display: flex; height: var(--ds-row-h); width: 100%; flex-shrink: 0; align-items: center; justify-content: center; gap: 12px;
  border: 0; border-radius: var(--ds-radius-sm); background: transparent; padding: 0 12px;
  font: inherit; font-size: 13px; font-weight: 500; line-height: 1; color: var(--ds-sidebar-muted);
  text-decoration: none; text-align: left; cursor: pointer; transition: background-color .12s, color .12s;
}
@media (min-width: 1280px) { .ds-row { justify-content: flex-start; } }
.ds-row:hover { background: var(--ds-brand-soft); color: var(--ds-sidebar-foreground); }
/* Selected: solid DeWalt yellow, charcoal text, no side marker. */
.ds-row[aria-current='page'], .ds-row.ds-active { background: var(--ds-brand); color: var(--ds-brand-foreground); font-weight: 600; }
.ds-row-icon { display: flex; width: 16px; height: 16px; flex-shrink: 0; align-items: center; justify-content: center; }
.ds-row-icon svg { width: 16px; height: 16px; }
/* The row's line-height is 1, and a clipped box that tight cuts the tails off g, p and y. */
.ds-row-label { display: none; min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.45; }
@media (min-width: 1280px) { .ds-row-label { display: block; } }
.ds-row-hint { display: none; border: 1px solid var(--ds-border); border-radius: 4px; padding: 1px 4px; font-size: 10px; font-weight: 500; color: var(--ds-muted-foreground); }
@media (min-width: 1280px) { .ds-row-hint { display: inline; } }
.ds-row-chevron { display: none; flex-shrink: 0; transition: transform .15s; }
@media (min-width: 1280px) { .ds-row-chevron { display: block; } }
.ds-row-chevron.ds-open { transform: rotate(180deg); }
.ds-row.ds-child .ds-row-label { font-size: 12.5px; }

/* Tool switcher: four black icons in a row above the AI button (2×2 on
   the rail). The current tool sits on light yellow. */
.ds-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; padding-bottom: 4px; }
@media (min-width: 1280px) { .ds-tools { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.ds-tool { display: grid; height: 28px; place-items: center; border-radius: var(--ds-radius-sm); color: var(--ds-foreground); text-decoration: none; transition: background-color .12s; }
@media (min-width: 1280px) { .ds-tool { height: 32px; } }
.ds-tool svg { width: 16px; height: 16px; }
.ds-tool:hover { background: var(--ds-brand-soft); }
.ds-tool[aria-current='page'] { background: var(--ds-brand-soft); }
.ds-tools-menu { margin-top: 12px; }
.ds-tools-menu .ds-tools { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding: 0; }
.ds-tools-menu .ds-tool { height: 44px; border: 1px solid var(--ds-border); background: var(--ds-card); }
.ds-tools-menu .ds-tool[aria-current='page'] { background: var(--ds-brand-soft); }

/* The AI button: the one other yellow thing. */
.ds-row.ds-ai { background: var(--ds-brand); color: var(--ds-brand-foreground); font-weight: 600; }
.ds-row.ds-ai:hover { background: color-mix(in oklab, var(--ds-brand) 88%, black); }
/* The AI row's label is the product's own wording ("Ask Leonidas AI"); its shortcut lives in the tooltip so the label never truncates. */
.ds-row.ds-ai .ds-row-hint { display: none; }
/* The one primary action (Create): charcoal. */
.ds-row.ds-primary { background: var(--ds-primary); color: var(--ds-primary-foreground); justify-content: center; }
.ds-row.ds-primary:hover { background: color-mix(in oklab, var(--ds-primary) 88%, white); }
/* A selector row (company switcher): outlined. */
.ds-row.ds-select { border: 1px solid var(--ds-sidebar-border); color: var(--ds-sidebar-foreground); }

.ds-footer { display: flex; flex-shrink: 0; flex-direction: column; gap: 2px; padding: 8px; }
/* The hairline sits under the tool buttons, above the AI button (owner, 2026-10-04). */
.ds-footer > .ds-tools { margin-bottom: 6px; border-bottom: 1px solid var(--ds-sidebar-border); padding-bottom: 8px; }
.ds-footer .ds-user { cursor: default; color: var(--ds-sidebar-foreground); }
.ds-footer .ds-user:hover { background: transparent; }

/* Popover menus (company switcher, create). */
.ds-popover {
  position: absolute; z-index: 100; min-width: 240px; max-height: 70vh; overflow-y: auto; padding: 4px 0;
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius); background: var(--ds-popover); color: var(--ds-popover-foreground);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
}
.ds-popover-up { bottom: calc(100% + 4px); left: 0; }
.ds-popover-down { top: calc(100% + 4px); left: 0; }
.ds-popover .ds-label { display: block; padding: 8px 12px 6px; }
.ds-menu-item {
  display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: transparent; padding: 8px 12px;
  font: inherit; font-size: 13px; color: var(--ds-muted-foreground); text-align: left; text-decoration: none; cursor: pointer;
}
.ds-menu-item:hover { background: var(--ds-brand-soft); color: var(--ds-foreground); }
.ds-menu-item.ds-active { color: var(--ds-foreground); font-weight: 600; }
.ds-menu-item > span:nth-child(2) { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The built-in search palette. */
.ds-palette-backdrop { position: fixed; inset: 0; z-index: 200; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; background: rgba(0, 0, 0, .35); }
.ds-palette { width: 100%; max-width: 520px; overflow: hidden; border: 1px solid var(--ds-border); border-radius: var(--ds-radius); background: var(--ds-popover); color: var(--ds-popover-foreground); box-shadow: 0 12px 40px rgba(0, 0, 0, .25); font-family: var(--ds-font-sans); }
.ds-palette-input { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--ds-border); padding: 0 14px; color: var(--ds-muted-foreground); }
.ds-palette-input input { height: 48px; flex: 1; border: 0; background: transparent; font: inherit; font-size: 15px; color: var(--ds-foreground); outline: none; }
@media (hover: none) and (pointer: coarse) { .ds-palette-input input { font-size: 16px; } }
.ds-palette-list { max-height: 50vh; overflow-y: auto; list-style: none; margin: 0; padding: 4px 0; }
.ds-palette-list .ds-menu-item.ds-active { background: var(--ds-brand-soft); }
.ds-palette-empty { padding: 14px; font-size: 13px; color: var(--ds-muted-foreground); }

/* Phones + tablets: top bar and bottom menu. */
.ds-topbar {
  display: flex; flex-shrink: 0; align-items: center; gap: 8px; border-bottom: 1px solid var(--ds-sidebar-border);
  background: var(--ds-sidebar); color: var(--ds-sidebar-foreground); padding: max(8px, env(safe-area-inset-top)) 12px 8px;
}
@media (min-width: 1024px) { .ds-topbar { display: none; } }
/* A page that draws its own header on phones/tablets renders <HideTopBar /> (e.g. a full-screen map). */
@media (max-width: 1023px) { .ds-shell:has([data-ds-hide-topbar]) .ds-topbar { display: none; } }
.ds-topbar img { height: 24px; width: auto; }
.ds-topbar .ds-wordmark { font-size: 19px; }
.ds-topbar-page { margin-left: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; color: var(--ds-sidebar-muted); }
.ds-icon-btn {
  display: grid; width: 36px; height: 36px; flex-shrink: 0; place-items: center; border: 0; border-radius: var(--ds-radius-sm);
  background: transparent; color: var(--ds-sidebar-muted); cursor: pointer;
}
.ds-icon-btn:hover { background: var(--ds-brand-soft); color: var(--ds-sidebar-foreground); }
.ds-icon-btn svg { width: 18px; height: 18px; }
.ds-icon-btn-ai { background: var(--ds-brand); color: var(--ds-brand-foreground, #1a1a1a); }
.ds-icon-btn-ai:hover { background: var(--ds-brand); color: var(--ds-brand-foreground, #1a1a1a); filter: brightness(.95); }
.ds-shell-content.ds-flush-content { padding: 0; }

.ds-bottombar {
  position: fixed; inset: auto 0 0 0; z-index: 40; border-top: 1px solid var(--ds-border); background: color-mix(in oklab, var(--ds-card) 95%, transparent);
  padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 16px rgba(0, 0, 0, .06); backdrop-filter: blur(8px);
}
@media (min-width: 1024px) { .ds-bottombar { display: none; } }
.ds-bottombar-strip { display: flex; overflow-x: auto; scrollbar-width: none; }
.ds-bottombar-strip::-webkit-scrollbar { display: none; }
/* Tabs are 84px apart and the bar ~70px tall: the icons need room to breathe when the strip scrolls (owner, 2026-10-11). */
.ds-tab {
  display: flex; min-width: 84px; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 10px 8px 8px;
  border: 0; background: transparent; font: inherit; font-size: 11px; font-weight: 500; color: var(--ds-muted-foreground); text-decoration: none; cursor: pointer;
}
.ds-tab-pill { display: grid; width: 52px; height: 32px; place-items: center; border-radius: 999px; transition: background-color .12s; }
.ds-tab-pill svg { width: 18px; height: 18px; }
.ds-tab[aria-current='page'], .ds-tab.ds-active { color: var(--ds-foreground); }
.ds-tab[aria-current='page'] .ds-tab-pill, .ds-tab.ds-active .ds-tab-pill { background: var(--ds-brand); color: var(--ds-brand-foreground); }

.ds-allmenu { position: fixed; inset: 0 0 calc(70px + env(safe-area-inset-bottom)) 0; z-index: 30; overflow-y: auto; background: var(--ds-background); }
@media (min-width: 1024px) { .ds-allmenu { display: none; } }
.ds-allmenu-inner { margin: 0 auto; max-width: 42rem; padding: 16px 16px 24px; }
/* The product row (company switcher) in the phone menu: full width, labelled, opens downwards. */
.ds-allmenu-extra { margin-top: 12px; }
.ds-allmenu-extra .ds-row { height: 44px; justify-content: flex-start; border: 1px solid var(--ds-border); background: var(--ds-card); color: var(--ds-foreground); font-size: 14px; }
.ds-allmenu-extra .ds-row-label, .ds-allmenu-extra .ds-row-chevron { display: block; }
.ds-allmenu-extra .ds-popover-up { top: calc(100% + 4px); bottom: auto; right: 0; }
.ds-allmenu-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; list-style: none; margin: 16px 0 0; padding: 0; }
@media (min-width: 640px) { .ds-allmenu-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ds-allmenu-grid a, .ds-allmenu-grid button {
  display: flex; height: 84px; width: 100%; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 0 8px;
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius); background: var(--ds-card); font: inherit; font-size: 12px; font-weight: 500;
  color: var(--ds-muted-foreground); text-align: center; text-decoration: none; cursor: pointer;
}
.ds-allmenu-grid svg { width: 20px; height: 20px; color: var(--ds-foreground); }
.ds-allmenu-grid [aria-current='page'] { border-color: var(--ds-brand); background: var(--ds-brand); color: var(--ds-brand-foreground); }

/* ── Page header ──────────────────────────────────────────────────────── */
.ds-page { display: flex; min-height: 0; min-width: 0; flex: 1; flex-direction: column; gap: var(--ds-gap); }
.ds-page-header { display: flex; min-height: 36px; flex-shrink: 0; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.ds-page-header-title { display: flex; min-width: 0; align-items: center; gap: 10px; }
.ds-page-header-tabs { order: 99; width: 100%; min-width: 0; }
@media (min-width: 640px) { .ds-page-header-tabs { order: 0; width: auto; } }
.ds-hint { position: relative; flex-shrink: 0; }
.ds-hint-btn { display: grid; width: 24px; height: 24px; place-items: center; border: 0; border-radius: var(--ds-radius-sm); background: transparent; color: var(--ds-muted-foreground); cursor: pointer; }
.ds-hint-btn:hover { background: var(--ds-brand-soft); color: var(--ds-foreground); }
.ds-hint-note { position: absolute; left: 0; top: 28px; z-index: 40; width: 22rem; border-radius: var(--ds-radius-sm); background: var(--ds-chrome); color: var(--ds-chrome-foreground); padding: 8px 12px; font-size: 12px; line-height: 1.5; box-shadow: 0 4px 16px rgba(0, 0, 0, .18); }
@media (max-width: 639px) { .ds-hint-note { position: fixed; left: 16px; right: 16px; top: 64px; width: auto; } }
/* AppShell banner: a notice above every page's header. */
.ds-banner-slot { flex-shrink: 0; margin-bottom: 12px; }
.ds-page-header-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--ds-muted-foreground); }
.ds-page-header-actions { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }

/* ── Dashboard grid (DESIGN.md §5): rows of 8 · 8 · 4 · 4 · 2 · 1 ───────── */
.ds-dash { container: ds-dash / inline-size; display: flex; flex-direction: column; gap: var(--ds-gap); }
.ds-dash-row { display: grid; gap: var(--ds-gap); grid-template-columns: repeat(var(--ds-cols-sm), minmax(0, 1fr)); }
.ds-dash-row > * { min-width: 0; }
.ds-cols-8 { --ds-cols-sm: 2; --ds-cols-md: 4; --ds-cols-lg: 8; }
.ds-cols-4 { --ds-cols-sm: 1; --ds-cols-md: 2; --ds-cols-lg: 4; }
.ds-cols-2 { --ds-cols-sm: 1; --ds-cols-md: 1; --ds-cols-lg: 2; }
.ds-cols-1 { --ds-cols-sm: 1; --ds-cols-md: 1; --ds-cols-lg: 1; }
@container ds-dash (min-width: 540px) { .ds-dash-row { grid-template-columns: repeat(var(--ds-cols-md), minmax(0, 1fr)); } }
@container ds-dash (min-width: 900px) { .ds-dash-row { grid-template-columns: repeat(var(--ds-cols-lg), minmax(0, 1fr)); } }
/* Rows 1–2: squares on a wide screen; compact, not square, below 900px so
   16 numbers stay a short scroll on phones and tablets. */
.ds-cols-8 > * { aspect-ratio: 1 / 1; }
@container ds-dash (max-width: 899px) { .ds-cols-8 > * { aspect-ratio: auto; height: 104px; } }
/* Rows 3–4: square on tablets; on a wide landscape screen they share the
   height left after rows 1–2 (set by <DashboardGrid> as --ds-fill-h). */
.ds-cols-4 > * { aspect-ratio: 1 / 1; }
/* .ds-dash-row raises these above .ds-tile { min-height: 0 }. */
@container ds-dash (max-width: 539px) { .ds-dash-row.ds-cols-4 > * { aspect-ratio: auto; min-height: 220px; } }
.ds-dash[data-fill='true'] .ds-cols-4 > * { aspect-ratio: auto; height: var(--ds-fill-h); }
/* Rows 5–6: as tall as their content. */
.ds-dash-row.ds-cols-2 > *, .ds-dash-row.ds-cols-1 > * { min-height: 160px; }

/* Phones, and tablets in portrait (owner, 2026-10-06). A tablet in landscape
   keeps the desktop layout above. Keep this query in step with COMPACT_QUERY
   in Dashboard.tsx, which turns off the desktop fill under the same terms.
     rows 1–2  4 columns of square tiles
     rows 3–4  2 columns, each 2:1 (width:height)
     row 5     2 columns, each 2:3
     row 6     full width, square                                          */
@media (orientation: portrait), (max-width: 1023px) {
  .ds-cols-8 { --ds-cols-sm: 4; --ds-cols-md: 4; --ds-cols-lg: 4; }
  .ds-cols-4 { --ds-cols-sm: 2; --ds-cols-md: 2; --ds-cols-lg: 2; }
  .ds-cols-2 { --ds-cols-sm: 2; --ds-cols-md: 2; --ds-cols-lg: 2; }
  .ds-cols-1 { --ds-cols-sm: 1; --ds-cols-md: 1; --ds-cols-lg: 1; }
  .ds-dash .ds-dash-row.ds-cols-8 > * { aspect-ratio: 1 / 1; height: auto; min-height: 0; }
  .ds-dash .ds-dash-row.ds-cols-4 > * { aspect-ratio: 2 / 1; height: auto; min-height: 0; }
  .ds-dash .ds-dash-row.ds-cols-2 > * { aspect-ratio: 2 / 3; height: auto; min-height: 0; }
  .ds-dash .ds-dash-row.ds-cols-1 > * { aspect-ratio: 1 / 1; height: auto; min-height: 0; }

  /* A square quarter-width tile on a phone is ~85px: tighter padding, a
     two-line label, the number, and no foot line or chart. */
  .ds-dash .ds-cols-8 .ds-stat { --ds-tile-pad: 10px; }
  .ds-dash .ds-cols-8 .ds-stat-top .ds-label { white-space: normal; word-break: normal; overflow-wrap: normal; hyphens: manual; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-overflow: clip; font-size: var(--ds-tile-title, clamp(8px, 11cqw, 10.5px)); letter-spacing: 0.01em; }
  .ds-dash .ds-cols-8 .ds-stat-viz { display: none !important; }
  @container (max-height: 110px) { .ds-dash .ds-cols-8 .ds-stat-foot { display: none; } }

  /* 2:1 panels are short on a phone: a tighter head, and the body scrolls
     rather than cutting its content off. */
  .ds-dash .ds-cols-4 .ds-panel-head { min-height: 34px; padding-top: 8px; }
  .ds-dash .ds-cols-4 .ds-panel-body,
  .ds-dash .ds-cols-2 .ds-panel-body,
  .ds-dash .ds-cols-1 .ds-panel-body { overflow-y: auto; scrollbar-width: thin; }
}

/* Phone panels (owner, 2026-10-06): every dashboard panel's head is the title alone, on one line, in the same
   type as the stat tiles' labels; no subtitle or "All …" link repeating the title. Bodies use the stat tiles' 10px inset. */
@media (max-width: 767px) {
  .ds-dash .ds-panel-head { flex-wrap: nowrap; min-height: 0; padding: 10px 10px 6px; gap: 6px; }
  .ds-dash .ds-panel-head .ds-title { font-size: var(--ds-tile-title); line-height: 1.2; font-weight: 600; letter-spacing: 0.01em; text-transform: uppercase; color: var(--ds-muted-foreground); }
  .ds-dash .ds-panel-head .ds-panel-sub,
  .ds-dash .ds-panel-head-action { display: none; }
  .ds-dash .ds-panel-body { padding: 0 10px 10px; }
  .ds-dash .ds-panel-body.ds-flush { padding: 0 0 4px; }
  .ds-dash .ds-cols-4 .ds-panel-body { overflow: hidden; }
}

/* <MiniChart>: number + caption on the left, chart on the right (rows 3–4 on phones). */
.ds-mini { display: flex; flex: 1; min-height: 0; width: 100%; align-items: stretch; gap: 10px; }
.ds-mini-kpi { display: flex; flex-shrink: 0; max-width: 52%; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; }
.ds-mini-value { font-size: 20px; line-height: 1; white-space: nowrap; overflow: hidden; }
.ds-mini-caption { font-size: 10.5px; line-height: 1.2; color: var(--ds-muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-mini-chart { display: flex; flex: 1; min-height: 0; min-width: 0; width: 100%; }
.ds-mini-chart svg { width: 100%; height: 100%; overflow: visible; }
.ds-mini-line { fill: none; stroke: var(--ds-emphasis); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ds-mini-area { fill: var(--ds-emphasis); opacity: .12; }
.ds-mini-bars { align-items: flex-end; justify-content: center; gap: 3px; }
.ds-mini-bar { display: flex; flex: 1; min-width: 0; max-width: 28px; height: 100%; align-items: flex-end; }
.ds-mini-bar-fill { width: 100%; border-radius: 3px 3px 0 0; background: var(--ds-emphasis); }
.ds-mini-empty { align-items: center; justify-content: center; font-size: 11px; color: var(--ds-muted-foreground); }
.ds-mini-donut { align-items: center; gap: 8px; }
.ds-mini-donut svg { width: auto; height: 100%; max-height: 64px; aspect-ratio: 1; flex-shrink: 0; }
.ds-mini-donut-track { fill: none; stroke: var(--ds-track); stroke-width: 6; }
.ds-mini-key { display: flex; min-width: 0; flex: 1; flex-direction: column; justify-content: center; gap: 3px; list-style: none; margin: 0; padding: 0; font-size: 10.5px; line-height: 1.2; }
.ds-mini-key li { display: flex; min-width: 0; align-items: center; gap: 5px; }
.ds-mini-key i { width: 7px; height: 7px; flex-shrink: 0; border-radius: 2px; }
.ds-mini-key span { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ds-muted-foreground); }
.ds-mini-key b { font-weight: 600; font-variant-numeric: tabular-nums; }
/* With a headline number there is no room for the key: the number and the ring say it. */
.ds-mini:has(.ds-mini-kpi) .ds-mini-key { display: none; }

/* <MiniList>: one line per item, value on the right; `amount` paints a soft bar behind the row. */
.ds-mini-list { display: flex; flex-direction: column; gap: 2px; list-style: none; margin: 0; padding: 0; min-height: 0; }
.ds-mini-list li { position: relative; display: flex; min-width: 0; flex-shrink: 0; align-items: center; gap: 8px; height: 26px; padding: 0 6px; font-size: 12px; line-height: 1; border-radius: var(--ds-radius-sm); }
.ds-mini-list-link { display: flex; min-width: 0; flex: 1; align-items: center; gap: 8px; height: 100%; color: inherit; text-decoration: none; }
.ds-mini-list-bar { position: absolute; inset: 0 auto 0 0; z-index: 0; border-radius: var(--ds-radius-sm); background: color-mix(in oklab, var(--ds-emphasis) 14%, transparent); }
.ds-mini-list-label { position: relative; z-index: 1; min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-mini-list-value { position: relative; z-index: 1; flex-shrink: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.ds-mini-list-empty { display: grid; flex: 1; place-items: center; padding: 12px; text-align: center; font-size: 11px; color: var(--ds-muted-foreground); }
/* Row text lines up with the tile title; the 6px row inset only shows on the bars behind. */
.ds-panel-body > .ds-mini-list { margin: 0 -6px; }
.ds-panel-body.ds-flush > .ds-mini-list { margin: 0; padding: 0 4px; }

/* <RangePicker>: the dashboard's period button and its shortcuts. */
.ds-range { position: relative; }
.ds-range-btn { gap: 6px; padding: 0 10px; }
.ds-range-btn svg { width: 14px; height: 14px; }
.ds-range-btn .ds-range-chevron { width: 12px; height: 12px; color: var(--ds-muted-foreground); }
.ds-range-menu { top: calc(100% + 4px); right: 0; left: auto; min-width: 160px; }

/* ── Tiles ────────────────────────────────────────────────────────────── */
.ds-tile {
  display: flex; min-height: 0; min-width: 0; flex-direction: column; overflow: hidden;
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius); background: var(--ds-card); color: var(--ds-card-foreground);
}
.ds-stat { container-type: size; justify-content: space-between; padding: var(--ds-tile-pad); }
.ds-stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 2px 6px; }
.ds-stat-top .ds-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
/* A narrow tile puts the delta under the label, and every narrow tile keeps
   that second line, so numbers stay level across the row. */
@container (max-width: 159px) {
  .ds-stat-top { flex-direction: column; min-height: calc(2.4em + 2px); }
  .ds-stat-top .ds-label { flex: none; max-width: 100%; }
}
.ds-stat-delta { flex-shrink: 0; font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
/* Never cut a number: the size follows the tile (18px floor), and StatTile shrinks only a value that is actually too wide. */
.ds-stat-value { flex-shrink: 0; min-height: 1.15em; line-height: 1.15; margin-block: auto; overflow: hidden; white-space: nowrap; font-size: clamp(18px, 17cqw, 40px); }
.ds-stat-foot { min-height: 1.3em; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--ds-muted-foreground); }
.ds-stat-viz { flex: 0 1 26cqh; min-height: 0; overflow: hidden; display: flex; align-items: flex-end; padding-bottom: 4px; }
/* The number always shows: a tile too small for its chart drops the chart (every tile in the row is the same size, so the row stays level).
   Size queries on .ds-stat measure its content box (inside the 16px padding): 96px inside ≈ a 130px tile. */
@container (max-width: 95px) { .ds-stat-viz { display: none !important; } }
@container (max-height: 95px) { .ds-stat-viz { display: none !important; } }
.ds-stat-viz:empty { display: none; }
/* A row with any chart reserves the same band in every tile, so numbers line up. */
.ds-dash-row:has(.ds-stat-viz:not(:empty)) .ds-stat-viz:empty { display: flex; }
@container ds-dash (max-width: 899px) { .ds-cols-8 .ds-stat-viz { display: none !important; } }
.ds-tone-good { color: var(--ds-good); }
.ds-tone-warn { color: var(--ds-warn); }
.ds-tone-bad { color: var(--ds-bad); }
.ds-tone-info { color: var(--ds-info); }
.ds-tone-muted { color: var(--ds-muted-foreground); }

.ds-panel-head { display: flex; flex-wrap: wrap; row-gap: 4px; min-height: 44px; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 12px; padding: 12px var(--ds-tile-pad) 4px; }
.ds-panel-head-title { display: flex; flex: 1 1 8em; min-width: 0; align-items: baseline; gap: 8px; }
/* The subtitle gives way long before the title does. */
.ds-panel-head-title .ds-title { flex-shrink: 1; }
.ds-panel-head-title .ds-panel-sub { flex-shrink: 1000; }
.ds-panel-head-title .ds-title, .ds-panel-head-title .ds-panel-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-panel-sub { font-size: 11px; color: var(--ds-muted-foreground); }
.ds-panel-head-action { display: flex; flex-shrink: 0; align-items: center; gap: 8px; }
.ds-panel-body { display: flex; flex-direction: column; min-height: 0; flex: 1; padding: 0 var(--ds-tile-pad) var(--ds-tile-pad); }
.ds-tile-link { color: inherit; text-decoration: none; }
.ds-tile-link:hover { border-color: var(--ds-brand); }
.ds-tile-link:focus-visible { outline: 2px solid var(--ds-ring, var(--ds-brand)); outline-offset: 2px; }
.ds-panel-body.ds-flush { padding: 0; }
.ds-panel-body.ds-scroll { overflow-y: auto; scrollbar-width: thin; }
.ds-panel:not(:has(.ds-panel-head)) .ds-panel-body:not(.ds-flush) { padding-top: var(--ds-tile-pad); }

.ds-empty {
  display: grid; height: 100%; min-height: 6rem; place-items: center; padding: 12px 16px; text-align: center;
  border: 1px dashed var(--ds-border); border-radius: var(--ds-radius-sm); font-size: 12px; color: var(--ds-muted-foreground);
}

/* Small pieces inside tiles. */
.ds-link { font-size: 12px; font-weight: 500; color: var(--ds-info); text-decoration: none; }
.ds-link:hover { text-decoration: underline; }
.ds-empty-inset { margin: 0 var(--ds-tile-pad) var(--ds-tile-pad); }
.ds-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 10.5px; color: var(--ds-muted-foreground); }
.ds-legend.ds-legend-v { flex-direction: column; align-items: flex-start; gap: 6px; }
.ds-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ds-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }

/* ── Sign-in ──────────────────────────────────────────────────────────── */
.ds-signin { display: flex; min-height: 100dvh; flex-direction: column; background: var(--ds-background); color: var(--ds-foreground); font-family: var(--ds-font-sans); }
@media (min-width: 1024px) { .ds-signin { flex-direction: row; } }
.ds-signin *, .ds-signin *::before, .ds-signin *::after { box-sizing: border-box; }
.ds-signin-brand {
  position: relative; display: flex; flex-shrink: 0; align-items: center; gap: 14px; overflow: hidden;
  background: var(--ds-chrome); color: var(--ds-chrome-foreground); padding: max(20px, env(safe-area-inset-top)) 20px 20px;
}
@media (min-width: 1024px) {
  .ds-signin-brand { width: 50%; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; padding: 48px 64px; }
  .ds-signin-brand::before {
    content: ''; position: absolute; inset: 0; opacity: .6; pointer-events: none;
    background-image: repeating-linear-gradient(90deg, var(--ds-chrome-border) 0 1px, transparent 1px 12.5%);
  }
}
.ds-signin-brand > * { position: relative; }
.ds-signin-logo { height: 28px; width: auto; filter: invert(1); }
@media (min-width: 1024px) { .ds-signin-logo { height: 64px; } }
.ds-signin-wordmark { font-size: 26px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; }
@media (min-width: 1024px) { .ds-signin-wordmark { font-size: 72px; line-height: .95; } }
.ds-signin-company { margin: 4px 0 0; font-size: 12.5px; color: var(--ds-chrome-muted); }
@media (min-width: 1024px) { .ds-signin-company { margin-top: 20px; font-size: 15px; font-weight: 500; color: var(--ds-chrome-foreground); } }
.ds-signin-tagline { display: none; margin: 6px 0 0; font-size: 13.5px; color: var(--ds-chrome-muted); }
@media (min-width: 1024px) { .ds-signin-tagline { display: block; } }
.ds-signin-form-wrap { display: flex; flex: 1; align-items: flex-start; justify-content: center; padding: 32px 20px; }
@media (min-width: 1024px) { .ds-signin-form-wrap { align-items: center; padding: 48px; } }
.ds-signin-form { width: 100%; max-width: 336px; }
.ds-signin-form .ds-page-title { margin: 0 0 24px; }
.ds-field-label { display: block; margin: 0 0 6px; }
.ds-field-label + .ds-input { margin-bottom: 16px; }
.ds-input {
  display: block; height: 40px; width: 100%; border: 1px solid var(--ds-input); border-radius: var(--ds-radius-sm);
  background: var(--ds-card); padding: 0 12px; font: inherit; font-size: 14px; color: var(--ds-foreground); outline: none;
}
.ds-input:focus { border-color: color-mix(in oklab, var(--ds-foreground) 45%, transparent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ds-ring) 15%, transparent); }
@media (hover: none) and (pointer: coarse) { .ds-input { font-size: 16px; } }
.ds-error { margin: 4px 0 0; font-size: 13px; color: var(--ds-bad); }
.ds-button {
  display: inline-flex; height: 32px; align-items: center; justify-content: center; gap: 8px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--ds-radius-sm); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none;
}
.ds-button svg { width: 16px; height: 16px; }
.ds-button-primary { background: var(--ds-primary); color: var(--ds-primary-foreground); }
.ds-button-primary:hover { background: color-mix(in oklab, var(--ds-primary) 88%, white); }
.ds-button-outline { border-color: var(--ds-input); background: var(--ds-card); color: var(--ds-foreground); }
.ds-button-outline:hover { background: var(--ds-muted); }
.ds-button-lg { height: 40px; width: 100%; font-size: 14px; }
.ds-button:disabled { opacity: .6; cursor: default; }
.ds-signin-form .ds-button-lg { margin-top: 24px; }

/* ── Phones (owner, 2026-10-07) ─────────────────────────────────────────────
   No top bar: the bottom menu's "Menu" holds Search, Dark mode and Log out, and the AI is a floating button.
   Dashboard: rows 1–2 = the first 8 numbers (4 across), then two rows of 2:1 panels, then the next panels tall
   (2:3), then the full-width table. Later rows of numbers are left out on phones. Tablets/computers unchanged. */
.ds-ai-fab { display: none; }
.ds-allmenu-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ds-allmenu-actions button {
  display: flex; height: 64px; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--ds-border); border-radius: var(--ds-radius); background: var(--ds-card); color: var(--ds-foreground);
  font: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
}
.ds-allmenu-actions svg { width: 18px; height: 18px; }
@media (max-width: 767px) {
  /* One title size for every tile on a phone: the stat tiles' label (owner, 2026-10-06). */
  :root {
    --ds-tile-title: 8px;
    /* Space left under the bottom menu's labels: none in the browser, so they sit on the address bar; in the
       home-screen app just enough to clear the home indicator. */
    --ds-bar-under: 0px;
  }
  .ds-topbar { display: none; }
  .ds-shell-content { padding-top: max(8px, env(safe-area-inset-top)); }
  .ds-shell-content.ds-flush-content { padding-top: env(safe-area-inset-top); }
  .ds-shell:has([data-ds-hide-topbar]) .ds-shell-content { padding-top: 0; }

  .ds-ai-fab {
    position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 45;
    display: grid; width: 56px; height: 56px; place-items: center; border: 0; border-radius: 999px;
    background: var(--ds-brand); color: var(--ds-brand-foreground); box-shadow: 0 6px 20px rgba(0, 0, 0, .18); cursor: pointer;
  }
  .ds-ai-fab svg { width: 24px; height: 24px; }
  .ds-ai-fab[aria-current='page'], .ds-shell:has([data-ds-hide-topbar]) .ds-ai-fab { display: none; }

  /* Bottom menu like app.workify.ca's, as low as it can go (owner, 2026-10-06): the tab labels sit on the bottom
     edge, and only the row of tabs is painted — any strip under it stays transparent so the page shows through. */
  .ds-bottombar {
    background: transparent; border-top: 0; box-shadow: none; backdrop-filter: none;
    padding-bottom: var(--ds-bar-under);
  }
  .ds-bottombar-strip { background: var(--ds-card); border-top: 1px solid var(--ds-border); box-shadow: 0 -4px 16px rgba(0, 0, 0, .06); }
  /* Taller than the tablet bar's padding would make it on a phone, and the tabs further apart, so the strip is
     not crowded as it scrolls (owner, 2026-10-11). Still flush with the bottom edge. */
  .ds-tab { min-width: 82px; gap: 5px; padding: 9px 6px 3px; font-size: 10px; line-height: 12px; }
  .ds-tab-pill svg { width: 22px; height: 22px; }
  /* The bar is 62px + --ds-bar-under: everything that sits above it follows. */
  .ds-allmenu { bottom: calc(62px + var(--ds-bar-under)); }
  .ds-shell-content:not(.ds-flush-content) { padding-bottom: calc(82px + var(--ds-bar-under)); }
  /* With the floating AI button, the last row must be able to scroll clear of it (56px button + 8px gap). */
  .ds-shell:has(.ds-ai-fab) .ds-shell-content:not(.ds-flush-content) { padding-bottom: calc(146px + var(--ds-bar-under)); }
  .ds-ai-fab { bottom: calc(78px + var(--ds-bar-under)); }

  /* Dashboard header: one compact row, so row 1 starts at the same height in every product. The period is a
     <RangePicker>, 28px tall; tabs or filters scroll sideways inside the row rather than wrapping under it. */
  .ds-page:has(.ds-dash) { gap: 8px; }
  .ds-page:has(.ds-dash) > .ds-page-header { min-height: 28px; flex-wrap: nowrap; gap: 8px; }
  .ds-page:has(.ds-dash) > .ds-page-header .ds-page-title { font-size: 18px; white-space: nowrap; }
  .ds-page:has(.ds-dash) > .ds-page-header .ds-page-header-title { flex: 0 1 auto; min-width: 0; gap: 8px; }
  .ds-page:has(.ds-dash) > .ds-page-header .ds-page-header-tabs { order: 0; width: auto; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; }
  .ds-page:has(.ds-dash) > .ds-page-header .ds-page-header-actions { flex-wrap: nowrap; flex-shrink: 0; gap: 6px; }
  .ds-page:has(.ds-dash) > .ds-page-header .ds-button { height: 28px; padding: 0 10px; font-size: 12px; }

  /* Rows on a phone: 1–2 numbers (4 across), 3–4 charts (2:1), 5–6 tall lists (2:3), 7 onwards full width. */
  .ds-dash .ds-dash-row.ds-cols-8 ~ .ds-dash-row.ds-cols-8 { display: none; }
  .ds-dash .ds-dash-row.ds-cols-4 ~ .ds-dash-row.ds-cols-4 > * { aspect-ratio: 2 / 3; height: auto; min-height: 0; }
  .ds-cols-2 { --ds-cols-sm: 1; --ds-cols-md: 1; --ds-cols-lg: 1; }
  .ds-dash .ds-dash-row.ds-cols-2 > * { aspect-ratio: 4 / 3; }
}
@media (max-width: 767px) and (display-mode: standalone) {
  :root { --ds-bar-under: max(calc(env(safe-area-inset-bottom) - 20px), 0px); }
}
