:root {
  color-scheme: dark;
  --bg: #080b0e;
  --panel: #10161b;
  --panel-2: #151d23;
  --line: #26343b;
  --text: #eef4ef;
  --muted: #91a19c;
  --gold: #c8a85a;
  --teal: #35b7a5;
  --red: #d16b6b;
  --green: #6fd38d;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  border: 1px solid var(--line);
  background: var(--gold);
  color: #111;
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

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

button.danger {
  background: transparent;
  border-color: rgba(209, 107, 107, 0.5);
  color: var(--red);
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b1014;
  color: var(--text);
  padding: 10px 12px;
}

textarea { min-height: 96px; resize: vertical; }
label { display: grid; gap: 6px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }

.hidden { display: none !important; }
.shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar {
  border-right: 1px solid var(--line);
  background: #0a0f13;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(200, 168, 90, 0.45);
  border-radius: 6px;
  color: var(--gold);
  font-weight: 900;
  letter-spacing: 0;
}
.brand small { display: block; color: var(--muted); }
nav { display: grid; gap: 6px; }
nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 9px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
}
nav a.active {
  color: var(--text);
  border-color: var(--line);
  background: var(--panel);
}
main { min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 14, 0.88);
  position: sticky;
  top: 0;
  z-index: 2;
}
.topbar h1 { margin: 0; font-size: 26px; }
.eyebrow { margin: 0 0 4px; color: var(--teal); text-transform: uppercase; font-size: 11px; letter-spacing: 0.12em; }
.clock { color: var(--muted); white-space: nowrap; }
.view { padding: 28px; display: grid; gap: 18px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.panel h2, .panel h3 { margin: 0 0 12px; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 12px;
}
.metric { display: grid; gap: 4px; }
.metric strong { font-size: 36px; line-height: 1; color: var(--gold); }
.metric span { color: var(--muted); }
.score-ring {
  width: 170px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--teal) calc(var(--score) * 1%), #1b252b 0);
  margin: 6px auto 12px;
}
.score-ring div {
  width: 124px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--panel);
  display: grid;
  place-items: center;
  font-size: 36px;
  color: var(--gold);
  font-weight: 900;
}
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.form-grid .wide { grid-column: span 3; }
.guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 12px 0 16px; }
.thesis-callout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}
.thesis-hero {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 16px;
  align-items: start;
}
.thesis-hero h3 {
  margin: 12px 0 8px;
  font-size: 24px;
}
.thesis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.thesis-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  background: var(--panel-2);
}
.thesis-card p { margin-bottom: 0; color: var(--muted); }
.list { display: grid; gap: 10px; }
.setup-list { display: grid; gap: 10px; }
.setup-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}
.setup-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(200, 168, 90, 0.35);
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: var(--panel-2);
}
.item small, .muted { color: var(--muted); }
.window-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  background: var(--panel-2);
}
.window-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.window-head p { margin: 4px 0 0; color: var(--muted); }
.factor-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.factor-chips span {
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid var(--line);
}
.chip-pos { color: var(--green); background: rgba(111, 211, 141, 0.08); }
.chip-neg { color: var(--red); background: rgba(209, 107, 107, 0.08); }
.impact-pos { color: var(--green); }
.impact-neg { color: var(--red); }
.note-box {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--muted);
  background: var(--panel-2);
}
.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  font-size: 12px;
}
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.login-panel h1 { margin: 0; }
.error { color: var(--red); min-height: 1.4em; }
.ok { color: var(--green); }

@media (max-width: 920px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-2, .grid.cols-3, .form-grid, .guide-grid, .thesis-hero, .thesis-grid { grid-template-columns: 1fr; }
  .thesis-callout { align-items: stretch; flex-direction: column; }
  .form-grid .wide { grid-column: auto; }
  .topbar { position: static; flex-direction: column; }
}
