/* ============================================================================
   Magic Link (anonymous patient surface) — SAMS Voice AI design tokens.
   Source of truth: design_handoff_magic_link (hifi prototype). Scoped under
   .mlk-page so nothing leaks into the authenticated portal styles.
   Fonts: Plus Jakarta Sans (UI) + Spline Sans Mono (codes/timers) — loaded by
   AuthLayout via <HeadContent>. Keep every asset in a wwwroot SUBFOLDER: the
   bare /{code} route swallows root-level static files.
   ============================================================================ */

.mlk-page {
    --mlk-primary: #1976D2;
    --mlk-primary-deep: #0D47A1;
    --mlk-danger: #D93025;
    --mlk-danger-hover: #B3261E;
    --mlk-danger-bg: #FDECEA;
    --mlk-danger-border: #F4C7C3;
    --mlk-success: #34A853;
    --mlk-warn: #B45309;
    --mlk-warn-bg: #FDF3E3;
    --mlk-card-border: #E1E8F0;
    --mlk-ctl-border: #D7E1EC;
    --mlk-subtle-border: #C5D3E3;
    --mlk-text: #1C2733;
    --mlk-text-2: #4E5D6C;
    --mlk-text-3: #64748B;
    --mlk-text-4: #93A3B5;
    --mlk-muted-panel: #ECF2F9;
    --mlk-muted-panel-2: #F5F8FC;
    --mlk-key-bg: #EAF1F8;
    --mlk-shadow: 0 10px 24px -18px rgba(23, 43, 77, 0.35);
    --mlk-shadow-web: 0 14px 30px -22px rgba(23, 43, 77, 0.35);

    min-height: 100vh;
    background: linear-gradient(160deg, #EAF1F8 0%, #E3EBF5 55%, #D8E4F2 100%);
    color: var(--mlk-text);
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
}

.mlk-mono { font-family: 'Spline Sans Mono', 'JetBrains Mono', monospace; }

.mlk-wrap { max-width: 720px; margin: 0 auto; padding: 18px 18px 64px; }
@media (min-width: 641px) { .mlk-wrap { padding-top: 30px; } }
.mlk-narrow { max-width: 480px; }

/* ---------- top bar: brand + secure pill + agent presence ----------
   Phone: transparent row on the gradient. Desktop: persistent full-width white
   bar spanning the window (per the prototype's ChromeWindow view). */
.mlk-topbar-outer { padding: 0 18px; }
.mlk-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 2px 6px; flex-wrap: wrap; }
@media (min-width: 641px) {
    .mlk-topbar-outer { background: #fff; border-bottom: 1px solid var(--mlk-card-border); padding: 0 28px; }
    .mlk-topbar { max-width: 1040px; margin: 0 auto; padding: 13px 0; }
}
.mlk-brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 17px; }
.mlk-brand-avatar {
    width: 28px; height: 28px; border-radius: 9px; background: linear-gradient(135deg, #1E88E5, #1565C0);
    color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 800;
}
.mlk-secure-pill {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px;
    background: #fff; border: 1px solid var(--mlk-ctl-border); color: var(--mlk-text-2); font-size: 12px; font-weight: 600;
}
.mlk-agent-banner {
    display: flex; align-items: center; gap: 8px; margin: 10px 0 0; padding: 8px 14px; border-radius: 12px;
    background: #E3F2FD; border: 1px solid #90CAF9; color: #0D47A1; font-size: 13px; font-weight: 600;
}
.mlk-agent-banner .mlk-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mlk-success); flex: 0 0 auto; }

/* ---------- headings & screen entry ---------- */
.mlk-screen { animation: mlk-fadeUp .28s ease both; }
.mlk-h1 { font-size: 27px; font-weight: 700; margin: 18px 0 14px; letter-spacing: -0.01em; }
@media (min-width: 641px) { .mlk-h1 { font-size: 34px; } }

/* ---------- cards ---------- */
.mlk-card {
    background: #fff; border: 1px solid var(--mlk-card-border); border-radius: 18px;
    box-shadow: var(--mlk-shadow); padding: 20px;
}
@media (min-width: 641px) { .mlk-card { border-radius: 20px; box-shadow: var(--mlk-shadow-web); padding: 24px; } }
.mlk-divider { border: 0; border-top: 1px solid var(--mlk-card-border); margin: 16px 0; }

/* ---------- appointment card: date badge + time ---------- */
.mlk-appt-head { display: flex; gap: 16px; align-items: center; }
.mlk-datebadge {
    width: 64px; flex: 0 0 auto; border: 1px solid var(--mlk-ctl-border); border-radius: 13px; overflow: hidden;
    text-align: center; background: #fff;
}
@media (min-width: 641px) { .mlk-datebadge { width: 78px; } }
.mlk-datebadge .mlk-mon {
    display: block; background: var(--mlk-primary); color: #fff; font-size: 10.5px; font-weight: 700;
    letter-spacing: 0.12em; padding: 3px 0; text-transform: uppercase;
}
.mlk-datebadge .mlk-day { display: block; font-size: 26px; font-weight: 800; line-height: 1.25; padding-top: 2px; }
@media (min-width: 641px) { .mlk-datebadge .mlk-day { font-size: 30px; } }
.mlk-datebadge .mlk-dow { display: block; font-size: 11px; font-weight: 600; color: var(--mlk-text-3); padding-bottom: 5px; text-transform: uppercase; }
.mlk-appt-time { font-size: 21px; font-weight: 700; }
.mlk-appt-meta { color: var(--mlk-text-2); font-size: 13.5px; margin-top: 3px; }

/* ---------- location row ---------- */
.mlk-loc { display: flex; gap: 10px; align-items: flex-start; }
.mlk-loc-name { font-weight: 700; font-size: 14.5px; }
.mlk-loc-addr { color: var(--mlk-text-3); font-size: 13px; margin-top: 1px; }
.mlk-link-btn { background: none; border: 0; padding: 0; color: var(--mlk-primary); font-weight: 700; font-size: 13.5px; cursor: pointer; font-family: inherit; text-decoration: none; }
.mlk-link-btn:hover { color: var(--mlk-primary-deep); }
.mlk-loc .mlk-link-btn { margin-left: auto; flex: 0 0 auto; }

/* ---------- add to calendar ---------- */
.mlk-cal-label { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mlk-text-4); margin-bottom: 9px; }
.mlk-cal-row { display: flex; gap: 10px; }
.mlk-cal-btn {
    flex: 1; text-align: center; padding: 10px 0; border-radius: 12px; border: 1px solid var(--mlk-ctl-border);
    background: var(--mlk-muted-panel-2); color: var(--mlk-text-2); font-weight: 700; font-size: 13.5px;
    text-decoration: none; cursor: pointer; font-family: inherit;
}
.mlk-cal-btn:hover { background: var(--mlk-muted-panel); }

/* ---------- buttons ---------- */
.mlk-btn {
    display: block; width: 100%; padding: 14px 18px; border-radius: 13px; border: 0; cursor: pointer;
    font-family: inherit; font-size: 15.5px; font-weight: 700; text-align: center; text-decoration: none;
}
.mlk-btn-primary { background: var(--mlk-primary); color: #fff; }
.mlk-btn-primary:hover { background: var(--mlk-primary-deep); }
.mlk-btn-danger { background: var(--mlk-danger); color: #fff; }
.mlk-btn-danger:hover { background: var(--mlk-danger-hover); }
.mlk-btn-danger-outline { background: #fff; color: var(--mlk-danger); border: 1px solid var(--mlk-danger-border); }
.mlk-btn-danger-outline:hover { background: var(--mlk-danger-bg); }
.mlk-btn-outline { background: #fff; color: var(--mlk-text-2); border: 1px solid var(--mlk-ctl-border); }
.mlk-btn-outline:hover { background: var(--mlk-muted-panel-2); }
.mlk-btn-text { background: none; color: var(--mlk-text-3); border: 0; font-weight: 600; }
.mlk-btn-text:hover { color: var(--mlk-text); }
.mlk-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
@media (min-width: 641px) { .mlk-actions { flex-direction: row; } .mlk-actions .mlk-btn { flex: 1; } }

/* ---------- privacy footnote / info boxes ---------- */
.mlk-privacy {
    margin-top: 16px; padding: 13px 15px; border: 1.5px dashed var(--mlk-subtle-border); border-radius: 13px;
    color: var(--mlk-text-3); font-size: 12.5px; line-height: 1.55;
}
.mlk-infobox {
    margin-top: 16px; padding: 13px 15px; border-radius: 13px; background: var(--mlk-muted-panel);
    color: var(--mlk-text-2); font-size: 13.5px; line-height: 1.55;
}
.mlk-warnbox { margin-top: 14px; padding: 12px 15px; border-radius: 13px; background: var(--mlk-warn-bg); color: #8F5A0B; font-size: 13px; line-height: 1.5; }
.mlk-cancelled-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px;
    background: var(--mlk-danger-bg); color: var(--mlk-danger); font-size: 12.5px; font-weight: 700;
}

/* ---------- empty state (screen B) ---------- */
.mlk-empty { text-align: center; padding: 30px 18px; }
.mlk-empty .mlk-empty-icon { font-size: 42px; color: var(--mlk-primary); margin-bottom: 8px; }
.mlk-empty h2 { font-size: 21px; font-weight: 700; margin: 6px 0 8px; }
.mlk-empty p { color: var(--mlk-text-2); font-size: 14.5px; line-height: 1.55; margin: 0 0 18px; }

/* ---------- verified chip ---------- */
.mlk-verified-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 99px;
    background: #E4EFE7; color: #1E7B3C; font-size: 12.5px; font-weight: 700; margin-bottom: 12px;
}

/* ---------- back affordance ---------- */
.mlk-back {
    display: inline-flex; align-items: center; gap: 5px; background: none; border: 0; cursor: pointer; padding: 4px 6px 4px 0;
    color: var(--mlk-text-2); font-family: inherit; font-size: 14px; font-weight: 700;
}
.mlk-back:hover { color: var(--mlk-text); }

/* ---------- schedule picker (screen D) ---------- */
.mlk-held { color: var(--mlk-text-2); font-size: 13.5px; margin: 2px 0 14px; }
.mlk-datechips { display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 10px; }
.mlk-datechip {
    flex: 0 0 auto; min-width: 74px; text-align: center; padding: 9px 12px; border-radius: 13px; cursor: pointer;
    background: #fff; border: 1px solid var(--mlk-card-border); font-family: inherit;
}
.mlk-datechip .mlk-chip-dow { display: block; font-size: 11px; font-weight: 600; opacity: .75; }
.mlk-datechip .mlk-chip-label { display: block; font-size: 16px; font-weight: 700; margin-top: 2px; }
@media (min-width: 641px) { .mlk-datechip .mlk-chip-label { font-size: 17px; } }
.mlk-datechip.selected { background: var(--mlk-primary); border-color: var(--mlk-primary); color: #fff; }
.mlk-slotgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 8px; }
@media (min-width: 641px) { .mlk-slotgrid { grid-template-columns: repeat(4, 1fr); } }
.mlk-slot {
    padding: 12px 6px; border-radius: 12px; border: 1px solid var(--mlk-ctl-border); background: #fff;
    font-family: inherit; font-size: 14px; font-weight: 700; color: var(--mlk-text-2); cursor: pointer; text-align: center;
}
.mlk-slot.selected { background: var(--mlk-primary); border-color: var(--mlk-primary); color: #fff; }
.mlk-sticky-confirm { position: sticky; bottom: 0; padding: 14px 0 6px; background: linear-gradient(transparent, #E3EBF5 35%); }
.mlk-btn-disabled { background: var(--mlk-subtle-border) !important; color: #6B7A8C !important; cursor: default !important; }

/* ---------- cancel screen (screen E) ---------- */
.mlk-reason-label { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mlk-text-4); margin: 16px 0 9px; }
.mlk-reason-chips { display: flex; gap: 9px; flex-wrap: wrap; }
.mlk-reason-chip {
    padding: 8px 14px; border-radius: 99px; border: 1px solid var(--mlk-ctl-border); background: var(--mlk-muted-panel-2);
    color: var(--mlk-text-2); font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.mlk-reason-chip.selected { border-color: var(--mlk-primary); color: var(--mlk-primary); background: #E3F2FD; }
.mlk-summary { font-weight: 700; font-size: 15.5px; }
.mlk-summary-sub { color: var(--mlk-text-3); font-size: 13.5px; margin-top: 2px; }

/* ---------- done screen (screen F) ---------- */
.mlk-done { text-align: center; padding-top: 26px; }
.mlk-done-icon {
    width: 62px; height: 62px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: 32px; margin-bottom: 14px;
}
.mlk-done-icon.green { background: var(--mlk-success); }
.mlk-done-icon.grey { background: var(--mlk-text-3); }
.mlk-done h1 { font-size: 26px; font-weight: 800; margin: 0 0 16px; }
.mlk-done .mlk-card { text-align: center; }
.mlk-revokebox { margin: 16px 0; padding: 13px 15px; border-radius: 13px; background: var(--mlk-muted-panel); color: var(--mlk-text-2); font-size: 13.5px; line-height: 1.55; text-align: left; }

/* ---------- error screen (screen G) ---------- */
.mlk-error { text-align: center; padding-top: 30px; }
.mlk-error .mlk-error-icon { font-size: 46px; color: var(--mlk-warn); margin-bottom: 10px; }
.mlk-error h1 { font-size: 24px; font-weight: 800; margin: 0 0 10px; }
@media (min-width: 641px) { .mlk-error h1 { font-size: 27px; } }
.mlk-error p { color: var(--mlk-text-2); font-size: 14.5px; line-height: 1.6; margin: 0 auto 18px; max-width: 420px; }
.mlk-helpbox { padding: 13px 15px; border-radius: 13px; background: var(--mlk-muted-panel); color: var(--mlk-text-2); font-size: 13.5px; line-height: 1.55; }

/* ---------- OTP step-up (screen C): bottom sheet on mobile, modal on web ---------- */
.mlk-overlay { position: fixed; inset: 0; background: rgba(13, 27, 51, 0.45); z-index: 1300; display: flex; align-items: flex-end; justify-content: center; }
.mlk-sheet {
    background: #fff; width: 100%; border-radius: 26px 26px 0 0; padding: 12px 22px 26px;
    animation: mlk-sheetUp .32s cubic-bezier(.3,.9,.4,1) both; max-height: 92vh; overflow-y: auto;
}
.mlk-sheet-handle { width: 42px; height: 5px; border-radius: 99px; background: var(--mlk-ctl-border); margin: 0 auto 14px; }
@media (min-width: 641px) {
    .mlk-overlay { align-items: center; padding: 16px; }
    .mlk-sheet { width: 410px; border-radius: 22px; padding: 24px 26px 26px; animation: mlk-fadeUp .28s ease both; }
    .mlk-sheet-handle { display: none; }
}
.mlk-otp-h2 { font-size: 20px; font-weight: 800; margin: 0 0 6px; text-align: center; }
.mlk-otp-body { color: var(--mlk-text-2); font-size: 13.5px; line-height: 1.55; text-align: center; margin: 0 0 16px; }
.mlk-otp-center { text-align: center; padding: 26px 0; color: var(--mlk-text-2); font-size: 14px; }

.mlk-otp-boxes { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.mlk-otp-boxes.shake { animation: mlk-shake .4s both; }
.mlk-otp-box {
    width: 44px; height: 56px; border-radius: 13px; border: 1.5px solid var(--mlk-ctl-border);
    display: inline-flex; align-items: center; justify-content: center;
    font-family: 'Spline Sans Mono', monospace; font-size: 24px; font-weight: 700;
}
@media (min-width: 380px) { .mlk-otp-box { width: 48px; height: 60px; } }
.mlk-otp-box.active { border-color: var(--mlk-primary); }
.mlk-otp-box.error { border-color: var(--mlk-danger); }

.mlk-otp-error { color: var(--mlk-danger); font-size: 13px; font-weight: 600; text-align: center; margin: 4px 0 8px; }
.mlk-otp-expired { color: var(--mlk-warn); font-size: 13px; font-weight: 600; text-align: center; margin: 4px 0 8px; }
.mlk-otp-ttl { color: var(--mlk-text-3); font-size: 13px; text-align: center; margin: 4px 0 12px; }
.mlk-otp-kbdhint { display: none; color: var(--mlk-text-4); font-size: 12px; text-align: center; margin-bottom: 8px; }
@media (min-width: 641px) { .mlk-otp-kbdhint { display: block; } }

.mlk-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 0 auto; }
@media (min-width: 641px) { .mlk-keypad { max-width: 280px; } }
.mlk-key {
    padding: 13px 0; border-radius: 12px; border: 0; background: var(--mlk-key-bg); cursor: pointer;
    font-family: inherit; font-size: 19px; font-weight: 700; color: var(--mlk-text);
}
.mlk-key:hover { background: var(--mlk-muted-panel); }
.mlk-key.mlk-key-blank { background: transparent; cursor: default; }
.mlk-key.mlk-key-del { background: transparent; }

.mlk-otp-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.mlk-resend { background: none; border: 0; cursor: pointer; font-family: inherit; font-size: 13.5px; font-weight: 700; color: var(--mlk-primary); }
.mlk-resend:disabled { color: #A6B4C4; cursor: default; }

.mlk-otp-fail-icon, .mlk-otp-lock-icon, .mlk-otp-sms-icon {
    width: 54px; height: 54px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-size: 28px; margin-bottom: 12px;
}
.mlk-otp-fail-icon { background: var(--mlk-danger-bg); color: var(--mlk-danger); }
.mlk-otp-lock-icon { background: var(--mlk-warn-bg); color: var(--mlk-warn); }
.mlk-otp-sms-icon { background: #E3F2FD; color: var(--mlk-primary); }
.mlk-lock-count { font-family: 'Spline Sans Mono', monospace; font-size: 34px; font-weight: 600; color: var(--mlk-warn); margin: 10px 0; }

/* ---------- spinner ---------- */
.mlk-spinner {
    width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--mlk-ctl-border); border-top-color: var(--mlk-primary);
    animation: mlk-spin .8s linear infinite; margin: 0 auto 14px;
}
.mlk-center { display: flex; justify-content: center; align-items: center; padding: 60px 16px; }

/* ---------- animations ---------- */
@keyframes mlk-fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes mlk-sheetUp { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: translateY(0); } }
@keyframes mlk-shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
@keyframes mlk-spin { to { transform: rotate(360deg); } }
