* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--gsg-shell);
  font-family: var(--sans);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.app {
  position: fixed;
  inset: 0;
  max-width: 430px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  height: 100dvh;
  height: 100svh;
}

.chrome {
  flex: none;
  background: var(--gsg-shell);
  color: #f8fafc;
  padding: calc(10px + var(--gsg-safe-top)) 16px 12px;
}
.chrome-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.wordmark {
  display: inline-flex;
  align-items: baseline;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.07em;
  line-height: 1;
  text-transform: uppercase;
  color: #f8fafc;
  font-family: var(--sans);
}
.wordmark .wm-gas { font-weight: 800; }
.wordmark .wm-right {
  font-weight: 800;
  color: #60a5fa;
}
.wordmark .wm-tld {
  font-size: 0.42em;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #94a3b8;
  margin-left: 2px;
  position: relative;
  top: -0.15em;
}
.wordmark.ink { color: #111318; }
.wordmark.ink .wm-right { color: #2563eb; }
.wordmark.ink .wm-tld { color: #6b7280; }
.wordmark .wm-right,
.wordmark .wm-tld {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.home-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  margin: -8px 0;
  padding: 8px 8px 8px 0;
  text-decoration: none;
  color: inherit;
}
.home-link svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: #93c5fd;
}
.dash-head {
  padding-bottom: 20px;
}
.dash-head .wordmark { font-size: 26px; }
.dash-kicker {
  margin: 14px 0 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #94a3b8;
}
.dash {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 8px;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 12px;
}
.tile {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--paper);
  border-radius: 16px;
  padding: 16px;
  min-height: 92px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 2px rgba(15, 18, 24, 0.06);
}
.tile:active { transform: scale(0.98); }
.tile:focus-visible {
  outline: 2px solid var(--gsg-accent);
  outline-offset: 2px;
}
.tile-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--gsg-accent-soft);
  color: var(--gsg-accent);
  display: grid;
  place-items: center;
  flex: none;
}
.tile-icon svg { width: 26px; height: 26px; }
.tile-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tile-copy strong {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.tile-copy span {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
}
.tile-go {
  width: 18px;
  height: 18px;
  flex: none;
  color: #94a3b8;
}
.dash-foot {
  flex: none;
  margin: 0;
  padding: 10px 16px calc(12px + var(--gsg-safe-bot));
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.35;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.dash-foot a {
  display: block;
  color: var(--gsg-accent);
  font-weight: 700;
  text-decoration: none;
  min-height: 44px;
  line-height: 44px;
}
.dash-foot span {
  display: block;
  font-size: 11px;
}
.legal {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(28px + var(--gsg-safe-bot));
  background: var(--bg);
}
.legal h1 {
  margin: 0 0 12px;
  font-size: 26px;
  letter-spacing: -0.04em;
  font-weight: 700;
}
.legal h2 {
  margin: 22px 0 8px;
  font-size: 15px;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.legal p, .legal li {
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
}
.legal-lead, .legal p, .legal ul { margin: 0 0 10px; }
.legal ul {
  padding-left: 1.2em;
}
.legal li { margin-bottom: 6px; }
.legal a {
  color: var(--gsg-accent);
  font-weight: 600;
  text-decoration: none;
}
.legal-end { margin-top: 24px; }
.text-btn {
  appearance: none;
  border: 0;
  background: none;
  color: #93c5fd;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 4px 0;
}
.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-top: 10px;
}
.hero-k {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 600;
}
.hero-iv {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.hero-iv small {
  font-size: 13px;
  margin-left: 4px;
  color: #94a3b8;
  font-weight: 500;
}
.proc-pill {
  display: inline-flex;
  align-items: center;
  background: var(--gsg-1b);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.proc-pill.up1a { background: var(--gsg-1a); }
.proc-pill.up1 { background: var(--gsg-1); }
.proc-pill.wait { background: #1e293b; color: #94a3b8; }
.proc-pill.ok { background: var(--gsg-ok); }
.proc-pill.bad { background: var(--gsg-bad); }

.times {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
  width: 100%;
}
.times div {
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 8px 6px;
  text-align: center;
}
.times span {
  display: block;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
  font-weight: 600;
}
.times strong {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
}

.screens {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}
.screen {
  display: none;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 16px 16px 28px;
}
.screen.on { display: block; }
.screen[hidden] { display: none !important; }
.screen h1 {
  margin: 0 0 12px;
  font-size: 28px;
  letter-spacing: -0.04em;
  font-weight: 700;
}
.screen h2 {
  margin: 18px 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.card {
  background: var(--paper);
  border-radius: var(--gsg-radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card .field + .field { margin-top: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field[hidden], .field.hidden { display: none !important; }
label, .label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.help, .hint {
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0 12px;
  line-height: 1.4;
}
input, select, textarea {
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--bg);
  border: 0;
  border-radius: 10px;
  padding: 12px 12px;
  min-height: var(--gsg-touch);
  width: 100%;
}
textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.4;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--gsg-accent);
  outline-offset: 1px;
  background: #fff;
}
.split, .split3 {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.split { grid-template-columns: 1fr 1fr; }
.split3 { grid-template-columns: 1fr 1fr 1fr; }
.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 500;
}
.choice input {
  width: 20px;
  height: 20px;
  min-height: 0;
}

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: #dfe3ea;
  border-radius: 12px;
  margin-bottom: 12px;
}
.seg.tight { margin: 8px 0 0; }
.seg.three { grid-template-columns: 1fr 1fr 1fr; }
.seg label.ok:has(input:checked) {
  background: var(--pass-bg);
  color: var(--pass);
  box-shadow: none;
}
.seg label.bad:has(input:checked) {
  background: var(--fail-bg);
  color: var(--fail);
  box-shadow: none;
}
.seg label {
  margin: 0;
  padding: 10px 8px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  border-radius: 9px;
  color: var(--muted);
}
.seg input { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.seg label:has(input:checked) {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15,18,24,0.08);
}

.pipe-card {
  background: var(--paper);
  border-radius: var(--gsg-radius);
  padding: 12px;
  margin-bottom: 10px;
}
.pipe-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.pipe-head .n {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.pipe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pipe-vol {
  grid-column: 1 / -1;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

.btn {
  appearance: none;
  border: 0;
  background: var(--gsg-accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 14px 16px;
  min-height: var(--gsg-touch);
  width: 100%;
  cursor: pointer;
  border-radius: 12px;
}
.btn:hover { background: var(--gsg-accent-press); }
.btn.ghost {
  background: var(--paper);
  color: var(--gsg-accent);
}
.btn.small {
  width: auto;
  min-height: 36px;
  padding: 6px 12px;
  font-size: 13px;
}
.btn.danger {
  background: transparent;
  color: var(--fail);
  min-height: 36px;
  width: auto;
  padding: 6px 8px;
}

.kpis, .result-grid { display: grid; gap: 8px; }
.kpis { margin-bottom: 8px; }
.kpis.two { grid-template-columns: 1fr 1fr; }
.kpis.two .kpi .v { white-space: nowrap; font-size: 18px; }
.result-grid { margin-bottom: 4px; }
.kpi, .stat {
  background: var(--paper);
  border-radius: var(--gsg-radius);
  padding: 12px;
  position: relative;
  z-index: 0;
}
.kpi .k, .stat .k {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.kpi .v, .stat .v {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  margin-top: 4px;
}
.stat .s { font-size: 13px; color: var(--muted); margin-top: 4px; }

.breakdown { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--paper); border-radius: var(--gsg-radius); overflow: hidden; }
.breakdown th, .breakdown td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.breakdown th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.breakdown td.num, .breakdown th.num { text-align: right; font-family: var(--mono); }
.breakdown tfoot td { font-weight: 700; border-bottom: 0; }

.volume-block {
  position: relative;
  z-index: 0;
  margin: 8px 0 16px;
  display: block;
}
.volume-block h2 { margin-top: 8px; }
#observedCard { margin-top: 8px; }
.verdict { margin-top: 0; }
.result-actions {
  position: relative;
  z-index: 0;
  display: block;
  margin: 12px 0 0;
  padding-top: 4px;
  clear: both;
}

.checks { list-style: none; margin: 0 0 12px; padding: 0; }
.checks li {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 8px;
  background: var(--paper);
  border-radius: 10px;
  padding: 10px 12px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; background: var(--line-strong); }
.dot.ok { background: var(--pass); }
.dot.no { background: var(--fail); }

.verdict {
  padding: 16px;
  border-radius: var(--gsg-radius);
  margin-bottom: 12px;
}
.verdict .v-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}
.verdict .v-reason {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
}
.verdict .v-cmp {
  margin-top: 10px;
  font-size: 14px;
}
.verdict .v-cmp strong { font-family: var(--mono); }
.verdict.pass { background: var(--pass-bg); color: var(--pass); }
.verdict.fail { background: var(--fail-bg); color: var(--fail); }
.verdict.wait { background: var(--paper); color: var(--ink); }
.verdict.wait .v-title { color: var(--muted); font-size: 20px; font-weight: 700; }

.banner {
  padding: 10px 12px;
  margin: 0 0 8px;
  font-size: 14px;
  border-radius: 10px;
}
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.note { background: var(--gsg-accent-soft); color: var(--gsg-accent-press); }

.footer-note { font-size: 12px; color: var(--muted); margin: 16px 0 8px; }
.disclaimer {
  margin: 16px 0 8px;
  padding: 14px;
  border-radius: var(--gsg-radius);
  background: #111318;
  color: #e5e7eb;
  font-size: 13px;
  line-height: 1.45;
}
.disclaimer strong {
  display: block;
  font-size: 14px;
  color: #fff;
  margin-bottom: 8px;
}
.disclaimer p { margin: 0 0 8px; }
.disclaimer p:last-child { margin-bottom: 0; }
.disclaimer p strong { display: inline; font-size: inherit; color: #fff; }

.tabbar {
  flex: none;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + var(--gsg-safe-bot));
}
.tabbar button {
  appearance: none;
  border: 0;
  background: none;
  color: #9ca3af;
  font: inherit;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 0;
}
.tabbar svg { width: 22px; height: 22px; }
.tabbar button.on { color: var(--gsg-accent); }
.tabbar.cols-3 { grid-template-columns: repeat(3, 1fr); }

.check-block { margin-bottom: 8px; }
.check-item {
  background: var(--paper);
  border-radius: var(--gsg-radius);
  padding: 12px;
  margin-bottom: 10px;
}
.check-item.fail { box-shadow: inset 0 0 0 2px var(--fail); }
.check-item .q {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.check-item .why {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.check-item .field { margin-top: 10px; }

.hidden { display: none !important; }

.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 18, 24, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 16px calc(16px + var(--gsg-safe-bot));
}
.sheet[hidden] { display: none !important; }
.sheet-card {
  width: 100%;
  max-width: 430px;
  background: var(--paper);
  border-radius: 20px;
  padding: 18px 16px 16px;
  max-height: min(90dvh, 640px);
  overflow: auto;
}
.sheet-card h2 {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: -0.03em;
}
.sheet-card .wordmark {
  display: flex;
  font-size: 18px;
  margin-bottom: 10px;
}
.sheet-card .field { margin-top: 12px; }
.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}
.sheet-actions .btn { width: 100%; }
.leave-copy {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
}
#exportErr { color: var(--fail); }

#printSheet { display: none; }

@media print {
  @page { size: A4 portrait; margin: 10mm; }
  html, body {
    overflow: visible;
    height: auto;
    background: #fff !important;
    color: #111;
  }
  .app, .sheet, .no-print { display: none !important; }
  #printSheet {
    display: block !important;
    width: 100%;
    max-height: 277mm;
    overflow: hidden;
    color: #111;
    font-family: var(--sans);
    font-size: 9.5pt;
    line-height: 1.3;
  }
  #printSheet.packed { font-size: 8.2pt; }
  #printSheet .wordmark { font-size: 18pt; }
  .ps-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #111;
    padding-bottom: 6px;
    margin-bottom: 8px;
  }
  .ps-title {
    font-size: 14pt;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-top: 2px;
  }
  .ps-guide {
    font-size: 8pt;
    font-weight: 700;
    margin-top: 4px;
    padding: 5px 6px;
    border: 1.5pt solid #111;
    background: #fffbeb;
    text-transform: none;
    letter-spacing: 0;
    max-width: 118mm;
    line-height: 1.3;
  }
  .ps-when { text-align: right; font-size: 9pt; }
  .ps-when strong { display: block; font-size: 11pt; }
  .ps-ref {
    font-size: 13pt;
    font-weight: 800;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
  }
  .ps-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 16px;
    margin: 0 0 8px;
  }
  .ps-meta div { display: flex; gap: 8px; }
  .ps-meta span { color: #555; min-width: 88px; }
  .ps-figs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin: 8px 0;
  }
  .ps-figs div {
    border: 1px solid #d1d5db;
    padding: 6px 8px;
  }
  .ps-figs span {
    display: block;
    font-size: 7.5pt;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #555;
    font-weight: 700;
  }
  .ps-figs strong {
    display: block;
    font-family: var(--mono);
    font-size: 13pt;
    margin-top: 2px;
  }
  .ps-verdict {
    margin: 8px 0;
    padding: 8px 10px;
    border: 2px solid #111;
  }
  .ps-verdict strong { font-size: 16pt; letter-spacing: -0.03em; }
  .ps-verdict p { margin: 4px 0 0; }
  .ps-verdict.pass { border-color: #059669; background: #ecfdf5; }
  .ps-verdict.fail { border-color: #dc2626; background: #fef2f2; }
  .ps-verdict.pending, .ps-verdict.wait { border-color: #d1d5db; }
  .ps-check {
    display: grid;
    grid-template-columns: 46px 1fr;
    gap: 6px 8px;
    padding: 3px 0;
    border-bottom: 0.4pt solid #e5e7eb;
    font-size: 8pt;
    align-items: start;
  }
  .ps-check span {
    font-weight: 800;
    letter-spacing: 0.04em;
  }
  .ps-check.pass span { color: #059669; }
  .ps-check.fail span { color: #dc2626; }
  .ps-check.na span, .ps-check.left span { color: #6b7280; }
  .ps-check strong { font-weight: 600; }
  .ps-check p { margin: 0; grid-column: 2; color: #555; }
  .ps-h {
    font-size: 8pt;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 8px 0 4px;
    border-bottom: 1px solid #d1d5db;
    padding-bottom: 2px;
  }
  .ps-table { width: 100%; border-collapse: collapse; }
  .ps-table th, .ps-table td {
    text-align: left;
    padding: 3px 6px;
    border-bottom: 1px solid #e5e7eb;
  }
  .ps-table th { font-size: 7.5pt; text-transform: uppercase; letter-spacing: 0.06em; color: #555; }
  .ps-table .num { text-align: right; font-family: var(--mono); }
  .ps-table tfoot td { font-weight: 700; border-bottom: 0; border-top: 1px solid #111; }
  .ps-notes {
    margin-top: 8px;
    white-space: pre-wrap;
    border: 1px solid #d1d5db;
    padding: 6px 8px;
    min-height: 28px;
  }
  .ps-foot {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #111;
    font-size: 7.5pt;
    color: #111;
    line-height: 1.35;
  }
  .ps-foot strong { display: block; margin-bottom: 2px; font-size: 8pt; }
}

@media (min-width: 860px) {
  body { background: #0b0d12; }
  .app {
    top: 16px;
    bottom: 16px;
    height: auto;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.45);
  }
  .sheet { align-items: center; }
}
