:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef3f8;
  color: #152235;
  line-height: 1.5;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: linear-gradient(145deg, #eef3f8 0%, #f8fafc 58%, #e6eef6 100%);
}

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

:where(a, button, input, select, textarea):focus-visible {
  outline: 3px solid #ffbf47;
  outline-offset: 3px;
  box-shadow: 0 0 0 2px #102f4d;
}

.access-gate,
.app-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 32px auto;
}

.access-gate {
  max-width: 620px;
  padding: 32px;
  border: 1px solid #cbd8e6;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(31, 53, 78, 0.12);
}

.brand-kicker,
.eyebrow,
.success-kicker {
  margin: 0 0 6px;
  color: #1f5f94;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.brand-kicker.light { color: #cfe8fb; }

.sign-in-form {
  display: grid;
  gap: 9px;
  margin-top: 20px;
}

.sign-in-form label,
.public-intake-form > fieldset > label,
.field-grid > label,
.chat-form > label { font-weight: 750; }

input:not([type="checkbox"]), select, textarea {
  display: block;
  width: 100%;
  min-height: 46px;
  margin-top: 6px;
  padding: 11px 12px;
  border: 1px solid #728aa1;
  border-radius: 10px;
  background: #fff;
  color: #152235;
}

textarea { resize: vertical; }

.button,
.scenario-grid button,
.correction-links button,
.sign-in-form button {
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid #1f5f94;
  border-radius: 10px;
  background: #1f5f94;
  color: #fff;
  cursor: pointer;
  font-weight: 780;
}

.button:hover,
.sign-in-form button:hover { background: #174b75; }

.button:disabled { cursor: not-allowed; opacity: 0.55; }
.secondary-button { background: #fff; color: #174b75; }
.ghost-button { border-color: #fff; background: transparent; }
.ghost-button:hover { background: rgba(255, 255, 255, 0.14); }

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  border-radius: 20px 20px 0 0;
  background: #123d68;
  color: #fff;
  box-shadow: 0 18px 45px rgba(23, 61, 99, 0.18);
}

.site-header-brand {
  display: flex;
  flex: 1 1 auto;
  align-items: flex-start;
  gap: 20px;
  min-width: 0;
}

.site-header-logo {
  flex: 0 0 auto;
  width: clamp(76px, 11vw, 112px);
  height: auto;
}

.site-header h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.05; }
.site-header p:last-child { max-width: 650px; margin: 10px 0 0; }

.preview-banner,
.office-boundary,
.request-notice,
.urgent-guidance {
  padding: 14px 17px;
  border: 1px solid #d39a2c;
  background: #fff8e5;
  color: #563d09;
}

.preview-banner { border-top: 0; }
.urgent-guidance { margin-top: 16px; border-left: 5px solid #a51d2d; background: #fff0f1; color: #62121c; }
.request-notice { margin-top: 0; }
.office-boundary { margin-bottom: 18px; border-radius: 10px; }

.view-tabs {
  display: flex;
  gap: 6px;
  padding: 14px 18px 0;
  border-right: 1px solid #d7e1eb;
  border-left: 1px solid #d7e1eb;
  background: #f7fafc;
  overflow-x: auto;
}

.view-tab {
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px 10px 0 0;
  background: transparent;
  color: #35536f;
  cursor: pointer;
  font-weight: 780;
  white-space: nowrap;
}

.view-tab[aria-selected="true"] {
  border-color: #c5d4e2;
  border-bottom-color: #fff;
  background: #fff;
  color: #123d68;
}

.view-panel {
  padding: 28px;
  border: 1px solid #d7e1eb;
  border-radius: 0 0 20px 20px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(31, 53, 78, 0.09);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.panel-heading.compact { margin-bottom: 16px; }
.panel-heading h2 { margin: 0; color: #123d68; font-size: clamp(1.5rem, 3vw, 2rem); }
.panel-heading p:last-child { max-width: 680px; margin: 7px 0 0; color: #52677b; }

.step-progress {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin: 0 0 26px;
  padding: 0;
  list-style: none;
  counter-reset: steps;
}

.step-progress li {
  counter-increment: steps;
  min-width: 0;
  padding: 9px 8px;
  border-top: 4px solid #c8d5e1;
  color: #52677b;
  font-size: 0.82rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.step-progress li::before { content: counter(steps) ". "; }
.step-progress li[aria-current="step"] { border-color: #1f5f94; color: #123d68; }
.step-progress li[data-complete="true"] { border-color: #2d7757; color: #295f49; }

.public-intake-form,
.intake-step { min-width: 0; }

.intake-step,
.emergency-options {
  margin: 0;
  padding: 0;
  border: 0;
}

.intake-step > legend {
  margin-bottom: 6px;
  color: #123d68;
  font-size: 1.35rem;
  font-weight: 820;
}

.step-help,
.quiet-note,
.optional { color: #52677b; font-weight: 500; }
.step-help { margin: 0 0 18px; }
.optional { font-size: 0.9em; }

.website-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.field-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.field-grid.two-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.public-intake-form > fieldset > label { display: block; margin-bottom: 16px; }

.emergency-options {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.emergency-options legend { margin-bottom: 8px; font-weight: 800; }
.emergency-options label,
.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #cbd8e6;
  border-radius: 10px;
  background: #f8fafc;
}

input[type="checkbox"] {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
}

.wizard-actions,
.form-actions,
.correction-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.correction-links { margin: 14px 0 22px; }
.correction-links button { border-color: #8ca0b4; background: #f3f7fa; color: #174b75; }

.status { min-height: 1.5em; margin: 10px 0 0; color: #7a291d; font-weight: 650; }

.summary-list,
.queue-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 0;
}

.summary-list > div,
.queue-card dl > div {
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid #d7e1eb;
  border-radius: 9px;
  background: #f7fafc;
}

.summary-list dt,
.queue-card dt {
  color: #456784;
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.summary-list dd,
.queue-card dd { margin: 4px 0 0; overflow-wrap: anywhere; }

.privacy-notice {
  padding: 16px;
  border: 1px solid #d9a441;
  border-radius: 12px;
  background: #fffaf0;
}

.privacy-notice h3 { margin: 0 0 12px; }
.privacy-notice-content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.privacy-notice-content h4 { margin: 0 0 4px; color: #5e4107; }
.privacy-notice-content p { margin: 0; font-size: 0.92rem; overflow-wrap: anywhere; }

.consent-row {
  margin-top: 16px;
  border: 2px solid #d09a2d;
  background: #fffdf7;
  font-weight: 720;
}

.receipt-panel {
  padding: 24px;
  border: 2px solid #2d7757;
  border-radius: 14px;
  background: #eef8f3;
}

.receipt-panel h3 { margin: 0; color: #225a42; font-size: 1.5rem; }
.receipt-panel p:last-child { margin-bottom: 0; }
.success-kicker { color: #2d7757; }

.review-queue { display: grid; gap: 14px; }
.queue-card { padding: 18px; border: 1px solid #cbd8e6; border-radius: 12px; background: #fff; }
.queue-card-header { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.queue-status { margin: 0; padding: 5px 10px; border-radius: 999px; background: #fff0cc; color: #674800; font-size: 0.8rem; font-weight: 850; }
.queue-reference { margin: 0; color: #456784; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 750; }
.queue-boundary { margin: 14px 0 0; padding-top: 13px; border-top: 1px solid #d7e1eb; font-weight: 700; }

.queue-decision {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #d7e1eb;
}

.queue-decision-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 9px;
  margin-bottom: 18px;
}

.scenario-grid button { background: #eef6fc; color: #174b75; text-align: left; }
.scenario-grid button:hover { background: #dceefa; }

.conversation {
  min-height: 220px;
  max-height: 500px;
  overflow-y: auto;
  padding: 15px;
  border: 1px solid #d7e1eb;
  border-radius: 12px;
  background: #f7fafc;
}

.message { width: min(720px, 92%); margin-bottom: 11px; padding: 12px 14px; border-radius: 12px; }
.message p { margin: 5px 0 0; white-space: pre-wrap; }
.assistant-message { background: #e4f0fa; color: #123d68; }
.user-message { margin-left: auto; background: #123d68; color: #fff; }
.response-meta { margin-top: 8px; color: #456784; font-size: 0.78rem; }
.chat-form { margin-top: 16px; }

@media (max-width: 700px) {
  .access-gate,
  .app-shell { width: min(100% - 16px, 1080px); margin: 8px auto 18px; }
  .access-gate { padding: 21px; border-radius: 14px; }
  .site-header { flex-direction: column; gap: 14px; padding: 20px; border-radius: 14px 14px 0 0; }
  .site-header-brand { gap: 13px; }
  .site-header-logo { width: 72px; }
  .site-header h1 { font-size: 2rem; }
  .ghost-button { width: 100%; }
  .preview-banner { padding: 12px; }
  .view-tabs { padding: 10px 8px 0; }
  .view-tab { flex: 0 0 auto; padding-inline: 12px; }
  .view-panel { padding: 18px 14px; border-radius: 0 0 14px 14px; }
  .panel-heading { flex-direction: column; gap: 12px; margin-bottom: 18px; }
  .panel-heading .button { width: 100%; }
  .step-progress { grid-template-columns: minmax(0, 1fr); gap: 3px; margin-bottom: 20px; }
  .step-progress li { padding: 5px 8px; border-top: 0; border-left: 4px solid #c8d5e1; }
  .field-grid.two-column,
  .summary-list,
  .queue-card dl,
  .privacy-notice-content { grid-template-columns: minmax(0, 1fr); }
  .wizard-actions .button,
  .form-actions .button { flex: 1 1 100%; }
  .correction-links button { flex: 1 1 calc(50% - 5px); }
  .queue-card { padding: 14px; }
  .queue-card-header { align-items: flex-start; flex-direction: column; }
  .message { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
