:root {
  color-scheme: light;
  --bg: #eef2f0;
  --surface: #ffffff;
  --surface-soft: #f7f8f3;
  --ink: #18201d;
  --muted: #68736c;
  --line: #d7ded7;
  --accent: #146c5c;
  --accent-strong: #0e4f44;
  --warn: #9b5f16;
  --danger: #aa2f2f;
  --shadow: 0 18px 45px rgba(22, 32, 29, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

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

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 0 16px;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  background: #9aa7a0;
  cursor: wait;
}

button.secondary {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink);
}

button.secondary:hover {
  border-color: #98aaa0;
  background: var(--surface-soft);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
  min-height: 160px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.shell {
  min-height: 100vh;
}

.login-panel {
  width: min(980px, calc(100% - 32px));
  min-height: 560px;
  margin: 32px auto;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.brand-block {
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #17231f;
  color: #fff;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 6px;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-mark.small {
  color: var(--accent-strong);
  border-color: var(--line);
  background: #fff;
}

.brand-block h1 {
  max-width: 620px;
  margin: 28px 0 14px;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1;
  letter-spacing: 0;
}

.brand-block p {
  max-width: 560px;
  margin: 0;
  color: #cad7d1;
  line-height: 1.6;
}

.login-form {
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

.app-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
}

.is-hidden {
  display: none;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.sidebar h2 {
  margin: 16px 0 0;
  font-size: 26px;
}

.project-form {
  display: grid;
  gap: 14px;
}

.workspace {
  padding: 24px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.topbar,
.status-band,
.control-strip,
.stage-actions,
.results-layout {
  width: min(1180px, 100%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h2 {
  margin: 2px 0 4px;
  font-size: 28px;
}

.topbar p {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  background: var(--surface);
}

.status-band > div {
  min-width: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
}

.status-band > div:last-child {
  border-right: 0;
}

.metric-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-band strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 18px;
}

.control-strip {
  display: flex;
  gap: 10px;
  align-items: center;
}

.lookup-form {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.stage-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.results-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(340px, 1.1fr);
  gap: 16px;
  min-height: 420px;
}

.timeline,
.details {
  background: var(--surface);
  border: 1px solid var(--line);
}

.timeline {
  padding: 10px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.timeline-item {
  width: 100%;
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  padding: 12px;
}

.timeline-item.is-active {
  border-color: var(--accent);
  background: #edf7f4;
}

.timeline-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.timeline-item strong {
  display: block;
  margin: 4px 0;
}

.timeline-item small {
  color: var(--muted);
}

.details {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.details-header h3 {
  margin: 0;
  font-size: 17px;
}

pre {
  margin: 0;
  padding: 16px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.5;
}

.empty-state,
.form-message {
  color: var(--muted);
}

.form-message {
  min-height: 22px;
  margin: 0;
  font-weight: 700;
}

.form-message.is-error {
  color: var(--danger);
}

.form-message.is-ok {
  color: var(--accent-strong);
}

@media (max-width: 980px) {
  .login-panel,
  .app-view,
  .results-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .status-band,
  .stage-actions {
    grid-template-columns: 1fr;
  }

  .status-band > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .status-band > div:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 640px) {
  .login-panel {
    width: 100%;
    margin: 0;
    min-height: 100vh;
    border: 0;
  }

  .brand-block,
  .login-form,
  .sidebar,
  .workspace {
    padding: 20px;
  }

  .topbar,
  .control-strip,
  .lookup-form {
    display: grid;
    grid-template-columns: 1fr;
  }
}
