/*
 * Mobile-first. Designed at 390px, allowed to grow.
 * Every tap target is at least --tap-min. One-handed reach is the constraint.
 */

/*
 * Palette follows the Ameren Illinois site: green for action, blue for
 * secondary and links, near-black text on white and light grey.
 *
 * Colours only. No logo, no wordmark, no claim of affiliation -- the masthead
 * says "Central Illinois" and nothing else. Solar lead gen is heavily
 * litigated and "it looked like my utility" is not an argument worth having.
 */
:root {
  --ink: #1a1a1a;
  --ink-soft: #56606b;
  --paper: #ffffff;
  --paper-sunk: #f2f4f5;
  --line: #dde1e4;
  --line-strong: #b4bcc3;

  /* Lighter and yellower than a pine green, matching the Manage Auto Pay button. */
  --accent: #1e8a3c;
  --accent-hover: #17722f;
  --accent-ink: #ffffff;
  --accent-tint: #e9f5ec;
  --accent-deep: #145f28;

  --blue: #1668b4;
  --blue-dark: #12558f;
  --blue-tint: #e9f2fa;
  --blue-line: #c3dbf0;
  --focus: #1668b4;

  --tap-min: 44px;
  --gutter: 20px;
  --measure: 34rem;
  --radius: 10px;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  font-size: 17px;
  line-height: 1.5;
}

.shell {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 24px var(--gutter) calc(64px + env(safe-area-inset-bottom));
}

/* Full-bleed blue header bar, white lettering, same on every step. */
.banner {
  background: var(--blue);
  padding-top: env(safe-area-inset-top);
}

.banner-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 16px var(--gutter) 18px;
}

.eyebrow {
  margin: 0 0 12px;
  color: #ffffff;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.progress {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/*
 * Three outlined segments; only the one you are on is filled white. It reads as
 * a position marker rather than a fill gauge -- going back a step moves the
 * white bar back, which a cumulative fill would not show.
 */
.progress li {
  height: 9px;
  flex: 1;
  border: 1px solid rgb(255 255 255 / 55%);
  border-radius: 2px;
  background: transparent;
}

.progress li.current {
  background: #ffffff;
}

h1 {
  margin: 0 0 8px;
  font-size: 1.625rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  /*
   * `balance` evens the line lengths, which on a short heading breaks it at an
   * arbitrary word. `pretty` only prevents orphans and otherwise leaves the
   * natural break alone.
   */
  text-wrap: pretty;
}

.lede {
  margin: 0 0 24px;
  color: var(--ink-soft);
  font-size: 1rem;
}

/* ---- fields ---------------------------------------------------------- */

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

.field-row {
  display: flex;
  gap: 12px;
}

.field-row .field {
  flex: 1;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-weight: 600;
}

input[type="text"],
input[type="tel"] {
  width: 100%;
  min-height: var(--tap-min);
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  /* 16px minimum or iOS zooms the viewport on focus. */
  font: inherit;
  font-size: 1rem;
}

input:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.group {
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}

.group legend {
  padding: 0;
  margin-bottom: 8px;
}

/* ---- buttons --------------------------------------------------------- */

.primary {
  width: 100%;
  min-height: 52px;
  margin-top: 8px;
  padding: 14px 20px;
  border: 1px solid var(--accent-hover);
  border-radius: 4px;
  background: linear-gradient(180deg, #239743 0%, var(--accent) 55%, #1a7c35 100%);
  color: var(--accent-ink);
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 22%),
    0 1px 2px rgb(20 26 20 / 24%);
}

.primary:hover {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
}

.primary:active {
  box-shadow: inset 0 2px 4px rgb(0 0 0 / 22%);
}


.tap-row {
  display: flex;
  gap: 12px;
}

.tap {
  flex: 1;
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1.0625rem;
  font-weight: 600;
  cursor: pointer;
}

.chip-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.chip {
  min-height: var(--tap-min);
  padding: 14px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.tap.selected,
.chip.selected {
  border-color: var(--accent);
  background: var(--accent-tint);
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* ---- step 3 ---------------------------------------------------------- */

/*
 * Matches the Ameren "enrolled in Auto Pay" notice: pale blue field, medium
 * blue type, everything in the box the same blue.
 */
:root {
  --notice-bg: #d6ebfa;
  --notice-ink: #1a6bab;
}

.estimate {
  margin-bottom: 24px;
  padding: 20px;
  border: 1px solid #bfdcf2;
  border-radius: var(--radius);
  background: var(--notice-bg);
  color: var(--notice-ink);
}

.estimate-label {
  margin: 0 0 4px;
  color: var(--notice-ink);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.estimate-range {
  margin: 0 0 12px;
  color: var(--notice-ink);
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.estimate-note {
  margin: 0;
  color: var(--notice-ink);
  font-size: 0.9375rem;
}

/* ---- bill segue ------------------------------------------------------ */

.segue {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.segue h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.segue-note {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.upload-target {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 24px 16px;
  border: 2px dashed var(--blue-line);
  border-radius: var(--radius);
  background: var(--blue-tint);
  text-align: center;
  cursor: pointer;
}

.upload-target:hover {
  border-color: var(--blue);
}

.upload-title {
  color: var(--blue-dark);
}

.upload-icon {
  font-size: 1.75rem;
  line-height: 1;
  margin-bottom: 6px;
}

.upload-title {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
}

.upload-sub {
  color: var(--ink-soft);
  font-size: 0.875rem;
}

/* Visually hidden, still focusable and still the label's target. */
.upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.upload-input:focus-visible + * {
  outline: 2px solid var(--focus);
}

.upload-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.upload-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 0.875rem;
}

.upload-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-status {
  flex: none;
  color: var(--ink-soft);
  font-weight: 600;
}

.upload-item.ok .upload-status {
  color: var(--accent-deep);
}

.upload-item.failed .upload-status {
  color: #a8331f;
}

/* ---- booking --------------------------------------------------------- */

.windows {
  margin-bottom: 24px;
}

.windows {
  padding: 20px 16px;
  border: 1px solid var(--blue-line);
  border-radius: var(--radius);
  background: var(--blue-tint);
}

.windows h2 {
  margin: 0 0 6px;
  color: var(--blue-dark);
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.windows-note {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

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

/* Five day columns, times stacked underneath. */
.slot-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.day-column {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.day-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0 6px;
  border-bottom: 2px solid var(--blue-line);
  line-height: 1.2;
}

.day-weekday {
  color: var(--blue-dark);
  font-size: 0.8125rem;
  font-weight: 700;
}

.day-date {
  color: var(--blue);
  font-size: 0.6875rem;
  font-weight: 600;
}

/*
 * 44px tall so the target stays reachable even though five columns squeeze
 * the width down to about 70px at 390px.
 */
.slot-time-button {
  min-height: var(--tap-min);
  padding: 4px 2px;
  border: 1px solid var(--accent-hover);
  border-radius: 4px;
  background: linear-gradient(180deg, #239743 0%, var(--accent) 55%, #1a7c35 100%);
  color: var(--accent-ink);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 20%);
}

.slot-time-button:hover {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
}

.slot-time-button.pending {
  opacity: 0.6;
}

.slot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.slot:hover {
  border-color: var(--accent);
}

.slot.pending {
  opacity: 0.6;
}

.slot-day {
  font-size: 1.0625rem;
  font-weight: 700;
}

.slot-time {
  color: var(--ink-soft);
  font-size: 1rem;
  font-weight: 600;
}

/*
 * The only consent point in the funnel. A line of text under the buttons --
 * not a checkbox, not a gate. Tapping a window books it.
 */
.consent {
  margin: 16px 0 0;
  color: var(--ink-soft);
  font-size: 0.75rem;
  line-height: 1.45;
}

.slot-error {
  margin: 12px 0 0;
  color: #a8331f;
  font-size: 0.9375rem;
  font-weight: 600;
}

.confirm-badge {
  display: inline-block;
  margin: 0 0 12px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent-deep);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.placeholder {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper-sunk);
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.placeholder p {
  margin: 0;
}

.placeholder-title {
  margin-bottom: 4px !important;
  color: var(--ink);
  font-weight: 600;
}

.hint {
  margin: -8px 0 12px;
  color: var(--accent-deep);
  font-size: 0.9375rem;
  font-weight: 600;
}

.save-state {
  margin: 20px 0 0;
  min-height: 1.2em;
  color: var(--ink-soft);
  font-size: 0.8125rem;
}

.save-state[data-kind="saved"] {
  color: var(--accent-deep);
}

.combo {
  position: relative;
}

.suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 8px 24px rgb(20 24 31 / 12%);
}

.suggestion {
  display: block;
  width: 100%;
  min-height: var(--tap-min);
  padding: 11px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  text-align: left;
  cursor: pointer;
}

.suggestion:hover,
.suggestion:focus-visible {
  background: var(--paper-sunk);
}

@media (min-width: 560px) {
  .shell {
    padding-top: 40px;
  }

  h1 {
    font-size: 2rem;
  }

  .chip-row {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ---- admin ----------------------------------------------------------- */

.admin {
  max-width: none;
  padding: 20px;
  font-size: 14px;
}

.admin table {
  width: 100%;
  border-collapse: collapse;
}

.admin th,
.admin td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.admin th {
  position: sticky;
  top: 0;
  background: var(--paper-sunk);
  cursor: pointer;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin .scroll {
  overflow-x: auto;
}

.admin .no-consent {
  color: #a8331f;
  font-weight: 700;
}

.admin .warn {
  padding: 10px 14px;
  margin-bottom: 16px;
  border-left: 3px solid var(--accent);
  background: var(--accent-tint);
}

.admin .toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.admin .download {
  display: inline-block;
  min-height: var(--tap-min);
  padding: 9px 16px;
  border: 1px solid var(--accent-hover);
  border-radius: 4px;
  background: linear-gradient(180deg, #239743 0%, var(--accent) 55%, #1a7c35 100%);
  color: var(--accent-ink);
  font-weight: 700;
  text-decoration: none;
}

.admin .download:hover {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
}

.admin .bill-toggle {
  min-height: 0;
  padding: 2px 8px;
  border: 1px solid var(--blue-line);
  border-radius: 3px;
  background: var(--blue-tint);
  color: var(--blue-dark);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.admin .bills-row td {
  background: var(--paper-sunk);
  white-space: normal;
}

.admin .bill-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin .bill-list li {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 4px 0;
}

.admin .bill-meta {
  color: var(--ink-soft);
}

.admin .bill-list a {
  color: var(--blue);
  font-weight: 700;
}
