:root {
  --bg: #f4ede3;
  --bg-strong: #e8dccb;
  --panel: rgba(255, 251, 245, 0.86);
  --panel-strong: #fffdf9;
  --line: rgba(86, 61, 32, 0.12);
  --ink: #1f1c18;
  --muted: #6d6357;
  --accent: #b65c2c;
  --accent-strong: #8f431f;
  --accent-soft: rgba(182, 92, 44, 0.12);
  --good: #1d7d59;
  --warn: #a46b14;
  --bad: #ba4047;
  --shadow: 0 28px 80px rgba(64, 46, 24, 0.16);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --font-display: "Trebuchet MS", "Segoe UI Variable Display", "Segoe UI", sans-serif;
  --font-body: "Segoe UI Variable Text", "Segoe UI", "Trebuchet MS", sans-serif;
}

body.admin-shell {
  --bg: #edf2f1;
  --bg-strong: #dbe7e4;
  --panel: rgba(248, 252, 251, 0.88);
  --panel-strong: #ffffff;
  --line: rgba(30, 78, 72, 0.12);
  --ink: #152321;
  --muted: #60726e;
  --accent: #0e7568;
  --accent-strong: #09594f;
  --accent-soft: rgba(14, 117, 104, 0.12);
  --good: #1f7d59;
  --warn: #986d13;
  --bad: #b64a52;
  --shadow: 0 28px 80px rgba(17, 61, 57, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 247, 235, 0.9) 0, transparent 34%),
    linear-gradient(160deg, var(--bg) 0%, #fbfaf7 48%, #f2ece5 100%);
}

body.admin-shell {
  background:
    radial-gradient(circle at top left, rgba(244, 255, 251, 0.92) 0, transparent 30%),
    linear-gradient(160deg, var(--bg) 0%, #f9fcfb 48%, #ebf1ef 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: 0;
  pointer-events: none;
  width: 34vw;
  height: 34vw;
  border-radius: 999px;
  filter: blur(44px);
  opacity: 0.35;
}

body::before {
  top: -10vw;
  right: -8vw;
  background: linear-gradient(135deg, var(--accent-soft), rgba(255, 255, 255, 0));
}

body::after {
  bottom: -14vw;
  left: -10vw;
  background: linear-gradient(135deg, rgba(70, 123, 110, 0.18), rgba(255, 255, 255, 0));
}

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

button {
  cursor: pointer;
}

.page-shell {
  position: relative;
  z-index: 1;
  max-width: 1360px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.frame-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.frame-title {
  margin: 2px 0 8px;
  font: 700 clamp(2.1rem, 3vw, 3.7rem) / 0.95 var(--font-display);
  letter-spacing: -0.04em;
}

.frame-subtitle {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.frame-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(16px);
  color: var(--muted);
  white-space: nowrap;
}

.frame-badge::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 0 0 6px var(--accent-soft);
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(290px, 0.9fr);
  gap: 18px;
  padding: 28px;
  overflow: hidden;
  position: relative;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto -80px -100px auto;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-soft), rgba(255, 255, 255, 0));
}

.hero-copy {
  position: relative;
  z-index: 1;
}

.hero-copy h2,
.hero-copy h1 {
  margin: 4px 0 12px;
  font: 700 clamp(2rem, 2.7vw, 3.35rem) / 0.95 var(--font-display);
  letter-spacing: -0.045em;
}

.hero-copy p {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.75;
}

.hero-side {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
}

.hero-card {
  padding: 18px 18px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-value,
.metric-value,
.detail-value {
  font: 700 clamp(1.45rem, 2vw, 2.5rem) / 1 var(--font-display);
  letter-spacing: -0.04em;
}

.progress-track {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
}

.progress-value {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

.metric-grid,
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.metric-card {
  padding: 18px;
}

.metric-label,
.detail-label {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.panel-body {
  padding: 22px;
}

.panel.wide {
  grid-column: 1 / -1;
}

.section-title {
  margin: 0 0 8px;
  font: 700 1.35rem/1.2 var(--font-display);
  letter-spacing: -0.03em;
}

.section-copy {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.7;
}

.toolbar,
.button-row,
.chip-row,
.inline-pairs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar {
  margin-top: 18px;
}

.button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.12);
}

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

.button.secondary,
.button.ghost,
.button.danger {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  box-shadow: none;
}

.button.danger {
  color: var(--bad);
}

.button:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}

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

.form-grid.single {
  grid-template-columns: 1fr;
}

.field {
  display: grid;
  gap: 8px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 0.9rem;
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 15px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field textarea {
  min-height: 148px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(0, 0, 0, 0.2);
  box-shadow: 0 0 0 5px var(--accent-soft);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
}

.status-pill::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: currentColor;
}

.status-pill.is-good {
  color: var(--good);
}

.status-pill.is-warn {
  color: var(--warn);
}

.status-pill.is-bad {
  color: var(--bad);
}

.status-pill.is-neutral {
  color: var(--muted);
}

.note-box,
.raw-box,
.timeline-event,
.list-card,
.link-box {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.66);
}

.note-box,
.raw-box,
.link-box {
  padding: 14px 16px;
}

.note-box p,
.raw-box p,
.timeline-event p {
  margin: 0;
  line-height: 1.65;
}

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

.kicker {
  color: var(--accent-strong);
  font-weight: 700;
}

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

.checklist li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
}

.checklist strong {
  font-size: 0.88rem;
}

.checklist .ok {
  color: var(--good);
}

.checklist .todo {
  color: var(--warn);
}

.split-layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 18px;
}

.list-stack,
.timeline,
.runtime-list {
  display: grid;
  gap: 12px;
}

.list-card,
.timeline-event {
  padding: 14px 16px;
}

.agency-row {
  display: grid;
  gap: 10px;
  text-align: left;
  width: 100%;
  padding: 16px;
  border: 1px solid transparent;
  border-radius: 18px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
}

.agency-row.active {
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 18px 28px rgba(0, 0, 0, 0.08);
  background: var(--panel-strong);
}

.agency-row h3,
.runtime-card h3,
.list-card h3 {
  margin: 0;
  font: 700 1.05rem/1.2 var(--font-display);
}

.inline-stat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.88rem;
}

.table-wrap {
  overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--line);
}

.table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.72);
}

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

.table th {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.table td {
  font-size: 0.95rem;
  line-height: 1.55;
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.92);
}

.code,
.code-inline {
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.code-inline {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
}

.link-box {
  overflow-wrap: anywhere;
  line-height: 1.7;
}

.flash {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  min-width: 260px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid transparent;
  box-shadow: var(--shadow);
  color: #fff;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.flash.show {
  opacity: 1;
  transform: translateY(0);
}

.flash.tone-success {
  background: linear-gradient(135deg, #1c7b56, #13573d);
}

.flash.tone-danger {
  background: linear-gradient(135deg, #bf4248, #88282d);
}

.flash.tone-info {
  background: linear-gradient(135deg, #38557c, #253754);
}

.loading-state,
.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  text-align: center;
  color: var(--muted);
}

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

.auth-copy {
  padding: 28px;
}

.auth-copy ul {
  margin: 18px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.raw-box pre,
.timeline-event pre {
  margin: 10px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: 0.83rem/1.6 "Cascadia Code", Consolas, monospace;
}

@media (max-width: 1180px) {
  .metric-grid,
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-grid,
  .hero-panel,
  .split-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .content-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .page-shell {
    padding-inline: 14px;
  }

  .panel-body,
  .hero-panel,
  .auth-copy {
    padding: 18px;
  }

  .metric-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .flash {
    left: 14px;
    right: 14px;
    max-width: none;
  }
}
