:root {
  color-scheme: light;
  --ink: #112126;
  --muted: #607176;
  --line: #cddadc;
  --paper: #f7faf8;
  --surface: #ffffff;
  --teal: #0f5961;
  --green: #317046;
  --coral: #ba4f38;
  --gold: #9a6a0a;
  --blue: #285b9d;
  --shadow: 0 16px 36px rgba(20, 41, 45, .14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #eaf2ef 0%, #f7faf8 36%, #e8eef2 100%);
  color: var(--ink);
}

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

.app-shell {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: max(18px, env(safe-area-inset-top)) 16px max(22px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 14px;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: 0;
}

h1 sup {
  margin-left: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  vertical-align: super;
}

h2 {
  margin-bottom: 10px;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--teal);
  font-size: 24px;
  font-weight: 700;
}

.partner-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.partner-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.icon-button:active {
  transform: translateY(1px);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 8px 0 12px;
  background: var(--paper);
}

.tab {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.tab.is-active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.view { display: none; }
.view.is-active { display: block; }

.intake {
  display: grid;
  gap: 13px;
}

.row {
  display: grid;
  gap: 10px;
}

.row.two { grid-template-columns: 1fr 1fr; }
.row.three { grid-template-columns: .7fr .95fr 1.35fr; }

label, fieldset {
  display: grid;
  gap: 7px;
  color: #31474d;
  font-size: 13px;
  font-weight: 800;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 12px;
  font-weight: 600;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 170px;
  line-height: 1.42;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 89, 97, .16);
}

fieldset {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

legend { padding: 0 4px; }

.check {
  grid-template-columns: 18px 1fr;
  align-items: start;
  gap: 9px;
  font-weight: 700;
  color: var(--ink);
}

.check input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--teal);
}

.primary {
  min-height: 48px;
  border: none;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-weight: 900;
}

.attachment-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.attachment-panel h2 {
  margin-bottom: 4px;
  font-size: 15px;
}

.attachment-panel p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.attachment-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.attachment-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  border: 1px solid #e1e9ea;
  border-radius: 8px;
  padding: 8px 10px;
  color: #32464c;
  font-size: 12px;
  font-weight: 800;
}

.attachment-list span {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.summary-panel, .panel, .code-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.summary-panel {
  padding: 16px;
  margin-bottom: 12px;
}

.summary-panel p:last-child { margin-bottom: 0; color: var(--muted); line-height: 1.45; }

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

.code-card {
  padding: 14px;
}

.code-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.code {
  color: var(--teal);
  font-size: 22px;
  font-weight: 900;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e8f3ef;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.tag.warn { background: #fff2d6; color: var(--gold); }
.tag.stop { background: #ffe7e0; color: var(--coral); }
.tag.info { background: #e7eef9; color: var(--blue); }

.code-card p {
  margin-bottom: 10px;
  color: #32464c;
  line-height: 1.45;
}

.mini-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.score-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.score-grid div {
  min-height: 104px;
  display: grid;
  align-content: center;
  justify-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.score-grid span {
  font-size: 34px;
  font-weight: 900;
  color: var(--teal);
}

.score-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.panel {
  display: grid;
  gap: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

.panel a {
  display: block;
  min-height: 42px;
  padding: 10px 0;
  color: var(--teal);
  font-weight: 800;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.plain-list {
  margin: 0;
  padding-left: 19px;
  color: #32464c;
  line-height: 1.45;
}

.plain-list li { margin-bottom: 9px; }

.disclaimer {
  margin-top: 18px;
  padding: 12px 2px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

@media (min-width: 760px) {
  body {
    padding: 24px;
  }

  .app-shell {
    min-height: calc(100vh - 48px);
    border-radius: 24px;
  }
}

@media (max-width: 360px) {
  .row.two,
  .row.three { grid-template-columns: 1fr; }
  h1 { font-size: 25px; }
  .tab { font-size: 12px; }
}



/* Attachment list: allow flex row for name + meta + remove button */
.attachment-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
