:root {
  --font-body: "Noto Serif", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-ui: "Noto Sans Mono", "SFMono-Regular", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --radius-lg: 24px;
  --radius-md: 16px;
  --shadow-soft: 0 24px 60px rgba(42, 23, 11, 0.14);
}

html {
  color-scheme: light;
}

html[data-theme="light"] {
  --theme: #fbf7f1;
  --entry: rgba(255, 252, 247, 0.84);
  --entry-strong: rgba(255, 250, 242, 0.96);
  --primary: #2d241d;
  --secondary: #6b5b4f;
  --accent: #b35a2d;
  --accent-soft: rgba(179, 90, 45, 0.12);
  --border: rgba(125, 94, 74, 0.16);
  --ring: rgba(179, 90, 45, 0.38);
  --shadow-color: rgba(93, 56, 27, 0.16);
  --hero-glow: rgba(223, 174, 133, 0.32);
  --hero-glow-strong: rgba(236, 204, 173, 0.36);
  --stat-value: #1f1711;
  --chart-bar-muted: rgba(179, 90, 45, 0.2);
  --chart-grid: rgba(125, 94, 74, 0.16);
  --chart-axis: rgba(107, 91, 79, 0.92);
  --theme-toggle-active: rgba(255, 255, 255, 0.9);
  --theme-toggle-border: rgba(125, 94, 74, 0.16);
  color-scheme: light;
}

html[data-theme="dark"] {
  --theme: rgb(29, 30, 32);
  --entry: rgba(46, 46, 51, 0.88);
  --entry-strong: rgba(56, 57, 61, 0.96);
  --primary: rgb(218, 218, 219);
  --secondary: rgb(155, 156, 157);
  --accent: #d18b5d;
  --accent-soft: rgba(209, 139, 93, 0.16);
  --border: rgb(51, 51, 51);
  --ring: rgba(209, 139, 93, 0.42);
  --shadow-color: rgba(0, 0, 0, 0.38);
  --hero-glow: rgba(170, 106, 61, 0.18);
  --hero-glow-strong: rgba(138, 82, 46, 0.24);
  --stat-value: rgb(245, 240, 232);
  --chart-bar-muted: rgba(209, 139, 93, 0.28);
  --chart-grid: rgba(255, 255, 255, 0.08);
  --chart-axis: rgba(192, 193, 196, 0.9);
  --theme-toggle-active: rgba(77, 78, 82, 0.96);
  --theme-toggle-border: rgba(255, 255, 255, 0.08);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--primary);
  background:
    radial-gradient(circle at top left, var(--hero-glow), transparent 36%),
    radial-gradient(circle at bottom right, var(--hero-glow-strong), transparent 30%),
    linear-gradient(180deg, color-mix(in srgb, var(--theme) 86%, white 14%), var(--theme));
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.page-shell {
  width: min(960px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 44px;
}

.eyebrow {
  margin: 0 0 10px;
  font-family: var(--font-ui);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.theme-controls {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-form {
  margin: 0;
}

.status-pill {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--theme-toggle-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--entry-strong) 88%, transparent);
  box-shadow: 0 14px 32px var(--shadow-color);
  font-family: var(--font-ui);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

#theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid var(--theme-toggle-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--entry-strong) 88%, transparent);
  color: var(--primary);
  cursor: pointer;
  backdrop-filter: blur(20px);
  box-shadow: 0 14px 32px var(--shadow-color);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

#theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--ring);
}

#theme-toggle:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
}

#theme-toggle svg {
  display: none;
}

html[data-theme="light"] #theme-toggle #moon,
html[data-theme="dark"] #theme-toggle #sun {
  display: block;
}

.content {
  display: grid;
  gap: 24px;
}

.hero,
.summary-card,
.stat-card,
.history-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--entry) 92%, transparent);
  box-shadow: var(--shadow-soft);
}

.hero::after,
.summary-card::after,
.stat-card::after,
.history-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, var(--accent-soft));
  pointer-events: none;
}

.hero {
  padding: 28px;
}

.hero-copy {
  margin: 0;
  max-width: 42rem;
  font-size: 1.12rem;
  line-height: 1.75;
  color: var(--secondary);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.inspect-stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
  padding: 24px 24px 22px;
}

.history-panel {
  padding: 26px 24px 24px;
}

.stat-label,
.stat-note,
.summary-meta,
.section-kicker,
.section-note {
  margin: 0;
}

.stat-label {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.stat-value {
  margin: 18px 0 10px;
  font-size: clamp(2.5rem, 7vw, 4rem);
  line-height: 1;
  letter-spacing: -0.06em;
  color: var(--stat-value);
}

.stat-value-compact {
  font-size: clamp(1.42rem, 3.6vw, 2.2rem);
  line-height: 1.18;
  letter-spacing: -0.04em;
}

.stat-note,
.summary-meta {
  color: var(--secondary);
  line-height: 1.6;
}

.summary-card {
  padding: 22px 24px;
}

#daily-brief-card {
  display: grid;
  gap: 16px;
}

.section-heading {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-kicker {
  font-family: var(--font-ui);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.section-heading h2 {
  margin: 8px 0 0;
  font-size: clamp(1.35rem, 3vw, 1.95rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.section-note {
  max-width: 25rem;
  color: var(--secondary);
  line-height: 1.6;
  text-align: right;
}

.history-chart-shell {
  position: relative;
  z-index: 1;
}

.inspect-panel {
  display: grid;
  gap: 20px;
}

.inspect-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.action-button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--accent);
  color: #fff8f2;
  cursor: pointer;
  box-shadow: 0 14px 28px var(--shadow-color);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    opacity 160ms ease,
    background-color 160ms ease;
}

.action-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.action-button:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
}

.action-button:disabled {
  cursor: wait;
  opacity: 0.64;
}

.action-button-secondary {
  border-color: var(--theme-toggle-border);
  background: color-mix(in srgb, var(--entry-strong) 90%, transparent);
  color: var(--primary);
}

.action-button-compact {
  min-height: 44px;
  padding: 0 16px;
  font-size: 0.72rem;
}

.action-button-full {
  width: 100%;
}

.action-status {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--secondary);
  line-height: 1.7;
}

.cache-list-shell {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
}

.cache-key-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cache-key-item,
.cache-key-empty {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--entry-strong) 88%, transparent);
}

.cache-key-item {
  display: grid;
  gap: 8px;
}

.cache-key-name,
.mono-cell {
  font-family: var(--font-ui);
  font-size: 0.82rem;
}

.cache-key-meta {
  color: var(--secondary);
  line-height: 1.5;
}

.cache-key-empty {
  color: var(--secondary);
}

.table-shell {
  position: relative;
  z-index: 1;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--entry-strong) 88%, transparent);
}

.data-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.data-table thead th {
  font-family: var(--font-ui);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.data-table tbody td {
  line-height: 1.6;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table-empty td {
  color: var(--secondary);
  text-align: center;
}

.history-chart {
  min-height: 292px;
  opacity: 0.4;
  transform: translateY(8px);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.history-panel[data-state="ready"] .history-chart,
.history-panel[data-state="error"] .history-chart {
  opacity: 1;
  transform: none;
}

.history-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.history-chart .domain,
.history-chart .tick line {
  stroke: transparent;
}

.history-chart .grid line {
  stroke: var(--chart-grid);
}

.history-chart text {
  fill: var(--chart-axis);
  font-family: var(--font-ui);
  font-size: 0.78rem;
}

.history-status {
  margin: 0;
  padding: 110px 0 88px;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary);
}

.summary-headline {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.summary-body,
.summary-highlights {
  position: relative;
  z-index: 1;
}

.summary-body {
  display: grid;
  gap: 12px;
  color: var(--primary);
}

.summary-markdown-paragraph,
.summary-markdown-list {
  margin: 0;
}

.summary-markdown-paragraph {
  line-height: 1.75;
}

.summary-markdown-list,
.summary-highlights {
  padding-left: 20px;
}

.summary-markdown-list {
  display: grid;
  gap: 8px;
  color: var(--secondary);
  line-height: 1.65;
}

.summary-highlights {
  display: grid;
  gap: 10px;
  margin: 0;
}

.summary-highlight {
  line-height: 1.65;
  color: var(--secondary);
}

.summary-body a {
  color: var(--accent);
}

.summary-body code {
  padding: 0.12em 0.38em;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-soft) 88%, transparent);
  font-family: var(--font-ui);
  font-size: 0.9em;
}

.summary-card-noscript {
  margin-top: 16px;
}

.login-shell {
  width: min(720px, calc(100vw - 32px));
}

.login-content {
  gap: 20px;
}

.login-panel {
  gap: 18px;
}

.login-feedback,
.login-helper {
  position: relative;
  z-index: 1;
  margin: 0;
  line-height: 1.65;
}

.login-feedback {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--entry-strong) 90%, transparent);
}

.login-feedback-error {
  color: color-mix(in srgb, var(--accent) 82%, var(--primary));
}

.login-feedback-info {
  color: var(--secondary);
}

.login-form {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
}

.login-field {
  display: block;
}

.login-input {
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--entry-strong) 90%, transparent);
  color: var(--primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.login-input::placeholder {
  color: var(--secondary);
}

.login-input:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 24px, 960px);
    padding-top: 18px;
  }

  .site-header {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 32px;
  }

  .theme-controls {
    align-self: flex-start;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .header-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .inspect-actions {
    flex-direction: column;
  }

  .action-button {
    width: 100%;
  }

  .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-note {
    max-width: none;
    text-align: left;
  }

  .history-chart {
    min-height: 248px;
  }

  .hero,
  .summary-card,
  .stat-card,
  .history-panel {
    border-radius: var(--radius-md);
  }

  .login-shell {
    width: min(100vw - 24px, 720px);
  }
}
