:root {
  color-scheme: light;
  --ink: #142525;
  --muted: #5b6b69;
  --paper: #f4f1e9;
  --paper-deep: #e8e3d7;
  --panel: #fffdf8;
  --line: #d7d1c4;
  --forest: #173a3a;
  --forest-soft: #285553;
  --signal: #e5623e;
  --signal-soft: #fff0e9;
  --gold: #c79b43;
  --ok: #26705f;
  --danger: #9a352e;
  --shadow: 0 22px 58px rgb(32 48 46 / 10%);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 8%, rgb(199 155 67 / 10%), transparent 23rem),
    linear-gradient(120deg, rgb(255 255 255 / 24%), transparent 40%),
    var(--paper);
}

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

button,
a,
input,
select,
textarea {
  outline-offset: 3px;
}

:focus-visible {
  outline: 3px solid var(--gold);
}

a {
  color: var(--forest-soft);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

h1 {
  max-width: 18ch;
  margin-bottom: 0.65rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.1rem, 5vw, 4.4rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

h2 {
  font-size: 1.12rem;
  line-height: 1.3;
}

h3 {
  margin-top: 2rem;
  margin-bottom: 0.7rem;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.7rem 1rem;
  color: white;
  background: var(--forest);
  border-radius: 8px;
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-stage {
  display: grid;
  min-height: 100vh;
  padding: clamp(1rem, 4vw, 4rem);
  place-items: center;
}

.login-stage::before {
  position: fixed;
  inset: 0 0 0 56%;
  z-index: -1;
  content: "";
  background:
    linear-gradient(145deg, rgb(23 58 58 / 94%), rgb(23 58 58 / 78%)),
    repeating-linear-gradient(34deg, transparent 0 30px, rgb(255 255 255 / 5%) 30px 31px);
}

.login-card {
  width: min(100%, 720px);
  padding: clamp(1.5rem, 6vw, 5rem);
  background: rgb(255 253 248 / 96%);
  border: 1px solid rgb(255 255 255 / 68%);
  border-radius: 28px 7px 28px 7px;
  box-shadow: var(--shadow);
}

.brand-mark {
  display: grid;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: 3rem;
  color: white;
  font-weight: 800;
  letter-spacing: -0.08em;
  background: var(--forest);
  border-radius: 50% 50% 50% 12%;
  place-items: center;
}

.lede {
  max-width: 62ch;
  margin-bottom: 2rem;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.65;
}

.eyebrow {
  margin-bottom: 0.85rem;
  color: var(--signal);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.workspace {
  min-height: 100vh;
  margin-left: 272px;
  padding: clamp(2rem, 5vw, 5.5rem) clamp(1rem, 6vw, 7rem);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  display: flex;
  width: 272px;
  padding: 1.5rem;
  color: #f8f5ed;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 3%), transparent 25%),
    var(--forest);
  flex-direction: column;
}

.wordmark {
  display: flex;
  margin: 0.25rem 0 3.2rem;
  align-items: center;
  gap: 0.8rem;
  letter-spacing: 0.08em;
}

.wordmark span {
  display: grid;
  width: 2.45rem;
  height: 2.45rem;
  color: var(--forest);
  background: var(--gold);
  border-radius: 50% 50% 50% 8px;
  font-weight: 900;
  place-items: center;
}

.nav-list {
  display: grid;
  gap: 0.32rem;
}

.nav-item {
  display: flex;
  width: 100%;
  min-height: 44px;
  padding: 0.72rem 0.8rem;
  color: rgb(255 255 255 / 73%);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
}

.nav-item:hover:not(:disabled),
.nav-item--active {
  color: white;
  background: rgb(255 255 255 / 9%);
}

.nav-item--active::before {
  width: 4px;
  height: 1.4rem;
  margin-left: -0.8rem;
  content: "";
  background: var(--signal);
  border-radius: 0 5px 5px 0;
}

.nav-item:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.nav-soon {
  font-size: 0.65rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.sidebar-foot {
  display: grid;
  margin-top: auto;
  color: rgb(255 255 255 / 62%);
  font-size: 0.76rem;
  gap: 0.45rem;
}

.release {
  color: var(--gold);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.page-header {
  padding-bottom: 2.4rem;
  border-bottom: 1px solid var(--line);
}

.page-header h1 {
  max-width: 22ch;
  font-size: clamp(2.3rem, 4vw, 3.8rem);
}

.page-header .lede {
  margin-bottom: 0;
}

.panel,
.notice,
.empty-state {
  margin-top: 1.5rem;
  padding: clamp(1.2rem, 3vw, 2.25rem);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 38px rgb(32 48 46 / 5%);
}

.panel-title {
  display: flex;
  margin-bottom: 1.35rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.panel-title h2 {
  margin: 0;
}

.notice {
  color: white;
  background: var(--forest-soft);
  border-color: transparent;
}

.notice--attention {
  color: var(--ink);
  background: var(--signal-soft);
  border-color: #f2c0ad;
}

.notice-inline {
  padding: 0.8rem 1rem;
  background: var(--signal-soft);
  border-left: 4px solid var(--signal);
}

.field {
  display: grid;
  gap: 0.5rem;
}

.field label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.04em;
}

input,
select,
textarea {
  width: 100%;
  color: var(--ink);
  background: #fff;
  border: 1px solid #bcb7ab;
  border-radius: 9px;
}

input,
select {
  min-height: 46px;
  padding: 0 0.85rem;
}

textarea {
  min-height: 12rem;
  padding: 1rem;
  line-height: 1.55;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--forest-soft);
}

.form-grid {
  display: grid;
  margin-top: 1.2rem;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cost-form .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.button {
  display: inline-flex;
  min-height: 42px;
  padding: 0.68rem 1rem;
  color: var(--forest);
  background: transparent;
  border: 1px solid currentcolor;
  border-radius: 999px;
  font-weight: 720;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

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

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button--primary {
  color: white;
  background: var(--forest);
  border-color: var(--forest);
}

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

.button--quiet {
  min-height: 36px;
  padding: 0.5rem 0.8rem;
  color: inherit;
  border-color: rgb(128 128 128 / 42%);
}

.sidebar .button--quiet {
  margin-top: 0.6rem;
}

form > .button,
.estimate-card > .button {
  margin-top: 1rem;
}

.form-error {
  min-height: 1.1em;
  margin: 1rem 0 0;
  color: var(--danger);
  font-weight: 650;
}

.fine-print {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

.status {
  display: inline-flex;
  width: fit-content;
  padding: 0.28rem 0.58rem;
  color: var(--forest);
  background: #e2ece8;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status--failed,
.status--rejected,
.status--cancelled,
.status--budget-stopped,
.status--degraded {
  color: var(--danger);
  background: #f5ded8;
}

.status--running,
.status--queued,
.status--awaiting-approval,
.status--attention {
  color: #785111;
  background: #f7e8bd;
}

.status--not-observed,
.status--paused,
.status--partial {
  color: #4f5c5b;
  background: #e3e7e5;
}

.optimized,
.answer {
  padding: 1rem 1.1rem;
  white-space: pre-wrap;
  background: #f4f1e9;
  border-radius: 10px;
  line-height: 1.6;
}

.plan-list,
.evidence-list {
  display: grid;
  padding-left: 1.25rem;
  gap: 0.75rem;
}

.plan-list li {
  padding-left: 0.35rem;
}

.plan-list span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
}

.metric-grid,
.health-list {
  display: grid;
  margin: 1.5rem 0;
  gap: 1px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.metric-grid div,
.health-list div {
  padding: 1rem;
  background: var(--panel);
}

.metric-grid dt,
.health-list dt {
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.metric-grid dd,
.health-list dd {
  margin: 0;
  font-weight: 780;
}

.run-grid,
.source-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.run-card h2 {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.run-card time {
  color: var(--muted);
  font-size: 0.72rem;
}

.run-detail {
  max-width: 960px;
}

.action-row {
  display: flex;
  margin: 1.2rem 0;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.evidence-list li {
  padding: 1rem;
  background: #f4f1e9;
  border-radius: 10px;
}

.evidence-list p {
  margin: 0.5rem 0;
  line-height: 1.55;
}

.classification {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.source-card .path {
  display: block;
  padding: 0.9rem;
  overflow-wrap: anywhere;
  background: var(--paper);
  border-radius: 8px;
}

.source-instructions {
  grid-column: 1 / -1;
}

.health-list {
  grid-template-columns: 1fr;
}

.health-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
}

@media (max-width: 860px) {
  .sidebar {
    position: static;
    width: auto;
    min-height: auto;
  }

  .wordmark {
    margin-bottom: 1rem;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-foot {
    margin-top: 1.4rem;
  }

  .workspace {
    min-height: auto;
    margin-left: 0;
    padding-top: 2.5rem;
  }

  .form-grid,
  .cost-form .form-grid,
  .metric-grid,
  .run-grid,
  .source-grid {
    grid-template-columns: 1fr;
  }

  .login-stage::before {
    inset: 55% 0 0;
  }
}

@media (max-width: 480px) {
  .sidebar {
    padding: 1rem;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .panel,
  .notice {
    border-radius: 13px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .button,
  .skip-link {
    transition: transform 150ms ease;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
