/* ── Tokens ──────────────────────────────────────────────────────────────────────────
   Light: Production Dashboard src/index.css :root (HSL, resolved to hex) and CRO src/index.css
   @theme. Dark: the same files' .dark blocks. --primary is the brand teal from
   "z - Bartlett Logos/Bartlett Circle Icon Large Teal Only.png" (#4ebfa1), deepened on cream
   so text set in it still passes contrast. The page is dark by default (class on <html>);
   public/theme.js removes the class when the visitor has chosen light. */
:root {
  --background: #f5f3f0;
  --foreground: #1a1a1a;
  --card: #faf9f7;
  --muted: #eeece8;
  --muted-foreground: #595959;
  --border: #e0dcd6;
  --primary: #178f75;
  --primary-foreground: #faf9f7;
  --brand: #4ebfa1;
  --page: rgba(238, 236, 232, 0.3);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --radius: 0.5rem;
  --tile-bg: 0.12;
  --tile-ring: 0.22;
  --icon: var(--accent-icon-light);
  --font: 'Space Grotesk', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}
html.dark {
  --background: #161a23;
  --foreground: #d4d4e0;
  --card: #1e232d;
  --muted: #252b36;
  --muted-foreground: #8a8aa3;
  --border: #38404d;
  --primary: #4ebfa1;
  --primary-foreground: #0c1017;
  --page: rgba(37, 43, 54, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --tile-bg: 0.16;
  --tile-ring: 0.28;
  --icon: var(--accent-icon);
}

* { margin: 0; padding: 0; box-sizing: border-box; border-color: var(--border); }
html { color-scheme: light; background: var(--background); }
html.dark { color-scheme: dark; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
svg.icon { width: 16px; height: 16px; flex: none; }
.only-dark { display: none; }
.only-light { display: block; }
html.dark .only-dark { display: block; }
html.dark .only-light { display: none; }

/* ── Header — Production Header.tsx: "flex h-14 md:h-16 items-center justify-between border-b
   bg-background px-3 md:px-6". Brand mark as in both Sidebars: h-7 w-7 object-contain,
   icon-dark on light, icon-light on dark. ─────────────────────────────────────────── */
.header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-inline: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--background);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 28px; height: 28px; object-fit: contain; }
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; line-height: 1.15; }
.brand-name small { display: block; font-weight: 500; font-size: 11.5px; letter-spacing: 0.02em; color: var(--primary); }
.tools { display: flex; align-items: center; gap: 4px; }
.tools-email { font-size: 13px; color: var(--muted-foreground); margin-right: 8px; }

/* ── Button — shadcn ui/button.tsx. Base "inline-flex items-center justify-center rounded-md
   text-sm font-medium"; ghost "hover:bg-accent"; outline "border bg-background hover:bg-accent";
   default "bg-primary text-primary-foreground hover:bg-primary/90"; icon "h-10 w-10". ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.btn-ghost { color: var(--foreground); }
.btn-ghost:hover { background: var(--muted); }
.btn-icon { width: 40px; height: 40px; padding: 0; }
.btn-icon svg.icon { width: 20px; height: 20px; }
.btn-outline { border: 1px solid var(--border); background: var(--background); }
.btn-outline:hover { background: var(--muted); border-color: rgba(78, 191, 161, 0.5); }
.btn-default { height: 40px; padding: 0 16px; background: var(--primary); color: var(--primary-foreground); }
.btn-default:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.6; cursor: default; }

/* ── Page — Production Layout.tsx <main class="bg-muted/30 p-4 md:p-6">; pages "space-y-8";
   title "text-xl md:text-2xl font-bold tracking-tight" + "text-sm text-muted-foreground". ─ */
main { flex: 1; padding: 16px; background: var(--page); }
.page { max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; gap: 32px; }
.page-title { border-left: 3px solid var(--brand); padding-left: 14px; }
.page-title h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; }
.page-title p { margin-top: 4px; font-size: 13px; color: var(--muted-foreground); }

/* ── Quick links — outline Buttons with a leading h-4 w-4 glyph in the primary colour. ─ */
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.quick .btn { font-size: 13px; }
.quick .btn svg.icon { color: var(--primary); }

/* ── Section heading — Production GuidesHome.tsx "text-sm font-semibold uppercase
   tracking-wide text-muted-foreground". ───────────────────────────────────────────── */
.section { display: flex; flex-direction: column; gap: 12px; }
.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  color: var(--muted-foreground);
}

/* ── Card — shadcn ui/card.tsx "rounded-lg border bg-card text-card-foreground shadow-sm".
   Hover as GuidesHome's area cards: "transition-colors group-hover:border-primary/50
   group-hover:bg-muted/40", re-keyed to the card's own accent; the ArrowRight nudges right. */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-company { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, background-color 0.15s;
}
.card:hover { border-color: rgba(var(--accent), 0.5); background: color-mix(in srgb, var(--muted) 40%, var(--card)); }
.card-head { display: flex; align-items: center; justify-content: space-between; }
/* Tile — Production GuideAreaCover.tsx "inline-grid place-items-center rounded-xl
   bg-primary/15 text-primary ring-1 ring-inset ring-primary/20", at KPICard's "p-2 rounded-lg"
   size and in the card's accent instead of the primary. */
.tile {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(var(--accent), var(--tile-bg));
  box-shadow: inset 0 0 0 1px rgba(var(--accent), var(--tile-ring));
  color: var(--icon);
}
.tile svg.icon { width: 20px; height: 20px; }
.card-arrow { color: var(--muted-foreground); transition: transform 0.15s, color 0.15s; }
.card:hover .card-arrow { transform: translateX(2px); color: var(--icon); }
.card-label { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
.card-description { margin-top: 4px; font-size: 13px; line-height: 1.45; color: var(--muted-foreground); }
.card-team {
  margin-top: auto;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
}
.grid-company .card { padding: 16px; gap: 12px; }
.grid-company .tile { width: 36px; height: 36px; border-radius: 7px; }
.grid-company .tile svg.icon { width: 18px; height: 18px; }
.grid-company .card-label { font-size: 15px; }

/* ── IT list — one Card holding Production Sidebar nav rows: ghost Buttons "w-full
   justify-start" h-10, glyph "h-4 w-4 mr-3", hover "bg-accent" in the row's accent. ──── */
.list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.15s, color 0.15s;
}
.list > .row:only-child { grid-column: 1 / -1; }
.row-icon { color: var(--icon); }
.row-text { flex: 1; min-width: 0; display: flex; gap: 8px; align-items: baseline; white-space: nowrap; overflow: hidden; }
.row-text .row-description { font-size: 12px; font-weight: 400; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; }
.row .card-arrow { opacity: 0; }
.row:hover { background: rgba(var(--accent), 0.1); color: var(--icon); }
.row:hover .card-arrow { opacity: 1; transform: none; color: inherit; }

/* ── Footer ────────────────────────────────────────────────────────────────────────── */
.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--background);
  font-size: 12px;
  color: var(--muted-foreground);
}

/* ── Impersonation banner — both apps: "bg-amber-500 text-amber-950 text-center text-sm
   font-medium py-1.5 px-4". ─────────────────────────────────────────────────────────── */
.banner {
  padding: 6px 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: #451a03;
  background: #f59e0b;
}

/* ── Signed-out / empty — both apps' SessionGate: "min-h-screen flex items-center
   justify-center bg-background p-4" > "max-w-sm space-y-6 text-center" > "text-2xl font-bold
   tracking-tight". ───────────────────────────────────────────────────────────────── */
.signedout { flex: 1; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--background); }
.signedout-box { width: 100%; max-width: 384px; display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; }
.signedout-box img { width: 64px; height: 64px; }
.signedout-box h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.025em; }
.lede { margin-top: 6px; font-size: 14px; color: var(--muted-foreground); }
.empty { max-width: 34rem; font-size: 14px; line-height: 1.6; color: var(--muted-foreground); }

/* ── Business identity ─────────────────────────────────────────────────────────────── */
.identity { font-size: 12px; line-height: 1.7; color: var(--muted-foreground); }
.identity-name { font-weight: 600; color: var(--foreground); }
.identity a { text-decoration: underline; text-underline-offset: 3px; }
.identity a:hover { color: var(--foreground); }
.identity-note { margin-top: 10px; max-width: 34rem; margin-inline: auto; }

@media (min-width: 768px) {
  .header { height: 64px; padding-inline: 24px; }
  main { padding: 24px; }
  .page-title h1 { font-size: 24px; }
}
@media (max-width: 900px) {
  .grid, .grid-company { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .grid, .grid-company, .list { grid-template-columns: 1fr; }
  .tools-email { display: none; }
  .row-text { flex-direction: column; gap: 0; white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Per-card accents, generated from the manifest. */
.card-production { --accent: 16, 185, 129; --accent-icon: #34d399; --accent-icon-light: #059669; }
.card-sales { --accent: 245, 158, 11; --accent-icon: #fbbf24; --accent-icon-light: #b45309; }
.card-estimating { --accent: 59, 130, 246; --accent-icon: #60a5fa; --accent-icon-light: #2563eb; }
.card-marketing { --accent: 6, 182, 212; --accent-icon: #22d3ee; --accent-icon-light: #0e7490; }
.card-recruiting { --accent: 139, 92, 246; --accent-icon: #a78bfa; --accent-icon-light: #7c3aed; }
.card-pitchdeck { --accent: 244, 63, 94; --accent-icon: #fb7185; --accent-icon-light: #e11d48; }
.card-help { --accent: 20, 184, 166; --accent-icon: #2dd4bf; --accent-icon-light: #0d9488; }
.card-insights { --accent: 14, 165, 233; --accent-icon: #38bdf8; --accent-icon-light: #0284c7; }
.card-sop { --accent: 132, 204, 22; --accent-icon: #a3e635; --accent-icon-light: #4d7c0f; }
.card-projects { --accent: 99, 102, 241; --accent-icon: #818cf8; --accent-icon-light: #4f46e5; }
.card-ooo { --accent: 236, 72, 153; --accent-icon: #f472b6; --accent-icon-light: #db2777; }
.card-roofchainreact { --accent: 249, 115, 22; --accent-icon: #fb923c; --accent-icon-light: #ea580c; }
.card-bash { --accent: 234, 179, 8; --accent-icon: #facc15; --accent-icon-light: #a16207; }
.card-middleman { --accent: 59, 130, 246; --accent-icon: #60a5fa; --accent-icon-light: #2563eb; }
.card-kuma { --accent: 16, 185, 129; --accent-icon: #34d399; --accent-icon-light: #059669; }
.card-redstring { --accent: 244, 63, 94; --accent-icon: #fb7185; --accent-icon-light: #e11d48; }
.card-onboarding { --accent: 139, 92, 246; --accent-icon: #a78bfa; --accent-icon-light: #7c3aed; }
.card-drive-sync { --accent: 6, 182, 212; --accent-icon: #22d3ee; --accent-icon-light: #0891b2; }
.card-it-dashboard { --accent: 148, 163, 184; --accent-icon: #cbd5e1; --accent-icon-light: #475569; }
.card-research { --accent: 217, 70, 239; --accent-icon: #e879f9; --accent-icon-light: #c026d3; }
.card-archive { --accent: 161, 161, 170; --accent-icon: #d4d4d8; --accent-icon-light: #52525b; }
.card-n8ndocs { --accent: 168, 85, 247; --accent-icon: #c084fc; --accent-icon-light: #9333ea; }
