:root {
  color-scheme: light;
  --navy: #071f3b;
  --ink: #20364d;
  --muted: #607287;
  --teal: #0a8585;
  --teal-dark: #086b6d;
  --teal-soft: #edf9f8;
  --line: #dbe3e9;
  --paper: #ffffff;
  --background: #f5f7f9;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--background);
  line-height: 1.5;
}

button, textarea { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 76px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--navy);
  font-size: 21px;
  font-weight: 760;
  text-decoration: none;
}

.brandmark {
  display: grid;
  width: 34px;
  height: 39px;
  place-items: center;
  color: white;
  border-radius: 6px;
  background: linear-gradient(145deg, #0aa7a4, #087c80);
  box-shadow: 0 5px 14px rgba(7, 128, 131, .2);
  font-size: 25px;
  font-weight: 400;
}

.page-name {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
}

.local-badge {
  justify-self: end;
  color: #3c5268;
  font-size: 14px;
}

main {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 44px 0 60px;
}

.hero { max-width: 800px; }
.eyebrow, .step-label {
  margin: 0 0 7px;
  color: var(--teal);
  letter-spacing: .14em;
  font-size: 11px;
  font-weight: 800;
}

.hero h1 {
  margin: 0 0 14px;
  color: var(--navy);
  letter-spacing: -.04em;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.06;
}

.hero > p:last-child {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

.privacy-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 13px;
  align-items: center;
  margin: 25px 0 18px;
  padding: 14px 17px;
  border: 1px solid #b9dfdc;
  border-radius: 12px;
  background: var(--teal-soft);
  color: #315c65;
}

.privacy-note > span { color: var(--teal); font-size: 26px; }
.privacy-note strong { color: #153e49; font-size: 13px; }
.privacy-note p { margin: 2px 0 0; font-size: 12px; }

.steps {
  display: flex;
  gap: 8px;
  margin: 0 0 18px;
  color: #728296;
}

.steps span {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.steps b {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid #bec9d2;
  border-radius: 50%;
  font-size: 10px;
}

.steps .active { color: var(--teal-dark); background: var(--teal-soft); }
.steps .active b { color: white; border-color: var(--teal); background: var(--teal); }

.panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--paper);
  box-shadow: 0 11px 35px rgba(14, 42, 65, .06);
}

.panel-heading, .result-heading, .transfer-bar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}

.panel-heading { padding: 20px 22px 16px; }
.panel h2, .result-heading h2 { margin: 0; color: var(--navy); font-size: 21px; }
.compact-actions { display: flex; flex-wrap: wrap; gap: 8px; }

button {
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 750;
  transition: .16s ease;
}

button:hover { transform: translateY(-1px); }
button:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgba(10, 133, 133, .24);
  outline-offset: 2px;
}

.primary { color: white; background: linear-gradient(145deg, #0a9290, #087477); box-shadow: 0 6px 15px rgba(8, 116, 119, .18); }
.secondary { color: var(--teal-dark); border: 1px solid #9bcfcd; background: white; }
.ghost { color: #627386; background: #f2f5f7; }

#source-text {
  display: block;
  width: calc(100% - 44px);
  min-height: 320px;
  margin: 0 22px;
  resize: vertical;
  border: 1px solid #cfd9e0;
  border-radius: 10px;
  padding: 16px;
  color: #19324b;
  background: #fbfcfd;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
}

#source-text:focus, .result-card textarea:focus { border-color: var(--teal); outline: 3px solid rgba(10, 133, 133, .12); }

.input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 22px 20px;
  color: var(--muted);
  font-size: 12px;
}

.results { margin-top: 34px; }
.result-heading { margin: 0 2px 16px; }
.result-heading > div > p:last-child { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.detected-count {
  flex: 0 0 auto;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--teal-dark);
  background: var(--teal-soft);
  font-size: 12px;
  font-weight: 800;
}

.warning {
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid #e9d59e;
  border-radius: 9px;
  color: #6b5424;
  background: #fff9e9;
  font-size: 13px;
}

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

.result-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.result-card > span { color: #3d596f; letter-spacing: .08em; font-size: 10px; font-weight: 850; }
.result-card textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid #d6dfe5;
  border-radius: 8px;
  padding: 11px 12px;
  color: #19324b;
  background: #fbfcfd;
  font-size: 13px;
  line-height: 1.55;
}

.full { grid-column: 1 / -1; }
.optional-fields { border: 1px dashed #bdcbd4; border-radius: 12px; background: #fafcfd; }
.optional-fields summary { cursor: pointer; padding: 14px 16px; color: var(--navy); font-size: 13px; font-weight: 750; }
.optional-grid { padding: 0 13px 13px; }

.review-note {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid #c9d7e1;
  border-radius: 11px;
  background: #f7fafc;
}
.review-note strong { color: var(--navy); font-size: 13px; }
.review-note p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.transfer-bar {
  margin-top: 14px;
  padding: 17px 19px;
  border-radius: 12px;
  color: #21455a;
  background: #eaf8f7;
}
.transfer-bar strong { font-size: 13px; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: white;
  font-size: 12px;
}
footer a { color: var(--teal-dark); font-weight: 750; text-decoration: none; }

#toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  max-width: 340px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  padding: 12px 15px;
  border-radius: 9px;
  color: white;
  background: var(--navy);
  box-shadow: 0 10px 25px rgba(0,0,0,.2);
  transition: .2s ease;
  font-size: 13px;
}
#toast.visible { opacity: 1; transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

@media (max-width: 760px) {
  .topbar { grid-template-columns: 1fr auto; min-height: 66px; padding: 0 18px; }
  .page-name { display: none; }
  .local-badge { font-size: 12px; }
  main { width: min(100% - 24px, 1120px); padding-top: 28px; }
  .hero h1 { font-size: 34px; }
  .steps { overflow-x: auto; }
  .steps span { white-space: nowrap; }
  .panel-heading, .result-heading, .transfer-bar { align-items: flex-start; flex-direction: column; }
  .compact-actions { width: 100%; }
  .compact-actions button { flex: 1; }
  #source-text { width: calc(100% - 28px); margin: 0 14px; }
  .input-footer { align-items: stretch; flex-direction: column; padding: 12px 14px 16px; }
  .result-grid, .optional-grid { grid-template-columns: 1fr; }
  .full { grid-column: auto; }
  .transfer-bar .primary { width: 100%; }
  footer { flex-direction: column; padding: 22px 18px; }
}
