/* =====================================================================
  Work Hero Engineering Dashboard — shared theme
  Used across all pages (active orders, completed, developers, capacity).
  Page-specific component CSS lives inline in each .html.
  Dark is the default; html[data-theme="light"] switches to light mode
  (toggled from the avatar menu, persisted in localStorage by
  dashboard.js → window.setTheme).
  ===================================================================== */

:root {
  --bg: #07090f;
  --bg-panel: #0c1220;
  --bg-row: #0d1426;
  --bg-row-hover: #131c33;
  --border: #1a2440;
  --border-strong: #243057;
  --text: #e4e7ee;
  --text-dim: #6b7a99;
  --text-muted: #44516e;
  --accent: #00d9ff;
  --bull: #00d68f;
  --bull-bg: rgba(0, 214, 143, 0.08);
  --bear: #ff3d71;
  --bear-bg: rgba(255, 61, 113, 0.08);
  --warn: #ffb000;
  --warn-bg: rgba(255, 176, 0, 0.10);
  --today: #ffd700;
  --today-bg: rgba(255, 215, 0, 0.09);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.4;
  overflow-x: hidden;
  background-image:
    radial-gradient(at 20% 0%, rgba(0, 217, 255, 0.04) 0%, transparent 50%),
    radial-gradient(at 80% 100%, rgba(255, 61, 113, 0.04) 0%, transparent 50%);
}
.mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }
::selection { background: rgba(0, 217, 255, 0.25); color: var(--text); }

/* ----------------------- HEADER (topbar) ----------------------- */
header.topbar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(12, 18, 32, 0.95) 0%, rgba(7, 9, 15, 0.85) 100%);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
header.topbar .topbar-right { margin-left: auto; }
.brand {
  display: flex; align-items: center; gap: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700; letter-spacing: 0.05em;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; opacity: 0.96; }
.brand .logo { width: 36px; height: 36px; display: block; object-fit: contain; }
.brand .title { font-size: 14px; line-height: 1.1; }
.brand .title .sub { color: var(--text-dim); font-weight: 500; margin-left: 6px; }

/* Reserve the header's exact footprint before JS replaces #topbar-slot. This
   prevents the first paint from jumping when switching pages. */
#topbar-slot {
  display: block;
  min-height: 65px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(12, 18, 32, 0.95) 0%, rgba(7, 9, 15, 0.85) 100%);
}

/* Header critical styles live in theme.css, not auth.css, because theme.css is
   loaded in the HTML head. Keeping logo/dropdown styles here prevents a brief
   unstyled logo + Select dropdown flash before the async auth stylesheet loads. */
.brand-block {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.brand-logo {
  display: flex; align-items: center; gap: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700; letter-spacing: 0.05em;
  color: var(--text); text-decoration: none;
  font-size: 14px; line-height: 1.1;
  white-space: nowrap;
}
.brand-logo:hover { opacity: 0.96; text-decoration: none; }
.brand-logo .logo { width: 36px; height: 36px; display: block; object-fit: contain; flex: 0 0 36px; }

.dashboard-switcher { position: relative; display: inline-flex; align-items: center; }
.switcher-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  min-width: 84px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; font-weight: 500; letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 120ms, background 120ms, border-color 120ms;
}
.switcher-trigger:hover { color: var(--text); background: rgba(255,255,255,0.04); border-color: var(--border-strong); }
.switcher-trigger .caret { font-size: 9px; color: var(--text-muted); transition: transform 120ms; }
.switcher-trigger[aria-expanded="true"] .caret { transform: rotate(180deg); }
.switcher-trigger[aria-expanded="true"] { color: var(--text); background: rgba(255,255,255,0.04); border-color: var(--border-strong); }
.switcher-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  background: #0e1422;
  border: 1px solid #2c3650;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  min-width: 240px;
  z-index: 50;
  overflow: hidden;
  display: none;
  padding: 4px 0;
}
.switcher-menu.open { display: block; }
.switcher-menu a {
  display: block;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.switcher-menu a:hover { background: #1a2238; }
.switcher-menu a.active { color: var(--accent); background: rgba(0, 217, 255, 0.06); }
.switcher-menu .dropdown-empty {
  padding: 10px 14px; font-size: 12px;
  color: #6e7892; font-style: italic;
}

.session-avatar-wrap { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.session-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4a7eff 0%, #6e57ff 100%);
  color: #fff; font-size: 12px; font-weight: 600; letter-spacing: 0.3px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; font-family: inherit; outline: none;
  transition: filter 120ms;
}
.session-avatar:hover { filter: brightness(1.15); }
.session-avatar:focus-visible { box-shadow: 0 0 0 2px #6aa3ff; }
.session-signout {
  background: transparent;
  border: 1px solid #2c3650; border-radius: 6px;
  padding: 4px 10px; font-size: 11px; color: #c0c8dd;
  cursor: pointer; font-family: inherit; letter-spacing: 0.3px;
}
.session-signout:hover { background: #1a2238; border-color: #3a466a; }
.session-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: #0e1422; border: 1px solid #2c3650; border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  min-width: 180px; z-index: 50; overflow: hidden; display: none;
}
.session-dropdown.open { display: block; }
.session-dropdown a {
  display: block; padding: 10px 14px;
  font-size: 13px; color: var(--text);
  text-decoration: none; font-family: inherit;
}
.session-dropdown a:hover { background: #1a2238; }
.session-dropdown .dropdown-empty {
  padding: 12px 14px; font-size: 12px;
  color: #6e7892; font-style: italic;
}

nav.topnav {
  display: flex; gap: 4px;
  margin-left: 28px;
  font-family: 'JetBrains Mono', monospace;
}
nav.topnav a {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.12s, background 0.12s;
}
nav.topnav a:hover { color: var(--text); background: rgba(255,255,255,0.03); }
nav.topnav a.active {
  color: var(--accent);
  background: rgba(0, 217, 255, 0.08);
}

.topbar-right { display: flex; align-items: center; gap: 22px; }
.session-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--text-dim); text-align: right;
}
.session-meta .clock {
  color: var(--text); font-size: 13px; font-weight: 600; letter-spacing: 0.04em;
}
.session-meta.last-update {
  padding-right: 14px; margin-right: -8px;
  border-right: 1px solid var(--border);
}
.session-meta.last-update .lbl {
  font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600;
}
.session-meta.last-update .val-row {
  display: flex; align-items: center; gap: 8px; justify-content: flex-end;
}
.session-meta.last-update .val {
  color: var(--text); font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  white-space: nowrap;
}
.session-meta.last-update .val .tz { color: var(--text-dim); font-weight: 500; margin-left: 4px; }
.info-trigger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
  color: var(--text-dim);
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 700;
  line-height: 1;
  transition: all 0.12s ease;
}
.info-trigger:hover {
  color: var(--warn);
  border-color: var(--warn);
  background: var(--warn-bg);
}
.live-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 11px;
  border: 1px solid var(--bull);
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 700; letter-spacing: 0.15em;
  color: var(--bull);
  background: var(--bull-bg);
}
.live-pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--bull);
  box-shadow: 0 0 8px var(--bull);
  animation: pulse 1.6s ease-in-out infinite;
}
.live-pill.demo { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }
.live-pill.demo .dot { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ----------------------- PAGE INFO MODAL ----------------------- */
.page-info-overlay {
  position: fixed; inset: 0;
  background: rgba(5, 8, 14, 0.8);
  backdrop-filter: blur(6px);
  z-index: 60;
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
}
.page-info-overlay.show { display: flex; }
.page-info-modal {
  width: min(760px, 100%);
  max-height: min(82vh, 900px);
  overflow: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.45);
  padding: 18px 20px 18px;
}
.page-info-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  margin-bottom: 14px;
}
.page-info-title {
  font: 700 18px/1.3 'Inter', sans-serif;
  color: var(--text);
}
.page-info-sub {
  margin-top: 4px;
  color: var(--text-muted);
  font: 11px/1.4 'JetBrains Mono', monospace;
}
.page-info-close {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font: 600 11px 'JetBrains Mono', monospace;
}
.page-info-body {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.65;
}
.page-info-body p { margin-bottom: 12px; }
.page-info-body h4 {
  margin: 14px 0 8px;
  color: var(--text);
  font: 700 12px/1.4 'JetBrains Mono', monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.page-info-body ul {
  margin: 0 0 10px 18px;
  padding: 0;
}
.page-info-body li { margin: 0 0 6px; }
.page-info-body b { color: var(--text); }

/* ----------------------- LAYOUT / PANELS ----------------------- */
.grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 14px;
  padding: 14px 22px;
  max-width: 1600px;
  margin: 0 auto;
}
@media (max-width: 1080px) {
  .grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.015);
}
.panel-head .label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-dim);
}
.panel-head .label strong { color: var(--text); }

/* ----------------------- FOOTER (status bar) ----------------------- */
footer.statusbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 22px;
  border-top: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--text-muted);
  letter-spacing: 0.06em;
}
footer .right { display: flex; gap: 18px; }
footer .right span b { color: var(--text-dim); }

/* ----------------------- LOCAL-PREVIEW AUTH GATE ----------------------- */
#auth-overlay {
  position: fixed; inset: 0;
  background: rgba(7, 9, 15, 0.97);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: none;
  align-items: center; justify-content: center;
}
#auth-overlay.show { display: flex; }
#auth-overlay .box {
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 28px 30px; width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
#auth-overlay h2 {
  font-family: 'JetBrains Mono', monospace; font-size: 14px;
  letter-spacing: 0.12em; margin-bottom: 6px;
}
#auth-overlay p { color: var(--text-dim); font-size: 11px; margin-bottom: 18px; }
#auth-overlay label {
  display: block; font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.14em; color: var(--text-muted); margin: 10px 0 4px;
}
#auth-overlay input {
  width: 100%; padding: 9px 10px;
  background: var(--bg-row); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
}
#auth-overlay input:focus { outline: none; border-color: var(--accent); }
#auth-overlay button {
  width: 100%; margin-top: 16px; padding: 10px;
  background: var(--accent); color: #07090f;
  border: none; border-radius: 4px; cursor: pointer;
  font-family: 'JetBrains Mono', monospace; font-weight: 700;
  letter-spacing: 0.1em; font-size: 12px;
}
#auth-overlay .err { color: var(--bear); font-size: 11px; margin-top: 10px; min-height: 14px; }

/* ----------------------- COMMON UTILITIES ----------------------- */
.empty-section {
  padding: 14px 16px; text-align: center;
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--text-muted); font-style: italic;
  letter-spacing: 0.05em;
}
.tag-chip {
  display: inline-block;
  padding: 1px 6px;
  margin-left: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.05);
  color: var(--text-dim);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: middle;
}

/* =====================================================================
   LIGHT MODE — html[data-theme="light"]
   Variable overrides first, then fixes for hardcoded dark colors
   (header gradient, dropdown backgrounds, page-level modals).
   ===================================================================== */

html[data-theme="light"] {
  --bg: #f3f5f9;
  --bg-panel: #ffffff;
  --bg-row: #f7f9fc;
  --bg-row-hover: #edf1f7;
  --border: #dbe2ec;
  --border-strong: #c0cbdc;
  --text: #1c2433;
  --text-dim: #5d6b85;
  --text-muted: #93a0b6;
  --accent: #0079a8;
  --bull: #0a9d6c;
  --bull-bg: rgba(10, 157, 108, 0.10);
  --bear: #d6275a;
  --bear-bg: rgba(214, 39, 90, 0.08);
  --warn: #a86e00;
  --warn-bg: rgba(168, 110, 0, 0.10);
  --today: #8a6d00;
  --today-bg: rgba(178, 142, 0, 0.10);
}
html[data-theme="light"] body {
  background-image:
    radial-gradient(at 20% 0%, rgba(0, 121, 168, 0.05) 0%, transparent 50%),
    radial-gradient(at 80% 100%, rgba(214, 39, 90, 0.04) 0%, transparent 50%);
}
html[data-theme="light"] ::selection { background: rgba(0, 121, 168, 0.2); }
html[data-theme="light"] header.topbar,
html[data-theme="light"] #topbar-slot {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(243, 245, 249, 0.9) 100%);
}
html[data-theme="light"] .switcher-trigger:hover,
html[data-theme="light"] .switcher-trigger[aria-expanded="true"] { background: rgba(0,0,0,0.04); }
html[data-theme="light"] .switcher-menu,
html[data-theme="light"] .session-dropdown {
  background: #ffffff;
  border-color: var(--border-strong);
  box-shadow: 0 12px 32px rgba(30, 41, 59, 0.18);
}
html[data-theme="light"] .switcher-menu a:hover,
html[data-theme="light"] .session-dropdown a:hover { background: #eef2f8; }
html[data-theme="light"] .session-signout { border-color: var(--border-strong); color: var(--text-dim); }
html[data-theme="light"] .session-signout:hover { background: #eef2f8; border-color: var(--border-strong); }
html[data-theme="light"] nav.topnav a:hover { background: rgba(0,0,0,0.04); }
html[data-theme="light"] .panel-head { background: rgba(0,0,0,0.018); }
html[data-theme="light"] .info-trigger { background: rgba(0,0,0,0.03); }
html[data-theme="light"] .page-info-overlay { background: rgba(30, 41, 59, 0.45); }
html[data-theme="light"] .page-info-close { background: rgba(0,0,0,0.04); }
html[data-theme="light"] .page-info-modal { box-shadow: 0 24px 70px rgba(30,41,59,0.25); }
html[data-theme="light"] .tag-chip { background: rgba(0,0,0,0.045); }

/* index.html — the depth bars fade to transparent from a theme color; the
   muted light-mode --bull/--bear/--warn read as dark sludge there, so use
   vivid anchors (capacity-heatmap energy) just for the bars. */
html[data-theme="light"] .ob-row .depth { background: rgba(0,0,0,0.05); }
html[data-theme="light"] .ob-section.top .depth .bar { background: linear-gradient(270deg, transparent 0%, #21d99c 100%); }
html[data-theme="light"] .ob-section.bot .depth .bar { background: linear-gradient(270deg, transparent 0%, #ff6e96 100%); }
html[data-theme="light"] .ob-section.mid .depth .bar { background: linear-gradient(270deg, transparent 0%, #ffc24d 100%); }
html[data-theme="light"] .depth .label { text-shadow: 0 1px 2px rgba(255,255,255,0.7); }

/* Page-level dark hardcodes (Dev Skills modals, inputs, chips) */
html[data-theme="light"] .modal-overlay { background: rgba(30, 41, 59, 0.45); }
html[data-theme="light"] .modal-box { background: #ffffff; box-shadow: 0 24px 80px rgba(30,41,59,0.3); }
html[data-theme="light"] .ms-panel { background: #ffffff; box-shadow: 0 10px 30px rgba(30,41,59,0.18); }
html[data-theme="light"] .skill-card { background: rgba(0,0,0,0.045); }
html[data-theme="light"] .skill-card:hover { background: rgba(0, 121, 168, 0.07); }
html[data-theme="light"] .chip.tag { color: #1d5fc2; background: rgba(29,95,194,0.08); border-color: rgba(29,95,194,0.3); }
html[data-theme="light"] .chip.client { color: #0a7d46; background: rgba(10,125,70,0.08); border-color: rgba(10,125,70,0.3); }
html[data-theme="light"] .rate-badge { color: #9a6b00; border-color: rgba(154,107,0,0.4); background: rgba(154,107,0,0.07); }
html[data-theme="light"] .rate-badge:hover { background: rgba(154,107,0,0.15); }
html[data-theme="light"] .who { background: rgba(29,95,194,0.12); color: #1d5fc2; }
html[data-theme="light"] .stars button { color: rgba(0,0,0,0.15); }
html[data-theme="light"] .stars button.on { color: #c98a00; }
html[data-theme="light"] .rt-item .st { color: #c98a00; }
html[data-theme="light"] #ed-rich code { background: rgba(29,95,194,0.1); }
html[data-theme="light"] #ed-rich pre { background: rgba(0,0,0,0.035); }
html[data-theme="light"] .sk-btn { background: rgba(0,121,168,0.1); }
html[data-theme="light"] .sk-btn:hover { background: rgba(0,121,168,0.18); }
html[data-theme="light"] .sk-btn.ghost { background: transparent; }
html[data-theme="light"] .sk-btn.danger { background: rgba(214,39,90,0.1); }
html[data-theme="light"] .sk-btn.danger:hover { background: rgba(214,39,90,0.2); }
html[data-theme="light"] .rt-btn:hover { background: rgba(0,0,0,0.05); }
html[data-theme="light"] .sub-chip.active { background: rgba(0,121,168,0.12); border-color: rgba(0,121,168,0.45); }
html[data-theme="light"] .sk-toolbar input[type=search],
html[data-theme="light"] .sk-toolbar select,
html[data-theme="light"] .ed-head input[type=text],
html[data-theme="light"] .ed-head select,
html[data-theme="light"] .ed-meta input[type=text],
html[data-theme="light"] .ms-trigger,
html[data-theme="light"] .ms-panel input,
html[data-theme="light"] #rt-comment {
  background: #f7f9fc;
}
