/* Ancizar Serif (SIL OFL 1.1, licence alongside the file): display face for headings. */
@font-face {
    font-family: "Ancizar Serif";
    src: url("../assets/fonts/ancizar-serif/AncizarSerif-VariableFont_wght.ttf") format("truetype");
    font-weight: 300 900;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: light;
    --znt-ink: #17201D;
    --znt-ink-soft: #333E3A;
    --znt-stone: #6B7772;
    --znt-mist: #E2E6E3;
    --znt-paper: #F6F6F3;
    --znt-white: #FFFFFF;
    --znt-jade: #3E7A68;
    --znt-jade-soft: #9BBDB1;
    --znt-sage: #58675D;
    --znt-sage-dark: #4A574F;
    --znt-sage-soft: #A7B89F;
    --znt-rose: #C98288;
    --znt-rose-dark: #B56B72;
    --znt-slate: var(--znt-jade);
    --znt-slate-light: var(--znt-jade-soft);
    --znt-slate-deep: var(--znt-ink);
    --znt-coral: var(--znt-jade);
    --znt-coral-soft: var(--znt-jade-soft);
    --znt-muted: var(--znt-stone);
    --znt-line: var(--znt-mist);
    --znt-surface: var(--znt-paper);
    --znt-font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --znt-font-display: "Ancizar Serif", Georgia, "Times New Roman", serif;
    --znt-radius-sm: 2px;
    --znt-radius-md: 3px;
    --znt-radius-lg: 4px;
    --znt-shadow: none;
    --znt-workspace-border: rgba(23, 32, 29, 0.14);
    --znt-workspace-shadow: none;
    --znt-workspace-radius: 4px;
    --znt-workspace-surface: var(--znt-white);
    /* Brand: sage for navigation and interaction, dusty rose for the main call to action. */
    --portal-primary: var(--znt-sage);
    --portal-primary-dark: var(--znt-sage-dark);
    --portal-primary-soft: rgba(88, 103, 93, 0.12);
    --portal-accent: var(--znt-rose);
    --portal-accent-dark: var(--znt-rose-dark);
    --portal-ink: var(--znt-ink);
    --portal-muted: var(--znt-stone);
    --portal-border: var(--znt-mist);
    --portal-surface: var(--znt-white);
    --portal-background: var(--znt-paper);
    --portal-danger: #a23d3d;
    /* Breathing room between the bottom nav and anything sitting directly above it, such as the
       message composer. Without it the composer's offset equals the nav height and the two touch. */
    --portal-nav-gap: .75rem;
    font-family: var(--znt-font);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
    background: var(--portal-background);
    color: var(--portal-ink);
}

body {
    font-size: 1rem;
    line-height: 1.45;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
}

h1,
h2,
p,
dl,
dd {
    margin-top: 0;
}

h1 {
    margin-bottom: .35rem;
    font-family: var(--znt-font-display);
    font-weight: 500;
    font-size: clamp(1.75rem, 7vw, 2.3rem);
    line-height: 1.08;
    letter-spacing: -.035em;
}

h2 {
    margin-bottom: .35rem;
    font-size: 1.1rem;
    line-height: 1.25;
}

.portal-shell {
    min-height: 100dvh;
}

.portal-header {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 3.75rem;
    padding: .75rem max(1rem, env(safe-area-inset-left));
    border-bottom: 1px solid color-mix(in srgb, var(--portal-border) 80%, transparent);
    background: color-mix(in srgb, var(--znt-white) 94%, transparent);
    backdrop-filter: blur(12px);
}

.portal-title {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
    color: var(--portal-ink);
    font-family: var(--znt-font-display);
    font-size: 1.2rem;
    font-weight: 600;
    text-decoration: none;
}

.portal-header-logo {
    flex: none;
    height: 1.75rem;
    width: auto;
}

/* A long clinic name truncates rather than pushing Sign out off a phone screen. */
.portal-title-text {
    min-width: 0;
    padding-left: .75rem;
    overflow: hidden;
    border-left: 1px solid var(--portal-border);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-title:focus-visible {
    outline: 3px solid var(--portal-primary-soft);
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.text-button {
    border: 0;
    background: transparent;
    color: var(--portal-primary-dark);
    font-weight: 700;
    text-decoration: none;
}

.text-button {
    padding: .55rem;
    cursor: pointer;
}

.portal-content {
    min-width: 0;
    width: min(100%, 48rem);
    margin: 0 auto;
    padding: 1.25rem 1rem calc(6.75rem + env(safe-area-inset-bottom));
}

.invoice-logo {
    display: block;
    max-width: 160px;
    max-height: 64px;
    margin-bottom: .75rem;
}

.page-header {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

/* Track-and-knob switch for a page-header filter, such as the invoices paid toggle. */
.portal-switch {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    gap: .5rem;
    align-items: center;
    color: var(--portal-muted);
    font-size: .78rem;
    font-weight: 650;
    cursor: pointer;
}

/* Hidden visually but kept focusable, so the track below shows the checkbox state. */
.portal-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.portal-switch-track {
    position: relative;
    flex: 0 0 auto;
    width: 2.4rem;
    height: 1.35rem;
    border-radius: 999px;
    background: var(--portal-border);
    transition: background .15s ease-in-out;
}

.portal-switch-track::after {
    content: "";
    position: absolute;
    top: .175rem;
    left: .175rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--znt-white);
    box-shadow: var(--znt-workspace-shadow);
    transition: transform .15s ease-in-out;
}

.portal-switch input:checked + .portal-switch-track {
    background: var(--portal-primary);
}

.portal-switch input:checked + .portal-switch-track::after {
    transform: translateX(1.05rem);
}

.portal-switch input:focus-visible + .portal-switch-track {
    outline: 3px solid var(--portal-primary-soft);
    outline-offset: 2px;
}

.portal-switch input:disabled + .portal-switch-track {
    opacity: .55;
}

.page-header p:last-child,
.section-intro {
    margin-bottom: 0;
    color: var(--portal-muted);
}

.eyebrow,
.card-kicker {
    margin-bottom: .3rem;
    color: var(--portal-primary-dark);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.bottom-nav {
    position: fixed;
    z-index: 30;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .5rem;
    min-height: 4.75rem;
    padding: .45rem max(1rem, env(safe-area-inset-right)) max(.45rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    border-top: 1px solid var(--portal-primary-dark);
    background: var(--portal-primary);
    box-shadow: 0 -8px 24px rgba(43, 58, 72, 0.18);
}

.bottom-nav-link {
    display: flex;
    flex-direction: column;
    gap: .18rem;
    align-items: center;
    justify-content: center;
    border-radius: .85rem;
    /* White, not a dimmed white: the label is small and bold, so anything mixed back towards the
       bar colour drops under 3:1. The selected tab is distinguished by its filled pill instead. */
    color: var(--znt-white);
    font-size: .72rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}

.bottom-nav-icon {
    position: relative;
    display: grid;
    place-items: center;
}

.bottom-nav-link svg {
    width: 1.45rem;
    height: 1.45rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.bottom-nav-message-count {
    position: absolute;
    top: -.55rem;
    left: calc(100% - .3rem);
    display: grid;
    min-width: 1.15rem;
    min-height: 1.15rem;
    padding: 0 .28rem;
    place-items: center;
    /* Rings the badge against the blue bar the way it used to ring against white. */
    border: 2px solid var(--portal-primary);
    border-radius: 999px;
    background: var(--portal-accent);
    color: var(--znt-white);
    font-size: .62rem;
    font-weight: 800;
    line-height: 1;
}

.bottom-nav-message-count--loading {
    background: var(--portal-surface);
    color: var(--portal-muted);
}

.bottom-nav-message-count--loading .znt-loading-dots {
    gap: .08rem;
}

.bottom-nav-message-count--loading .znt-loading-dots__dot {
    width: .18rem;
    height: .18rem;
}

.bottom-nav-link.active {
    background: var(--portal-primary-dark);
    color: var(--znt-white);
}

.card-list,
.selection-list,
.slot-list {
    display: grid;
    min-width: 0;
    gap: .8rem;
}

.portal-card,
.calendar-card,
.terms-card {
    border: 1px solid var(--portal-border);
    border-radius: var(--znt-radius-md);
    background: var(--portal-surface);
    box-shadow: var(--znt-workspace-shadow);
}

.portal-card {
    padding: 1rem;
}

.card-heading {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    justify-content: space-between;
}

.status-badge {
    flex: 0 0 auto;
    padding: .28rem .58rem;
    border-radius: 999px;
    background: #dff5ed;
    color: #087353;
    font-size: .72rem;
    font-weight: 800;
}

.status-badge.muted {
    background: var(--znt-surface);
    color: var(--znt-muted);
}

.appointment-relative-date-badge {
    background: var(--portal-primary-soft);
    color: var(--portal-primary-dark);
}

.clinic-badge {
    background: var(--znt-surface);
    color: var(--portal-muted);
}

.detail-list {
    display: grid;
    gap: .75rem;
    margin-bottom: 0;
}

.detail-list.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: .8rem 0;
}

.detail-list.compact .wide {
    grid-column: 1 / -1;
}

.detail-list div {
    display: grid;
    gap: .12rem;
}

.detail-list dt {
    color: var(--portal-muted);
    font-size: .75rem;
    font-weight: 650;
}

.detail-list dd {
    margin-bottom: 0;
    font-weight: 700;
}

.invoice-detail-list .invoice-line,
.invoice-detail-list .invoice-summary {
    grid-template-columns: minmax(0, 1fr) minmax(6rem, auto);
    align-items: baseline;
    column-gap: 1rem;
}

.invoice-detail-list dd {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* A charge for more than one unit says what one costs, on its own line under the description. */
.invoice-detail-list .invoice-line-quantity {
    display: block;
    font-weight: 400;
    font-size: .875rem;
    color: var(--portal-muted);
    font-variant-numeric: tabular-nums;
}

.invoice-detail-list .invoice-summary dt {
    text-align: right;
}

.invoice-detail-list .invoice-summary-first {
    margin-top: 1.5rem;
}

.invoice-payments {
    margin-top: 1.5rem;
}

.invoice-payment-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.35rem 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--portal-border);
}

.invoice-payment-line a {
    grid-column: 1 / -1;
}

/* A deposit is a deduction rather than a summary figure, so its name sits on the left
   like the charge lines, under a rule that separates it from the invoice total. */
.invoice-detail-list .invoice-received dt {
    text-align: left;
}

.invoice-detail-list .invoice-received-first {
    margin-top: 1.5rem;
    padding-top: .75rem;
    border-top: 1px solid var(--portal-border);
}

.invoice-detail-list .invoice-total {
    margin-top: 1.5rem;
    padding-top: .75rem;
    border-top: 1px solid var(--portal-border);
}

.invoice-balance-list .invoice-total dt {
    color: var(--portal-primary);
    font-size: 1.1rem;
    text-align: left;
}

.invoice-balance-list .invoice-total dd {
    font-size: 1.1rem;
}

.invoice-payment-card {
    margin-top: 2rem;
}

.detail-address {
    display: block;
    color: var(--portal-muted);
    font-size: .86rem;
    font-weight: 500;
}

.booking-summary {
    display: grid;
    gap: .1rem;
    margin-top: .75rem;
    padding: .8rem;
    border-radius: .85rem;
    background: #f2faf7;
    color: #285b4b;
}

.booking-summary span {
    font-size: .86rem;
}

.primary-button,
.secondary-button {
    display: inline-flex;
    gap: .45rem;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
    padding: .72rem 1rem;
    border: 1px solid transparent;
    border-radius: .85rem;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.primary-button {
    background: var(--portal-accent);
    color: var(--znt-white);
}

.primary-button:hover {
    background: var(--portal-accent-dark);
}

.secondary-button {
    border-color: var(--portal-border);
    background: var(--znt-white);
    color: var(--portal-primary-dark);
}

.primary-button:disabled,
.secondary-button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.full-width {
    width: 100%;
}

.page-action {
    margin-bottom: 1rem;
}

.appointment-card {
    display: grid;
    grid-template-columns: 3.5rem minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

/* The booking a link pointed at, so it is findable in a list of several. */
.appointment-card--highlighted {
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 2px var(--portal-primary-soft);
}

.invoice-card-link {
    border-radius: var(--znt-radius-md);
    text-decoration: none;
}

.invoice-card-link:hover .invoice-card {
    border-color: color-mix(in srgb, var(--portal-primary) 45%, var(--portal-border));
}

.invoice-card-link:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--portal-primary) 38%, transparent);
    outline-offset: 2px;
}

.invoice-card {
    display: grid;
    gap: .7rem;
}

.invoice-card h2,
.invoice-card p {
    margin-bottom: 0;
}

.invoice-card-heading-meta {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: .35rem;
    align-items: flex-end;
    text-align: right;
}

/* Marks a fully-settled invoice in the top right of its card. */
.invoice-paid-stamp {
    display: inline-flex;
    flex: 0 0 auto;
    gap: .3rem;
    align-items: center;
    padding: .28rem .58rem .28rem .42rem;
    border: 1px solid #9bd9c4;
    border-radius: 999px;
    background: #dff5ed;
    color: #087353;
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.invoice-paid-stamp svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2.2;
}

.invoice-descriptions {
    color: var(--portal-muted);
    font-size: .88rem;
    overflow-wrap: anywhere;
}

.invoice-card-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding-top: .7rem;
    border-top: 1px solid var(--portal-border);
}

.invoice-card-total span {
    color: var(--portal-muted);
    font-size: .78rem;
    font-weight: 650;
}

.invoice-card-total strong {
    font-size: 1.08rem;
}

.invoice-load-more {
    margin-top: 1rem;
}

.conversation-card {
    display: grid;
    gap: .5rem;
}

.conversation-card h2,
.conversation-card p {
    margin-bottom: 0;
}

.conversation-card p,
.conversation-card time {
    color: var(--portal-muted);
    font-size: .82rem;
}

.appointment-card p {
    margin-bottom: .12rem;
    color: var(--portal-muted);
    font-size: .88rem;
}

.appointment-card .appointment-time {
    margin-bottom: .45rem;
    color: var(--portal-ink);
    font-weight: 700;
}

.appointment-card .appointment-services {
    color: var(--portal-ink);
    font-weight: 650;
}

.maps-link {
    display: inline-block;
    margin-bottom: .12rem;
    color: var(--portal-primary-dark);
    font-size: .88rem;
    font-weight: 650;
    overflow-wrap: anywhere;
    text-decoration: underline;
    text-underline-offset: .14rem;
}

.appointment-date {
    display: grid;
    place-items: center;
    min-height: 3.6rem;
    border-radius: .85rem;
    background: var(--portal-primary-soft);
    color: var(--portal-primary-dark);
}

.appointment-date span {
    font-size: .68rem;
    font-weight: 800;
    text-transform: uppercase;
}

.appointment-date strong {
    font-size: 1.35rem;
}

.loading-state,
.empty-state,
.success-state {
    display: grid;
    gap: .75rem;
    place-items: center;
    min-height: 12rem;
    padding: 2rem 1rem;
    text-align: center;
}

.loading-state {
    min-height: 10rem;
    color: var(--portal-muted);
}

.empty-state p,
.success-state p {
    max-width: 28rem;
    margin-bottom: 0;
    color: var(--portal-muted);
}

.notice {
    margin: .9rem 0;
    padding: .8rem 1rem;
    border-radius: .8rem;
    background: var(--znt-surface);
    color: var(--portal-muted);
}

.notice-error,
.form-error {
    background: #faeaea;
    color: var(--portal-danger);
}

.section-title {
    margin: 0 0 .4rem;
    font-size: 1.2rem;
}

.section-intro {
    margin-bottom: 1rem;
}

.treatment-group-heading {
    margin: 1.4rem 0 .6rem;
    font-size: 1rem;
}

.treatment-group-heading:first-child {
    margin-top: 0;
}

.selection-card,
.slot-button {
    display: flex;
    gap: .75rem;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    width: 100%;
    min-height: 4rem;
    padding: .85rem 1rem;
    border: 1px solid var(--portal-border);
    border-radius: var(--znt-radius-md);
    background: var(--znt-white);
    color: var(--portal-ink);
    text-align: left;
    cursor: pointer;
}

.selection-card span:first-child {
    display: grid;
    gap: .1rem;
    min-width: 0;
}

.selection-card strong,
.selection-card small {
    overflow-wrap: anywhere;
}

.selection-card small {
    color: var(--portal-muted);
}

.treatment-selection-card {
    display: block;
    padding: 0;
    overflow: hidden;
}

.treatment-selection-action {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    width: 100%;
    padding: .85rem 1rem;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

/* The description sits directly under the name, so the name row gives up its lower padding. */
.treatment-selection-card.has-description .treatment-selection-action {
    padding-bottom: .2rem;
}

.treatment-selection-action:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--portal-primary) 38%, transparent);
    outline-offset: -3px;
}

.treatment-selection-description {
    padding: 0 1rem .85rem;
    background: transparent;
    color: var(--portal-muted);
    font-size: .9rem;
    overflow-wrap: anywhere;
    cursor: pointer;
}

.treatment-selection-description:hover {
    background: color-mix(in srgb, var(--portal-primary) 4%, transparent);
}

.treatment-selection-description:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--portal-primary) 38%, transparent);
    outline-offset: -3px;
}

.treatment-selection-description > :first-child {
    margin-top: 0;
}

.treatment-selection-description > :last-child {
    margin-bottom: 0;
}

.treatment-selection-description img {
    display: block;
    max-width: 100%;
    height: auto;
}

.selection-card.selected {
    border-color: var(--portal-primary);
    background: var(--portal-primary-soft);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--portal-primary) 12%, transparent);
}

.chevron {
    color: var(--portal-primary);
    font-size: 2rem;
    line-height: 1;
}

.radio-mark {
    width: 1.2rem;
    height: 1.2rem;
    border: 2px solid var(--znt-muted);
    border-radius: 50%;
}

.selection-card.selected .radio-mark {
    border: .35rem solid var(--portal-primary);
}

.checkbox-mark {
    display: grid;
    flex: none;
    place-items: center;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--znt-muted);
    border-radius: .3rem;
    color: var(--znt-white);
    font-size: .85rem;
    font-weight: 800;
    line-height: 1;
}

.selection-card.selected .checkbox-mark {
    border-color: var(--portal-primary);
    background: var(--portal-primary);
}

.selection-card.selected .checkbox-mark::after {
    content: "✓";
}

.action-row {
    display: flex;
    gap: .75rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

.booking-progress {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin: 0 0 1.35rem;
    padding: 0;
    list-style: none;
}

.booking-progress li {
    position: relative;
    display: grid;
    gap: .25rem;
    place-items: center;
    color: var(--znt-muted);
    font-size: .68rem;
    text-align: center;
}

.booking-progress li::before {
    position: absolute;
    z-index: -1;
    top: .85rem;
    right: 50%;
    left: -50%;
    height: 2px;
    background: var(--portal-border);
    content: "";
}

.booking-progress li:first-child::before {
    display: none;
}

.booking-progress li > span {
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border: 2px solid var(--portal-border);
    border-radius: 50%;
    background: var(--portal-background);
    font-weight: 800;
}

.booking-progress li.active,
.booking-progress li.complete {
    color: var(--portal-primary-dark);
}

.booking-progress li.active > span,
.booking-progress li.complete > span {
    border-color: var(--portal-primary);
    background: var(--portal-primary);
    color: var(--znt-white);
}

.booking-progress li.complete::before {
    background: var(--portal-primary);
}

.calendar-card {
    padding: .7rem;
}

.calendar-toolbar {
    display: grid;
    grid-template-columns: 2.5rem 1fr 2.5rem;
    align-items: center;
    margin-bottom: .8rem;
}

.calendar-toolbar h3 {
    margin: 0;
    color: var(--znt-ink);
    font-size: 1rem;
    text-align: center;
}

.calendar-navigation-button {
    display: inline-grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid var(--portal-border);
    border-radius: 50%;
    background: var(--znt-white);
    color: var(--portal-primary-dark);
    font-size: 1.6rem;
    line-height: 0;
    cursor: pointer;
}

.calendar-navigation-button:disabled {
    color: var(--portal-muted);
    cursor: default;
    opacity: .45;
}

.calendar-navigation-button > * {
    margin: auto;
    width: 1.25rem;
    height: 1.25rem;
}

.calendar-weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: .28rem;
}

.calendar-weekdays {
    margin-bottom: .35rem;
    color: var(--portal-muted);
    font-size: .65rem;
    font-weight: 700;
    text-align: center;
}

.calendar-day {
    display: grid;
    gap: 0;
    place-items: center;
    min-width: 0;
    aspect-ratio: 1;
    padding: .15rem;
    border: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--znt-sage-soft) 28%, var(--znt-white));
    color: var(--znt-ink);
    cursor: pointer;
}

.calendar-empty {
    aspect-ratio: 1;
}

.calendar-day small {
    font-size: .52rem;
    line-height: 1;
    text-transform: uppercase;
}

.calendar-day strong {
    font-size: .9rem;
}

.calendar-day:disabled {
    background: transparent;
    color: color-mix(in srgb, var(--znt-muted) 72%, var(--znt-white));
    cursor: default;
}

.calendar-day.selected {
    background: var(--portal-primary);
    color: var(--znt-white);
    box-shadow: 0 0 0 3px var(--portal-primary-soft);
}

.practitioner-title {
    margin-top: 1.2rem;
}

.practitioner-list {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding: .25rem .1rem .55rem;
    scrollbar-width: thin;
}

.practitioner-option {
    display: grid;
    flex: 0 0 5rem;
    gap: .4rem;
    justify-items: center;
    min-width: 0;
    padding: .25rem;
    border: 0;
    border-radius: .8rem;
    background: transparent;
    color: var(--znt-ink);
    cursor: pointer;
}

.practitioner-option span:last-child {
    width: 100%;
    min-height: 1.85rem;
    font-size: .76rem;
    line-height: 1.2;
    text-align: center;
    overflow-wrap: anywhere;
}

.practitioner-option .practitioner-profile-image {
    box-shadow: 0 0 0 2px var(--znt-white), 0 0 0 3px var(--portal-border);
}

.practitioner-option.selected .practitioner-profile-image {
    box-shadow: 0 0 0 2px var(--znt-white), 0 0 0 4px var(--portal-primary);
}

.practitioner-option.selected span:last-child {
    color: var(--portal-primary-dark);
    font-weight: 800;
}

.time-title {
    margin-top: 1.2rem;
}

.slot-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.slot-button {
    display: grid;
    gap: .1rem;
    min-height: 3.6rem;
    justify-content: stretch;
    border-color: color-mix(in srgb, var(--portal-primary) 35%, var(--portal-border));
    color: var(--portal-primary-dark);
    text-align: center;
}

.slot-button span {
    overflow: hidden;
    color: var(--portal-muted);
    font-size: .72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.confirmation-card,
.payment-card,
.terms-card {
    margin-bottom: .85rem;
}

.payment-card .card-heading {
    margin-bottom: .7rem;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.terms-card {
    padding: 1rem;
}

.terms-card p {
    margin-bottom: 0;
    color: var(--portal-muted);
    font-size: .88rem;
}

.terms-card .terms-body {
    white-space: pre-wrap;
}

.form-field {
    display: grid;
    gap: .35rem;
    color: var(--portal-ink);
    font-size: .83rem;
    font-weight: 700;
}

.form-field input,
.form-field select {
    width: 100%;
    min-height: 3rem;
    padding: .72rem .8rem;
    border: 1px solid var(--portal-border);
    border-radius: var(--znt-radius-sm);
    background: var(--znt-white);
    color: var(--portal-ink);
}

.form-field .validation-message {
    color: var(--portal-danger);
    font-size: .78rem;
    font-weight: 600;
}

.form-field input:disabled {
    background: var(--znt-surface);
    color: var(--znt-muted);
}

.sticky-actions {
    position: sticky;
    bottom: calc(5rem + env(safe-area-inset-bottom));
    padding: .65rem 0;
    background: linear-gradient(transparent, var(--portal-background) 25%);
}

.messages-page {
    display: flex;
    height: 100%;
    min-height: 0;
    flex-direction: column;
}

.message-thread-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-height: 2rem;
    margin-bottom: .35rem;
}

.portal-back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: .25rem;
}

.portal-back-link svg {
    width: 1.35rem;
    height: 1.35rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.invoice-back-link {
    margin-bottom: .75rem;
}

.message-thread-clinic {
    overflow: hidden;
    color: var(--portal-ink);
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-shell:has(.messages-page) {
    display: flex;
    height: 100dvh;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
}

.portal-shell:has(.messages-page) .portal-header {
    flex: 0 0 auto;
}

.portal-content:has(.messages-page) {
    flex: 1;
    min-height: 0;
    padding-top: .75rem;
    padding-bottom: calc(4.75rem + var(--portal-nav-gap) + env(safe-area-inset-bottom));
}

.chat-thread {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: .28rem;
    min-height: 0;
    padding: .75rem;
    overflow-y: auto;
    border: 1px solid var(--portal-border);
    border-radius: var(--znt-radius-md);
    background: var(--portal-surface);
    scroll-behavior: smooth;
}

.chat-empty-state {
    min-height: 14rem;
}

.chat-day-separator {
    align-self: center;
    margin: .65rem 0 .35rem;
    color: var(--portal-muted);
    font-size: .72rem;
    font-weight: 700;
}

.chat-bubble {
    display: grid;
    gap: .22rem;
    align-self: flex-start;
    max-width: min(85%, 30rem);
    padding: .68rem .82rem;
    border-radius: 1rem;
    background: var(--znt-surface);
    color: var(--portal-ink);
}

.chat-bubble--patient {
    align-self: flex-end;
    background: var(--portal-primary-soft);
    color: var(--portal-primary-dark);
}

.chat-bubble--group-start {
    margin-top: .5rem;
}

.chat-bubble p {
    margin: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.chat-bubble time,
.chat-sender,
.chat-pending-status {
    color: var(--portal-muted);
    font-size: .7rem;
}

.chat-bubble--patient time {
    color: color-mix(in srgb, var(--portal-primary-dark) 72%, transparent);
    text-align: right;
}

.chat-sender {
    font-weight: 800;
}

.chat-bubble--pending {
    opacity: .82;
}

.chat-pending-status {
    display: flex;
    gap: .35rem;
    align-items: center;
    justify-content: flex-end;
}

.chat-pending-status .text-button {
    padding: .2rem;
    font-size: inherit;
}

.chat-composer {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: .35rem;
    margin-top: .65rem;
}

.messages-page .chat-composer {
    bottom: calc(4.75rem + var(--portal-nav-gap) + env(safe-area-inset-bottom));
    padding-bottom: 0;
}

.chat-composer label {
    color: var(--portal-ink);
    font-size: .83rem;
    font-weight: 700;
}

.chat-composer-input {
    position: relative;
}

.chat-composer textarea {
    display: block;
    width: 100%;
    min-height: 3.5rem;
    max-height: 10rem;
    padding: .72rem 3.5rem .72rem .8rem;
    resize: vertical;
    border: 1px solid var(--portal-border);
    border-radius: var(--znt-radius-sm);
    background: var(--znt-white);
    color: var(--portal-ink);
}

.chat-composer textarea:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--portal-primary) 38%, transparent);
    outline-offset: 2px;
}

.chat-send {
    position: absolute;
    z-index: 1;
    right: .4rem;
    bottom: .35rem;
    display: grid;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    place-items: center;
    border-radius: 50%;
}

.chat-send svg {
    width: 1.35rem;
    height: 1.35rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.chat-send:disabled {
    cursor: default;
    opacity: .45;
}

.chat-new-messages {
    position: sticky;
    bottom: 10rem;
    display: flex;
    width: fit-content;
    min-height: 2.4rem;
    margin: -.25rem auto 0;
    padding: .5rem .8rem;
}

.success-state {
    min-height: 22rem;
}

.success-icon {
    display: grid;
    place-items: center;
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background: #dff5ed;
    color: #087353;
    font-size: 2rem;
    font-weight: 900;
}

/* Same backdrop as the web app's auth shell: jade, sage and rose washes over paper, with two
   slow-drifting sweeps (::before ring arcs, ::after a blurred glow) fixed behind the card. */
.login-shell {
    position: relative;
    isolation: isolate;
    display: grid;
    min-height: 100dvh;
    padding: max(1.25rem, env(safe-area-inset-top)) 1rem max(1.25rem, env(safe-area-inset-bottom));
    place-items: center;
    background:
        radial-gradient(120% 85% at 0% 0%, rgba(155, 189, 177, 0.55) 0%, rgba(155, 189, 177, 0) 62%),
        radial-gradient(95% 75% at 100% 100%, rgba(201, 130, 136, 0.34) 0%, rgba(201, 130, 136, 0) 60%),
        radial-gradient(70% 60% at 100% 0%, rgba(88, 103, 93, 0.2) 0%, rgba(88, 103, 93, 0) 70%),
        radial-gradient(60% 55% at 0% 100%, rgba(62, 122, 104, 0.16) 0%, rgba(62, 122, 104, 0) 70%),
        linear-gradient(160deg, #EAF1EC 0%, var(--znt-paper) 48%, #F6ECEA 100%);
    background-attachment: fixed;
}

.login-shell::before,
.login-shell::after {
    content: "";
    position: fixed;
    z-index: -1;
    pointer-events: none;
}

.login-shell::before {
    top: -55vmax;
    left: -40vmax;
    width: 140vmax;
    height: 120vmax;
    border-radius: 50%;
    background:
        radial-gradient(closest-side, rgba(255, 255, 255, 0) 70%, rgba(62, 122, 104, 0.2) 79%, rgba(255, 255, 255, 0) 88%),
        radial-gradient(closest-side, rgba(255, 255, 255, 0) 84%, rgba(201, 130, 136, 0.22) 92%, rgba(255, 255, 255, 0) 99%);
    animation: login-shell-sweep 48s ease-in-out infinite alternate;
}

.login-shell::after {
    right: -20vmax;
    bottom: -25vmax;
    width: 75vmax;
    height: 60vmax;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(201, 130, 136, 0.32), rgba(155, 189, 177, 0.3));
    filter: blur(70px);
    animation: login-shell-drift 36s ease-in-out infinite alternate;
}

@keyframes login-shell-sweep {
    from { transform: rotate(-6deg) translate3d(0, 0, 0); }
    to   { transform: rotate(8deg) translate3d(4vmax, 3vmax, 0); }
}

@keyframes login-shell-drift {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(-12vmax, -8vmax, 0) scale(1.12); }
}

@media (prefers-reduced-motion: reduce) {
    .login-shell::before,
    .login-shell::after {
        animation: none;
    }
}

.login-card {
    width: min(100%, 25rem);
    padding: 1.5rem;
    border: 1px solid var(--portal-border);
    border-radius: var(--znt-radius-lg);
    background: color-mix(in srgb, var(--znt-white) 96%, transparent);
    box-shadow: var(--znt-shadow);
}

.login-card .form-field input:not(.verification-code-input) {
    font-size: 1rem;
}

.login-brand {
    display: block;
    width: min(13rem, 75%);
    height: auto;
    margin: 0 auto 1rem;
}

.login-intro {
    margin-bottom: 1.25rem;
    color: var(--portal-muted);
}

.portal-form {
    display: grid;
    gap: 1rem;
}

.login-submit-busy {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

.login-submit-busy[hidden] {
    display: none;
}

.login-submit-button {
    margin-top: 1.5rem;
}

.login-submit-button:disabled {
    opacity: .8;
}

.verification-code-input {
    font-size: 1.5rem;
    letter-spacing: .6rem;
    text-align: center;
}

.verify-resend-form {
    margin-top: .75rem;
    text-align: center;
}

.form-error {
    margin-bottom: 0;
    padding: .75rem;
    border-radius: .75rem;
    font-size: .86rem;
}

.primary-button:focus-visible,
.secondary-button:focus-visible,
.text-button:focus-visible,
.selection-card:focus-visible,
.slot-button:focus-visible,
.practitioner-option:focus-visible,
.calendar-day:focus-visible,
.calendar-navigation-button:focus-visible,
.bottom-nav-link:focus-visible,
.form-field input:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--portal-primary) 38%, transparent);
    outline-offset: 2px;
}

/* The shared ring above is the primary colour, which the primary-coloured bar would swallow. */
.bottom-nav-link:focus-visible {
    outline-color: color-mix(in srgb, var(--znt-white) 70%, transparent);
}

h1[tabindex="-1"]:focus {
    outline: none;
}

.znt-loading-dots__dot {
    animation: znt-loading-dots-bounce 1.2s ease-in-out infinite;
}

.znt-loading-dots__dot:nth-child(2) {
    animation-delay: .15s;
}

.znt-loading-dots__dot:nth-child(3) {
    animation-delay: .3s;
}

@keyframes znt-loading-dots-bounce {
    0%, 60%, 100% {
        opacity: .25;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-.25em);
    }
}

.znt-skeleton-shimmer {
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--znt-workspace-border) 72%, #fff) 0%,
        color-mix(in srgb, var(--znt-workspace-border) 36%, #fff) 42%,
        color-mix(in srgb, var(--znt-workspace-border) 72%, #fff) 84%
    );
    background-size: 220% 100%;
    animation: znt-skeleton-shimmer 1.35s ease-in-out infinite;
}

@keyframes znt-skeleton-shimmer {
    0% {
        background-position: 120% 0;
    }

    100% {
        background-position: -120% 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .znt-loading-dots__dot {
        animation-duration: 1.8s;
    }

    .znt-skeleton-shimmer {
        animation: none;
    }
}

@media (max-width: 24rem) {
    .bottom-nav {
        gap: .25rem;
        padding-right: max(.5rem, env(safe-area-inset-right));
        padding-left: max(.5rem, env(safe-area-inset-left));
    }

    .bottom-nav-link {
        font-size: .65rem;
    }
}

@media (min-width: 48rem) {
    .portal-header {
        padding-right: max(2rem, calc((100vw - 48rem) / 2));
        padding-left: max(2rem, calc((100vw - 48rem) / 2));
    }

    .bottom-nav {
        right: calc((100vw - 32rem) / 2);
        left: calc((100vw - 32rem) / 2);
        bottom: .75rem;
        border: 1px solid var(--portal-primary-dark);
        border-radius: 1.25rem;
    }

    .portal-content {
        padding-right: 1.5rem;
        padding-left: 1.5rem;
    }

    /* The nav floats .75rem clear of the bottom here, so its top edge sits a further .75rem up. */
    .portal-content:has(.messages-page) {
        padding-bottom: calc(5.5rem + var(--portal-nav-gap) + env(safe-area-inset-bottom));
    }

    .messages-page .chat-composer {
        bottom: calc(5.5rem + var(--portal-nav-gap) + env(safe-area-inset-bottom));
    }

    .slot-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 22rem) {
    .detail-list.compact,
    .slot-list,
    .details-grid {
        grid-template-columns: 1fr;
    }
}
/* Remains usable when the interactive application fails to start. */
.portal-startup-error:not([hidden]) {
    position: fixed;
    inset: 1rem 1rem auto;
    z-index: 2000;
    padding: 1rem;
    background: var(--znt-white);
    color: var(--znt-ink);
    border: 1px solid currentColor;
    border-radius: .5rem;
}
