/* escript.cliniweb - Titanium e-Script. Same premiumUI tokens and components as
   me.cliniweb (/assets/portal.css, /book/book.css); keep them in step. */
@font-face {
  font-family: "Cliniweb Appointment Sans";
  src: url("/assets/fonts/OpenSans-Variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --premium-canvas: #f5f5f1;
  --premium-surface: #ffffff;
  --premium-ink: #233932;
  --premium-muted: #69756f;
  --premium-line: #e5e9e3;
  --premium-soft: #f3f6f1;
  --premium-accent: #245b4b;
  --premium-accent-dark: #194637;
  --premium-accent-soft: #eaf1eb;
  --premium-success: #42633b;
  --premium-warning: #836d42;
  --premium-danger: #9b3e39;
  --premium-danger-soft: #f8ecea;
  --premium-warning-soft: #f5eddf;
  --field-bg: #fbfcf9;
  --field-line: #e2e7df;
  --secondary-bg: #fbfcf9;
  --secondary-line: #e8ece3;
  --pad: clamp(20px, 5vw, 30px);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--premium-canvas);
  color: var(--premium-ink);
  font: 400 15px/1.55 "Cliniweb Appointment Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--premium-accent); }
[hidden] { display: none !important; }
code { padding: 1px 5px; border-radius: 4px; background: var(--premium-soft); font-size: .9em; }

.es-ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Frame -------------------------------------------------------------- */
.es-wrap { width: min(620px, calc(100% - 32px)); margin: 0 auto; padding: clamp(24px, 6vh, 64px) 0 40px; }
.es-wrap.has-aside { width: min(1040px, calc(100% - 32px)); }
.es-layout { display: grid; gap: 16px; align-items: start; }
@media (min-width: 900px) {
  .has-aside .es-layout { grid-template-columns: minmax(0, 1fr) 340px; }
  .es-aside { position: sticky; top: 16px; }
}
.es-main, .es-aside { display: grid; gap: 16px; min-width: 0; }

.es-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.es-head-mark {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  border-radius: 9px; background: var(--premium-accent-soft); color: var(--premium-accent);
}
.es-head-mark .es-ico { width: 20px; height: 20px; }
.es-kicker, .es-label, .es-section {
  font-size: .66rem; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--premium-muted);
}
.es-head-name { font-size: .85rem; font-weight: 450; color: var(--premium-muted); }
.es-head .es-kicker { color: var(--premium-ink); font-size: .72rem; }

/* ---- Step rail ---------------------------------------------------------- */
.es-steps { display: flex; gap: 6px; list-style: none; margin: 0 0 16px; padding: 0; }
.es-steps li {
  flex: 1; display: flex; align-items: center; gap: 7px; min-width: 0;
  padding-top: 9px; border-top: 2px solid var(--premium-line);
  font-size: .72rem; font-weight: 550; color: #8a948e; white-space: nowrap; overflow: hidden;
}
.es-steps li span {
  width: 20px; height: 20px; flex: none; display: grid; place-items: center; border-radius: 6px;
  background: var(--premium-soft); font-size: .66rem; font-weight: 650;
}
.es-steps li.is-done { border-top-color: #9fbaa6; color: var(--premium-muted); }
.es-steps li.is-done span { background: var(--premium-accent-soft); color: var(--premium-accent); }
.es-steps li.is-current { border-top-color: var(--premium-accent); color: var(--premium-accent); }
.es-steps li.is-current span { background: var(--premium-accent); color: #fff; }
.es-steps em { font-style: normal; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) {
  .es-steps li:not(.is-current) { flex: 0 0 34px; }
  .es-steps li:not(.is-current) em { display: none; }
}

/* ---- Cards -------------------------------------------------------------- */
.es-card {
  background: var(--premium-surface);
  border: 1px solid #e2e7df;
  border-radius: 13px;
  box-shadow: 0 3px 5px rgba(39,59,36,.025), 0 18px 40px -32px rgba(31,56,32,.20);
  padding: var(--pad);
  animation: es-rise .28s ease-out both;
}
@keyframes es-rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .es-card { animation: none; } }
.es-aside .es-card { padding: 18px 20px; animation: none; }

.es-title { margin: 0 0 6px; font-size: clamp(1.35rem, 4.4vw, 1.7rem); font-weight: 550; line-height: 1.2; letter-spacing: -.035em; }
.es-lead { margin: 0 0 18px; color: var(--premium-muted); font-size: .9rem; }
.es-note { margin: 12px 0 0; color: var(--premium-muted); font-size: .78rem; }
.es-note-tight { margin: 0 0 12px; }
.es-label { display: flex; align-items: center; gap: 7px; margin: 0 0 12px; }
.es-label .es-ico { width: 15px; height: 15px; }
.es-section { margin: 22px 0 10px; padding-top: 16px; border-top: 1px solid var(--premium-line); }
.es-form > .es-section:first-of-type { margin-top: 4px; padding-top: 0; border-top: 0; }
.es-center { text-align: center; }

/* ---- A focused first step ------------------------------------------------ */
.es-welcome { padding: clamp(24px, 6vw, 40px); }
.es-welcome .es-title { font-size: clamp(1.75rem, 6vw, 2rem); }
.es-welcome .es-lead { margin: 12px 0 28px; font-size: 1rem; line-height: 1.65; }
.es-lookup .es-field label { font-size: .875rem; margin-bottom: 8px; }
.es-lookup #r { min-height: 56px; }
.es-lookup .es-btn { min-height: 52px; font-size: 1rem; margin-top: 2px; }
.es-code-help { margin-top: 18px; }
.es-code-help summary { color: var(--premium-accent); font-weight: 500; }
.es-code-example { padding: 12px; border-radius: 8px; background: var(--premium-soft); overflow-wrap: anywhere; }
.es-code-example span { display: block; margin-top: 4px; }

/* ---- Forms -------------------------------------------------------------- */
.es-form { margin: 0; }
.es-field { margin: 0 0 14px; padding: 0; border: 0; min-width: 0; }
.es-field label, .es-field legend { display: block; margin-bottom: 5px; padding: 0; font-size: .78rem; font-weight: 600; }
.es-field small { display: block; margin-top: 6px; color: var(--premium-muted); font-size: .74rem; }
.es-opt { font-weight: 450; color: var(--premium-muted); }
.es-field input:not([type="checkbox"]):not([type="radio"]), .es-field select {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--field-bg); border: 1px solid var(--field-line); border-radius: 7px;
  color: var(--premium-ink); font: inherit; font-size: 16px; /* 16px stops iOS zoom */
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.es-field input:focus, .es-field select:focus {
  background: #fff; border-color: #96b49c; box-shadow: 0 0 0 3px rgba(54,98,57,.08); outline: 0;
}
::placeholder { color: #778371; opacity: 1; }
.es-field.has-error input, .es-field.has-error select { border-color: #d9a8a3; background: #fffafa; }
.es-field-error { margin: 6px 0 0; color: var(--premium-danger); font-size: .78rem; font-weight: 550; }
.es-lookup #r { font-size: 1.3rem; letter-spacing: .14em; text-transform: lowercase; font-variant-numeric: tabular-nums; }
.es-filter { margin-bottom: 6px; }
.es-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .es-grid { grid-template-columns: 1fr; } }

.es-radios { display: flex; gap: 8px; }
.es-radio { flex: 1; cursor: pointer; position: relative; }
.es-radio input { position: absolute; opacity: 0; pointer-events: none; }
.es-radio span {
  display: flex; align-items: center; justify-content: center; min-height: 44px; border: 1px solid #dde3db; border-radius: 8px;
  font-size: .9rem; font-weight: 550; color: #506652; background: #fff;
}
.es-radio input:checked + span { border-color: var(--premium-accent); background: var(--premium-accent-soft); color: var(--premium-accent); box-shadow: inset 0 0 0 1px var(--premium-accent); }
.es-radio input:focus-visible + span { outline: 2px solid #547b42; outline-offset: 2px; }

.es-check, .es-field label.es-check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 14px; font-size: .84rem; font-weight: 450; cursor: pointer; }
.es-check input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--premium-accent); }
.es-check-inline { margin: 10px 0 0; }
.es-check.has-error { color: var(--premium-danger); }

.es-picked { margin: 8px 0 0; padding: 8px 10px; border-radius: 7px; background: var(--premium-accent-soft); color: var(--premium-accent); font-size: .82rem; font-weight: 550; }

/* ---- Buttons ------------------------------------------------------------- */
.es-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border: 1px solid #dde3db; border-radius: 8px; background: #fff; color: #506652;
  font: inherit; font-weight: 550; text-decoration: none; cursor: pointer;
  transition: background .12s, border-color .12s, transform .06s;
}
.es-btn:hover { border-color: #b9cdbd; background: #f7f9f5; }
.es-btn:active { transform: translateY(1px); }
.es-btn:disabled { opacity: .55; cursor: progress; }
.es-btn-primary {
  background: var(--premium-accent); border-color: var(--premium-accent); color: #fff; font-weight: 600;
  box-shadow: 0 2px 3px rgba(28,57,43,.10), inset 0 1px 0 rgba(255,255,255,.08);
}
.es-btn-primary:hover { background: var(--premium-accent-dark); border-color: var(--premium-accent-dark); }
.es-btn-block { width: 100%; margin-top: 6px; }
.es-btn:focus-visible { outline: 2px solid #547b42; outline-offset: 2px; }
.es-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin: 18px 0 0; }
.es-actions-split { justify-content: space-between; }
@media (max-width: 520px) { .es-actions .es-btn { flex: 1 1 100%; } }
.es-or { margin: 4px 0 18px; }
.es-or .es-btn { width: 100%; }

/* ---- Messages ------------------------------------------------------------ */
.es-flash { padding: 11px 14px; border-radius: 9px; font-size: .86rem; font-weight: 550; }
.es-flash-ok { background: var(--premium-accent-soft); color: var(--premium-accent); }
.es-flash-error { background: var(--premium-danger-soft); color: var(--premium-danger); }
.es-card .es-flash { margin-bottom: 16px; }

.es-status { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 9px; font-size: .88rem; }
.es-status .es-ico { margin-top: 2px; }
.es-status p { margin: 3px 0 0; }
.es-status-wait { background: var(--premium-warning-soft); color: #5f4f2f; }
.es-status-error { background: var(--premium-danger-soft); color: var(--premium-danger); margin-bottom: 14px; }

.es-callout { display: flex; gap: 10px; align-items: flex-start; margin-top: 4px; padding: 10px 12px; border-radius: 8px; background: var(--premium-warning-soft); color: var(--premium-warning); font-size: .82rem; }

.es-checklist { margin: 0 0 18px; padding-left: 18px; color: var(--premium-muted); font-size: .86rem; }
.es-checklist li + li { margin-top: 4px; }

/* ---- Summary lists --------------------------------------------------------- */
.es-dl { margin: 0; padding: 2px 14px; border: 1px solid var(--secondary-line); border-radius: 9px; background: var(--secondary-bg); }
.es-dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--premium-line); }
.es-dl > div:last-child { border-bottom: 0; }
.es-dl dt { color: var(--premium-muted); font-size: .76rem; white-space: nowrap; }
.es-dl dd { margin: 0; font-weight: 600; font-size: .82rem; text-align: right; overflow-wrap: anywhere; }
.es-edit { margin-left: 4px; font-size: .72rem; font-weight: 600; }

.es-meds { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.es-meds li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 9px; background: var(--premium-soft); }
.es-meds .es-ico { color: var(--premium-accent); margin-top: 2px; }
.es-meds strong { display: block; font-size: .86rem; line-height: 1.35; }
.es-meds span, .es-meds small { display: block; color: var(--premium-muted); font-size: .76rem; }

.es-choice-box { display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--premium-accent); border-radius: 9px; background: var(--premium-accent-soft); }
.es-choice-box strong { color: var(--premium-accent); }
.es-choice-box span { color: #506652; font-size: .84rem; }

.es-how { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.es-how li { display: flex; gap: 12px; align-items: flex-start; }
.es-how-n { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 7px; background: var(--premium-accent-soft); color: var(--premium-accent); font-size: .74rem; font-weight: 650; }
.es-how strong { font-size: .88rem; }
.es-how p { margin: 1px 0 0; color: var(--premium-muted); font-size: .8rem; }

/* ---- Pharmacies ------------------------------------------------------------ */
.es-dc { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; background: #00843d; color: #fff; font-size: .66rem; font-weight: 700; letter-spacing: 0; }
.es-pharms { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.es-pharm { padding: 12px; border: 1px solid #e2e7df; border-radius: 10px; }
.es-pharm-name { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; font-weight: 600; font-size: .9rem; }
.es-pharm-name .es-ico { color: var(--premium-accent); width: 16px; height: 16px; }
.es-pharm-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.es-pharm-actions form { margin: 0; }
.es-pharm-btn { width: 100%; justify-content: flex-start; text-align: left; padding: 10px 14px; min-height: 58px; }
.es-pharm-btn .es-ico { color: var(--premium-accent); }
.es-pharm-btn strong { display: block; color: var(--premium-ink); font-size: .88rem; }
.es-pharm-btn small { display: block; color: var(--premium-muted); font-size: .72rem; font-weight: 450; }

/* ---- Sent / status ------------------------------------------------------------ */
.es-done-mark {
  width: 52px; height: 52px; margin: 0 auto 12px; display: grid; place-items: center;
  border-radius: 50%; background: var(--premium-accent-soft); color: var(--premium-accent);
}
.es-done-mark svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 24; stroke-dashoffset: 24; animation: es-draw .45s .15s ease-out forwards; }
@keyframes es-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .es-done-mark svg { animation: none; stroke-dashoffset: 0; } }
.es-order { display: inline-grid; gap: 2px; margin-top: 4px; padding: 12px 22px; border: 1px dashed #9fbaa6; border-radius: 10px; background: var(--secondary-bg); }
.es-order span { font-size: .66rem; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--premium-muted); }
.es-order strong { font-size: 1.35rem; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.es-next { margin: 0; padding-left: 20px; font-size: .88rem; }
.es-next li + li { margin-top: 6px; }

.es-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.es-timeline li { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--secondary-line); border-radius: 9px; background: var(--secondary-bg); }
.es-timeline .es-ico { color: var(--premium-accent); margin-top: 2px; }
.es-timeline strong { display: block; font-size: .88rem; }
.es-timeline small { display: block; color: var(--premium-muted); font-size: .76rem; }
.es-pill { display: inline-block; margin: 6px 6px 0 0; padding: 2px 9px; border-radius: 999px; background: var(--premium-accent-soft); color: var(--premium-accent); font-size: .74rem; font-weight: 600; }
.es-pill-muted { background: var(--premium-soft); color: var(--premium-muted); }
.es-timeline .es-pill + small { display: inline; }

/* ---- Help --------------------------------------------------------------------- */
.es-faq-item { border-top: 1px solid var(--premium-line); }
.es-faq-item:first-of-type { border-top: 0; }
.es-faq-item summary {
  display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; cursor: pointer; list-style: none;
  font-size: .86rem; font-weight: 600;
}
.es-faq-item summary::-webkit-details-marker { display: none; }
.es-faq-item summary::after { content: "+"; color: var(--premium-muted); font-weight: 500; }
.es-faq-item[open] summary::after { content: "\2212"; }
.es-faq-item summary:focus-visible { outline: 2px solid #547b42; outline-offset: 2px; border-radius: 4px; }
.es-faq-item p { margin: 0 0 12px; color: #506652; font-size: .82rem; }

.es-support { padding: 0 6px; }
.es-disclosure { border-bottom: 1px solid var(--premium-line); }
.es-disclosure > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 52px; padding: 12px 2px; list-style: none; cursor: pointer;
  color: var(--premium-accent); font-size: .9rem; font-weight: 550;
}
.es-disclosure > summary::-webkit-details-marker { display: none; }
.es-disclosure > summary::after {
  content: ""; width: 7px; height: 7px; flex: none; margin-right: 5px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}
.es-disclosure[open] > summary::after { transform: rotate(225deg) translate(-2px, -1px); }
.es-disclosure > summary:focus-visible { outline: 2px solid var(--premium-accent); outline-offset: 3px; border-radius: 4px; }
.es-disclosure-body { padding: 4px 2px 20px; }
.es-disclosure-body > .es-card { padding: 0; border: 0; border-radius: 0; box-shadow: none; background: none; animation: none; }
.es-disclosure-body > .es-contact { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--premium-line); }
.es-faq-item summary { min-height: 44px; align-items: center; }
.es-faq-item summary::after { flex: none; }

.es-contact-name { margin-bottom: 6px; font-weight: 600; font-size: .9rem; }
.es-contact-line { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: .86rem; font-weight: 550; text-decoration: none; overflow-wrap: anywhere; }
.es-contact-line .es-ico { width: 16px; height: 16px; }

.es-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 5px; margin-top: 28px; text-align: center; color: var(--premium-muted); font-size: .7rem; }
.es-foot .es-ico { width: 13px; height: 13px; }
.pw-link { color: inherit; text-decoration: underline; text-decoration-color: rgba(138, 148, 142, .45); text-underline-offset: 2px; }
.pw-link:hover { color: #245b4b; }

/* Google Places dropdown in the premium palette */
.pac-container { border-radius: 8px; border: 1px solid #e2e7df; box-shadow: 0 12px 30px -18px rgba(31,56,32,.35); font-family: inherit; }
.pac-item { padding: 6px 10px; }
