html {
  color-scheme: light dark;
}

:root,
html[data-theme="light"] {
  --navy: #061f38;
  --navy-2: #04182c;
  --blue: #0b3158;
  --paper: #fbfaf7;
  --warm: #f8f3e8;
  --ink: #101827;
  --muted: #5b6472;
  --line: #d8cdb7;
  --gold: #b5894d;
  --gold-soft: rgba(181, 137, 77, 0.12);
  --green: #0f766e;
  --red: #991b1b;
  --amber: #b45309;
  --card-bg: rgba(251,250,247,0.92);
  --field-bg: #ffffff;
  --soft-bg: rgba(255,255,255,0.58);
  --heading: #0d2745;
  --pill-text: #6b4b1f;
  --notice-text: #7c2d12;
  --notice-good-text: #134e4a;
  --notice-danger-text: #7f1d1d;
  --disabled-bg: #d6d3d1;
  --disabled-border: #a8a29e;
  --disabled-text: #78716c;
  --shadow: rgba(15,23,42,0.08);
}

html[data-theme="dark"] {
  --navy: #030f1c;
  --navy-2: #020912;
  --blue: #8cc9ff;
  --paper: #111820;
  --warm: #07090b;
  --ink: #f8f4ec;
  --muted: #b8c2ce;
  --line: rgba(215,226,238,0.16);
  --gold: #d8ad61;
  --gold-soft: rgba(216,173,97,0.18);
  --green: #5eead4;
  --red: #fca5a5;
  --amber: #fbbf24;
  --card-bg: rgba(17,24,32,0.94);
  --field-bg: #0c131a;
  --soft-bg: rgba(255,255,255,0.06);
  --heading: #f8f4ec;
  --pill-text: #f4d6a0;
  --notice-text: #fed7aa;
  --notice-good-text: #99f6e4;
  --notice-danger-text: #fecaca;
  --disabled-bg: #27313c;
  --disabled-border: #485563;
  --disabled-text: #94a3b8;
  --shadow: rgba(0,0,0,0.38);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(181,137,77,0.12), transparent 28%),
    var(--warm);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a { color: var(--blue); }

.top {
  background: var(--navy);
  color: white;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 26px;
}

.brand {
  color: white;
  text-decoration: none;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 3vw, 38px);
  letter-spacing: -0.035em;
}

.nav {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.nav a,
.link-button,
.theme-toggle {
  color: rgba(255,255,255,0.86);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.18);
  min-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}

.theme-toggle {
  color: white;
}

.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.hero,
.card,
.panel,
.login-card {
  border: 1px solid var(--line);
  background: var(--card-bg);
  box-shadow: 0 18px 50px var(--shadow);
}

.hero {
  padding: 28px;
  margin-bottom: 16px;
}

.eyebrow,
.label {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.74rem;
  font-weight: 900;
  margin: 0 0 8px;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--heading);
  font-weight: 500;
  line-height: 1.1;
}

h1 { font-size: clamp(38px, 5vw, 64px); letter-spacing: -0.04em; }
h2 { font-size: 28px; }
h3 { font-size: 22px; }

.lead { color: var(--muted); max-width: 780px; font-size: 18px; margin: 16px 0 0; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.card,
.panel {
  padding: 20px;
}

.metric {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 11px 9px;
  vertical-align: top;
}

th {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
}

.pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--gold-soft);
  color: var(--pill-text);
  font-size: 12px;
  font-weight: 850;
}

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

.stack-actions {
  display: grid;
  gap: 8px;
  min-width: 150px;
}

.stack-actions button {
  width: 100%;
}

dl {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 8px 14px;
}

dt {
  color: var(--muted);
  font-weight: 900;
}

dd {
  margin: 0;
}

.health {
  border: 1px solid var(--line);
  background: var(--soft-bg);
  padding: 14px;
  margin-top: 12px;
}

.health-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.button,
button {
  min-height: 42px;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: white;
  padding: 0 15px;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button.secondary,
button.secondary {
  background: transparent;
  color: var(--blue);
}

button:disabled {
  border-color: var(--disabled-border);
  background: var(--disabled-bg);
  color: var(--disabled-text);
  cursor: not-allowed;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  background: var(--field-bg);
  color: var(--ink);
  padding: 0 11px;
  font: inherit;
}

textarea {
  min-height: 110px;
  padding-top: 10px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  font-weight: 900;
}

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

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

.login-body {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 520px);
  padding: 32px;
}

.login-card form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.notice {
  border-left: 3px solid var(--amber);
  background: rgba(180,83,9,0.09);
  color: var(--notice-text);
  padding: 12px 14px;
  margin: 14px 0;
}

.notice.good {
  border-left-color: var(--green);
  background: rgba(15,118,110,0.09);
  color: var(--notice-good-text);
}

.notice.danger {
  border-left-color: var(--red);
  background: rgba(153,27,27,0.09);
  color: var(--notice-danger-text);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  color: var(--ink);
}

.check-row input {
  width: auto;
  min-height: 0;
}

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

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

pre {
  white-space: pre-wrap;
  font-family: inherit;
  margin: 8px 0 0;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(170px, 1fr) minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 620px;
}

.inline-form input,
.inline-form select {
  min-height: 36px;
  padding: 8px 10px;
}

.inline-form button {
  min-height: 36px;
  padding: 8px 12px;
}

@media (max-width: 860px) {
  .top,
  .nav {
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
  }

  .grid,
  .split-grid,
  .form-grid,
  .inline-form {
    grid-template-columns: 1fr;
    min-width: 0;
  }
}
