/* Dark only, on purpose: the wall display runs in a Chrome whose own setting is
   "light", and the board should look the same everywhere regardless. */
:root {
  color-scheme: dark;
  --bg: #0e1a2b;
  --surface: #15263d;
  --surface-2: #1c304a;
  --ink: #e7eef5;
  --ink-muted: #93a7bd;
  --line: #2c4260;
  --blue: #85b4ec;
  --blue-soft: #1e3654;
  --green: #74c29a;
  --green-soft: #1c3327;
  --amber: #e0b366;
  --amber-soft: #3a2e14;
}

* { box-sizing: border-box; }

/* Author styles like display:flex would otherwise beat the browser's [hidden]. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding: 0 20px 40px;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-block: 20px 12px;
}

.topbar h1 {
  font-size: 26px;
  margin: 0;
}

.topbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

.view-toggle button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-muted);
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}
.view-toggle button:first-child { border-radius: 6px 0 0 6px; }
.view-toggle button:last-child { border-radius: 0 6px 6px 0; border-left: none; }
.view-toggle button.active { background: var(--blue); border-color: var(--blue); color: white; }

.family-toggle {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-muted);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}
.family-toggle.active { background: #0f9b8e22; border-color: #0f9b8e; color: #0f9b8e; font-weight: 600; }
.family-toggle.unconfigured { opacity: 0.5; }

.work-toggle {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-muted);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}
.work-toggle.active { background: var(--surface-2); border-color: var(--ink-muted); color: var(--ink); font-weight: 600; }
.work-toggle.unconfigured { opacity: 0.5; }

.reminders-toggle {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-muted);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}
.reminders-toggle.active { background: var(--amber-soft); border-color: var(--amber); color: var(--amber); font-weight: 600; }
.reminders-toggle.unconfigured { opacity: 0.5; }

.appt-busy { opacity: 0.7; }
.appt-busy .appt-title { color: var(--ink-muted); font-weight: 500; font-style: italic; }

.sync-status {
  font-size: 12px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.sync-status.offline { color: var(--amber); font-weight: 600; }

.setup-banner {
  background: var(--amber-soft);
  border: 1px solid var(--amber);
  color: var(--ink);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 16px;
}
.setup-banner code {
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 3px;
}

.agent-filter {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-muted);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}
.chip.active {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: var(--blue);
  font-weight: 600;
}

.weather {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px 18px;
  margin-bottom: 16px;
}
.weather[hidden] { display: none; }
.weather-now { display: flex; align-items: center; gap: 14px; min-width: 0; }
.weather-temp { font-size: 34px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
.weather-now-detail { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.weather-cond { font-weight: 600; }
.weather-meta { font-size: 13px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.weather-days { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.weather-day { display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.weather-day-name { font-weight: 600; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.04em; font-size: 11px; }
.weather-day-temps { font-variant-numeric: tabular-nums; font-weight: 600; }
.weather-day-cond { color: var(--ink-muted); }

.goals { margin-bottom: 24px; }
.goals h2 { font-size: 18px; margin-bottom: 12px; }

.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.goal-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px 16px;
}
.goal-tile .goal-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.goal-tile .goal-label { font-size: 13px; color: var(--ink-muted); }
.goal-tile .goal-numbers { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.goal-tile .goal-numbers .of { color: var(--ink-muted); font-weight: 400; }
.goal-tile .goal-edit {
  background: none; border: none; color: var(--blue);
  font-size: 12px; cursor: pointer; padding: 0;
}
.goal-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}
.goal-bar .fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
}
.goal-bar .fill.over { background: var(--blue); }

.goal-edit-form { display: flex; gap: 6px; align-items: center; }
.goal-edit-form .goal-input {
  width: 64px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  padding: 4px 6px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.goal-edit-form button {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.goal-edit-form button[type="submit"] { background: var(--blue); border-color: var(--blue); color: white; }

.calendar {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.day-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.day-group h3 {
  margin: 0;
  padding: 10px 16px;
  background: var(--surface-2);
  font-size: 14px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.appt {
  display: flex;
  gap: 14px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  align-items: baseline;
}
.appt:first-of-type { border-top: none; }

.appt-time {
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
  font-size: 13px;
  min-width: 70px;
}

.appt-body { flex: 1; min-width: 0; }
.appt-title { font-weight: 600; }
.appt-meta { color: var(--ink-muted); font-size: 13px; margin-top: 2px; }
/* 5-day view: today + the next four days as side-by-side columns. */
.calendar.five-day {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}
.five-day .day-group h3 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 12px;
  font-size: 13px;
}
.five-day .day-group.today h3 { background: var(--blue-soft); color: var(--blue); }
.five-day .day-date { font-weight: 400; letter-spacing: 0; }
.five-day .appt { flex-direction: column; gap: 2px; padding: 10px 12px; }
.five-day .appt-time { min-width: 0; font-size: 12px; }
.five-day .appt-title { font-size: 14px; overflow-wrap: anywhere; }
.five-day .appt-meta { overflow-wrap: anywhere; }
.day-empty { padding: 14px 12px; color: var(--ink-muted); font-size: 13px; font-style: italic; }

@media (max-width: 1000px) {
  .calendar.five-day { grid-template-columns: 1fr; }
  .five-day .appt { flex-direction: row; gap: 14px; }
  .five-day .appt-time { min-width: 70px; }
}

.appt-outcome {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 6px;
}

.deal-lists {
  margin-top: 36px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}
.deal-panel h2 {
  font-size: 18px;
  margin: 0 0 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.deal-panel h2 .count {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 1px 9px;
}
.deal-panel h2 .count:empty { display: none; }

.deal-rows {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.deal-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}
.deal-row:first-child { border-top: none; }

.deal-main { flex: 1; min-width: 0; }
.deal-main .primary { font-weight: 600; overflow-wrap: anywhere; }
.deal-main .secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  color: var(--ink-muted);
  font-size: 13px;
}

.deal-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.deal-close {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.deal-close.none { color: var(--ink-muted); font-style: italic; }
.deal-close.past { color: var(--amber); font-weight: 600; }

.deal-price {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}
.deal-price.unset { color: var(--ink-muted); font-weight: 400; }

.deal-agent {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.deal-empty { padding: 16px; color: var(--ink-muted); font-size: 14px; }

@media (max-width: 900px) {
  .deal-lists { grid-template-columns: 1fr; }
}

.agent-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.empty-state {
  color: var(--ink-muted);
  padding: 40px 0;
  text-align: center;
}

.pipeline { margin-top: 36px; }
.pipeline h2 { font-size: 18px; }

.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.pipeline-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px 16px;
}
.pipeline-tile .label { font-size: 12px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.pipeline-tile .value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 4px; }

@media (max-width: 480px) {
  .topbar { flex-direction: column; align-items: flex-start; }
}
