/* ==========================================================================
   GCM provider portal — the only stylesheet.

   ★ NO WEB FONTS, NO CDN, NO @import. `style-src 'self'` in the CSP means an
     external stylesheet or font would simply fail to load, and a form that
     renders unstyled on a doctor's office PC because a third party was slow is
     a form somebody gives up on. System fonts render instantly and everywhere.

   ★ NO :hover-ONLY AFFORDANCES AND NO COLOUR-ONLY STATE. Errors carry the word
     "Error:" in text (see views/fields.ts); this file adds the red border and
     the left bar as REINFORCEMENT, never as the signal.

   ★ 44px MINIMUM TARGETS on every control and button. A lot of this gets
     filled in on a tablet, one-handed, next to a patient.

   Accessibility targets held here: contrast at or above WCAG AA on every
   text/background pair, a visible focus ring that is never removed, and a
   layout that reflows to 320px without horizontal scrolling.
   ========================================================================== */

:root {
  /* Gator Custom Mobility: deep navy and a warm orange. Both darkened from the
     marketing palette so text on them clears AA. */
  --ink: #14243a;
  --ink-soft: #40506a;
  --page: #f4f6f9;
  --surface: #ffffff;
  --line: #c7d0dd;
  --brand: #14355e;
  --brand-ink: #ffffff;
  --accent: #a33b06;
  --accent-ink: #ffffff;
  --danger: #9a1c1c;
  --danger-bg: #fdf1f1;
  --success: #14603a;
  --success-bg: #eef7f2;
  --urgent-bg: #fff6e8;
  --urgent-line: #a33b06;
  --focus: #0b5fff;
  --radius: 6px;
  --gap: 1.25rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* Never below 16px: a smaller base makes iOS Safari zoom on focus, which on
     a long form throws the layout around every time a field is tapped. */
  font-size: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
}

/* --- Focus ---------------------------------------------------------------
   ★ NEVER REMOVED, ANYWHERE IN THIS FILE. Keyboard and switch users navigate
   this form; an invisible focus ring on a page of medical fields means not
   knowing which box you are typing a member ID into. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

a {
  color: var(--brand);
}
a:hover,
a:focus {
  /* Underline is always on, so the link is not distinguished by colour alone. */
  text-decoration: underline;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--ink);
  padding: 0.75rem 1rem;
  z-index: 10;
}
.skip-link:focus {
  left: 0;
}

/* --- Shell --------------------------------------------------------------- */

.site-header {
  background: var(--brand);
  color: var(--brand-ink);
  padding: 1rem;
}
.site-header a {
  color: var(--brand-ink);
}
.brand {
  margin: 0 0 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  align-items: center;
  justify-content: space-between;
}
.site-nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav-list a {
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
}
.site-nav-account {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.signed-in {
  margin: 0;
  font-size: 0.95rem;
}
.signout-form {
  margin: 0;
}

.site-main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}
.site-main:focus {
  outline: none;
}

h1 {
  font-size: 1.75rem;
  line-height: 1.25;
  margin: 0 0 0.75rem;
}
h2 {
  font-size: 1.25rem;
  margin: 0 0 0.5rem;
}
.lead {
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin-top: 0;
}
.muted {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 1rem 3rem;
  max-width: 46rem;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* --- Notices ------------------------------------------------------------- */

.notice {
  border: 1px solid var(--line);
  border-left: 6px solid var(--line);
  background: var(--surface);
  padding: 1rem;
  border-radius: var(--radius);
  margin: 0 0 1.5rem;
}
.notice-urgent {
  background: var(--urgent-bg);
  border-color: var(--urgent-line);
  border-left-color: var(--urgent-line);
}
.notice-title {
  margin-top: 0;
  font-size: 1.05rem;
}
.notice p:last-child {
  margin-bottom: 0;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.5rem 0;
}
.panel-quiet {
  background: transparent;
}
.panel-success {
  background: var(--success-bg);
  border-left: 6px solid var(--success);
}
.panel h2 {
  margin-top: 0;
}

.reference-block {
  font-size: 1.1rem;
}
.reference code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.15rem;
  /* Long-ish token: allow it to wrap rather than push the page sideways. */
  word-break: break-all;
}

.card-grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.card h2 {
  margin-top: 0;
}

/* --- Error summary -------------------------------------------------------
   Reinforces, never replaces, the "Error:" text inside each field. */

.error-summary {
  background: var(--danger-bg);
  border: 2px solid var(--danger);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 0 0 1.5rem;
}
.error-summary-title {
  margin-top: 0;
  color: var(--danger);
}
.error-summary-list {
  margin: 0;
  padding-left: 1.25rem;
}
.error-summary-list a {
  color: var(--danger);
}

/* --- Forms --------------------------------------------------------------- */

.form {
  margin: 0 0 2rem;
}
.form-narrow {
  max-width: 26rem;
}
.form-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 0 0 var(--gap);
}
.form-section h2 {
  margin-top: 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.field {
  margin: 0 0 1.25rem;
  border: 0;
  padding: 0;
}
.field:last-child {
  margin-bottom: 0;
}
.field label,
.field legend {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  padding: 0;
}
.label-required {
  font-weight: 400;
  color: var(--danger);
}
.label-optional {
  font-weight: 400;
  color: var(--ink-soft);
}
.field-hint {
  margin: 0 0 0.4rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.field-error {
  margin: 0 0 0.4rem;
  color: var(--danger);
  font-weight: 600;
}

.field input[type="text"],
.field input[type="tel"],
.field input[type="date"],
.field input[type="email"],
.field input[type="password"],
.field input[type="file"],
.field textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.7rem;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--ink-soft);
  border-radius: var(--radius);
}
.field textarea {
  min-height: 7rem;
  resize: vertical;
}
.field-has-error input,
.field-has-error textarea {
  border-color: var(--danger);
}
.field-has-error {
  border-left: 6px solid var(--danger);
  padding-left: 0.85rem;
}

.radio,
.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  /* The whole row is at least 44px so the label is part of the target. */
  min-height: 44px;
  padding: 0.35rem 0;
}
.radio input,
.checkbox input {
  width: 24px;
  height: 24px;
  margin: 0.55rem 0 0;
  flex: 0 0 auto;
}
.radio label,
.checkbox label {
  font-weight: 400;
  margin: 0;
  padding: 0.5rem 0;
  cursor: pointer;
}

/* --- Buttons ------------------------------------------------------------- */

.button {
  display: inline-block;
  min-height: 44px;
  padding: 0.7rem 1.2rem;
  margin: 0.25rem 0.5rem 0.25rem 0;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  color: var(--brand);
  background: var(--surface);
  border: 2px solid var(--brand);
  border-radius: var(--radius);
  cursor: pointer;
}
.button-primary {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}
.button-primary:hover,
.button-primary:focus {
  /* Darker still on interaction — the contrast only ever increases. */
  background: #822f05;
  border-color: #822f05;
}
.button-secondary {
  color: var(--brand);
  background: var(--brand-ink);
}
.button-submit {
  width: 100%;
  font-size: 1.05rem;
}

@media (min-width: 40rem) {
  .button-submit {
    width: auto;
  }
}

/* --- Motion and print ---------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

@media print {
  /* ★ A printed page of this portal is a printed page of PHI. The nav and the
     buttons are removed so a print-out is at least not also a set of live
     instructions, and the emergency notice is kept because it is the one thing
     worth reading on paper. */
  .site-nav,
  .button,
  .skip-link {
    display: none;
  }
  body {
    background: #ffffff;
  }
}
