/* Pulse — dark UI. Palette follows the validated dark-mode reference set. */
:root {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232322;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --border-soft: rgba(255, 255, 255, 0.06);
  --accent: #3987e5;
  --accent-strong: #256abf;
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; margin: 10px 2px 0; }
.num { text-align: right; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------- layout ---------------- */
.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
#main { max-width: 1060px; margin: 0 auto; padding: 20px 20px 80px; display: flex; flex-direction: column; gap: 16px; }
#member-root, #admin-root, .tabpane { display: flex; flex-direction: column; gap: 16px; }

.pulse-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); animation: throb 1.1s ease-in-out infinite; }
@keyframes throb { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.35); opacity: .55; } }

/* ---------------- wordmark / topbar ---------------- */
.wordmark { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: 0.18em; font-size: 15px; }
.wordmark .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(57,135,229,.8); }
.wordmark.big { font-size: 26px; justify-content: center; }
.wordmark.big .dot { width: 14px; height: 14px; }
.tagline { text-align: center; color: var(--muted); margin: 6px 0 22px; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 20px;
  padding: 12px 20px;
  background: rgba(13, 13, 13, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.who { color: var(--ink-2); font-size: 13px; }

.demo-banner {
  background: rgba(250, 178, 25, 0.10);
  border-bottom: 1px solid rgba(250, 178, 25, 0.25);
  color: #eecf8a;
  text-align: center; font-size: 13px; padding: 7px 16px;
}

/* ---------------- tabs ---------------- */
.tabs { display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 10px; padding: 3px; }
.tab {
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: 7px; cursor: pointer;
}
.tab:hover { color: var(--ink-2); }
.tab.active { background: var(--surface-2); color: var(--ink); }

/* ---------------- cards ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.card.narrow { max-width: 640px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card h3 { margin: 0; font-size: 15px; font-weight: 650; }
.section-label { margin: 18px 0 8px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

/* ---------------- forms & buttons ---------------- */
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--ink-2); }
input, select, textarea {
  font: inherit; color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  outline: none;
  width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(57,135,229,.18); }
input[type="color"] { padding: 4px; height: 40px; cursor: pointer; }
textarea { resize: vertical; }

.btn {
  font: inherit; font-weight: 600; font-size: 14px;
  border-radius: 10px; border: 1px solid transparent;
  padding: 9px 16px; cursor: pointer;
  background: var(--surface-2); color: var(--ink);
  transition: filter .12s ease, background .12s ease;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { filter: brightness(1.12); }
.btn.primary { background: var(--accent-strong); }
.btn.primary:hover { background: var(--accent); filter: none; }
.btn.danger { background: rgba(208, 59, 59, 0.16); color: #f09a9a; border-color: rgba(208, 59, 59, 0.4); }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: var(--border); }
.btn.small { font-size: 12.5px; padding: 5px 11px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 620px) { .grid-2 { grid-template-columns: 1fr; } }
.row-end { display: flex; justify-content: flex-end; margin-top: 10px; }
.row-end.gap { gap: 10px; }
.form-error { color: #f09a9a; font-size: 13px; background: rgba(208,59,59,.1); border: 1px solid rgba(208,59,59,.3); padding: 8px 12px; border-radius: 8px; }

/* ---------------- auth ---------------- */
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.auth-card h2 { margin: 0; font-size: 17px; }
.demo-note {
  border: 1px solid rgba(250, 178, 25, 0.25); background: rgba(250, 178, 25, 0.07);
  color: var(--ink-2); border-radius: 12px; padding: 12px 14px; font-size: 13px; margin-bottom: 14px;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 9px; }
.chip {
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px;
}
.chip:hover { border-color: var(--accent); }

/* ---------------- tracker ---------------- */
.tracker { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: center; }
@media (max-width: 720px) { .tracker { grid-template-columns: 1fr; } }
.tracker-status { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13.5px; font-weight: 600; }
.tracker-project { margin-top: 6px; }
.timer {
  font-size: 54px; font-weight: 700; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums; /* live readout — digits must not jitter */
  margin: 4px 0 2px; line-height: 1.05;
}
#start-controls { display: flex; flex-direction: column; gap: 10px; }
.led { width: 9px; height: 9px; border-radius: 50%; background: var(--baseline); display: inline-block; flex: none; }
.led.on { background: var(--good); box-shadow: 0 0 10px rgba(12,163,12,.7); animation: throb 2s ease-in-out infinite; }
.led.off { background: var(--baseline); }

/* ---------------- stat tiles ---------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tiles.compact { grid-template-columns: repeat(3, 1fr); margin-top: 4px; }
.tile { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 12px; padding: 14px 16px; }
.tiles.compact .tile { background: var(--surface-2); }
.tile .t-label { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.tile .t-value { font-size: 24px; font-weight: 650; line-height: 1.1; }
.tile .t-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------------- activity strip (10-min blocks) ---------------- */
.strip {
  display: flex; align-items: flex-end; gap: 2px; /* surface gap between marks */
  height: 72px; padding: 6px 2px 0;
  border-bottom: 1px solid var(--baseline);
}
.strip.small { height: 52px; }
.strip .blk {
  flex: 1 1 0; min-width: 3px; max-width: 22px;
  background: var(--accent);
  border-radius: 3px 3px 0 0; /* rounded data-end, square baseline */
  min-height: 2px;
}
.strip .blk.zero { background: var(--surface-2); }
.strip .blk:hover { background: #5a9cf0; }
.strip-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 5px; }
.strip-empty { color: var(--muted); font-size: 13px; padding: 22px 0; text-align: center; }

/* ---------------- week bars ---------------- */
.week-bars { display: flex; gap: 12px; align-items: flex-end; height: 170px; padding-top: 26px; }
.wb { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.wb .wb-val { font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.wb .wb-bar {
  width: 100%; max-width: 24px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
}
.wb .wb-bar.zero { background: var(--surface-2); }
.wb .wb-day { font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--baseline); width: 100%; text-align: center; padding-top: 6px; }
.wb.today .wb-day { color: var(--ink); font-weight: 650; }

/* ---------------- tables ---------------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 600; padding: 8px 10px;
  border-bottom: 1px solid var(--grid);
}
.table th.num { text-align: right; }
.table td { padding: 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table.hover tbody tr { cursor: pointer; }
.table.hover tbody tr:hover td { background: rgba(255,255,255,0.025); }
.empty { color: var(--muted); text-align: center; padding: 26px 0 12px; font-size: 13.5px; }

.person-cell .p-name { font-weight: 600; }
.person-cell .p-title { font-size: 12px; color: var(--muted); }

.proj-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); }
.proj-chip .swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; }

.status-cell { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }

.meter { display: inline-flex; align-items: center; gap: 8px; }
.meter .track { display: inline-block; width: 54px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.meter .fill { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.meter .pct { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 34px; }

.ok-badge { color: var(--good); font-weight: 700; }
.dash-badge { color: var(--baseline); }

/* ---------------- timesheet grid ---------------- */
.scroll-x { overflow-x: auto; }
#ts-table th, #ts-table td { white-space: nowrap; }
#ts-table td.cell { text-align: right; font-variant-numeric: tabular-nums; min-width: 64px; }
#ts-table td.rowtotal, #ts-table tr.totals td { font-weight: 650; }
#ts-table tr.totals td { border-top: 1px solid var(--grid); }
.range-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range-label { font-size: 13px; color: var(--ink-2); min-width: 150px; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------------- report feed ---------------- */
.report-feed { display: flex; flex-direction: column; gap: 4px; max-height: 420px; overflow-y: auto; }
.report-feed.roomy { max-height: none; }
.report-item { padding: 10px 2px; border-bottom: 1px solid var(--border-soft); }
.report-item:last-child { border-bottom: 0; }
.report-item .r-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; margin-bottom: 4px; }
.report-item .r-who { font-weight: 650; color: var(--ink); }
.report-item .r-day { color: var(--muted); font-variant-numeric: tabular-nums; }
.report-item .r-body { color: var(--ink-2); font-size: 13.5px; white-space: pre-wrap; }
.report-body { color: var(--ink-2); font-size: 13.5px; white-space: pre-wrap; background: var(--surface-2); border-radius: 10px; padding: 12px 14px; }

/* ---------------- project rows / split ---------------- */
.split-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; }
.split-row .name { flex: 0 0 150px; font-size: 13.5px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.split-row .bar-track { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.split-row .bar-fill { height: 100%; border-radius: 4px; }
.split-row .val { flex: 0 0 52px; text-align: right; font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.proj-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--border-soft); }
.proj-row:last-child { border-bottom: 0; }
.proj-row .grow { flex: 1; }
.proj-row.archived { opacity: .5; }

/* ---------------- overlays ---------------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 18px 18px; overflow-y: auto;
}
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 22px 24px;
  width: 100%; max-width: 760px;
}
.modal.narrow-modal { max-width: 430px; margin-top: 18vh; }
.modal h3 { margin: 0; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--ink); font-size: 13.5px; font-weight: 600;
  padding: 10px 18px; border-radius: 999px; z-index: 200;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
}

.tooltip {
  position: fixed; z-index: 300; pointer-events: none;
  background: #0a0a0a; border: 1px solid var(--border);
  color: var(--ink-2); font-size: 12.5px;
  padding: 6px 10px; border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.55);
  max-width: 260px;
}
.tooltip b { color: var(--ink); }
