/* =========================================================================
   Tervo AI theme (Nov 16): Camden's "Overview" mockup.
   Dark navy sidebar, light blue-grey page, white rounded cards with a soft
   shadow, ONE accent (blue) for actions and the active page, green = good /
   up, red = needs you, orange = crew work. Inter type, generous spacing.
   Loaded after panel.css + views.css, so it restyles every screen without
   changing how anything works. To change the look, change it here.
   ========================================================================= */
:root {
  --bg: #f4f6fa;              /* page */
  --surface: #ffffff;         /* cards */
  --surface-2: #f8fafc;       /* table heads, insets, row backgrounds */
  --hover: #f1f4f9;
  --border: #e6eaf1;
  --border-strong: #d6dce6;
  --text: #0f172a;
  --text-2: #4b5567;
  --text-3: #8b95a7;
  --ink: #12203a; --on-ink: #ffffff;          /* toasts, the save bar */
  --accent: #3366ee; --accent-hover: #2856d6; --accent-soft: #edf2fe; --accent-line: #c9d7fc; --accent-text: #2450c8;
  --good: #16a34a; --good-text: #15803d; --good-soft: #e9f7ef;
  --bad: #e5484d; --bad-text: #c62f34; --bad-soft: #fdeeee;
  --warn: #f59e0b; --warn-text: #b45309; --warn-soft: #fff6e6;
  --orange: #f97316; --orange-soft: #fff1e7;
  /* older names other files still use */
  --data: #3366ee; --data-soft: #d9e4fd; --data-soft-2: #91aff6; --data-bg: #edf2fe; --data-line: #c9d7fc;
  --data-text: #2450c8; --data-text-2: #4a68b8;
  --now: #f59e0b; --now-text: #b45309;
  --green: #15803d; --green-soft: #e9f7ef;
  --blue: #2450c8;  --blue-soft: #edf2fe;
  --violet: #4b5567; --violet-soft: #f1f4f9;
  --amber: #b45309; --amber-soft: #fff6e6; --amber-line: #f7d49a;
  --gray: #4b5567;  --gray-soft: #f1f4f9;
  --red: #c62f34;
  --dot-good: #16a34a; --dot-warn: #f59e0b; --dot-bad: #e5484d; --dot-info: #3366ee; --dot-muted: #b6bfcd;
  --series-1: #3366ee; --series-2: #f97316;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 2px 8px -2px rgba(15, 23, 42, .05);
  --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, .28), 0 0 0 1px rgba(15, 23, 42, .06);
  --radius: 14px;
  /* sidebar: navy in light AND dark mode */
  --nav-bg: #121f37; --nav-line: rgba(255, 255, 255, .08); --nav-hover: rgba(255, 255, 255, .06);
  --nav-text: #e3e8f2; --nav-text-2: #aab4c6; --nav-text-3: #76839b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220; --surface: #121a2b; --surface-2: #162034; --hover: #1a253b;
    --border: rgba(255, 255, 255, .08); --border-strong: rgba(255, 255, 255, .14);
    --text: #e8edf6; --text-2: #a9b3c6; --text-3: #6f7b92;
    --ink: #e8edf6; --on-ink: #0b1220;
    --accent: #5b8cff; --accent-hover: #7aa2ff; --accent-soft: rgba(91, 140, 255, .14); --accent-line: rgba(91, 140, 255, .35); --accent-text: #9dbbff;
    --good: #34c46a; --good-text: #5fd88c; --good-soft: rgba(52, 196, 106, .14);
    --bad: #f0686c; --bad-text: #ff8f92; --bad-soft: rgba(240, 104, 108, .14);
    --warn: #f5b13d; --warn-text: #f7c66e; --warn-soft: rgba(245, 177, 61, .14);
    --orange: #fb8a3c; --orange-soft: rgba(251, 138, 60, .14);
    --data: #5b8cff; --data-soft: #233a63; --data-soft-2: #3d6bc0; --data-bg: rgba(91, 140, 255, .12); --data-line: rgba(91, 140, 255, .35);
    --data-text: #b8cdfb; --data-text-2: #8eaae6;
    --now: #f5b13d; --now-text: #f7c66e;
    --green: #5fd88c; --green-soft: rgba(52, 196, 106, .14);
    --blue: #9dbbff;  --blue-soft: rgba(91, 140, 255, .14);
    --violet: #a9b3c6; --violet-soft: rgba(255, 255, 255, .06);
    --amber: #f7c66e; --amber-soft: rgba(245, 177, 61, .12); --amber-line: rgba(245, 177, 61, .35);
    --gray: #a9b3c6;  --gray-soft: rgba(255, 255, 255, .06);
    --red: #ff8f92;
    --dot-muted: #4d5870;
    --series-1: #5b8cff; --series-2: #fb8a3c;
    --shadow-xs: none; --shadow-sm: 0 0 0 1px rgba(255, 255, 255, .02);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .08);
    --nav-bg: #0a1222;
  }
}

body { background: var(--bg); color: var(--text); letter-spacing: -0.008em;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; font-feature-settings: "cv11", "ss01"; }
h1, h2, h3, h4 { letter-spacing: -0.015em; }
:focus-visible { outline-color: var(--accent); }

/* ---------- App frame: navy sidebar + top bar + content ---------- */
.app { grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { background: var(--nav-bg); color: var(--nav-text); border-right: 0; padding: 22px 14px 18px; gap: 22px;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent; }
.brand { padding: 0 8px; gap: 9px; }
.brand-mark { width: 24px; height: 24px; color: var(--accent); background: none; box-shadow: none; border-radius: 0; }
@media (prefers-color-scheme: dark) { .brand-mark { color: #6f9bff; } }
.brand-name { color: #ffffff; font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.switcher { gap: 8px; }
.switcher-label, .nav-label { color: var(--nav-text-3); font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.switcher-box { background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .16); border-radius: 9px; }
.switcher-box select { color: #ffffff; font-size: 13px; padding: 9px 30px 9px 11px; }
.switcher-box select option { background: var(--nav-bg); color: #ffffff; }
.switcher-box .ti { color: var(--nav-text-2); font-size: 14px; }
.nav { gap: 3px; }
.nav-label { margin: 14px 0 6px; padding: 14px 8px 0; border-top: 1px solid var(--nav-line); }
.nav-item { color: var(--nav-text); font-weight: 500; font-size: 13.5px; border-radius: 9px; padding: 8px 10px; gap: 12px; }
.nav-item .ti { color: var(--nav-text-2); font-size: 18px; }
.nav-item:hover { background: var(--nav-hover); color: #ffffff; }
.nav-item:hover .ti { color: #ffffff; }
.nav-item.active { background: var(--accent); color: #ffffff; box-shadow: 0 6px 16px -8px rgba(51, 102, 238, .7); }
.nav-item.active::before { display: none; }
.nav-item.active .ti { color: #ffffff; }
.count { display: none; }                         /* plain totals stay hidden: only badges show */
.count.badge { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: #ffffff; font-size: 11px; font-weight: 600; }
.nav-item.active .count.badge { background: rgba(255, 255, 255, .25); color: #ffffff; }
.sidebar-foot { border-top: 1px solid var(--nav-line); gap: 10px; }
.sim-launch { background: rgba(255, 255, 255, .06); color: #ffffff; border: 1px solid rgba(255, 255, 255, .14); border-radius: 9px; }
.sim-launch:hover { border-color: var(--accent); }
.sim-launch .ti { color: #9dbbff; }
.sidebar .ai-status { color: var(--nav-text-2); }
.ai-status.on .dot { background: #34c46a; box-shadow: none; }
.ai-status.off .dot { background: #f5b13d; }

.main { padding: 0; max-width: none; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 64px; padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-title { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.tb-date { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 1px solid var(--border-strong);
  border-radius: 9px; font: inherit; font-size: 13px; font-weight: 500; color: var(--text); background: var(--surface); white-space: nowrap; cursor: pointer; }
.tb-date:hover { border-color: var(--accent); }
.tb-date.picked { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.tb-date.picked .ti { color: var(--accent); }
/* the real date picker sits invisibly under the chip; the chip opens it */
.tb-datewrap { position: relative; display: inline-flex; }
.tb-datepick { position: absolute; left: 0; bottom: 0; width: 100%; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.tb-date[hidden] { display: none; }
.tb-date .ti { font-size: 16px; color: var(--text-2); }
.tb-icon { position: relative; width: 38px; height: 38px; border-radius: 9px; border: 0; background: none; color: var(--text);
  display: grid; place-items: center; font-size: 20px; cursor: pointer; }
.tb-icon:hover { background: var(--hover); }
.tb-dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad);
  box-shadow: 0 0 0 2px var(--surface); }
.me { position: relative; }
.tb-me { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--ink); color: var(--on-ink);
  font-weight: 600; font-size: 14px; cursor: pointer; display: grid; place-items: center; }
.me-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.me-menu .me-text { font-size: 12.5px; }
.me-item { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 8px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer; text-align: left; border-top: 1px solid var(--border); }
.me-item:hover { background: var(--hover); }
.content { padding: 26px 28px 44px; flex: 1; min-width: 0; }
/* Phones and small tablets: the sidebar becomes a bar on top, its sections scroll sideways. */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; padding: 12px 16px; gap: 12px; }
  .nav { width: 100%; min-width: 0; }
  .nav-label { display: none; }
  .topbar { padding: 0 16px; height: 56px; }
  .content { padding: 20px 16px 36px; }
}
/* the top bar names the page, so a page's own heading would only repeat it */
.panel .tab-body > .panel-head > h2:first-child, #tabCrew > .panel-head > h2:first-child { display: none; }
.panel .tab-body > .panel-head { min-height: 0; }
.panel .tab-body > .panel-head > .btn:last-child { margin-left: auto; }   /* the page's main button stays on the right */

/* ---------- Cards and panels: white, rounded, a soft shadow ---------- */
.card, .panel, .kpi, .set-card, .member, .table, .metrics { border-radius: var(--radius) !important; border-color: var(--border) !important;
  box-shadow: var(--shadow-sm) !important; }
.panel { min-height: 0; }
.tab-body { padding: 22px 24px 26px; }
.card-head { padding: 16px 20px 10px; }
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-head h3 .tile { background: var(--accent-soft) !important; color: var(--accent) !important; }
.link-btn { color: var(--accent); }
.link-btn:hover { background: var(--accent-soft); }
.panel-sub { color: var(--text-3); }

/* ---------- Buttons and chips: blue for the main action ---------- */
.btn { border-radius: 9px; border-color: var(--border-strong); box-shadow: none; }
.btn-primary, .btn-dark { background: var(--accent); color: #ffffff; border-color: var(--accent); }
.btn-primary:hover, .btn-dark:hover { background: var(--accent-hover); border-color: var(--accent-hover); opacity: 1; }
.chip { border-color: var(--border-strong); border-radius: 999px; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #ffffff; }
.save-bar .btn { background: var(--accent); color: #ffffff; border-color: var(--accent); }

/* ---------- Tables ---------- */
.row.head { background: var(--surface-2) !important; color: var(--text-3); }
.row:hover { background: var(--surface-2); }

/* ---------- People: soft blue initials, never rainbow ---------- */
.tech-av, .avatar, .avatar-lg { background: var(--accent-soft) !important; color: var(--accent-text) !important; box-shadow: none; font-weight: 600; }
.tech { color: var(--text-2); }

/* ---------- Status pills: a soft tint + a dot + a word ---------- */
.pill, .stage { background: var(--gray-soft) !important; color: var(--text-2) !important; border: 0;
  font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 12px; padding: 2px 9px; border-radius: 999px; }
.stage::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--dot-info); }
.pill::before { background: var(--dot-muted) !important; }
.pill.new, .pill.sent, .pill.est-open, .stage.scheduled { background: var(--accent-soft) !important; color: var(--accent-text) !important; }
.pill.new::before, .pill.sent::before, .pill.est-open::before, .stage.scheduled::before { background: var(--dot-info) !important; }
.pill.booked, .pill.won, .pill.paid, .pill.est-won, .stage.paid { background: var(--good-soft) !important; color: var(--good-text) !important; }
.pill.booked::before, .pill.won::before, .pill.paid::before, .pill.est-won::before, .stage.paid::before { background: var(--dot-good) !important; }
.pill.owner, .pill.overdue, .pill.est-q, .pill.queued, .stage.invoiced { background: var(--warn-soft) !important; color: var(--warn-text) !important; }
.pill.owner::before, .pill.overdue::before, .pill.est-q::before, .pill.queued::before, .stage.invoiced::before { background: var(--dot-warn) !important; }
.stage.ready_to_invoice::before, .stage.invoicing::before, .pill.contacted::before { background: var(--text-3) !important; }

/* ---------- Icon tiles (Team, Results...): soft tints, no gradients ---------- */
.ic-blue, .ic-violet, .ic-slate { background: var(--accent-soft) !important; color: var(--accent) !important; }
.ic-green { background: var(--good-soft) !important; color: var(--good) !important; }
.ic-amber { background: var(--warn-soft) !important; color: var(--warn-text) !important; }
.ic-rose { background: var(--bad-soft) !important; color: var(--bad) !important; }
.att-ic, .feed-ic { border: 0 !important; }
.notice { background: var(--warn-soft) !important; border: 1px solid var(--amber-line) !important; color: var(--text) !important; border-radius: 12px; }
.notice .ti { color: var(--warn-text) !important; }

/* ---------- KPIs (Results, Leads, Money) ---------- */
.kpi { background: var(--surface) !important; }
.kpi.hero-kpi { background: var(--surface) !important; color: var(--text) !important; border: 1px solid var(--border) !important; }
.kpi.hero-kpi .kpi-value { font-size: 40px; letter-spacing: -0.035em; margin-top: 2px; }
.kpi.hero-kpi .kpi-label, .kpi.hero-kpi .kpi-foot { color: var(--text-2) !important; }
.kpi-value { font-size: 26px; }
.metrics { background: var(--surface); }
.metric-warn.active { background: var(--warn-soft) !important; }
.metric-warn.active .metric-label, .metric-warn.active .metric-value { color: var(--warn-text) !important; }

/* ---------- Charts: flat series colors ---------- */
rect[fill="url(#gLeads)"] { fill: var(--series-1); }
rect[fill="url(#gBooked)"] { fill: var(--series-2); }
rect[fill="url(#gRev)"] { fill: var(--series-1); }
.bars-h .fill { background: var(--series-1); }
.bars-h .track { height: 8px; background: var(--hover); }
.chart-legend i { border-radius: 2px !important; }

/* ---------- Schedule: all-day crew jobs (installs Tervo AI booked) ---------- */
.cell.crew-job { background: var(--ink); border: 1px solid var(--ink); color: var(--on-ink); cursor: pointer; }
.cell.crew-job .cell-time { color: #a9b5cb; }
.cell.crew-job .cell-name { color: #ffffff; }
.cell.crew-job .cell-sub, .cell.crew-job .cell-addr { color: #cdd5e3; }
.cell.crew-job:hover { border-color: var(--accent); }
.sw.crew-job { background: var(--ink); }
@media (prefers-color-scheme: dark) {
  .cell.crew-job .cell-name { color: #0b1220; }
  .cell.crew-job .cell-time, .cell.crew-job .cell-sub, .cell.crew-job .cell-addr { color: #4b5567; }
}

/* ---------- Schedule: open cells are clickable to block; blocked = hatched ---------- */
button.cell { font: inherit; color: inherit; text-align: left; width: 100%; cursor: pointer; background: var(--surface); }
.cell.open:hover { border-color: var(--accent); }
.cell.open.more { cursor: default; padding-top: 4px; padding-bottom: 4px; }
.cell.blocked, .sw.blocked { background: repeating-linear-gradient(135deg, var(--hover) 0 6px, var(--surface) 6px 12px);
  border: 1px dashed var(--border-strong); color: var(--text-3); }
.cell.blocked:hover { border-color: var(--text-3); }
/* Events from the business's OWN calendar (calendar sync): outlined, never Tervo AI's accent. */
.cell.outside, .sw.outside { background: var(--surface); border: 1px dashed var(--border-strong); }
.cell.outside .cell-time { color: var(--text-3); }
.cell.outside .ti, .cell.crew-job.outside .ti { font-size: 12px; vertical-align: -1px; }
/* Their all-day events: dark like a crew job, but a dashed outline + "Your calendar" mark it as theirs. */
.cell.crew-job.outside { background: var(--ink); border: 1px dashed #8391ab; cursor: default; }
.cell.crew-job.outside:hover { border-color: #8391ab; }
@media (prefers-color-scheme: dark) { .cell.crew-job.outside, .cell.crew-job.outside:hover { border-color: #4b5567; } }
