/* HBOTRefer — clinical navy.
   Tailwind carries the layout; this file carries the materiality: how things
   feel to press, how text sits, how the page breathes on a phone. */

/* ------------------------------------------------------------------ base -- */

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

body {
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  letter-spacing: -0.006em;
  /* A whisper of warmth under the cool blue, so the app doesn't read as cold. */
  background-image:
    radial-gradient(72rem 40rem at 50% -12rem, rgba(37, 99, 235, .06), transparent 60%),
    radial-gradient(56rem 30rem at 50% 118%, rgba(251, 191, 36, .045), transparent 60%);
  background-attachment: fixed;
}

h1, h2, h3, h4 { letter-spacing: -0.022em; text-wrap: balance; }
p { text-wrap: pretty; }

::selection { background: rgba(37, 99, 235, .16); }

/* Keyboard users must always be able to see where they are. Applied globally
   rather than per-component so a new control can never ship without it. */
:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
  border-radius: 6px;
}
/* Inputs draw their own focus halo; a second outline on top just looks broken. */
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  padding: .7rem 1.1rem; border-radius: 0 0 12px 12px;
  background: #fff; color: #1d4ed8; font-weight: 700; font-size: 14px;
  box-shadow: 0 8px 24px -8px rgba(15, 23, 42, .35);
  transition: top .15s ease;
}
.skip-link:focus { top: 0; }

/* The signed-out shell: deep navy, the same chrome as the app header. */
.auth-bg {
  background:
    radial-gradient(60rem 34rem at 50% -8rem, rgba(59, 130, 246, .22), transparent 62%),
    linear-gradient(168deg, #0a1122 0%, #0f1e3d 58%, #122a4d 100%);
  background-attachment: fixed;
}

/* ----------------------------------------------------------------- cards -- */

.card {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, .07);
  border-radius: 18px;
  box-shadow: 0 1px 2px 0 rgba(15, 23, 42, .04), 0 8px 30px -18px rgba(15, 23, 42, .16);
}

/* ---------------------------------------------------------------- inputs -- */
/* 16px minimum: anything smaller makes iOS zoom the page on focus, which on a
   form this long is genuinely disorienting. */

.input, input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="date"], input[type="search"], input[type="number"],
select, textarea {
  width: 100%;
  font-size: 16px;
  line-height: 1.45;
  color: #0f172a;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .7rem center;
  background-size: 1.1rem;
  padding-right: 2.4rem;
}
.input:hover, input:hover, select:hover, textarea:hover { border-color: #cbd5e1; }
.input:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .13);
}
/* #94a3b8 on white is ~2.6:1 — below the 4.5:1 needed to be read reliably on a
   phone in a bright exam room. #64748b clears it. */
::placeholder { color: #64748b; opacity: 1; }
input:disabled, select:disabled, textarea:disabled { background: #f8fafc; color: #475569; }

.label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #3a4757;
  margin-bottom: .45rem;
}

/* A field the AI filled — the doctor must be able to see what to check. */
.ai-filled { border-color: #93c5fd; background: #f8fbff; }
.ai-badge {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  color: #1d4ed8; background: #dbeafe;
  border-radius: 9999px; padding: .1rem .4rem;
}
/* A field we've asked the doctor to fill in. */
.needs-info { border-color: #fbbf24; background: #fffbeb; }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-weight: 650; font-size: 15px; line-height: 1;
  padding: .8rem 1.1rem;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .15s ease, box-shadow .15s ease, transform .06s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px rgba(37, 99, 235, .22); }
.btn[disabled], .btn.is-busy { opacity: .6; pointer-events: none; }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  box-shadow: 0 10px 28px -12px rgba(37, 99, 235, .65);
}
.btn-primary:hover { background: linear-gradient(135deg, #2f77f0, #1a45c4); }

.btn-secondary { color: #1e293b; background: #fff; border-color: #e2e8f0; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.btn-secondary:hover { border-color: #cbd5e1; background: #f8fafc; }

.btn-ghost { color: #334155; background: transparent; }
.btn-ghost:hover { background: rgba(15, 23, 42, .05); }

.btn-danger { color: #be123c; background: #fff; border-color: #fecdd3; }
.btn-danger:hover { background: #fff1f2; }

.btn-lg { font-size: 16px; padding: 1rem 1.3rem; border-radius: 14px; }
.btn-sm { font-size: 13.5px; padding: .55rem .8rem; border-radius: 10px; }
.btn-block { width: 100%; }

/* A slot in the chamber timetable. Selection has to survive being read at
   arm's length in a bright room, so it is a border and a fill, not a tint. */
.slot-btn.is-picked {
  border-color: #2563eb; background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .16);
}
.slot-btn.is-taken { opacity: .4; pointer-events: none; text-decoration: line-through; }

/* ------------------------------------------------------------ tab bar -- */

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: 2px;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: rgba(10, 17, 34, .92);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.bn-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 2px 4px;
  text-decoration: none;
  color: rgba(255, 255, 255, .55);
  -webkit-tap-highlight-color: transparent;
}
.bn-icon {
  position: relative;
  display: grid; place-items: center;
  width: 40px; height: 27px;
  border-radius: 9999px;
  transition: background .18s ease, box-shadow .18s ease, transform .12s ease;
}
.bn-item:active .bn-icon { transform: scale(.9); }
.bn-item.is-active { color: #fff; }
.bn-item.is-active .bn-icon {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  box-shadow: 0 6px 16px -6px rgba(59, 130, 246, .9);
}
.bn-label { font-size: 10.5px; font-weight: 650; letter-spacing: -.01em; }
.bn-badge {
  position: absolute; top: -2px; right: 1px;
  min-width: 16px; height: 16px; padding: 0 4px;
  display: grid; place-items: center;
  border-radius: 9999px;
  background: #fbbf24; color: #0f172a;
  font-size: 9.5px; font-weight: 800;
  box-shadow: 0 0 0 2px rgba(10, 17, 34, .92);
}

/* -------------------------------------------------------- install prompt -- */

.install-card {
  position: fixed; z-index: 55;
  left: 12px; right: 12px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  padding: 1rem 1.1rem;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, .08);
  box-shadow: 0 20px 50px -16px rgba(15, 23, 42, .35);
  opacity: 0; transform: translateY(14px);
  transition: opacity .25s ease, transform .25s cubic-bezier(.22, 1, .36, 1);
}
.install-card.show { opacity: 1; transform: none; }
.ic-title { font-weight: 700; font-size: 15px; color: #0f172a; margin: 0; }
.ic-sub   { font-size: 13px; color: #3a4757; margin: .3rem 0 0; line-height: 1.5; }
.ic-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .9rem; }
.ic-actions .btn { padding: .6rem .95rem; font-size: 14px; }
@media (min-width: 640px) {
  .install-card { left: auto; right: 22px; bottom: 22px; max-width: 23rem; }
}

/* ---------------------------------------------------------------- toast -- */

#toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  z-index: 60;
  max-width: min(90vw, 26rem);
  padding: .7rem 1.05rem;
  border-radius: 12px;
  background: #0f172a; color: #fff;
  font-size: 14px; font-weight: 550;
  box-shadow: 0 18px 40px -14px rgba(15, 23, 42, .6);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 640px) { #toast { bottom: 28px; } }

/* ------------------------------------------------------------ animation -- */

@keyframes fadeup { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.animate-fadeup { animation: fadeup .34s cubic-bezier(.22, 1, .36, 1) both; }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, #eef2f6 25%, #e2e8f0 37%, #eef2f6 63%);
  background-size: 400% 100%;
  animation: shimmer 1.35s ease infinite;
  border-radius: 8px;
}
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ----------------------------------------------------------------- misc -- */

details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

.hr-divider { display: flex; align-items: center; gap: .85rem; color: #94a3b8; font-size: 12px; font-weight: 600; }
.hr-divider::before, .hr-divider::after { content: ""; height: 1px; flex: 1; background: #e2e8f0; }

@media print {
  .bottom-nav, header, footer, .no-print { display: none !important; }
  body { background: #fff !important; }
  main { padding: 0 !important; max-width: none !important; }
}
