:root {
  color-scheme: light;
  --bg: #f5efe4;
  --panel: rgba(255, 252, 246, 0.88);
  --panel-strong: #fffaf0;
  --line: rgba(62, 52, 35, 0.14);
  --text: #1c1912;
  --muted: #675e4b;
  --accent: #005f73;
  --accent-soft: #d7f0eb;
  --ok: #12715b;
  --warn: #a75b00;
  --idle: #5b6070;
  --shadow: 0 24px 60px rgba(56, 42, 20, 0.14);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(0, 95, 115, 0.16), transparent 34%),
    radial-gradient(circle at top right, rgba(255, 183, 3, 0.18), transparent 28%),
    linear-gradient(180deg, #f7f1e4 0%, #efe4d0 100%);
  color: var(--text);
  font-family: "Segoe UI Variable", "Candara", "Trebuchet MS", sans-serif;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  padding: 12px 16px;
  border-radius: 999px;
  background: #111;
  color: #fff;
  z-index: 10;
}

.skip-link:focus {
  top: 16px;
}

.shell {
  width: min(1200px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.hero,
.panel {
  backdrop-filter: blur(14px);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px;
  border-radius: calc(var(--radius) + 8px);
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 14ch;
  font-size: clamp(2.3rem, 6vw, 4.5rem);
  line-height: 0.96;
}

.hero-copy,
.section-copy,
dd,
td,
th,
.log-meta,
#updated-at,
#qr-empty {
  color: var(--muted);
}

.hero-copy {
  max-width: 62ch;
  margin-top: 12px;
  line-height: 1.6;
  font-size: 1rem;
}

.hero-meta {
  min-width: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

button:hover,
button:focus-visible {
  background: #004654;
}

.secondary-button {
  background: #d6e2e5;
  color: #163742;
}

.secondary-button:hover,
.secondary-button:focus-visible {
  background: #bfced2;
}

.danger-button {
  background: #9e2a2b;
}

.danger-button:hover,
.danger-button:focus-visible {
  background: #7f1d1d;
}

.layout {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.metric-card,
.panel {
  border-radius: var(--radius);
}

.metric-card {
  padding: 22px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.accent-card {
  background: linear-gradient(135deg, #fffaf0 0%, #edf7f5 100%);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 18px;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
}

.status-pill::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}

.status-ok {
  color: var(--ok);
  background: rgba(18, 113, 91, 0.12);
}

.status-warn {
  color: var(--warn);
  background: rgba(167, 91, 0, 0.12);
}

.status-idle {
  color: var(--idle);
  background: rgba(91, 96, 112, 0.12);
}

dl {
  display: grid;
  gap: 12px;
}

dl div {
  display: grid;
  gap: 2px;
}

dt {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

dd {
  margin: 0;
  font-size: 1rem;
}

.trigger-value {
  font-size: 1.4rem;
  line-height: 1.2;
  font-weight: 700;
}

.panel {
  padding: 22px;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.qr-panel {
  overflow: hidden;
}

.qr-frame {
  min-height: 260px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  border: 1px dashed rgba(0, 95, 115, 0.24);
  background: linear-gradient(180deg, rgba(0, 95, 115, 0.04), rgba(255, 255, 255, 0.8));
  padding: 20px;
}

#qr-image {
  width: min(100%, 320px);
  height: auto;
  background: #fff;
  padding: 12px;
  border-radius: 18px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
}

th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.log-item {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 250, 240, 0.95);
  border: 1px solid var(--line);
}

.log-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.log-level {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 700;
}

.log-message {
  font-weight: 700;
}

.log-context {
  margin-top: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(0, 95, 115, 0.06);
  overflow-x: auto;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Cascadia Code", "Consolas", monospace;
  color: #153844;
}

@media (max-width: 920px) {
  .hero,
  .section-head {
    flex-direction: column;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }

  .controls-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .panel,
  .metric-card {
    animation: rise 420ms ease both;
  }

  .metric-card:nth-child(2) {
    animation-delay: 70ms;
  }

  .metric-card:nth-child(3) {
    animation-delay: 120ms;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}