:root {
  --bg: #f4efe6;
  --bg-accent: #fffaf2;
  --panel: rgba(255, 251, 245, 0.84);
  --border: rgba(73, 44, 16, 0.14);
  --text: #24160c;
  --muted: #746454;
  --accent: #c96a1a;
  --accent-strong: #8f3f00;
  --success: #127a5b;
  --danger: #b74128;
  --shadow: 0 24px 60px rgba(74, 41, 16, 0.12);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(201, 106, 26, 0.17), transparent 28%),
    radial-gradient(circle at bottom right, rgba(18, 122, 91, 0.12), transparent 24%),
    linear-gradient(135deg, #f3eadf, #f8f5ef 55%, #ece6dc);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
}

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

.auth-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  padding: 32px 24px;
  background: rgba(36, 22, 12, 0.92);
  color: #fbf0df;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: inline-block;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 40px;
}

.nav {
  display: grid;
  gap: 10px;
}

.nav a {
  padding: 12px 14px;
  border-radius: 14px;
  color: rgba(251, 240, 223, 0.8);
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff7ee;
}

.sidebar-note {
  margin-top: 36px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  color: rgba(251, 240, 223, 0.72);
  line-height: 1.5;
}

.content {
  padding: 36px;
}

.page-header {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.eyebrow,
.hero-kicker {
  margin: 0 0 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
}

h1, h2, h3, h4, p {
  margin: 0;
}

.hero,
.panel,
.watcher-panel,
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 28px;
  margin-bottom: 24px;
}

.hero h2 {
  max-width: 720px;
  line-height: 1.15;
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.stats-grid,
.panel-grid,
.watcher-grid {
  display: grid;
  gap: 18px;
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 24px;
}

.panel-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 24px;
}

.watcher-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.stat-card,
.panel,
.watcher-panel {
  padding: 22px;
}

.auth-panel {
  width: min(100%, 460px);
  display: grid;
  gap: 18px;
}

.auth-copy,
.form-copy {
  line-height: 1.6;
}

.stat-card span {
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin-top: 14px;
  font-size: 2.4rem;
}

.panel-header,
.toolbar,
.button-row,
.watcher-meta,
.filter-form,
.kv-grid,
.table-wrap,
.watcher-card {
  display: flex;
}

.panel-header,
.toolbar {
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.toolbar {
  margin-bottom: 24px;
}

.panel-header {
  margin-bottom: 18px;
}

.button-row,
.watcher-meta,
.filter-form {
  gap: 12px;
  flex-wrap: wrap;
}

.button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 18px;
  background: rgba(36, 22, 12, 0.08);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.button.primary {
  background: linear-gradient(135deg, var(--accent), #f0a14d);
  color: #fffaf5;
}

.button.ghost {
  border-color: var(--border);
  background: transparent;
}

.button.danger {
  background: rgba(183, 65, 40, 0.12);
  border-color: rgba(183, 65, 40, 0.18);
  color: var(--danger);
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(36, 22, 12, 0.08);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
}

.badge.accent {
  background: rgba(201, 106, 26, 0.15);
  color: var(--accent-strong);
}

.status-live {
  color: var(--success);
}

.status-muted,
.muted,
small {
  color: var(--muted);
}

.event-list,
.watcher-list,
.stack-form {
  display: grid;
  gap: 14px;
}

.event-item,
.watcher-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(73, 44, 16, 0.08);
}

.event-item.static {
  display: grid;
  gap: 8px;
}

.snapshot-toggle {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(73, 44, 16, 0.08);
  overflow: hidden;
}

.snapshot-toggle summary {
  list-style: none;
  cursor: pointer;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.snapshot-toggle summary::-webkit-details-marker {
  display: none;
}

.multiline-box {
  white-space: pre-wrap;
  line-height: 1.55;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.snapshot-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid rgba(73, 44, 16, 0.08);
}

.watcher-card {
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  display: grid;
}

.sparkline-shell {
  position: relative;
  height: 56px;
  width: 100%;
  margin-top: 8px;
}

.sparkline-chart {
  width: 100% !important;
  height: 100% !important;
}

.stack-form label {
  display: grid;
  gap: 8px;
}

.stack-form input,
.stack-form select,
.filter-form select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

.stack-form.compact {
  margin-top: 16px;
}

.checkbox {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox input {
  width: auto;
}

.kv-grid {
  flex-wrap: wrap;
  gap: 18px;
}

.kv-grid div {
  min-width: 160px;
}

.kv-grid dt {
  color: var(--muted);
  margin-bottom: 6px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(73, 44, 16, 0.08);
}

.empty-state {
  color: var(--muted);
  padding: 8px 0;
}

.error-box {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(183, 65, 40, 0.1);
  color: var(--danger);
}

.diff-box {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  border-radius: 18px;
  background: rgba(36, 22, 12, 0.94);
  color: #f8f2e8;
  font-family: Consolas, monospace;
  font-size: 0.88rem;
}

canvas.history-chart {
  width: 100% !important;
  height: 100% !important;
}

.chart-shell {
  position: relative;
  height: 320px;
  width: 100%;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .content {
    padding: 20px;
  }

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

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

  .page-header {
    flex-direction: column;
  }
}
