:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --ink: #0f0f0f;
  --muted: #575757;
  --accent: #ffd500;
  --accent-strong: #f4c400;
  --border: #d9d9d9;
  --story: #fff2a3;
  --spotlight: #111111;
  --spotlight-ink: #ffffff;
  --danger: #b42318;
  --success: #0f766e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Space Grotesk", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(255, 213, 0, 0.25), transparent 25%),
    linear-gradient(180deg, #fffef6 0%, #ffffff 55%);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
code { font-family: "SFMono-Regular", monospace; }
h1, h2, h3, p { margin-top: 0; }

.brandmark { font-size: 1.8rem; font-weight: 700; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 14px 35px rgba(17, 17, 17, 0.06);
}

.narrow { max-width: 520px; }
.login-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  padding: 28px 20px;
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
}

.sidebar-nav { display: grid; gap: 8px; margin-top: 22px; }
.sidebar-nav a {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  font-weight: 700;
}
.sidebar-nav a.active {
  background: var(--accent);
  border-color: var(--accent-strong);
}
.brand-switcher { margin: 8px 0 6px; }
.sidebar-divider { height: 1px; margin: 12px 0 4px; background: var(--border); }
.sidebar-section-label { color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; }
.sidebar-footer { display: grid; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); }
.app-main { min-width: 0; }
.page { padding: 28px 28px 48px; }
.stack { display: grid; gap: 14px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin-bottom: 20px; }
.hero-heading, .section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.subtle { color: var(--muted); }
.eyebrow { display: inline-block; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.78rem; color: var(--muted); }
.stat-card strong { display: block; margin-top: 10px; font-size: 2rem; }
.metric-list { display: grid; gap: 12px; margin: 0; }
.metric-list div { display: flex; justify-content: space-between; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.metric-list dt { color: var(--muted); }
.metric-list dd { margin: 0; font-weight: 700; }

label { display: grid; gap: 6px; font-size: 0.95rem; }
input, textarea, select, button { font: inherit; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 12px;
  background: #ffffff;
}
textarea { min-height: 110px; resize: vertical; }
.checkbox { display: flex; align-items: center; gap: 10px; }
.checkbox input { width: auto; }

.button {
  appearance: none;
  border: 1px solid var(--accent-strong);
  border-radius: 999px;
  padding: 11px 18px;
  background: var(--accent);
  color: #111111;
  font-weight: 700;
  cursor: pointer;
}
.button.button-secondary {
  background: #ffffff;
  border-color: var(--border);
}
.button.button-small {
  padding: 9px 14px;
  font-size: 0.92rem;
}

.inline-form, .filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.block-form { margin-bottom: 18px; }
.flash {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
}
.flash-success { background: rgba(15, 118, 110, 0.08); color: var(--success); }
.flash-error { background: rgba(180, 35, 24, 0.08); color: var(--danger); }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table th { color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }
.planner-panel {
  margin-bottom: 20px;
  overflow: hidden;
}
.planner-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
.planner-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.planner-week-pill {
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: linear-gradient(180deg, #fffdf1 0%, #ffffff 100%);
  font-weight: 700;
  white-space: nowrap;
}
.planner-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
}
.planner-table {
  width: 100%;
  min-width: 1100px;
  border-collapse: separate;
  border-spacing: 0;
  background: #ffffff;
}
.planner-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
  background: #fffef7;
  text-align: left;
  vertical-align: bottom;
}
.planner-table thead th:first-child {
  min-width: 220px;
}
.planner-day-heading {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}
.planner-day-subheading {
  display: block;
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}
.planner-row th,
.planner-row td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.planner-profile-cell {
  min-width: 220px;
  background: #ffffff;
}
.planner-profile-cell strong {
  display: block;
  font-size: 1rem;
}
.planner-row td {
  background: linear-gradient(180deg, rgba(255, 213, 0, 0.05), rgba(255, 255, 255, 0));
}
.planner-row:nth-child(even) td {
  background: linear-gradient(180deg, rgba(17, 17, 17, 0.02), rgba(255, 255, 255, 0));
}
.planner-row:nth-child(even) th {
  background: #fcfcfc;
}
.planner-row:nth-child(odd) th {
  background: #ffffff;
}
.planner-cell {
  min-width: 145px;
}
.planner-entry-stack {
  display: grid;
  gap: 8px;
}
.planner-entry {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  padding: 8px 10px;
  border: 1px solid transparent;
  min-height: 36px;
}
.planner-entry-story {
  background: var(--story);
  border-color: rgba(244, 196, 0, 0.35);
}
.planner-entry-spotlight {
  background: #111111;
  color: #ffffff;
  border-color: #111111;
}
.planner-entry-status {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.planner-entry-spotlight .planner-entry-status {
  color: rgba(255, 255, 255, 0.92);
}
.planner-empty {
  display: inline-block;
  color: var(--muted);
  opacity: 0.6;
  padding-top: 8px;
}
.spotlight-hours-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.spotlight-hours-card {
  display: grid;
  gap: 16px;
}
.spotlight-hours-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.spotlight-hours-card-header h2 {
  margin-bottom: 4px;
  font-size: 1.15rem;
}
.spotlight-hours-card-header strong {
  font-size: 1.4rem;
  line-height: 1;
  white-space: nowrap;
}
.spotlight-hours-mini-chart {
  padding-top: 4px;
}
.spotlight-hours-mini-bars {
  height: 180px;
  display: grid;
  grid-template-columns: repeat(28, minmax(0, 1fr));
  gap: 6px;
  align-items: end;
  padding: 0 2px;
  border-bottom: 2px solid var(--border);
}
.spotlight-hours-mini-bar {
  min-height: 8%;
  border-radius: 6px 6px 0 0;
}
.spotlight-hours-mini-axis {
  display: grid;
  grid-template-columns: repeat(28, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 2px 0;
}
.spotlight-actions-cell {
  min-width: 320px;
}
.spotlight-actions {
  display: grid;
  gap: 8px;
}
.spotlight-reschedule-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.spotlight-reschedule-form input {
  min-width: 0;
  padding: 10px 12px;
}
.spotlight-stop-form {
  display: flex;
  justify-content: flex-end;
}
.spotlight-hours-panel {
  margin-bottom: 20px;
  overflow: hidden;
}
.spotlight-hours-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.spotlight-hours-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 18px 0 20px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.spotlight-hours-summary strong {
  display: block;
  margin-top: 10px;
  font-size: 2.4rem;
  line-height: 1;
}
.spotlight-hours-compare {
  text-align: right;
}
.spotlight-hours-chart {
  padding-top: 22px;
}
.spotlight-hours-bars {
  height: 360px;
  display: grid;
  grid-template-columns: repeat(28, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  padding: 0 6px;
  border-bottom: 2px solid var(--border);
}
.spotlight-hours-bar {
  width: 100%;
  min-height: 10%;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, rgba(17, 17, 17, 0.12), rgba(17, 17, 17, 0.18));
}
.spotlight-hours-bar-highlight {
  background: linear-gradient(180deg, rgba(255, 213, 0, 0.95), rgba(244, 196, 0, 0.92));
  box-shadow: 0 0 0 1px rgba(244, 196, 0, 0.35);
}
.spotlight-hours-axis {
  display: grid;
  grid-template-columns: repeat(28, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 6px 0;
}
.spotlight-hours-tick {
  font-size: 0.82rem;
  color: var(--muted);
}
.spotlight-hours-tick:nth-child(14) {
  text-align: center;
}
.spotlight-hours-tick:last-child {
  text-align: right;
}

.type-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}
.type-pill-story { background: var(--story); }
.type-pill-spotlight { background: var(--spotlight); color: var(--spotlight-ink); }

.legend { display: flex; gap: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 8px; }
.legend-swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid var(--border); }
.legend-story { background: var(--story); }
.legend-spotlight { background: var(--spotlight); }

.calendar-panel { margin-bottom: 20px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.calendar-day {
  min-height: 110px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fffdf4;
}
.calendar-day-muted { opacity: 0.45; }
.calendar-item { margin-top: 8px; border-radius: 10px; padding: 6px 8px; font-size: 0.82rem; font-weight: 700; }
.calendar-item-story { background: var(--story); }
.calendar-item-spotlight { background: var(--spotlight); color: var(--spotlight-ink); }

.simple-list { margin: 0; padding-left: 18px; display: grid; gap: 10px; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; min-height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .two-col, .stats-grid { grid-template-columns: 1fr; }
  .spotlight-hours-grid { grid-template-columns: 1fr; }
  .planner-header {
    flex-direction: column;
    align-items: stretch;
  }
  .planner-toolbar {
    justify-content: flex-start;
  }
  .calendar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spotlight-actions-cell {
    min-width: 0;
  }
  .spotlight-hours-summary {
    grid-template-columns: 1fr;
  }
  .spotlight-hours-compare {
    text-align: left;
  }
  .spotlight-hours-bars {
    height: 220px;
    gap: 6px;
    padding: 0;
  }
  .spotlight-hours-axis {
    gap: 6px;
    padding: 12px 0 0;
  }
  .spotlight-reschedule-form {
    grid-template-columns: 1fr;
  }
  .spotlight-stop-form {
    justify-content: flex-start;
  }
}
