:root {
  --bg: #e8edf2;
  --card: #ffffff;
  --navy: #10233f;
  --navy-soft: #1b3356;
  --text: #1b2836;
  --muted: #5d6b7a;
  --line: #d5dee7;
  --line-strong: #b7c4d1;
  --green: #157347;
  --green-dark: #0f5a37;
  --green-soft: #e5f6ec;
  --red: #8d1c1c;
  --shadow: 0 1px 2px rgba(16, 35, 63, 0.05), 0 8px 24px rgba(16, 35, 63, 0.05);
  --radius: 12px;
  --page: 52rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}

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

html {
  font-size: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.5;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
h2,
h3 {
  color: var(--navy);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1.05rem; }

a {
  color: var(--green-dark);
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 30;
  background: #fff;
  color: var(--navy);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 0.5rem;
}

.site-header {
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header-inner,
.page,
.flash-inner {
  width: min(var(--page), 100%);
  margin-inline: auto;
}

.site-header-inner {
  padding: 0.75rem 1rem 0.45rem;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

.brand-row {
  margin-bottom: 0.45rem;
}

.brand {
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.provider-nav {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
}

.provider-nav form {
  margin: 0;
}

.provider-nav button {
  min-height: 2.15rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  color: #fff;
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}

.provider-nav button.is-current {
  color: var(--navy);
  background: #fff;
  border-color: #fff;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding-bottom: 0.45rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.site-nav::-webkit-scrollbar {
  height: 4px;
}

.site-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
}

.site-nav > a,
.nav-logout {
  flex: 0 0 auto;
}

.site-nav a {
  color: #d7e3f0;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.site-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.site-nav a.is-current {
  background: #fff;
  color: var(--navy);
  border-color: #fff;
}

.nav-logout {
  margin: 0 0 0 auto;
}

.nav-logout button {
  font-weight: 700;
  font-size: 0.92rem;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}

.nav-logout button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.site-header a:focus-visible,
.site-header button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
.page a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.site-header a:focus-visible,
.site-header button:focus-visible {
  outline-color: #fff;
}

.flash {
  background: var(--green-soft);
  color: #0c5a30;
  border-bottom: 1px solid #b7e6c9;
}

.flash-error {
  background: #fde2e0;
  color: var(--red);
  border-bottom: 1px solid #f3c1bd;
}

.flash-inner {
  padding: 0.7rem 1rem;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  font-weight: 600;
  overflow-wrap: anywhere;
}

.page {
  padding: 1.2rem 1rem 3rem;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

.page a {
  font-weight: 700;
}

.page a:hover {
  text-decoration-thickness: 2px;
}

.page-head {
  margin-bottom: 1rem;
}

.page-head > * + *,
.card > * + * {
  margin-top: 0.75rem;
}

.lede {
  color: var(--muted);
  max-width: 40rem;
}

.stack {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.section {
  margin-top: 1.6rem;
}

.section > h2 {
  margin-bottom: 0.75rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.05rem 1.1rem;
}

.card-next {
  border-color: #b7dfc8;
  border-left: 4px solid var(--green);
  background: linear-gradient(180deg, #f3fbf6 0%, #fff 4.5rem);
}

.card-prefs {
  border-top: 3px solid var(--green);
}

.card-creds {
  border-top: 3px solid var(--navy);
}

.day-card.is-inactive {
  background: #f4f6f8;
  border-color: #e3e8ee;
  box-shadow: none;
}

.day-card.is-inactive .day-name {
  color: #6b7785;
}

.day-card.is-active {
  border-color: #b7dfc8;
}

.hero {
  display: grid;
  gap: 0.15rem;
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green-dark);
}

.next-date {
  font-size: 1.45rem;
}

.next-time {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--green-dark);
  line-height: 1.15;
}

.day-name {
  text-transform: capitalize;
}

.item-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
}

.meta,
.hint {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 400;
}

.facts {
  display: grid;
  gap: 0.55rem 1rem;
  margin: 0;
}

.facts div {
  display: grid;
  gap: 0.1rem;
}

.facts dt {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.facts dd {
  margin: 0;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #e7edf3;
  color: #1c3348;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-booked { background: #d8f3e3; color: #0c5a30; }
.badge-no_slot { background: #fff3d6; color: #7a5600; }
.badge-error { background: #f8d6d4; color: #8d1c1c; }
.badge-running { background: #d9e8fb; color: #0d3f78; }
.badge-otp_required { background: #ffe4cc; color: #8a3d00; }
.badge-dry_run { background: #ece7f8; color: #4c2f86; }
.badge-payment_required { background: #fff0c2; color: #765000; }

.error-line {
  color: var(--red);
  font-weight: 600;
}

.callout {
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: #fff6e5;
  color: #6d4e09;
  border: 1px solid #f0ddb0;
}

.callout-bad {
  background: #fdecea;
  color: var(--red);
  border-color: #f3c7c4;
}

.preview-line {
  background: #f4f7fa;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}

[data-preview] {
  font-weight: 700;
  color: var(--navy);
}

.form-grid {
  display: grid;
  gap: 0.85rem;
}

.pair {
  display: grid;
  gap: 0.75rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.92rem;
}

label.check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 1rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
select {
  width: 100%;
  min-height: 2.7rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
}

input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.15rem;
  flex: 0 0 auto;
  accent-color: var(--green);
}

input:focus,
select:focus {
  border-color: var(--green);
  outline: none;
  box-shadow: 0 0 0 3px rgba(21, 115, 71, 0.18);
}

input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.7rem;
  padding: 0.5rem 0.95rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: var(--green-dark);
}

.btn-secondary {
  background: #fff;
  color: var(--navy);
  border-color: var(--line-strong);
}

.btn-secondary:hover {
  background: #f3f6f9;
}

.btn-danger {
  background: #fff;
  color: var(--red);
  border-color: #e7b4b0;
}

.btn-danger:hover {
  background: #fdecea;
}

.more-link {
  margin-top: 0.85rem;
}

.auth-shell {
  display: flex;
  justify-content: center;
  padding-top: clamp(1.5rem, 8vh, 4.5rem);
}

.auth-card {
  width: min(100%, 24rem);
}

.auth-card .btn {
  width: 100%;
}

.center-copy {
  text-align: center;
}

.log-body {
  margin: 0;
  max-height: 70vh;
  overflow: auto;
  padding: 0.9rem 1rem;
  background: #f4f7fb;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty-card p {
  color: var(--muted);
}

@media (max-width: 40rem) {
  .form-actions .btn {
    width: 100%;
  }
}

@media (min-width: 36rem) {
  .pair {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 40rem) {
  .facts {
    grid-template-columns: 1fr 1fr;
  }

  .card-next .facts {
    grid-template-columns: repeat(3, 1fr);
  }
}
