:root {
  color-scheme: dark;
  --bg: #0e1116;
  --surface: #161b22;
  --surface-alt: #1d2430;
  --border: #2a3342;
  --text: #eef2f7;
  --muted: #98a4b8;
  --accent: #f5c400;
  --accent-text: #14171c;
  --low: #22c55e;
  --medium: #eab308;
  --high: #f97316;
  --peak: #ef4444;
  --forecast: #60a5fa;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(1220px, calc(100vw - 32px));
  margin: 0 auto;
}

.topbar {
  background: rgba(22, 27, 34, 0.92);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  flex-wrap: wrap;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
}

.brand-mark {
  background: var(--accent);
  color: var(--accent-text);
  padding: 3px 9px;
  border-radius: 6px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  font-size: 0.84rem;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 999px;
}

.main-content {
  padding: 22px 0 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.studio-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.studio-tab {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.92rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.studio-tab:hover {
  border-color: var(--accent);
}

.studio-tab.is-active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 700;
}

.studio-tab small {
  opacity: 0.78;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}

h1,
h2,
h3 {
  margin: 0 0 6px;
  line-height: 1.25;
}

h1 {
  font-size: 1.65rem;
}

h2 {
  font-size: 1.2rem;
}

h3 {
  font-size: 1.05rem;
}

p {
  margin: 0;
}

.muted {
  color: var(--muted);
}

.studio-header-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.studio-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.studio-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.studio-header-actions form {
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface-alt);
  color: var(--text);
}

.btn:hover {
  border-color: #4c5b73;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-ghost {
  background: transparent;
}

.btn-muted {
  background: #232a36;
  color: var(--muted);
}

.btn-sm {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.kpi-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.kpi-label {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.kpi-value-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.kpi-value {
  font-size: 1.7rem;
  font-weight: 800;
}

.kpi-value-sm {
  font-size: 1.25rem;
}

.kpi-sub {
  font-size: 0.82rem;
  margin-top: 4px;
}

.pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.pill-accent {
  background: rgba(245, 196, 0, 0.18);
  color: var(--accent);
  border: 1px solid rgba(245, 196, 0, 0.35);
}

.pill-info {
  background: rgba(96, 165, 250, 0.16);
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.35);
}

.pill-muted {
  background: rgba(152, 164, 184, 0.14);
  color: var(--muted);
}

.status-badge.level-low {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
}

.status-badge.level-medium {
  background: rgba(234, 179, 8, 0.2);
  color: #facc15;
}

.status-badge.level-high {
  background: rgba(249, 115, 22, 0.2);
  color: #fb923c;
}

.status-badge.level-peak {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.status-badge.level-none {
  background: rgba(152, 164, 184, 0.15);
  color: var(--muted);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.chart-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.day-svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-grid-line {
  stroke: #263040;
  stroke-width: 1;
}

.chart-axis-label {
  fill: var(--muted);
  font-size: 11px;
}

.chart-bar.level-low {
  fill: var(--low);
}

.chart-bar.level-medium {
  fill: var(--medium);
}

.chart-bar.level-high {
  fill: var(--high);
}

.chart-bar.level-peak {
  fill: var(--peak);
}

.chart-bar.level-forecast,
.chart-bar.is-forecast-only {
  fill: rgba(96, 165, 250, 0.32);
  stroke: rgba(96, 165, 250, 0.75);
  stroke-width: 1;
  stroke-dasharray: 3 2;
}

.chart-bar.is-current {
  stroke: #ffffff;
  stroke-width: 2;
}

.chart-forecast-line {
  stroke: #e2e8f0;
  stroke-width: 2;
  stroke-dasharray: 5 4;
  opacity: 0.9;
}

.chart-forecast-dot {
  fill: #e2e8f0;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.82rem;
  color: var(--muted);
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.swatch-low {
  background: var(--low);
}

.swatch-medium {
  background: var(--medium);
}

.swatch-high {
  background: var(--high);
}

.swatch-peak {
  background: var(--peak);
}

.swatch-forecast {
  background: rgba(96, 165, 250, 0.45);
  border: 1px dashed var(--forecast);
}

.swatch-line {
  height: 2px;
  background: #e2e8f0;
}

.outlook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
}

.outlook-card {
  text-align: left;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 10px;
  padding: 12px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.outlook-card:hover {
  border-color: var(--accent);
}

.outlook-card.level-low {
  border-left-color: var(--low);
}

.outlook-card.level-medium {
  border-left-color: var(--medium);
}

.outlook-card.level-high {
  border-left-color: var(--high);
}

.outlook-card.level-peak {
  border-left-color: var(--peak);
}

.outlook-top {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 6px;
}

.outlook-date {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.85rem;
}

.outlook-avg {
  font-size: 1.25rem;
  font-weight: 800;
}

.outlook-meta,
.outlook-best {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 3px;
}

.heatmap-scroll {
  overflow-x: auto;
}

.heatmap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 3px;
  min-width: 680px;
}

.heatmap-table th {
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 600;
  padding: 2px 4px;
  text-align: center;
}

.heatmap-day {
  text-align: left !important;
  padding-right: 8px !important;
  white-space: nowrap;
}

.heatmap-cell {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 5px;
  padding: 6px 2px;
  min-width: 24px;
  color: #0b0e13;
}

.heatmap-cell.level-none {
  background: var(--surface-alt);
  color: var(--muted);
}

.heatmap-cell.level-low {
  background: rgba(34, 197, 94, 0.78);
}

.heatmap-cell.level-medium {
  background: rgba(234, 179, 8, 0.82);
}

.heatmap-cell.level-high {
  background: rgba(249, 115, 22, 0.86);
}

.heatmap-cell.level-peak {
  background: rgba(239, 68, 68, 0.9);
  color: #ffffff;
}

.heatmap-cell.is-fallback {
  opacity: 0.6;
}

.two-col-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.subpanel {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.rank-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rank-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.day-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.date-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.quick-dates {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

input[type="search"],
input[type="text"],
input[type="date"] {
  min-height: 38px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
  font-size: 0.9rem;
}

.windows-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.windows-label {
  font-size: 0.86rem;
  color: var(--muted);
}

.window-chip {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.84rem;
  border: 1px solid var(--border);
  background: var(--surface-alt);
}

.hour-table-details {
  margin-top: 14px;
}

.hour-table-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.table-scroll {
  overflow-x: auto;
  margin-top: 10px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
}

.row-current {
  background: rgba(245, 196, 0, 0.08);
}

.finder-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.finder-controls > input[type="search"] {
  flex: 1 1 320px;
}

.inline-id-form {
  display: flex;
  gap: 8px;
  flex: 0 1 360px;
}

.inline-id-form input {
  flex: 1;
}

.catalog-meta {
  font-size: 0.84rem;
  margin-bottom: 10px;
}

.studio-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.studio-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  flex-wrap: wrap;
}

.studio-row-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.studio-row-title a:hover {
  color: var(--accent);
}

.studio-row-sub {
  font-size: 0.84rem;
}

.studio-row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.studio-row-actions form {
  margin: 0;
}

.alert {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin: 8px 0;
}

.alert-success {
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #86efac;
}

.alert-error {
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.empty-box {
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--muted);
}

.hero-empty {
  padding: 28px 24px;
}
