:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #182026;
  --muted: #60707d;
  --line: #d9e0e6;
  --blue: #2563eb;
  --green: #16845b;
  --amber: #b56a00;
  --red: #b42318;
  --ink: #0f1720;
  --shadow: 0 12px 28px rgba(15, 23, 32, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.app-shell {
  min-height: 100vh;
}

.topbar {
  min-height: 92px;
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.topbar p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.status-pill {
  min-width: 92px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  background: #f9fafb;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.auth-line {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

.login-panel {
  display: grid;
  place-items: center;
  padding: 36px 18px;
}

.login-card {
  width: min(420px, 100%);
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-card h2 {
  font-size: 18px;
  margin-bottom: 6px;
}

.login-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 16px;
}

.control-panel,
.result-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.control-panel {
  padding: 16px;
  align-self: start;
}

.result-panel {
  padding: 18px;
  min-width: 0;
}

.field-row {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

label,
legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  min-height: 38px;
  padding: 8px 10px;
}

textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.4;
  margin-bottom: 12px;
}

.text-label {
  display: block;
  margin-bottom: 6px;
}

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

fieldset {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  margin: 0 0 14px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  color: var(--text);
  text-transform: none;
  font-weight: 600;
}

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

.hidden {
  display: none !important;
}

.primary-button,
button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  width: 100%;
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.quiet-button {
  width: 100%;
  margin-top: 8px;
}

.claim-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.readiness-box,
.estimate-box {
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fbfcfd;
  font-size: 12px;
  line-height: 1.35;
}

.summary-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.summary-band > div {
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.summary-band strong {
  display: block;
  font-size: 20px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.action-line,
.error-line {
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
  line-height: 1.35;
  font-size: 14px;
}

.action-line {
  background: #eef6f3;
  border: 1px solid #b9ded1;
  color: #0f5e43;
}

.error-line {
  background: #fff1f0;
  border: 1px solid #f4b8b4;
  color: var(--red);
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.score-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  min-height: 92px;
  background: #fff;
}

.score-tile span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  min-height: 32px;
}

.score-tile strong {
  display: block;
  font-size: 18px;
  margin-bottom: 8px;
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: #e5eaf0;
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--blue);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 4px;
  margin-bottom: 10px;
}

.section-heading h2 {
  font-size: 16px;
}

.section-heading span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.signals-list {
  display: grid;
  gap: 8px;
}

.signal-item {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr) 88px;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.signal-name {
  font-weight: 900;
  overflow-wrap: anywhere;
}

.signal-summary {
  color: var(--muted);
  font-size: 13px;
}

.signal-score {
  text-align: right;
  font-weight: 900;
}

.flags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
}

.baseline-comparison {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.baseline-comparison strong {
  color: var(--text);
}

.response-baseline-note,
.muted-line {
  color: var(--muted);
  font-size: 12px;
}

.response-rows {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.response-row {
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}

.response-row span {
  overflow-wrap: anywhere;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.history-item strong {
  display: block;
  font-size: 13px;
  overflow-wrap: anywhere;
}

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

.history-item button,
.section-heading button {
  min-height: 32px;
  padding: 4px 10px;
}

.flag {
  max-width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  background: #fff7ed;
  color: #8a4b00;
  border: 1px solid #f3c892;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.risk-low {
  color: var(--green);
}

.risk-medium,
.risk-high,
.risk-review {
  color: var(--amber);
}

.risk-critical {
  color: var(--red);
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .summary-band,
  .score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 16px;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .workspace {
    padding: 10px;
  }

  .summary-band,
  .score-grid,
  .split {
    grid-template-columns: 1fr;
  }

  .signal-item {
    grid-template-columns: 1fr;
  }

  .signal-score {
    text-align: left;
  }
}
