:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #627086;
  --line: #d9e0ea;
  --paper: #ffffff;
  --bg: #f5f7fb;
  --navy: #10233f;
  --gold: #f2c14e;
  --green: #2fbf71;
  --red: #c84630;
  --blue: #2f6fed;
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100dvh;
  padding-bottom: 80px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--navy);
  color: white;
  padding: 18px 16px 14px;
}

.brand-row {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.brand {
  display: grid;
  gap: 2px;
}

.brand strong {
  font-size: 18px;
}

.brand span {
  color: #bfd0e7;
  font-size: 13px;
}

.ico-pill {
  align-items: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  display: flex;
  gap: 8px;
  padding: 8px 10px;
}

.ico-pill b {
  font-size: 20px;
}

.content {
  display: grid;
  gap: 14px;
  margin: 0 auto;
  max-width: 920px;
  padding: 14px;
}

.panel,
.indicator {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel {
  padding: 14px;
}

.section-title {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title h2,
.indicator h3 {
  font-size: 17px;
  line-height: 1.25;
  margin: 0;
}

.section-title p,
.indicator p,
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin: 3px 0 0;
}

.field-grid {
  display: grid;
  gap: 10px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 5px;
}

input,
select,
textarea {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 42px;
  padding: 10px;
  width: 100%;
}

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

.tabs {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 14px;
  position: sticky;
  top: 74px;
  z-index: 4;
}

.tab {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-width: 58px;
  padding: 9px 11px;
}

.tab.active {
  background: var(--navy);
  border-color: var(--navy);
  color: white;
}

.indicator {
  display: grid;
  gap: 12px;
  padding: 13px;
}

.score-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto;
}

.score-buttons {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(4, minmax(42px, 1fr));
}

.score-button {
  background: #edf2f8;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  height: 42px;
}

.score-button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
  font-weight: 700;
}

.switch-row {
  align-items: center;
  display: flex;
  gap: 8px;
}

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

.evidence {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 9px;
  padding-top: 11px;
}

.evidence-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 8px;
}

.status.ok {
  background: #e4f7ec;
  color: #146b3a;
}

.status.warn {
  background: #fff2cb;
  color: #74530a;
}

.status.bad {
  background: #fde8e3;
  color: #8c2e20;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.primary,
.secondary,
.danger {
  border-radius: 8px;
  min-height: 42px;
  padding: 10px 12px;
}

.primary {
  background: var(--navy);
  color: white;
}

.secondary {
  background: #edf2f8;
  color: var(--ink);
}

.danger {
  background: #fde8e3;
  color: #8c2e20;
}

.result-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, 1fr);
}

.metric {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

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

.metric b {
  display: block;
  font-size: 24px;
  margin-top: 4px;
}

.bar-list {
  display: grid;
  gap: 10px;
}

.bar-label {
  display: flex;
  font-size: 13px;
  justify-content: space-between;
  margin-bottom: 5px;
}

.bar-track {
  background: #e8eef6;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}

.bar-fill {
  background: var(--green);
  height: 100%;
}

.bottom-nav {
  background: white;
  border-top: 1px solid var(--line);
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  left: 0;
  position: fixed;
  right: 0;
  z-index: 6;
}

.bottom-nav button {
  background: white;
  color: var(--muted);
  padding: 10px 6px 12px;
}

.bottom-nav button.active {
  color: var(--navy);
  font-weight: 700;
}

.case-list {
  display: grid;
  gap: 10px;
}

.case-card {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 11px;
  padding: 12px;
}

.case-card.selected {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.case-card h3 {
  font-size: 16px;
  line-height: 1.25;
  margin: 0;
}

.case-card p {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 0;
}

.case-metrics {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(2, 1fr);
}

.case-metrics span {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  padding: 8px;
}

.case-metrics b {
  color: var(--ink);
  font-size: 16px;
}

.report-heading {
  align-items: start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.report-heading h1 {
  font-size: 28px;
  line-height: 1.1;
  margin: 4px 0 0;
}

.report-score {
  background: var(--navy);
  border-radius: 8px;
  color: white;
  display: grid;
  min-width: 96px;
  padding: 12px;
  text-align: center;
}

.report-score b {
  font-size: 30px;
}

.report-score span {
  color: #bfd0e7;
  font-size: 12px;
}

.report-meta {
  display: grid;
  gap: 4px;
  margin: 14px 0;
}

.report-meta p {
  margin: 0;
}

.report-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.report-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-template-columns: 42px 1fr 48px 52px;
  padding: 10px;
}

.report-row:last-child {
  border-bottom: 0;
}

.report-finding {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.report-finding:first-of-type {
  border-top: 0;
}

.report-finding p {
  color: var(--muted);
  margin: 4px 0 0;
}

@media (min-width: 760px) {
  .field-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .indicator-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, 1fr);
  }

  .result-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media print {
  body {
    background: white;
  }

  .topbar,
  .bottom-nav,
  .tabs,
  .no-print {
    display: none !important;
  }

  .app-shell {
    padding-bottom: 0;
  }

  .content {
    max-width: none;
    padding: 0;
  }

  .panel {
    border: 0;
    border-radius: 0;
    break-inside: avoid;
    padding: 16px 0;
  }

  .report-page {
    color: #111827;
  }
}
