/*
 * Precision OS — app stylesheet (DPE Calling)
 * Look: Nexora CRM (shadcn "neutral" tokens, Geist, radius .625rem, inset sidebar layout,
 * dotted KPI cards with gradient icon tiles). The DPE leaf green appears only on the logo tile.
 * Light theme on :root, dark theme on [data-theme="dark"], and the OS preference is followed
 * when no choice is saved (see public/js/app-shell.js). Class reference: docs/UI-CLASSES.md
 * Fonts: Geist Sans and Geist Mono (SIL Open Font License, self-hosted, public/fonts/GEIST-OFL.txt).
 */

@font-face { font-family: "Geist"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/geist-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Geist"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/geist-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Geist"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/geist-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Geist"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/geist-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Geist Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/geist-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Geist Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/geist-mono-latin-500-normal.woff2") format("woff2"); }

/* ================================================================
   1. Design tokens
   ================================================================ */
:root {
  color-scheme: light;
  --background: #ffffff;
  --foreground: #0a0a0a;
  --card: #ffffff;
  --card-foreground: #0a0a0a;
  --muted: #f5f5f5;
  --muted-foreground: #6b6b6b;      /* 5.3:1 on white, 4.9:1 on --muted (AA) */
  --border: #e5e5e5;
  --input: #e0e0e0;
  --sidebar: #fafafa;
  --sidebar-hover: #f0f0f0;
  --row-hover: #fafafa;
  --table-head: #fafafa;
  --primary: #171717;
  --primary-hover: #333333;
  --primary-foreground: #fafafa;
  --destructive: #dc2626;
  --destructive-soft: #fef2f2;
  --focus: #047857;                 /* emerald-700, 5.5:1 on white */
  --dot: #e5e7eb;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, .12);

  /* status palette: bg / border / text */
  --em-bg: #ecfdf5; --em-border: #a7f3d0; --em-fg: #047857;
  --vi-bg: #f5f3ff; --vi-border: #ddd6fe; --vi-fg: #6d28d9;
  --am-bg: #fffbeb; --am-border: #fde68a; --am-fg: #b45309;
  --bl-bg: #eff6ff; --bl-border: #bfdbfe; --bl-fg: #1d4ed8;
  --ro-bg: #fff1f2; --ro-border: #fecdd3; --ro-fg: #be123c;
  --ne-bg: var(--muted); --ne-border: var(--border); --ne-fg: var(--muted-foreground);

  /* gradient icon tiles */
  --g-cy: linear-gradient(135deg, #06b6d4, #2563eb);
  --g-vi: linear-gradient(135deg, #8b5cf6, #9333ea);
  --g-em: linear-gradient(135deg, #10b981, #0d9488);
  --g-am: linear-gradient(135deg, #f59e0b, #ea580c);
  --g-ro: linear-gradient(135deg, #f43f5e, #db2777);
  --g-sl: linear-gradient(135deg, #475569, #1e293b);

  /* brand: DPE leaf green, logo tile only */
  --brand: #3d6b42;
  --brand-2: #62a145;
  --g-brand: linear-gradient(135deg, var(--brand-2), var(--brand));

  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: .625rem;                /* 10px */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --sidebar-width: 256px;
  --header-height: 56px;
  --tabbar-height: 64px;
  --tap: 44px;
}

/* dark: explicit choice */
:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #0a0a0a;
  --foreground: #fafafa;
  --card: #141414;
  --card-foreground: #fafafa;
  --muted: #232323;
  --muted-foreground: #a1a1a1;
  --border: rgba(255, 255, 255, .1);
  --input: rgba(255, 255, 255, .15);
  --sidebar: #111111;
  --sidebar-hover: #1c1c1c;
  --row-hover: #171717;
  --table-head: #121212;
  --primary: #e5e5e5;
  --primary-hover: #ffffff;
  --primary-foreground: #171717;
  --destructive: #f87171;
  --destructive-soft: #2a1212;
  --focus: #34d399;
  --dot: #1f2937;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .5);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, .6);
  --em-bg: #022c22; --em-border: #064e3b; --em-fg: #34d399;
  --vi-bg: #2e1065; --vi-border: #4c1d95; --vi-fg: #c4b5fd;
  --am-bg: #451a03; --am-border: #78350f; --am-fg: #fbbf24;
  --bl-bg: #172554; --bl-border: #1e3a8a; --bl-fg: #93c5fd;
  --ro-bg: #4c0519; --ro-border: #881337; --ro-fg: #fda4af;
}

/* dark: no saved choice, OS prefers dark (same values as above) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: #0a0a0a;
    --foreground: #fafafa;
    --card: #141414;
    --card-foreground: #fafafa;
    --muted: #232323;
    --muted-foreground: #a1a1a1;
    --border: rgba(255, 255, 255, .1);
    --input: rgba(255, 255, 255, .15);
    --sidebar: #111111;
    --sidebar-hover: #1c1c1c;
    --row-hover: #171717;
    --table-head: #121212;
    --primary: #e5e5e5;
    --primary-hover: #ffffff;
    --primary-foreground: #171717;
    --destructive: #f87171;
    --destructive-soft: #2a1212;
    --focus: #34d399;
    --dot: #1f2937;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .5);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, .6);
    --em-bg: #022c22; --em-border: #064e3b; --em-fg: #34d399;
    --vi-bg: #2e1065; --vi-border: #4c1d95; --vi-fg: #c4b5fd;
    --am-bg: #451a03; --am-border: #78350f; --am-fg: #fbbf24;
    --bl-bg: #172554; --bl-border: #1e3a8a; --bl-fg: #93c5fd;
    --ro-bg: #4c0519; --ro-border: #881337; --ro-fg: #fda4af;
  }
}

/* ================================================================
   2. Base
   ================================================================ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 14px/1.5 var(--font-sans); color: var(--foreground); background: var(--sidebar); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; color: var(--foreground); }
p { margin: 0 0 8px; }
a { color: var(--foreground); text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--bl-bg); color: var(--foreground); }
img { max-width: 100%; }
.icon { flex: none; display: inline-block; vertical-align: middle; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted-foreground); margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: var(--radius); background: var(--primary); color: var(--primary-foreground); text-decoration: none; font-weight: 500; }
.skip-link:focus { top: 12px; }

/* ================================================================
   3. Shell: inset sidebar + rounded content panel
   ================================================================ */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar { position: sticky; top: 0; flex: none; display: flex; flex-direction: column; gap: 2px; width: var(--sidebar-width); height: 100vh; height: 100dvh; padding: 10px; overflow-y: auto; background: var(--sidebar); scrollbar-width: thin; }
:root[data-sidebar="collapsed"] .sidebar { display: none; }

.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-md); color: var(--foreground); text-decoration: none; }
.sidebar-brand:hover { background: var(--sidebar-hover); }
.brand-tile { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: var(--radius-md); background: var(--g-brand); color: #fff; font: 700 14px/1 var(--font-sans); }
.brand-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.brand-name { font-weight: 600; font-size: 14px; line-height: 1.2; }
.brand-sub { font-size: 12px; line-height: 1.3; color: var(--muted-foreground); }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-group-label { padding: 14px 10px 4px; font-size: 12px; font-weight: 500; color: var(--muted-foreground); }
.nav-link { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 6px 10px; border-radius: var(--radius-md); color: var(--foreground); font-size: 14px; text-decoration: none; }
.nav-link .icon { color: var(--muted-foreground); }
.nav-link:hover { background: var(--sidebar-hover); }
.nav-link.is-active { background: var(--card); box-shadow: 0 0 0 1px var(--border), var(--shadow-xs); font-weight: 500; }
.nav-link.is-active .icon { color: var(--foreground); }
.nav-link-out .nav-out-mark { margin-left: auto; }

.sidebar-foot { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--muted); color: var(--foreground); font: 600 12px/1 var(--font-sans); border: 1px solid var(--border); }
.user-card-text { display: flex; flex-direction: column; min-width: 0; }
.user-card-name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.user-card-email { font-size: 12px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.panel { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; margin: 8px 8px 8px 0; background: var(--background); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-xs); }
:root[data-sidebar="collapsed"] .panel { margin-left: 8px; }
.panel-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; min-height: var(--header-height); padding: 8px 16px; border-bottom: 1px solid var(--border); background: var(--background); border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
.header-divider { width: 1px; height: 18px; background: var(--border); flex: none; }
.breadcrumb { flex: 1; min-width: 0; }
.breadcrumb ol { display: flex; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 14px; white-space: nowrap; overflow: hidden; }
.breadcrumb li { overflow: hidden; text-overflow: ellipsis; }
.breadcrumb li + li::before { content: "/"; margin-right: 6px; color: var(--muted-foreground); }
.breadcrumb .crumb-group { color: var(--muted-foreground); }
.breadcrumb [aria-current="page"] { font-weight: 500; color: var(--foreground); }
.header-actions { display: flex; align-items: center; gap: 6px; flex: none; }

/* theme toggle shows the icon of the theme it switches to */
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: inline-block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .icon-sun { display: inline-block; }
  :root:not([data-theme]) .theme-toggle .icon-moon { display: none; }
}

.user-menu { position: relative; }
.user-menu-button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 2px 8px 2px 2px; border: 1px solid transparent; border-radius: 999px; background: transparent; color: var(--foreground); font: 500 14px var(--font-sans); cursor: pointer; }
.user-menu-button:hover { background: var(--muted); }
.user-menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; width: 240px; padding: 6px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); }
.user-menu-list[hidden] { display: none; }
.menu-head { display: flex; flex-direction: column; padding: 6px 8px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-head strong { font-size: 14px; font-weight: 600; }
.menu-head span { font-size: 12px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 6px 8px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--foreground); font: 400 14px var(--font-sans); text-align: left; text-decoration: none; cursor: pointer; }
.menu-item:hover { background: var(--muted); }
.menu-item .icon { color: var(--muted-foreground); }
.logout { margin: 0; }

.page { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.page > * { margin-top: 0; margin-bottom: 0; }
.page-call .page { max-width: 880px; }

.drawer-backdrop { display: none; }
.tabbar { display: none; }

/* ================================================================
   4. Page header, sections, cards
   ================================================================ */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.page-head > .title, .page-head > .subtitle, .page-head > .eyebrow { flex-basis: 100%; }
.page-head-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 360px; }
.page-head .title, .title { margin: 0; font-size: 22px; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
.subtitle { margin: 0; color: var(--muted-foreground); font-size: 15px; line-height: 1.5; max-width: 72ch; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.page-head > .btn { margin-top: 0; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.section-title { margin: 0 0 12px; font-size: 16px; font-weight: 600; line-height: 1.35; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.section-head .section-title { margin: 0; }
.section-head-main { display: flex; align-items: center; gap: 10px; }
.label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--muted-foreground); }

.card { background: var(--card); color: var(--card-foreground); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 20px; box-shadow: var(--shadow-xs); margin: 0; }
.card + .card { margin-top: 0; }
.card-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.dots { background-image: radial-gradient(var(--dot) 1px, transparent 1px); background-size: 16px 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }

.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid; border-radius: var(--radius-lg); font-weight: 500; font-size: 14px; }
.flash-ok { background: var(--em-bg); border-color: var(--em-border); color: var(--em-fg); }
.flash-error { background: var(--ro-bg); border-color: var(--ro-border); color: var(--ro-fg); }

.callout { margin: 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--muted); color: var(--foreground); }
.callout p { margin: 0 0 4px; }
.callout p:last-child { margin-bottom: 0; }
.callout ul { margin: 6px 0 0; padding-left: 18px; }
.callout-warn { background: var(--am-bg); border-color: var(--am-border); }
.callout-warn, .callout-warn strong { color: var(--foreground); }
.callout-warn > p:first-child strong { color: var(--am-fg); }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 40px 24px; }
.empty-state .title { font-size: 18px; }
.empty-state p { color: var(--muted-foreground); max-width: 52ch; }
.empty-state .btn { margin-top: 8px; }
.empty-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-bottom: 6px; border-radius: 12px; border: 1px solid var(--border); background: var(--muted); color: var(--muted-foreground); }

/* ================================================================
   5. Chips, badges, statuses
   ================================================================ */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--foreground); font-size: 12px; font-weight: 500; white-space: nowrap; }
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: #10b981; flex: none; }

.badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.badge, .status { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--ne-border); border-radius: var(--radius-sm); background: var(--ne-bg); color: var(--ne-fg); font: 500 12px/1.5 var(--font-sans); white-space: nowrap; vertical-align: middle; }
.status { text-transform: capitalize; }
.badge-em, .badge-priority-a, .status.status-booked, .status.status-won { background: var(--em-bg); border-color: var(--em-border); color: var(--em-fg); }
.badge-vi, .badge-attempt, .status.status-calling { background: var(--vi-bg); border-color: var(--vi-border); color: var(--vi-fg); }
.badge-am, .badge-warn, .status.status-nurture { background: var(--am-bg); border-color: var(--am-border); color: var(--am-fg); }
.badge-bl, .badge-priority-b, .badge-slot, .status.status-new { background: var(--bl-bg); border-color: var(--bl-border); color: var(--bl-fg); }
.badge-ro, .status.status-dnc { background: var(--ro-bg); border-color: var(--ro-border); color: var(--ro-fg); }
.badge-ne, .badge-priority-c, .status.status-closed { background: var(--ne-bg); border-color: var(--ne-border); color: var(--ne-fg); }

/* ================================================================
   6. Gradient icon tiles and KPI cards
   ================================================================ */
.tile { display: inline-flex; flex: none; width: 40px; height: 40px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.tile > span { display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; border-radius: 7px; color: #fff; }
.tile-sm { width: 32px; height: 32px; border-radius: var(--radius-md); }
.tile-sm > span { border-radius: 6px; }
.g-cy { background: var(--g-cy); } .g-vi { background: var(--g-vi); } .g-em { background: var(--g-em); }
.g-am { background: var(--g-am); } .g-ro { background: var(--g-ro); } .g-sl { background: var(--g-sl); }
.g-brand { background: var(--g-brand); }

.kpi-grid, .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.kpi, .stat { display: flex; flex-direction: column; gap: 12px; padding: 20px; background-color: var(--card); background-image: radial-gradient(var(--dot) 1px, transparent 1px); background-size: 16px 16px; border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-xs); }
.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-label, .stat-label { font-size: 14px; font-weight: 500; color: var(--muted-foreground); }
.kpi-value, .stat-value { font-size: 26px; font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--foreground); }
.kpi-value small, .stat-value small { margin-left: 2px; font-size: 15px; font-weight: 500; color: var(--muted-foreground); letter-spacing: 0; }
.kpi-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.kpi-note { color: var(--muted-foreground); }

/* ================================================================
   7. Welcome banner (Today)
   ================================================================ */
.banner { position: relative; overflow: hidden; padding: 28px; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--card); box-shadow: var(--shadow-xs); }
.banner-rings { position: absolute; inset: 0; pointer-events: none; color: var(--foreground); opacity: .07; background-image: repeating-radial-gradient(circle at 100% 0%, transparent 0 28px, currentColor 28px 29px); -webkit-mask-image: linear-gradient(to bottom left, #000, transparent 75%); mask-image: linear-gradient(to bottom left, #000, transparent 75%); }
.banner-blob { position: absolute; pointer-events: none; border-radius: 50%; filter: blur(60px); }
.banner-blob-a { right: -80px; top: -110px; width: 320px; height: 320px; background: rgba(52, 211, 153, .25); }
.banner-blob-b { left: 25%; bottom: -130px; width: 290px; height: 290px; background: rgba(56, 189, 248, .18); }
:root[data-theme="dark"] .banner-blob-a { background: rgba(52, 211, 153, .12); }
:root[data-theme="dark"] .banner-blob-b { background: rgba(56, 189, 248, .08); }
.banner-body { position: relative; display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; }
.banner-main { flex: 1 1 460px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.banner-title { margin: 0; font-size: 30px; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; }
.banner-text { margin: 0; max-width: 64ch; color: var(--muted-foreground); font-size: 16px; line-height: 1.6; }
.banner-text strong { color: var(--foreground); font-weight: 600; }
.banner-stats { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; margin: 0; padding-top: 16px; border-top: 1px solid var(--border); }
.banner-stat { display: flex; flex-direction: column; gap: 4px; padding: 0 20px; border-left: 1px solid var(--border); }
.banner-stat:first-child { padding-left: 0; border-left: 0; }
.banner-stat dt { font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-foreground); }
.banner-stat dd { margin: 0; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.banner-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }

/* ================================================================
   8. Buttons
   ================================================================ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); color: var(--foreground); font: 500 14px/1.2 var(--font-sans); text-decoration: none; white-space: nowrap; cursor: pointer; box-shadow: var(--shadow-xs); transition: background-color .15s, border-color .15s, color .15s; -webkit-tap-highlight-color: transparent; }
.btn:hover { background: var(--muted); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-secondary, .btn-outline { background: var(--card); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--muted); }
.btn-danger { color: var(--destructive); border-color: var(--ro-border); background: var(--card); }
.btn-danger:hover:not(:disabled) { background: var(--ro-bg); }
.btn-icon { width: 36px; padding: 0; background: transparent; border-color: transparent; box-shadow: none; }
.btn-icon:hover { background: var(--muted); }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: var(--radius-md); }
.btn-lg { min-height: 44px; padding: 0 18px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-row, .inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form .input { width: auto; flex: 1 1 200px; }
form.inline { display: inline-flex; margin: 0; }

/* ================================================================
   9. Forms
   ================================================================ */
.form { display: grid; gap: 12px; margin: 0; }
.form-compact { margin-top: 14px; gap: 10px; }
.form-compact > .btn { justify-self: start; }
.field { display: block; margin: 0; }
.field .label { color: var(--foreground); font-size: 14px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.field-check { display: flex; align-items: center; gap: 8px; align-self: end; min-height: 38px; font-weight: 500; }
.field-check-inline { display: inline-flex; gap: 8px; align-items: center; min-height: 32px; margin-right: 16px; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--primary); }
.input { display: block; width: 100%; min-height: 38px; padding: 7px 12px; border: 1px solid var(--input); border-radius: var(--radius-lg); background: var(--background); color: var(--foreground); font: 400 14px/1.4 var(--font-sans); box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s; }
.input::placeholder { color: var(--muted-foreground); opacity: 1; }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
select.input { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23858585' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
input[type="file"].input { padding: 6px; }
input[type="file"].input::file-selector-button { margin-right: 10px; padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--muted); color: var(--foreground); font: 500 13px var(--font-sans); cursor: pointer; }
.textarea { min-height: 88px; resize: vertical; }
.hint { display: block; margin-top: 6px; font-size: 12px; color: var(--muted-foreground); }
.field-error { color: var(--destructive); margin: 0; font-size: 14px; font-weight: 500; }
.fieldset { min-width: 0; }
.fieldset legend { float: left; width: 100%; padding: 0; margin-bottom: 14px; }
.fieldset legend + * { clear: both; }
.fieldset > .field + .field, .fieldset > .field-row + .field { margin-top: 12px; }

/* ================================================================
   10. Tables and pagination
   ================================================================ */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-xs); }
.table-wrap.flat { border-radius: var(--radius-lg); box-shadow: none; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { padding: 10px 14px; background: var(--table-head); border-bottom: 1px solid var(--border); color: var(--muted-foreground); font-size: 13px; font-weight: 500; text-align: left; white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--row-hover); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td a { font-weight: 500; text-decoration: none; }
.table td a:hover { text-decoration: underline; }
.table-sub { display: block; font-size: 12px; color: var(--muted-foreground); }
.table-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
nav[role="navigation"] { min-width: 0; }
.pagination { display: flex; gap: 4px; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; }
.pagination .page-link { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card); color: var(--foreground); font-size: 14px; font-weight: 500; text-decoration: none; }
.pagination a.page-link:hover { background: var(--muted); }
.pagination .active .page-link { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.pagination .disabled .page-link { color: var(--muted-foreground); opacity: .7; }

/* ================================================================
   11. Segmented line tabs
   ================================================================ */
.line-tabs { display: flex; gap: 2px; max-width: 100%; width: max-content; padding: 3px; margin: 0; overflow-x: auto; background: var(--muted); border-radius: var(--radius-lg); scrollbar-width: none; }
.line-tabs::-webkit-scrollbar { display: none; }
.line-tab { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 7px; color: var(--muted-foreground); font-size: 13px; font-weight: 500; white-space: nowrap; text-decoration: none; }
.line-tab:hover { color: var(--foreground); }
.line-tab.is-active { background: var(--card); color: var(--foreground); box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 1px var(--border); }

/* ================================================================
   12. Today: calling blocks and finish
   ================================================================ */
.blocks { display: flex; flex-direction: column; gap: 12px; }
.blocks .section-title { margin: 0; }
.block-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.block-card { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.block-card:hover { border-color: var(--muted-foreground); box-shadow: var(--shadow-sm); }
.block-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.block-name { font-size: 15px; font-weight: 600; }
.block-progress { font-weight: 500; font-variant-numeric: tabular-nums; }
.block-meta { font-size: 13px; color: var(--muted-foreground); }
.meter { display: block; height: 6px; margin-top: 8px; border-radius: 999px; background: var(--muted); overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.block-card.is-done .meter-fill { background: #10b981; }

.finish { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.finish .section-title { margin: 0; }
.finish p { margin: 0; }
.finish form { width: 100%; }
.finish.is-done { border-color: var(--em-border); background: var(--em-bg); }
.finish-head { display: flex; align-items: center; gap: 12px; }
.blocker-list { margin: 0; padding-left: 18px; }

/* ================================================================
   13. Calling card
   ================================================================ */
.call-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.call-progress { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0; color: var(--muted-foreground); }
.progress-text strong { color: var(--foreground); font-weight: 600; font-variant-numeric: tabular-nums; }
.prospect-card { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.prospect-card > * { margin: 0; }
.prospect-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.prospect-id { display: flex; gap: 14px; align-items: flex-start; min-width: 0; }
.company-name { margin: 0; font-size: 22px; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; text-decoration: none; color: var(--foreground); }
a.company-name:hover { text-decoration: underline; }
.company-meta { margin: 4px 0 0; color: var(--muted-foreground); }
.audit-check .btn-row { margin-top: 10px; }
.research { color: var(--muted-foreground); font-size: 14px; }
.hook .label { color: var(--muted-foreground); }

.contact-block { display: grid; gap: 14px; }
.contact-name { margin: 0; font-size: 16px; font-weight: 600; }
.phones { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn-dial { min-height: 48px; padding: 0 22px; background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); font-size: 15px; font-variant-numeric: tabular-nums; }
.btn-dial:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-dial::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z'/%3E%3C/svg%3E") center/contain no-repeat; }

.opener { padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card); }
.opener summary { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 14px; cursor: pointer; font-weight: 500; list-style: none; }
.opener summary::-webkit-details-marker { display: none; }
.opener summary::after { content: ""; margin-left: auto; width: 16px; height: 16px; flex: none; background: currentColor; opacity: .6; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center/contain no-repeat; transition: transform .15s; }
.opener[open] summary::after { transform: rotate(180deg); }
.opener[open] summary { border-bottom: 1px solid var(--border); }
.opener > p, .opener > dl { margin: 0; padding: 12px 14px 14px; }
.opener > p { font-size: 15px; line-height: 1.65; }

.history { display: flex; flex-direction: column; }
.history-list, .item-list, .note-list, .contact-list { list-style: none; margin: 0; padding: 0; }
.history-list li, .note-list li, .contact-list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.history-list li:last-child, .note-list li:last-child, .contact-list li:last-child { border-bottom: 0; }
.history-date { margin-right: 8px; color: var(--muted-foreground); font-size: 12px; font-weight: 500; font-family: var(--font-mono); }
.is-undone { opacity: .55; text-decoration: line-through; }

.result-form { padding-top: 18px; border-top: 1px solid var(--border); display: grid; gap: 12px; }
.result-hint { margin: 0; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.btn-result { min-height: 48px; white-space: normal; text-align: center; }
.result-booked { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.result-booked:hover { background: var(--primary-hover) !important; }
.result-advance { border-color: var(--em-border); }
.result-callback { border-color: var(--bl-border); }
.result-nurture { border-color: var(--am-border); }
.result-close { color: var(--muted-foreground); }
.result-dnc { color: var(--destructive); border-color: var(--ro-border); }
.result-dnc:hover { background: var(--ro-bg); }

.card-inset { padding: 16px; border-radius: var(--radius-lg); background: var(--em-bg); border: 1px solid var(--em-border); }
.card-inset[hidden] { display: none; }
.in-call-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.in-call-status { font-weight: 600; }
.in-call-timer { font: 600 22px var(--font-mono); font-variant-numeric: tabular-nums; }
.consent-line { margin: 4px 0 12px; }
#rec-state.is-recording { color: var(--ro-fg); font-weight: 600; }
#rec-state.is-recording::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #e11d48; vertical-align: middle; }
.ai-summary { margin: 4px 0 0; color: var(--muted-foreground); font-size: 14px; }

/* ================================================================
   14. Follow-up and outbox items
   ================================================================ */
.item-group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin-bottom: 6px; }
.item-group-head .company-name { font-size: 16px; }
.item { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: 0; padding-bottom: 0; }
.item-main { flex: 1 1 260px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; }
.item-main .muted, .item-main .field-error { flex-basis: 100%; font-size: 13px; }
.item-type { display: inline-flex; align-items: center; padding: 2px 8px; border: 1px solid var(--bl-border); border-radius: var(--radius-sm); background: var(--bl-bg); color: var(--bl-fg); font-size: 12px; font-weight: 500; }
.item-email .item-type { background: var(--bl-bg); border-color: var(--bl-border); color: var(--bl-fg); }
.item-calendar .item-type { background: var(--vi-bg); border-color: var(--vi-border); color: var(--vi-fg); }
.item-research .item-type { background: var(--em-bg); border-color: var(--em-border); color: var(--em-fg); }
.item-task .item-type { background: var(--ne-bg); border-color: var(--ne-border); color: var(--ne-fg); }
.item-title { font-weight: 500; }
.item.is-overdue .item-title { color: var(--destructive); }
.item-actions { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; }
.push summary { list-style: none; }
.push summary::-webkit-details-marker { display: none; }
.push-form { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.push-form .input { width: auto; min-width: 220px; flex: 1; }
.item-actions .push-form { margin-top: 0; }

/* ================================================================
   15. Prospects
   ================================================================ */
.filters { display: grid; grid-template-columns: minmax(200px, 2fr) repeat(5, minmax(110px, 1fr)) auto; gap: 8px; margin: 0; }
.search-field { position: relative; }
.search-field .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); pointer-events: none; }
.search-field .input { padding-left: 34px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.grid-2 > .card { margin: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0 0 14px; }
.facts dt { color: var(--muted-foreground); font-size: 13px; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.card > .callout { margin: 12px 0; }

/* ================================================================
   16. Objections, coaching, library
   ================================================================ */
.objection { display: flex; flex-direction: column; gap: 12px; }
.objection > * { margin: 0; }
.objection-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.objection-title { margin: 0; font-size: 16px; font-weight: 600; }
.objection-score { display: flex; gap: 6px; flex-wrap: wrap; }
.objection-answer { margin: 0; font-size: 15px; line-height: 1.65; }
.objection-more summary, .coach-inline summary, .transcript summary, .template summary { cursor: pointer; font-weight: 500; }
.objection-more summary { color: var(--muted-foreground); font-size: 13px; min-height: 32px; display: flex; align-items: center; }
.objection-more summary:hover { color: var(--foreground); }
.objection-dl { margin: 0; }
.objection-dl dt { margin-top: 10px; font-weight: 600; }
.objection-dl dt:first-child { margin-top: 0; }
.objection-dl dd { margin: 2px 0 0; color: var(--muted-foreground); }
.proposal { display: flex; flex-direction: column; gap: 10px; }
.proposal > * { margin: 0; }
.evidence { margin: 0; padding: 10px 14px; border-left: 3px solid #10b981; border-radius: 0 var(--radius-md) var(--radius-md) 0; background: var(--muted); font-style: italic; }
.focus-list { margin: 0; padding-left: 20px; font-weight: 500; }
.focus-list li { margin-bottom: 8px; }
.coaching-card { display: flex; flex-direction: column; gap: 10px; }
.coaching-card > * { margin: 0; }
.coaching-grid { padding-top: 12px; border-top: 1px solid var(--border); }
.coaching-grid ul { margin: 4px 0 0; padding-left: 18px; }
.coaching-grid li { margin-bottom: 4px; }
.coach-inline, .transcript { margin-top: 8px; }
.transcript pre { white-space: pre-wrap; max-height: 360px; overflow: auto; margin: 8px 0 0; padding: 12px; background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius-md); font: 400 13px/1.55 var(--font-mono); }
.template { padding: 0; }
.template summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 52px; padding: 14px 20px; list-style: none; }
.template summary::-webkit-details-marker { display: none; }
.template[open] summary { border-bottom: 1px solid var(--border); }
.template .form { padding: 0 20px 20px; }
.connection-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.connection-list .status { min-width: 40px; justify-content: center; }

/* ================================================================
   17. Sign-in pages
   ================================================================ */
body.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background-color: var(--background); background-image: radial-gradient(var(--dot) 1px, transparent 1px); background-size: 18px 18px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px; }
.auth-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; text-decoration: none; color: var(--foreground); }
.auth-main { flex: 1; display: grid; place-items: center; padding: 16px; }
.auth-card { width: min(400px, 100%); padding: 32px; margin: 0; border-radius: 16px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 6px; }
.auth-card .title { font-size: 22px; text-align: left; margin: 0; }
.auth-card .subtitle { font-size: 14px; margin-bottom: 18px; }
.auth-card .form { gap: 14px; }
.auth-card .btn-block { min-height: 40px; margin-top: 4px; }
.auth-logo { display: block; width: 168px; max-width: 70%; margin: 0 0 18px; }
:root[data-theme="dark"] .auth-logo { filter: brightness(0) invert(1) opacity(.9); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .auth-logo { filter: brightness(0) invert(1) opacity(.9); } }
.auth-foot { display: flex; justify-content: center; padding: 20px 24px; font-size: 12px; color: var(--muted-foreground); }
.auth-links { text-align: center; margin: 8px 0 0; font-size: 14px; }

/* ================================================================
   18. Phones and small tablets (<= 768px)
   ================================================================ */
@media (max-width: 768px) {
  body { font-size: 15px; }
  .shell { display: block; }
  .panel { margin: 0; min-height: 100vh; min-height: 100dvh; border: 0; border-radius: 0; box-shadow: none; padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom)); }
  :root[data-sidebar="collapsed"] .panel { margin: 0; }
  .panel-header { padding: 6px 12px; border-radius: 0; gap: 6px; }
  .header-divider { display: none; }
  .breadcrumb .crumb-group { display: none; }
  .breadcrumb li + li::before { content: none; }
  .user-menu-button .user-menu-name, .user-menu-button .icon { display: none; }
  .user-menu-button { padding: 2px; }

  /* off-canvas drawer */
  .sidebar, :root[data-sidebar="collapsed"] .sidebar { display: flex; position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; height: 100%; width: min(300px, 86vw); padding: 12px; border-right: 1px solid var(--border); box-shadow: var(--shadow-lg); transform: translateX(-100%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s; }
  :root[data-drawer="open"] .sidebar { transform: none; visibility: visible; transition: transform .22s ease; }
  .drawer-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .45); opacity: 0; pointer-events: none; transition: opacity .22s; border: 0; padding: 0; }
  :root[data-drawer="open"] .drawer-backdrop { opacity: 1; pointer-events: auto; }
  :root[data-drawer="open"] body { overflow: hidden; }
  .nav-link { min-height: var(--tap); }

  /* bottom tab bar */
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar-height) + env(safe-area-inset-bottom)); padding: 4px 6px env(safe-area-inset-bottom); background: var(--background); border-top: 1px solid var(--border); }
  .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: var(--tap); border-radius: var(--radius-md); color: var(--muted-foreground); font-size: 12px; font-weight: 500; text-decoration: none; }
  .tab.is-active { color: var(--foreground); }
  .tab.is-active .tab-icon { background: var(--muted); }
  .tab-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 28px; border-radius: 999px; }

  /* touch targets */
  .btn, .btn-sm, .input, .pagination .page-link, .line-tab, .menu-item { min-height: var(--tap); }
  .btn-icon { width: var(--tap); }
  .input { font-size: 16px; }   /* prevents iOS zoom on focus */
  .field-check, .field-check-inline { min-height: var(--tap); }
  .objection-more summary, .template summary { min-height: var(--tap); }

  .page { padding: 16px; gap: 16px; }
  .page-head { padding-bottom: 16px; }
  .page-head .title, .title { font-size: 20px; }
  .subtitle { font-size: 14px; }
  .page-actions, .page-actions .btn { width: 100%; }
  .card { padding: 16px; }
  .banner { padding: 20px; }
  .banner-title { font-size: 24px; }
  .banner-side { align-items: stretch; width: 100%; }
  .banner-side .btn-row .btn { flex: 1; }
  .banner-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .banner-stat { padding: 0 10px; }
  .banner-stat dt { font-size: 12px; letter-spacing: .02em; }
  .kpi-grid, .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi, .stat { padding: 14px; gap: 10px; }
  .kpi-value, .stat-value { font-size: 22px; }
  .kpi .tile { width: 32px; height: 32px; }
  .kpi-label, .stat-label { font-size: 13px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters > :first-child { grid-column: 1 / -1; }
  .filters > .btn { grid-column: 1 / -1; }
  .prospect-card { padding: 16px; gap: 16px; }
  .company-name { font-size: 20px; }
  .btn-dial { width: 100%; }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .line-tabs { width: 100%; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 8px; }
  .push-form .input { min-width: 0; }
  .table th, .table td { white-space: nowrap; padding: 10px 12px; }
  .table td:first-child { white-space: normal; min-width: 170px; }
  .item-actions { width: 100%; }
}

@media (min-width: 769px) {
  .drawer-backdrop { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* spacing helpers inside cards */
.card .table-wrap + .muted, .card .table-wrap + p { margin-top: 12px; }
.card > .section-title:first-child + p, .card > p:last-child { margin-bottom: 0; }

/* library templates and inline forms */
.card.template { padding: 0; }
.template summary .mono { font-size: 12px; }
.inline-form .input { min-width: 0; max-width: 100%; }
@media (max-width: 768px) {
  .inline-form > .input, .inline-form > .btn { flex: 1 1 100%; width: 100%; }
  .template summary { padding: 12px 16px; }
  .template .form { padding: 0 16px 16px; }
}
