/* ==========================================================================
   Sign-in, registration and the patient account.
   Builds on yh-site.css (tokens + .yh-* classes). Prefix: ac-.
   Components yh-site.css does not have, implemented here: .ac-auth card shell,
   .ac-shell account layout + nav, .ac-stat tiles, .ac-panel, .ac-list, .ac-tl timeline,
   .ac-kv key/value grid, .ac-skel loading skeleton, .ac-code one-time-code input.
   ========================================================================== */

/* ---- sign-in / registration card */
.ac-auth { background: var(--hv-bg); padding: 36px 0 56px; min-height: 52vh; }
.ac-auth__card { max-width: 440px; margin: 0 auto; }
.ac-auth__card--wide { max-width: 560px; }
.ac-auth__card .yh-card__body { padding: 24px; }
.ac-auth__title { font-size: 18px; font-weight: 700; color: var(--hv-navy); margin: 0 0 4px; }
.ac-auth__sub { font-size: 13px; color: var(--hv-muted); margin: 0 0 18px; }
.ac-auth__alt { text-align: center; font-size: 13px; color: var(--hv-muted); margin: 16px 0 0; }
.ac-auth__alt a { color: var(--hv-blue); font-weight: 600; text-decoration: none; }
.ac-auth__alt a:hover { text-decoration: underline; }
.ac-auth__foot { border-top: 1px solid var(--hv-line); padding: 12px 24px; font-size: 12.5px; color: var(--hv-muted); background: #fafcff; text-align: center; }
.ac-auth .yh-notice { margin-bottom: 14px; }
.ac-code { text-align: center; font-size: 22px; letter-spacing: .45em; font-weight: 600; padding-left: calc(12px + .45em); }
.ac-divider { display: flex; align-items: center; gap: 10px; color: var(--hv-muted); font-size: 12px; margin: 16px 0; }
.ac-divider::before, .ac-divider::after { content: ""; flex: 1; height: 1px; background: var(--hv-line); }
.ac-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; }
.ac-linkbtn { background: none; border: 0; padding: 0; color: var(--hv-blue); font-weight: 600; font-size: 13px; cursor: pointer; }
.ac-linkbtn:hover { text-decoration: underline; }
.ac-linkbtn:focus-visible { outline: 2px solid var(--hv-blue); outline-offset: 2px; }
.ac-input-err, .yh-input.is-invalid { border-color: var(--hv-red); }
.ac-auth .yh-btn { padding: 11px 16px; }
.hidden { display: none !important; }
/* JS-built status messages used by the Firebase sign-in scripts */
.message { padding: 10px 12px; border-radius: 6px; margin-bottom: 14px; font-size: 13px; border: 1px solid transparent; }
.message.success { background: var(--hv-green-50); color: #08793f; border-color: #bfe9d1; }
.message.error { background: var(--hv-red-50); color: #b4232f; border-color: #f5c2c7; }
.message.info { background: var(--hv-blue-50); color: #0a4fbf; border-color: #c9d8f0; }
#recaptcha-container { margin: 12px 0; min-height: 0; }

/* ---- account shell */
.ac-shell { background: var(--hv-bg); padding: 22px 0 48px; }
.ac-nav { background: #fff; border: 1px solid var(--hv-line); border-radius: var(--hv-radius); overflow: hidden; }
.ac-nav__user { display: flex; align-items: center; gap: 10px; padding: 14px; border-bottom: 1px solid var(--hv-line); }
.ac-nav__name { font-weight: 700; color: var(--hv-navy); font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.ac-nav__mail { font-size: 12px; color: var(--hv-muted); overflow-wrap: anywhere; }
.ac-nav__list { list-style: none; margin: 0; padding: 6px; }
.ac-nav__list a, .ac-nav__list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 6px; font-size: 13.5px; color: var(--hv-text); text-decoration: none; text-align: left; cursor: pointer; }
.ac-nav__list i { width: 16px; text-align: center; color: #8a99ae; font-size: 13px; }
.ac-nav__list a:hover, .ac-nav__list button:hover { background: var(--hv-bg); color: var(--hv-blue); }
.ac-nav__list a.is-active { background: var(--hv-blue-50); color: var(--hv-blue); font-weight: 600; }
.ac-nav__list a.is-active i { color: var(--hv-blue); }
.ac-nav__list a:focus-visible, .ac-nav__list button:focus-visible { outline: 2px solid var(--hv-blue); outline-offset: -2px; }
.ac-nav__count { margin-left: auto; background: var(--hv-red); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.ac-nav__sep { height: 1px; background: var(--hv-line); margin: 6px 4px; }
.ac-main { min-width: 0; }
.ac-main > * + * { margin-top: 16px; }
.ac-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ac-title h2 { font-size: 18px; font-weight: 700; color: var(--hv-navy); margin: 0; }
.ac-title p { font-size: 13px; color: var(--hv-muted); margin: 3px 0 0; }

/* ---- panels */
.ac-panel { background: #fff; border: 1px solid var(--hv-line); border-radius: var(--hv-radius); }
.ac-panel__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--hv-line); }
.ac-panel__head h3 { font-size: 14px; font-weight: 700; color: var(--hv-navy); margin: 0; }
.ac-panel__head a { font-size: 12.5px; font-weight: 600; color: var(--hv-blue); text-decoration: none; white-space: nowrap; }
.ac-panel__head a:hover { text-decoration: underline; }
.ac-panel__body { padding: 16px; }
.ac-panel__body > .yh-empty { margin: 0; }
.ac-panel__body--flush { padding: 0; }
.ac-panel .yh-table-wrap { border: 0; border-radius: 0 0 var(--hv-radius) var(--hv-radius); }

/* ---- stat tiles */
.ac-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ac-stat { display: block; background: #fff; border: 1px solid var(--hv-line); border-radius: var(--hv-radius); padding: 14px; text-decoration: none; color: inherit; }
a.ac-stat:hover { border-color: #c9d8f0; }
a.ac-stat:focus-visible { outline: 2px solid var(--hv-blue); outline-offset: 2px; }
.ac-stat__label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--hv-muted); }
.ac-stat__value { font-size: 24px; font-weight: 700; color: var(--hv-navy); line-height: 1.2; margin-top: 4px; overflow-wrap: anywhere; }
.ac-stat__value--sm { font-size: 16px; }
.ac-stat__hint { font-size: 12px; color: var(--hv-muted); margin-top: 3px; }
.ac-stat--alert { border-color: #f3dcb0; background: var(--hv-amber-50); }
.ac-stat--alert .ac-stat__value { color: var(--hv-amber); }

/* ---- lists */
.ac-list { list-style: none; margin: 0; padding: 0; }
.ac-list > li { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--hv-line); }
.ac-list > li:last-child { border-bottom: 0; }
.ac-list > li.is-unread { background: #f8fbff; box-shadow: inset 3px 0 0 var(--hv-blue); }
.ac-list__main { flex: 1; min-width: 0; }
.ac-list__title { font-weight: 600; color: var(--hv-ink); font-size: 13.5px; overflow-wrap: anywhere; }
.ac-list__sub { font-size: 12.5px; color: var(--hv-muted); margin-top: 2px; overflow-wrap: anywhere; }
.ac-list__aside { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ac-date { width: 96px; flex: none; font-size: 12.5px; color: var(--hv-muted); }

/* ---- timeline */
.ac-tl { list-style: none; margin: 0; padding: 4px 16px 4px 16px; }
.ac-tl > li { position: relative; display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 12px; padding: 12px 0 12px 20px; border-bottom: 1px solid var(--hv-line); }
.ac-tl > li:last-child { border-bottom: 0; }
.ac-tl > li::before { content: ""; position: absolute; left: 0; top: 18px; width: 9px; height: 9px; border-radius: 50%; background: #fff; border: 2px solid var(--hv-blue); }
.ac-tl > li.is-past::before { background: var(--hv-blue); }
.ac-tl > li.is-next { background: #f8fbff; margin: 0 -16px; padding-left: 36px; padding-right: 16px; }
.ac-tl > li.is-next::before { left: 16px; }

/* ---- key / value grid */
.ac-kv { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 0; }
.ac-kv dt { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--hv-muted); margin-bottom: 3px; }
.ac-kv dd { margin: 0; font-size: 14px; font-weight: 600; color: var(--hv-ink); overflow-wrap: anywhere; }
.ac-kv dd small { display: block; font-weight: 400; font-size: 12px; color: var(--hv-muted); }

/* ---- forms inside the account */
.ac-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.ac-form-grid .is-full { grid-column: 1 / -1; }
.ac-form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.ac-inline-form { display: inline; margin: 0; }
.ac-share { display: grid; grid-template-columns: minmax(0, 1fr) 90px auto; gap: 8px; margin-top: 10px; align-items: end; }
.ac-share .yh-label { margin-bottom: 3px; }
.ac-photo { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.ac-prefs td, .ac-prefs th { text-align: center; }
.ac-prefs td:first-child, .ac-prefs th:first-child { text-align: left; }
.ac-prefs input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--hv-blue); }
.ac-share-url { display: flex; gap: 8px; }
.ac-code-big { font-size: 26px; font-weight: 700; letter-spacing: .25em; color: var(--hv-navy); margin: 0 0 10px; overflow-wrap: anywhere; }

/* ---- loading skeleton (shown while a panel is replaced, and for aria-busy forms) */
.ac-skel { display: block; height: 14px; border-radius: 4px; background: #eef2f8; margin: 8px 0; }
[aria-busy="true"] { opacity: .7; pointer-events: none; }

@media (max-width: 991px) {
    .ac-nav { position: static; }
    .ac-nav__user { display: none; }
    .ac-nav__list { display: flex; gap: 2px; overflow-x: auto; padding: 4px; -webkit-overflow-scrolling: touch; }
    .ac-nav__list li { flex: none; }
    .ac-nav__list a, .ac-nav__list button { padding: 8px 12px; white-space: nowrap; }
    .ac-nav__sep { display: none; }
    .ac-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ac-kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .ac-auth { padding: 20px 0 36px; }
    .ac-auth__card .yh-card__body { padding: 18px; }
    .ac-form-grid { grid-template-columns: 1fr; }
    .ac-tl > li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
    .ac-date { width: auto; }
    .ac-list > li { flex-wrap: wrap; }
    .ac-share { grid-template-columns: minmax(0, 1fr) 80px; }
    .ac-share .yh-btn { grid-column: 1 / -1; }
    .ac-row { grid-template-columns: 100px minmax(0, 1fr); }
    .ac-stat__value { font-size: 20px; }
}

/* ---- Firebase sign-in helpers (tabs toggled by script with .active, busy overlay) */
.yh-tabs .tab-btn.active { color: var(--hv-blue); border-bottom-color: var(--hv-blue); font-weight: 600; }
.yh-tabs .tab-btn { cursor: pointer; }
.ac-overlay { position: fixed; inset: 0; background: rgba(255, 255, 255, .7); display: flex; align-items: center; justify-content: center; z-index: 2000; }
.ac-spinner { width: 28px; height: 28px; border: 3px solid var(--hv-line); border-top-color: var(--hv-blue); border-radius: 50%; animation: ac-spin .8s linear infinite; }
@keyframes ac-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ac-spinner { animation: none; } }

.iti { width: 100%; }

.ac-shell .yh-layout > * { min-width: 0; }
.ac-nav { max-width: 100%; }
