:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --panel-2: #eef4f1;
  --ink: #17211d;
  --muted: #65736d;
  --line: #d9e1dc;
  --teal: #0f766e;
  --teal-2: #dff3ee;
  --blue: #2457d6;
  --blue-2: #e8eefc;
  --amber: #b7791f;
  --amber-2: #fff5d9;
  --red: #b42318;
  --red-2: #ffe6e2;
  --green: #1f7a4d;
  --green-2: #e5f6ea;
  --shadow: 0 18px 40px rgba(24, 38, 32, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

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

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  width: 100%;
  overflow-x: hidden;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-right: 1px solid var(--line);
  background: #fbfcfa;
  padding: 24px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid #0f766e;
  border-radius: 8px;
  background: var(--teal-2);
  color: var(--teal);
  font-size: 0.88rem;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 1.02rem;
}

.brand span {
  color: var(--muted);
  font-size: 0.78rem;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 11px;
  text-align: left;
  text-decoration: none;
}

.nav-item.active {
  background: var(--panel-2);
  color: var(--ink);
  font-weight: 700;
}

.nav-admin {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding-top: 14px;
}

.nav-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--teal);
}

.nav-dot.muted {
  background: #b5c3bd;
}

.sidebar-note {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  padding: 14px;
  font-size: 0.84rem;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 24px;
}

.topbar,
.section-heading,
.upload-card-header,
.upload-row,
.topbar-actions,
.demo-row,
.tab-bar {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
}

.topbar h1,
.section-heading h2,
.score-block h3 {
  margin: 0;
}

.topbar h1 {
  max-width: 740px;
  font-size: 1.72rem;
  line-height: 1.18;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar-actions {
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.icon-button,
.demo-button,
.tab,
.primary-button,
.file-input {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 0 12px;
  text-decoration: none;
  white-space: nowrap;
}

.icon-button.secondary {
  color: var(--muted);
}

.admin-link {
  opacity: 0.72;
}

.primary-button {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
  font-weight: 800;
}

.status-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.status-band > div {
  min-height: 78px;
  background: var(--panel);
  padding: 14px 16px;
}

.metric-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.status-band strong {
  font-size: 1.08rem;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(330px, 0.82fr) minmax(430px, 1.18fr);
  gap: 18px;
  align-items: start;
}

.input-panel,
.results-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.section-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-heading h2 {
  font-size: 1.08rem;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}

.demo-row {
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.demo-button {
  background: #f7faf8;
  color: #34443d;
  font-size: 0.86rem;
}

.demo-button:hover,
.icon-button:hover,
.tab:hover,
.file-input:hover {
  border-color: #a8b8b1;
}

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

label {
  display: grid;
  gap: 6px;
  color: #405047;
  font-size: 0.78rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.document-label {
  margin-top: 14px;
}

textarea {
  min-height: 220px;
  resize: vertical;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.82rem;
}

.upload-card {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 12px;
}

.upload-card-header {
  justify-content: space-between;
  gap: 10px;
}

.upload-card h3 {
  margin: 0;
  font-size: 0.98rem;
}

.upload-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  padding: 10px 12px;
  font-size: 0.84rem;
}

.upload-summary strong {
  color: var(--ink);
}

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

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

.upload-item strong,
.upload-item span {
  display: block;
  overflow-wrap: anywhere;
}

.upload-item span {
  color: var(--muted);
  font-size: 0.78rem;
}

.upload-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-start;
}

.upload-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: var(--blue-2);
  color: var(--blue);
  padding: 0 8px;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.upload-tag.warn {
  background: var(--amber-2);
  color: var(--amber);
}

.upload-hint {
  max-width: 420px;
  color: var(--muted);
  font-size: 0.82rem;
}

.upload-row {
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.file-input {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.file-input input {
  display: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: var(--blue-2);
  color: var(--blue);
  padding: 0 10px;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.score-block {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 14px;
}

.live-status,
.report-status,
.outcome-status {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--muted);
  padding: 10px 12px;
  font-size: 0.84rem;
}

.live-status strong,
.report-status strong,
.outcome-status strong {
  color: var(--ink);
}

.report-row,
.outcome-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.report-row span,
.outcome-row span {
  margin-right: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.report-row button,
.report-row a,
.outcome-row button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
  color: #34443d;
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 800;
}

.report-row a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.report-row button:disabled {
  cursor: wait;
  opacity: 0.64;
}

.score-ring {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 0 52%, transparent 53%),
    conic-gradient(var(--teal) 0deg, var(--line) 0deg);
}

.score-ring span {
  font-size: 1.12rem;
  font-weight: 900;
}

.score-block p {
  margin: 6px 0 0;
  color: var(--muted);
}

.tab-bar {
  gap: 6px;
  margin: 16px 0 12px;
  overflow-x: auto;
}

.tab {
  min-width: 112px;
  background: #f7faf8;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 800;
}

.tab.active {
  border-color: var(--teal);
  background: var(--teal-2);
  color: var(--teal);
}

.tab-panel {
  display: none;
  min-width: 0;
}

.tab-panel.active {
  display: grid;
  gap: 10px;
}

.finding,
.fact-row,
.packet-row,
.api-block {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.finding {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
}

.severity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: start;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.severity.pass {
  background: var(--green-2);
  color: var(--green);
}

.severity.warn {
  background: var(--amber-2);
  color: var(--amber);
}

.severity.fail {
  background: var(--red-2);
  color: var(--red);
}

.severity.info {
  background: var(--blue-2);
  color: var(--blue);
}

.finding h4,
.packet-row h4,
.api-block h4 {
  margin: 0;
  font-size: 0.94rem;
}

.finding p,
.packet-row p,
.api-block p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.source-line {
  margin-top: 8px;
  color: #405047;
  font-size: 0.78rem;
  font-weight: 800;
}

.fact-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.fact-row span:first-child {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.fact-row span:last-child {
  overflow-wrap: anywhere;
  font-size: 0.88rem;
}

.api-block pre {
  max-width: 100%;
  min-width: 0;
  overflow: auto;
  margin: 10px 0 0;
  border-radius: 8px;
  background: #17211d;
  color: #ecf4f0;
  padding: 12px;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.api-block code {
  white-space: inherit;
}

.empty-state {
  border: 1px dashed #b7c3be;
  border-radius: 8px;
  color: var(--muted);
  padding: 20px;
  text-align: center;
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-list {
    grid-auto-flow: column;
    overflow-x: auto;
  }

  .sidebar-note {
    display: none;
  }

  .main-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 16px;
  }

  .topbar,
  .section-heading,
  .upload-card-header,
  .upload-row {
    align-items: stretch;
    flex-direction: column;
  }

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

  .topbar h1 {
    font-size: 1.36rem;
  }

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

  .score-block,
  .finding,
  .fact-row {
    grid-template-columns: 1fr;
  }
}
