@font-face {
    font-family: "Inter";
    src: url("../fonts/Inter-Variable.woff2") format("woff2");
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}

* { box-sizing: border-box; }

html {
    background: var(--portal-bg, #f4f7fb);
    color-scheme: light;
}

html[data-portal-theme="dark"] { color-scheme: dark; }

body {
    margin: 0;
    color: var(--portal-text, #182230);
    background: var(--portal-bg, #f4f7fb);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

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

:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--portal-primary, #3f5f92) 36%, transparent);
    outline-offset: 3px;
}

.portal-root {
    min-height: 100vh;
    color: var(--portal-text);
    background:
        radial-gradient(circle at 8% -8%, color-mix(in srgb, var(--portal-primary-soft) 70%, transparent) 0, transparent 32rem),
        var(--portal-bg);
}

.portal-root .mud-typography,
.portal-root .mud-input,
.portal-root .mud-button-root { font-family: inherit; }

.portal-root .mud-paper,
.portal-root .mud-card {
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow-sm);
}

.portal-root .mud-button-root {
    min-height: 42px;
    border-radius: var(--portal-radius-sm);
    font-weight: 650;
    letter-spacing: -.01em;
    text-transform: none;
}

.portal-root .mud-button-filled-primary {
    color: var(--portal-on-primary) !important;
    box-shadow: 0 6px 16px color-mix(in srgb, var(--portal-primary) 22%, transparent);
}

.portal-root .mud-input-control > .mud-input-control-input-container > .mud-input-label {
    color: var(--portal-text-muted);
}

.portal-root .mud-input-outlined-border { border-color: var(--portal-border); }
.portal-root .mud-input-root:hover .mud-input-outlined-border { border-color: var(--portal-primary); }

.portal-topbar {
    height: 72px;
    padding: 0 max(22px, calc((100vw - 1180px) / 2));
    border-bottom: 1px solid color-mix(in srgb, var(--portal-border) 82%, transparent);
    background: color-mix(in srgb, var(--portal-surface) 92%, transparent) !important;
    color: var(--portal-text) !important;
    backdrop-filter: blur(16px);
}

.portal-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 210px;
    color: inherit;
    text-decoration: none;
}

.portal-brand__logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 10px;
}

.portal-brand__mark {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 13px;
    color: var(--portal-on-primary);
    background: linear-gradient(145deg, var(--portal-primary), var(--portal-primary-strong));
    box-shadow: 0 7px 18px color-mix(in srgb, var(--portal-primary) 26%, transparent);
    font-size: .8rem;
    font-weight: 750;
    letter-spacing: .02em;
}

.portal-brand__copy { display: flex; flex-direction: column; line-height: 1.15; }
.portal-brand__copy strong { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
.portal-brand__copy small { margin-top: 4px; color: var(--portal-text-muted); font-size: .72rem; font-weight: 550; }

.portal-desktop-nav { display: flex; align-self: stretch; align-items: center; gap: 4px; margin: 0 auto; }

.portal-nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    padding: 0 13px;
    border-radius: 11px;
    color: var(--portal-text-muted);
    text-decoration: none;
    font-size: .88rem;
    font-weight: 620;
    transition: color .16s ease, background-color .16s ease, transform .16s ease;
}

.portal-nav-link .mud-icon-root { font-size: 1.25rem; }
.portal-nav-link:hover { color: var(--portal-primary-strong); background: var(--portal-primary-soft); }
.portal-nav-link.active { color: var(--portal-primary-strong); background: var(--portal-primary-soft); }
.portal-nav-link--book { color: var(--portal-accent-strong); }
.portal-nav-link--book:hover,
.portal-nav-link--book.active { color: var(--portal-accent-strong); background: var(--portal-accent-soft); }

.portal-topbar__actions { display: flex; align-items: center; min-width: 144px; justify-content: flex-end; }
.portal-topbar__actions .mud-icon-button { color: var(--portal-text-muted); }
.portal-notification-badge--unread .mud-icon-button { color: var(--portal-primary); }
.portal-notification-badge--unread .mud-badge { animation: portal-badge-arrive .32s ease-out; }

@keyframes portal-badge-arrive {
    0% { opacity: 0; transform: scale(.55); }
    72% { transform: scale(1.12); }
    100% { opacity: 1; transform: scale(1); }
}

.portal-main { min-height: calc(100vh - 72px); }
.portal-content { width: min(100% - 32px, 980px); margin: 0 auto; padding: 44px 0 72px; }

.portal-mobile-nav { display: none; }

.portal-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.portal-page-header__eyebrow {
    display: block;
    margin-bottom: 6px;
    color: var(--portal-primary);
    font-size: .75rem;
    font-weight: 750;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.portal-page-title { margin: 0; color: var(--portal-text); font-size: clamp(1.65rem, 4vw, 2.15rem); font-weight: 760; letter-spacing: -.035em; line-height: 1.15; }
.portal-page-subtitle { max-width: 620px; margin: 8px 0 0; color: var(--portal-text-muted); font-size: .97rem; line-height: 1.55; }

.portal-section-title { margin: 28px 0 12px; color: var(--portal-text); font-size: .78rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }

.portal-empty {
    display: grid;
    justify-items: center;
    padding: 54px 24px;
    border: 1px dashed color-mix(in srgb, var(--portal-primary) 28%, var(--portal-border));
    border-radius: var(--portal-radius-lg);
    background: color-mix(in srgb, var(--portal-surface) 88%, var(--portal-primary-soft));
    text-align: center;
}

.portal-empty__icon { display: grid; place-items: center; width: 62px; height: 62px; margin-bottom: 18px; border-radius: 20px; color: var(--portal-primary); background: var(--portal-primary-soft); }
.portal-empty__icon .mud-icon-root { font-size: 1.9rem; }
.portal-empty h2 { margin: 0 0 8px; font-size: 1.15rem; font-weight: 720; }
.portal-empty p { max-width: 430px; margin: 0 0 22px; color: var(--portal-text-muted); line-height: 1.55; }

.portal-skeleton { position: relative; overflow: hidden; min-height: 150px; margin-bottom: 14px; border: 1px solid var(--portal-border); border-radius: var(--portal-radius); background: var(--portal-surface); }
.portal-skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--portal-text) 12%, transparent), transparent); animation: portal-shimmer 1.5s infinite; }
@keyframes portal-shimmer { 100% { transform: translateX(100%); } }

.portal-public-root { padding-bottom: 48px; }
.portal-public-header { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 92px; padding: 20px 72px; }
.portal-public-header img { max-width: 180px; max-height: 54px; object-fit: contain; }
.portal-public-header__theme { position: absolute; top: 50%; right: 20px; transform: translateY(-50%); color: var(--portal-text-muted); }

.portal-badge { display: inline-flex; align-items: center; gap: 5px; min-height: 27px; padding: 4px 9px; border-radius: 999px; color: var(--portal-text-muted); background: var(--portal-surface-muted); font-size: .72rem; font-weight: 700; white-space: nowrap; }
.portal-badge .mud-icon-root { font-size: .95rem; }
.portal-badge--success { color: var(--portal-success); background: var(--portal-success-soft); }
.portal-badge--warning { color: var(--portal-warning); background: var(--portal-warning-soft); }
.portal-badge--danger { color: var(--portal-danger); background: var(--portal-danger-soft); }
.portal-badge--info { color: var(--portal-info); background: var(--portal-info-soft); }

.appointment-list { display: grid; gap: 14px; }
.appointment-card { position: relative; display: grid; grid-template-columns: 84px minmax(0, 1fr); overflow: hidden; border: 1px solid var(--portal-border); border-radius: var(--portal-radius); background: var(--portal-surface); box-shadow: var(--portal-shadow-sm); }
.appointment-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--portal-border); }
.appointment-card--success::before { background: var(--portal-success); }
.appointment-card--warning::before { background: var(--portal-warning); }
.appointment-card--danger::before { background: var(--portal-danger); }
.appointment-card__date { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 148px; border-right: 1px solid var(--portal-border); background: var(--portal-surface-muted); text-transform: uppercase; }
.appointment-card__date span { color: var(--portal-primary); font-size: .7rem; font-weight: 800; letter-spacing: .1em; }
.appointment-card__date strong { margin: 2px 0; color: var(--portal-text); font-size: 1.8rem; line-height: 1; letter-spacing: -.05em; }
.appointment-card__date small { color: var(--portal-text-muted); font-size: .7rem; font-weight: 650; }
.appointment-card__body { min-width: 0; padding: 20px 22px; }
.appointment-card__topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.appointment-card h3 { margin: 0 0 6px; color: var(--portal-text); font-size: 1.05rem; font-weight: 740; letter-spacing: -.02em; }
.appointment-card__time, .appointment-card__person { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--portal-text-muted); font-size: .84rem; }
.appointment-card__time .mud-icon-root, .appointment-card__person .mud-icon-root { font-size: 1.05rem; color: var(--portal-primary); }
.appointment-card__person { margin-top: 12px; }
.appointment-card__badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.appointment-card__actions { display: flex; align-items: center; gap: 6px; margin: 18px -8px -8px; padding-top: 14px; border-top: 1px solid var(--portal-border); }
.appointment-card__warning { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; padding: 12px; border-radius: 12px; color: var(--portal-danger); background: var(--portal-danger-soft); }
.appointment-card__warning > div { display: flex; align-items: center; gap: 8px; }
.appointment-card__warning > div:first-child { align-items: flex-start; flex-direction: column; gap: 2px; }
.appointment-card__warning span { font-size: .78rem; }
.appointment-card__reschedule { margin: 16px -2px -2px; padding: 16px; border: 1px solid var(--portal-border); border-radius: 13px; background: var(--portal-surface-muted); }
.appointment-card__reschedule > strong { display: block; margin-bottom: 12px; font-size: .85rem; }
.appointment-reschedule-dates { margin-top: 8px; }
.appointment-reschedule-dates .portal-date-chip { flex-basis: 64px; min-height: 78px; }
.appointment-reschedule-periods { margin-top: 6px; }
.portal-inline-loading { display: flex; align-items: center; gap: 10px; color: var(--portal-text-muted); font-size: .85rem; }
.portal-slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 8px; }
.portal-slot-grid--compact { max-height: 250px; overflow: auto; padding: 2px; }
.portal-time-slot { min-height: 52px; padding: 8px 10px; border: 1px solid var(--portal-border); border-radius: 10px; color: var(--portal-primary-strong); background: var(--portal-surface); cursor: pointer; transition: border-color .15s ease, background-color .15s ease, transform .15s ease; }
.portal-time-slot:hover { border-color: var(--portal-primary); background: var(--portal-primary-soft); transform: translateY(-1px); }
.portal-time-slot span, .portal-time-slot strong { display: block; }
.portal-time-slot span { color: var(--portal-text-muted); font-size: .67rem; }
.portal-time-slot strong { margin-top: 2px; font-size: .8rem; }
.appointment-history { margin-top: 32px; border: 1px solid var(--portal-border); border-radius: var(--portal-radius); background: color-mix(in srgb, var(--portal-surface) 72%, transparent); }
.appointment-history summary { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 0 18px; color: var(--portal-text-muted); font-size: .84rem; font-weight: 700; cursor: pointer; list-style: none; }
.appointment-history summary::-webkit-details-marker { display: none; }
.appointment-history summary span { display: grid; place-items: center; min-width: 26px; height: 26px; border-radius: 999px; background: var(--portal-surface-muted); }
.appointment-history__list { border-top: 1px solid var(--portal-border); }
.appointment-history__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 18px; border-bottom: 1px solid var(--portal-border); }
.appointment-history__row:last-child { border-bottom: 0; }
.appointment-history__row strong, .appointment-history__row span { display: block; }
.appointment-history__row strong { font-size: .88rem; }
.appointment-history__row div span { margin-top: 4px; color: var(--portal-text-muted); font-size: .76rem; }

.booking-panel, .booking-availability { border: 1px solid var(--portal-border); border-radius: var(--portal-radius-lg); background: var(--portal-surface); box-shadow: var(--portal-shadow-sm); }
.booking-panel { padding: clamp(20px, 4vw, 32px); }
.booking-step { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 16px; padding-bottom: 28px; }
.booking-step:last-child { padding-bottom: 0; }
.booking-step__number { display: grid; place-items: center; align-self: start; width: 32px; height: 32px; border-radius: 50%; color: var(--portal-primary-strong); background: var(--portal-primary-soft); font-size: .78rem; font-weight: 800; }
.booking-step__content h2, .booking-availability h2 { margin: 3px 0 5px; color: var(--portal-text); font-size: 1.08rem; font-weight: 740; letter-spacing: -.02em; }
.booking-step__content > p { margin: 0 0 16px; color: var(--portal-text-muted); font-size: .86rem; }
.booking-person-select { max-width: 420px; margin-top: 8px; }
.service-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.service-choice { display: grid; grid-template-columns: 40px minmax(0, 1fr) 24px; align-items: center; gap: 12px; min-height: 80px; padding: 13px; border: 1px solid var(--portal-border); border-radius: 13px; color: var(--portal-text); background: var(--portal-surface); text-align: left; cursor: pointer; transition: border-color .15s ease, background-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.service-choice:hover { border-color: color-mix(in srgb, var(--portal-primary) 58%, var(--portal-border)); transform: translateY(-1px); }
.service-choice--selected { border-color: var(--portal-primary); background: color-mix(in srgb, var(--portal-primary-soft) 64%, var(--portal-surface)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--portal-primary) 10%, transparent); }
.service-choice__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--portal-primary); background: var(--portal-primary-soft); }
.service-choice__copy, .service-choice__copy strong, .service-choice__copy small { display: block; min-width: 0; }
.service-choice__copy strong { overflow: hidden; text-overflow: ellipsis; color: var(--portal-text); font-size: .88rem; font-weight: 710; white-space: nowrap; }
.service-choice__copy small { margin-top: 5px; color: var(--portal-text-muted); font-size: .7rem; line-height: 1.4; }
.service-choice__check { color: var(--portal-primary); font-size: 1.3rem !important; }
.booking-find-button { margin-top: 20px; }
.booking-availability { margin-top: 20px; padding: clamp(20px, 4vw, 32px); }
.booking-availability__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.booking-availability__header > span { padding: 6px 9px; border-radius: 999px; color: var(--portal-success); background: var(--portal-success-soft); font-size: .7rem; font-weight: 720; }
.portal-date-strip { display: flex; gap: 9px; margin: 24px 0 12px; padding: 3px 2px 8px; overflow-x: auto; scroll-snap-type: x mandatory; }
.portal-date-chip { position: relative; display: flex; flex: 0 0 72px; flex-direction: column; align-items: center; min-height: 88px; padding: 10px 8px; border: 1px solid var(--portal-border); border-radius: 13px; color: var(--portal-text); background: var(--portal-surface); scroll-snap-align: start; cursor: pointer; transition: border-color .15s ease, background-color .15s ease, transform .15s ease; }
.portal-date-chip:hover { border-color: var(--portal-primary); transform: translateY(-1px); }
.portal-date-chip--selected { border-color: var(--portal-primary); color: var(--portal-on-primary); background: var(--portal-primary); box-shadow: 0 7px 18px color-mix(in srgb, var(--portal-primary) 22%, transparent); }
.portal-date-chip span, .portal-date-chip small { font-size: .66rem; font-weight: 650; text-transform: uppercase; }
.portal-date-chip strong { margin: 3px 0; font-size: 1.25rem; line-height: 1; }
.portal-date-chip em { position: absolute; right: 5px; top: 5px; display: grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; color: var(--portal-primary); background: var(--portal-primary-soft); font-size: .58rem; font-style: normal; font-weight: 750; }
.portal-date-chip--selected em { color: var(--portal-primary-strong); background: var(--portal-surface); }
/* Closed day (public holiday / clinic closure): hatched grey, not selectable. */
.portal-date-chip--closed { cursor: default; color: color-mix(in srgb, var(--portal-text) 55%, transparent); background-color: color-mix(in srgb, var(--portal-text) 6%, var(--portal-surface)); background-image: repeating-linear-gradient(45deg, color-mix(in srgb, var(--portal-text) 12%, transparent) 0, color-mix(in srgb, var(--portal-text) 12%, transparent) 2px, transparent 2px, transparent 7px); }
.portal-date-chip--closed:hover { border-color: var(--portal-border); transform: none; }
.portal-date-chip__closed-tag { position: static; margin-top: 4px; min-width: auto; height: auto; padding: 1px 6px; border-radius: 6px; color: var(--portal-text); background: color-mix(in srgb, var(--portal-text) 14%, transparent); font-size: .56rem; text-transform: uppercase; letter-spacing: .04em; }
.portal-text-action { display: inline-flex; align-items: center; gap: 5px; padding: 5px 0; border: 0; color: var(--portal-primary); background: transparent; font-size: .78rem; font-weight: 680; cursor: pointer; }
.portal-text-action .mud-icon-root { font-size: 1rem; }
.portal-period-filter { display: inline-flex; gap: 4px; margin: 18px 0 16px; padding: 4px; border-radius: 12px; background: var(--portal-surface-muted); }
.portal-period-filter button { min-height: 36px; padding: 0 13px; border: 0; border-radius: 9px; color: var(--portal-text-muted); background: transparent; font-size: .76rem; font-weight: 650; cursor: pointer; }
.portal-period-filter button.active { color: var(--portal-primary-strong); background: var(--portal-surface); box-shadow: 0 2px 8px rgba(29,41,57,.08); }
.booking-slot-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.booking-time-slot { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 48px; }
.booking-time-slot .mud-icon-root { font-size: 1.05rem; }
.booking-time-slot strong { margin: 0; font-size: .8rem; }
.booking-time-slot--selected { border-color: var(--portal-primary); color: var(--portal-on-primary); background: var(--portal-primary); box-shadow: 0 6px 16px color-mix(in srgb, var(--portal-primary) 22%, transparent); }
.booking-no-period { margin: 4px 0; padding: 14px; border-radius: 11px; color: var(--portal-text-muted); background: var(--portal-surface-muted); font-size: .82rem; }
.booking-summary { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 16px; margin-top: 24px; padding: 18px; border: 1px solid color-mix(in srgb, var(--portal-primary) 28%, var(--portal-border)); border-radius: 15px; background: color-mix(in srgb, var(--portal-primary-soft) 46%, var(--portal-surface)); }
.booking-summary__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; color: var(--portal-primary); background: var(--portal-surface); }
.booking-summary__copy > span { color: var(--portal-primary); font-size: .67rem; font-weight: 760; letter-spacing: .06em; text-transform: uppercase; }
.booking-summary__copy h3 { margin: 3px 0; font-size: .95rem; font-weight: 740; }
.booking-summary__copy p { margin: 0; color: var(--portal-text-muted); font-size: .8rem; }
.booking-summary__copy small { display: block; margin-top: 8px; color: var(--portal-text-muted); font-size: .7rem; }
.booking-summary__copy .portal-badge { margin-top: 8px; }
.booking-empty { margin-top: 20px; }

.portal-person-filter { max-width: 360px; margin-bottom: 20px; }
.portal-table-card { overflow: hidden; border: 1px solid var(--portal-border); border-radius: var(--portal-radius); background: var(--portal-surface); box-shadow: var(--portal-shadow-sm); }
.portal-records-table { background: transparent !important; }
.portal-records-table .mud-table-head { background: var(--portal-surface-muted); }
.portal-records-table .mud-table-cell { padding: 16px; border-color: var(--portal-border); }
.portal-records-table .mud-table-row { cursor: pointer; }
.portal-records-table .mud-table-row:hover { background: var(--portal-primary-soft) !important; }
.portal-numeric-cell { text-align: right !important; font-variant-numeric: tabular-nums; }
.portal-record-action-cell { text-align: center !important; }
.portal-record-action-cell .mud-icon-root { display: block; margin: 0 auto; }

@media (min-width: 600px) {
    .portal-records-table table { width: 100%; table-layout: fixed; }
    .portal-record-date-cell { width: 24%; }
    .portal-record-number-cell { width: 17%; }
    .portal-record-action-cell { width: 8%; }
}

.portal-back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 24px; color: var(--portal-primary); text-decoration: none; font-size: .82rem; font-weight: 680; }
.portal-back-link .mud-icon-root { font-size: 1.05rem; }
.record-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.record-metrics > div { padding: 18px; border: 1px solid var(--portal-border); border-radius: 14px; background: var(--portal-surface); box-shadow: var(--portal-shadow-sm); }
.record-metrics span, .record-metrics strong { display: block; }
.record-metrics span { margin-bottom: 7px; color: var(--portal-text-muted); font-size: .7rem; font-weight: 680; text-transform: uppercase; letter-spacing: .05em; }
.record-metrics strong { color: var(--portal-primary-strong); font-size: 1.35rem; font-weight: 760; letter-spacing: -.03em; }
.record-section { margin-top: 16px; padding: 22px; border: 1px solid var(--portal-border); border-radius: var(--portal-radius); background: var(--portal-surface); box-shadow: var(--portal-shadow-sm); }
.record-section h2 { margin: 0 0 16px; font-size: .98rem; font-weight: 740; }
.record-glucose-table { overflow: hidden; border-radius: 10px; }
.record-copy p { margin: 0; color: var(--portal-text-muted); line-height: 1.65; white-space: pre-wrap; }

.profile-card { overflow: hidden; margin-bottom: 18px; border: 1px solid var(--portal-border); border-radius: var(--portal-radius-lg); background: var(--portal-surface); box-shadow: var(--portal-shadow-sm); }
.profile-person-divider { margin: 4px 0 22px; }
.profile-card__header { display: flex; align-items: center; gap: 14px; padding: 22px 24px; border-bottom: 1px solid var(--portal-border); background: var(--portal-surface-muted); }
.profile-avatar { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 16px; color: var(--portal-primary-strong); background: var(--portal-primary-soft); font-size: .85rem; font-weight: 780; }
.profile-card__header h2 { margin: 0 0 6px; font-size: 1.05rem; font-weight: 740; }
.profile-card__body { padding: 24px; }
.profile-card__body h3 { margin: 2px 0 14px; color: var(--portal-text-muted); font-size: .72rem; font-weight: 760; letter-spacing: .08em; text-transform: uppercase; }
.profile-card__body h3:not(:first-child) { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--portal-border); }
.profile-card__actions { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 24px; border-top: 1px solid var(--portal-border); background: color-mix(in srgb, var(--portal-surface) 94%, transparent); }
.profile-card__actions span { color: var(--portal-text-muted); font-size: .75rem; }
.profile-save-button { color: var(--portal-on-primary) !important; }
.profile-save-button:not(.mud-disabled) .profile-save-button__label { color: var(--portal-on-primary) !important; }

.notification-list { display: grid; overflow: hidden; border: 1px solid var(--portal-border); border-radius: var(--portal-radius); background: var(--portal-surface); box-shadow: var(--portal-shadow-sm); }
.notification-row { position: relative; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 13px; min-height: 78px; padding: 15px 18px; border-bottom: 1px solid var(--portal-border); }
.notification-row:last-child { border-bottom: 0; }
.notification-row--unread { background: color-mix(in srgb, var(--portal-primary-soft) 48%, var(--portal-surface)); }
.notification-row--unread::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--portal-primary); }
.notification-row__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; color: var(--portal-primary); background: var(--portal-primary-soft); }
.notification-row__icon .mud-icon-root { font-size: 1.25rem; }
.notification-row__copy p { margin: 0; color: var(--portal-text); font-size: .86rem; font-weight: 560; line-height: 1.45; }
.notification-row--unread .notification-row__copy p { font-weight: 690; }
.notification-row__copy time { display: block; margin-top: 5px; color: var(--portal-text-muted); font-size: .7rem; }
.notification-row__read-action { white-space: nowrap; }

.portal-onboard { margin-top: 20px; margin-bottom: 40px; }
.onboard-heading { margin: 12px 0 26px; }
.onboard-card { padding: 24px !important; border-radius: var(--portal-radius) !important; }
.onboard-card__heading { display: flex; align-items: center; gap: 13px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--portal-border); }
.onboard-card__heading > span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: var(--portal-primary); background: var(--portal-primary-soft); }
.onboard-card__heading h2 { margin: 0; font-size: .98rem; font-weight: 740; }
.onboard-card__heading p { margin: 3px 0 0; color: var(--portal-text-muted); font-size: .74rem; }
.onboard-result { border-radius: var(--portal-radius-lg) !important; }
.onboard-submit { min-height: 52px !important; }

.portal-login {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 20px;
    background:
        radial-gradient(circle at 12% 8%, var(--portal-primary-soft) 0, transparent 30rem),
        radial-gradient(circle at 92% 92%, var(--portal-accent-soft) 0, transparent 25rem),
        var(--portal-bg);
}

.portal-login__card {
    width: min(100%, 440px);
    padding: clamp(28px, 6vw, 44px);
    border: 1px solid color-mix(in srgb, var(--portal-border) 82%, transparent);
    border-radius: var(--portal-radius-lg);
    background: color-mix(in srgb, var(--portal-surface) 96%, transparent);
    box-shadow: var(--portal-shadow);
}

.portal-login__brand { min-height: 60px; display: flex; align-items: center; margin-bottom: 26px; }
.portal-login__logo { display: block; max-width: 200px; max-height: 64px; object-fit: contain; }
.portal-login__mark { width: 52px; height: 52px; border-radius: 16px; font-size: .92rem; }
.portal-login h1 { margin: 0; color: var(--portal-text); font-size: clamp(1.7rem, 6vw, 2.15rem); font-weight: 760; letter-spacing: -.04em; line-height: 1.15; }
.portal-login__sub { margin: 10px 0 28px; color: var(--portal-text-muted); font-size: .94rem; line-height: 1.55; }
.portal-login__form label { display: block; margin: 0 0 7px; color: var(--portal-text); font-size: .82rem; font-weight: 650; }
.portal-login__form input[type="text"],
.portal-login__form input[type="password"] { width: 100%; min-height: 48px; margin: 0 0 18px; padding: 11px 13px; border: 1px solid var(--portal-border); border-radius: var(--portal-radius-sm); color: var(--portal-text); background: var(--portal-surface); font-size: 1rem; transition: border-color .15s ease, box-shadow .15s ease; }
.portal-login__form input[type="text"]:focus,
.portal-login__form input[type="password"]:focus { outline: 0; border-color: var(--portal-primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--portal-primary) 13%, transparent); }
.portal-login__remember { display: flex; align-items: center; gap: 9px; margin: 0 0 24px; }
.portal-login__remember input { width: 18px; height: 18px; accent-color: var(--portal-primary); }
.portal-login__remember label { margin: 0; color: var(--portal-text-muted); font-size: .88rem; font-weight: 500; }
.portal-login__form button { width: 100%; min-height: 49px; border: 0; border-radius: var(--portal-radius-sm); color: var(--portal-on-primary); background: var(--portal-primary); box-shadow: 0 7px 18px color-mix(in srgb, var(--portal-primary) 26%, transparent); font-weight: 700; cursor: pointer; transition: background-color .15s ease, transform .15s ease; }
.portal-login__form button:hover { background: var(--portal-primary-strong); transform: translateY(-1px); }
.portal-login__error { margin-bottom: 20px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--portal-danger) 22%, transparent); border-radius: var(--portal-radius-sm); color: var(--portal-danger); background: var(--portal-danger-soft); font-size: .88rem; line-height: 1.45; }
.portal-login__links { margin-top: 20px; text-align: center; font-size: .88rem; }
.portal-login__links a { color: var(--portal-primary); font-weight: 650; text-decoration: none; }
.portal-login__links a:hover { text-decoration: underline; }
.portal-login__privacy { margin: 28px 0 0; padding-top: 20px; border-top: 1px solid var(--portal-border); color: var(--portal-text-muted); font-size: .76rem; line-height: 1.5; text-align: center; }

.portal-theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--portal-border);
    border-radius: 50%;
    color: var(--portal-text-muted);
    background: color-mix(in srgb, var(--portal-surface) 92%, transparent);
    box-shadow: var(--portal-shadow-sm);
    cursor: pointer;
}
.portal-theme-toggle:hover { color: var(--portal-primary); border-color: var(--portal-primary); }
.portal-theme-toggle__sun { display: none; }
html[data-portal-theme="dark"] .portal-theme-toggle__moon { display: none; }
html[data-portal-theme="dark"] .portal-theme-toggle__sun { display: inline; }

#blazor-error-ui { display: none; position: fixed; inset: auto 0 0; z-index: 9999; padding: 14px 20px; color: #fff; background: #8f3039; }

@media (max-width: 820px) {
    .portal-topbar { height: 64px; padding: 0 16px; }
    .portal-brand { min-width: 0; }
    .portal-brand__logo, .portal-brand__mark { width: 38px; height: 38px; border-radius: 11px; }
    .portal-brand__copy strong { max-width: min(42vw, 220px); }
    .portal-brand__copy small { display: none; }
    .portal-desktop-nav { display: none; }
    .portal-topbar__actions { min-width: auto; margin-left: auto; }
    .portal-topbar__actions .mud-icon-button { width: 40px; height: 40px; padding: 8px; }
    .portal-main { min-height: calc(100vh - 64px); padding-bottom: calc(82px + env(safe-area-inset-bottom)); }
    .portal-content { width: min(100% - 28px, 680px); padding: 28px 0 42px; }
    .portal-mobile-nav {
        position: fixed;
        inset: auto 0 0;
        z-index: 1200;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        height: calc(70px + env(safe-area-inset-bottom));
        padding: 8px 8px env(safe-area-inset-bottom);
        border-top: 1px solid var(--portal-border);
        background: color-mix(in srgb, var(--portal-surface) 94%, transparent);
        box-shadow: 0 -10px 28px rgba(29,41,57,.08);
        backdrop-filter: blur(18px);
    }
    .portal-mobile-link { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; border-radius: 11px; color: var(--portal-text-muted); text-decoration: none; font-size: .67rem; font-weight: 650; }
    .portal-mobile-link .mud-icon-root { font-size: 1.35rem; }
    .portal-mobile-link.active { color: var(--portal-primary); background: var(--portal-primary-soft); }
    .portal-mobile-link--book { color: var(--portal-accent-strong); }
    .portal-mobile-link--book.active { color: var(--portal-accent-strong); background: transparent; }
    .portal-mobile-link__book-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-top: -22px; border: 4px solid var(--portal-surface); border-radius: 50%; color: var(--portal-on-accent); background: var(--portal-accent); box-shadow: 0 7px 18px color-mix(in srgb, var(--portal-accent) 30%, transparent); }
    .portal-mobile-link__book-icon .mud-icon-root { font-size: 1.4rem; }
    .portal-page-header { align-items: flex-start; margin-bottom: 22px; }
}

@media (max-width: 520px) {
    .portal-content { width: min(100% - 24px, 680px); }
    .portal-page-header { flex-direction: column; gap: 16px; }
    .portal-page-header .mud-button-root { width: 100%; }
    .portal-page-title { font-size: 1.65rem; }
    .appointment-card { grid-template-columns: 66px minmax(0, 1fr); }
    .appointment-card__date { min-height: 128px; }
    .appointment-card__date strong { font-size: 1.55rem; }
    .appointment-card__body { padding: 17px 15px; }
    .appointment-card__topline { flex-direction: column; gap: 12px; }
    .appointment-card__badges { justify-content: flex-start; }
    .appointment-card__actions { flex-wrap: wrap; }
    .appointment-card__warning { align-items: flex-start; flex-direction: column; }
    .appointment-card__warning > div:last-child { flex-wrap: wrap; }
    .service-choice-grid { grid-template-columns: 1fr; }
    .booking-panel, .booking-availability { margin-right: -2px; margin-left: -2px; border-radius: 18px; }
    .booking-step { grid-template-columns: 28px minmax(0, 1fr); gap: 11px; }
    .booking-step__number { width: 28px; height: 28px; }
    .booking-availability__header { flex-direction: column; gap: 8px; }
    .portal-period-filter { display: grid; grid-template-columns: repeat(2, 1fr); width: 100%; }
    .booking-summary { grid-template-columns: 42px minmax(0, 1fr); }
    .booking-summary__icon { width: 42px; height: 42px; }
    .booking-summary .mud-button-root { grid-column: 1 / -1; width: 100%; }
    .record-metrics { grid-template-columns: repeat(2, 1fr); }
    .portal-records-table .mud-table-row { margin: 10px; border: 1px solid var(--portal-border); border-radius: 12px; background: var(--portal-surface); }
    .portal-records-table .mud-table-cell { padding: 10px 14px; }
    .portal-numeric-cell { text-align: left !important; }
    .profile-card__header, .profile-card__body { padding: 18px; }
    .profile-card__actions { align-items: stretch; flex-direction: column; padding: 14px 18px; }
    .profile-card__actions .mud-button-root { width: 100%; }
    .notification-row { grid-template-columns: 38px minmax(0, 1fr); padding: 14px; }
    .notification-row__read-action { grid-column: 2; justify-self: start; margin-left: -8px; }
}

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