/* ==========================================================================
   Vitalis Clinic — design tokens
   A calm medical palette: teal for action, deep slate for text, mint surfaces.
   Everything is expressed with CSS logical properties so a single stylesheet
   serves both the Arabic (RTL) and English (LTR) layouts.
   ========================================================================== */

:root {
    /* brand */
    --brand-50: #ecfdfa;
    --brand-100: #d0f7f0;
    --brand-200: #a3efe3;
    --brand-300: #6ee0d1;
    --brand-400: #38c8b8;
    --brand-500: #14a89a;
    --brand-600: #0e8b80;
    --brand-700: #0f6f68;
    --brand-800: #115853;
    --brand-900: #123f3d;

    /* secondary accent — clinical blue */
    --accent-100: #e0edff;
    --accent-300: #94bdff;
    --accent-500: #3b7ddd;
    --accent-600: #2b62b8;

    /* semantic */
    --success-100: #dcfce7;
    --success-500: #16a34a;
    --success-700: #15803d;
    --warning-100: #fef3c7;
    --warning-500: #d97706;
    --warning-700: #b45309;
    --danger-100: #ffe4e6;
    --danger-500: #e11d48;
    --danger-700: #be123c;
    --info-100: #e0f2fe;
    --info-500: #0284c7;
    --info-700: #0369a1;

    /* neutrals */
    --ink-900: #0f1e2b;
    --ink-800: #16293a;
    --ink-700: #274259;
    --ink-600: #40607c;
    --ink-500: #6b849c;
    --ink-400: #9aacbe;
    --ink-300: #c6d2dd;
    --ink-200: #e2e9f0;
    --ink-100: #eff4f8;
    --ink-50: #f7fafc;

    /* surfaces */
    --bg-body: #f4f8f9;
    --bg-surface: #ffffff;
    --bg-raised: #ffffff;
    --bg-subtle: var(--ink-100);
    --bg-sidebar: #0d2f35;
    --bg-sidebar-active: rgba(20, 168, 154, .22);

    --text-strong: var(--ink-900);
    --text-body: var(--ink-700);
    --text-muted: var(--ink-500);
    --border-color: var(--ink-200);
    --border-strong: var(--ink-300);

    /* shape + depth */
    --radius-sm: .55rem;
    --radius: .9rem;
    --radius-lg: 1.25rem;
    --radius-pill: 999px;

    --shadow-xs: 0 1px 2px rgba(15, 30, 43, .06);
    --shadow-sm: 0 2px 8px rgba(15, 30, 43, .06);
    --shadow-md: 0 8px 24px rgba(15, 30, 43, .08);
    --shadow-lg: 0 18px 48px rgba(15, 30, 43, .12);

    --sidebar-width: 17rem;
    --topbar-height: 4.25rem;
    --bottom-nav-height: 4.25rem;

    --font-sans: "Cairo", "Segoe UI", "Noto Sans Arabic", Tahoma, system-ui, -apple-system, sans-serif;

    --transition: 160ms cubic-bezier(.4, 0, .2, 1);
}

[data-theme="dark"] {
    --bg-body: #0b1720;
    --bg-surface: #12212c;
    --bg-raised: #172936;
    --bg-subtle: #1b303d;
    --bg-sidebar: #08161c;
    --bg-sidebar-active: rgba(56, 200, 184, .18);

    --text-strong: #eaf2f6;
    --text-body: #c3d3de;
    --text-muted: #8ba2b3;
    --border-color: #22394a;
    --border-strong: #2d4a5e;

    --ink-100: #1b303d;
    --ink-200: #22394a;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, .35);
    --shadow-md: 0 10px 28px rgba(0, 0, 0, .4);
    --shadow-lg: 0 20px 52px rgba(0, 0, 0, .5);
}

/* ============================================================ base elements */

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    font-size: .95rem;
    line-height: 1.65;
    color: var(--text-body);
    background: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-strong);
    font-weight: 700;
    letter-spacing: -.01em;
}

a {
    color: var(--brand-600);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--brand-700);
}

:focus-visible {
    outline: 3px solid var(--brand-300);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

::selection {
    background: var(--brand-200);
    color: var(--ink-900);
}

/* Arabic numerals stay latin inside data tables for scannability. */
.tabular {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

/* ================================================================= layout */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    flex: 0 0 var(--sidebar-width);
    background: var(--bg-sidebar);
    color: #cfe3e4;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 40;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.4rem 1.25rem;
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    border-block-end: 1px solid rgba(255, 255, 255, .07);
}

.sidebar__mark {
    inline-size: 2.4rem;
    block-size: 2.4rem;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    background: linear-gradient(140deg, var(--brand-400), var(--brand-600));
    color: #05231f;
    font-size: 1.2rem;
    box-shadow: 0 6px 18px rgba(20, 168, 154, .35);
}

/* An uploaded logo replaces the generated square mark. Clinic logos are usually wordmarks with
   generous margins of their own, so this gives them a wide box rather than squeezing them into
   the 2.4rem tile, and lets the image keep its aspect ratio inside it. */
.sidebar__logo {
    inline-size: 100%;
    block-size: 4.75rem;
    display: grid;
    place-items: center;
    padding: .4rem .6rem;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-xs);
}

/* Height is capped with a length, never a percentage: the grid row here is auto-sized by this
   very image, so a percentage height resolves against the image itself and does not constrain it. */
.sidebar__logo img {
    max-inline-size: 100%;
    max-block-size: 3.95rem;
    object-fit: contain;
}

/* With a logo the brand becomes a column: the mark on top, the clinic strapline underneath. */
.sidebar__brand--stacked {
    flex-direction: column;
    align-items: stretch;
    gap: .5rem;
    text-align: center;
}

.sidebar__brand--stacked small {
    color: rgba(255, 255, 255, .6);
}

/* Preview tile on the settings screen. */
.logo-preview {
    inline-size: 100%;
    max-inline-size: 18rem;
    block-size: 6rem;
    display: grid;
    place-items: center;
    padding: .75rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    background: #fff;
}

.logo-preview img {
    max-inline-size: 100%;
    max-block-size: 4.5rem;
    object-fit: contain;
}

.sidebar__brand small {
    display: block;
    font-size: .72rem;
    font-weight: 500;
    color: rgba(255, 255, 255, .55);
}

.sidebar__nav {
    padding: 1rem .85rem 2rem;
    flex: 1;
}

.sidebar__section {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: rgba(255, 255, 255, .38);
    padding: 1.1rem .7rem .35rem;
    font-weight: 600;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .62rem .75rem;
    border-radius: var(--radius);
    color: rgba(255, 255, 255, .78);
    font-weight: 500;
    margin-block-end: .15rem;
    transition: background var(--transition), color var(--transition);
}

.sidebar__link i {
    font-size: 1.05rem;
    opacity: .9;
}

.sidebar__link:hover {
    background: rgba(255, 255, 255, .07);
    color: #fff;
}

.sidebar__link.is-active {
    background: var(--bg-sidebar-active);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(56, 200, 184, .25);
}

.sidebar__footer {
    padding: 1rem;
    border-block-start: 1px solid rgba(255, 255, 255, .07);
    font-size: .78rem;
    color: rgba(255, 255, 255, .5);
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: .75rem;
    padding-inline: 1.25rem;
    background: color-mix(in srgb, var(--bg-surface) 88%, transparent);
    backdrop-filter: blur(10px);
    border-block-end: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-strong);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar__spacer {
    flex: 1;
}

.page {
    padding: 1.5rem 1.25rem 3rem;
    max-width: 1400px;
    width: 100%;
    margin-inline: auto;
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    margin-block-end: 1.4rem;
}

.page-head h1 {
    font-size: 1.5rem;
    margin: 0;
}

.page-head p {
    margin: .2rem 0 0;
    color: var(--text-muted);
    font-size: .9rem;
}

.page-head__actions {
    margin-inline-start: auto;
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

/* ================================================================= surfaces */

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

.card__head {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1rem 1.15rem;
    border-block-end: 1px solid var(--border-color);
}

.card__head h2,
.card__head h3 {
    font-size: 1rem;
    margin: 0;
}

.card__head .btn,
.card__head .form-control,
.card__head .form-select {
    margin-inline-start: auto;
}

.card__body {
    padding: 1.15rem;
}

.card__body--flush {
    padding: 0;
}

.card__foot {
    padding: .85rem 1.15rem;
    border-block-start: 1px solid var(--border-color);
    background: var(--bg-subtle);
    border-end-start-radius: var(--radius-lg);
    border-end-end-radius: var(--radius-lg);
}

/* Cards sitting side by side in one grid row are stretched to a common height, but a plain card
   leaves its footer wherever the content ends. Pricing cards carry descriptions of different
   lengths, so their calls to action would sit at different heights; this pins every footer to the
   bottom of its own card. */
.card--equal {
    display: flex;
    flex-direction: column;
}

.card--equal > .card__body {
    flex: 1;
}

.section-title {
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-block: 1.6rem .7rem;
}

/* stat cards */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 1rem;
}

.stat-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: 1.05rem 1.15rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: inherit;
}

.stat-card::after {
    content: "";
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: 0;
    inline-size: 100%;
    block-size: 3px;
    background: var(--tone, var(--brand-500));
}

.stat-card__icon {
    inline-size: 3rem;
    block-size: 3rem;
    flex: 0 0 3rem;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    font-size: 1.35rem;
    background: var(--tone-soft, var(--brand-50));
    color: var(--tone, var(--brand-600));
}

/* The text column next to the icon. */
.stat-card > span:last-child {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-card__value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-strong);
    line-height: 1.2;
}

.stat-card__label {
    font-size: .82rem;
    color: var(--text-muted);
}

.tone-primary { --tone: var(--brand-600); --tone-soft: var(--brand-50); }
.tone-accent  { --tone: var(--accent-500); --tone-soft: var(--accent-100); }
.tone-success { --tone: var(--success-500); --tone-soft: var(--success-100); }
.tone-warning { --tone: var(--warning-500); --tone-soft: var(--warning-100); }
.tone-danger  { --tone: var(--danger-500); --tone-soft: var(--danger-100); }
.tone-info    { --tone: var(--info-500); --tone-soft: var(--info-100); }
.tone-muted   { --tone: var(--ink-500); --tone-soft: var(--ink-100); }

[data-theme="dark"] .tone-primary { --tone-soft: rgba(20, 168, 154, .16); }
[data-theme="dark"] .tone-accent  { --tone-soft: rgba(59, 125, 221, .16); }
[data-theme="dark"] .tone-success { --tone-soft: rgba(22, 163, 74, .16); }
[data-theme="dark"] .tone-warning { --tone-soft: rgba(217, 119, 6, .16); }
[data-theme="dark"] .tone-danger  { --tone-soft: rgba(225, 29, 72, .16); }
[data-theme="dark"] .tone-info    { --tone-soft: rgba(2, 132, 199, .16); }
[data-theme="dark"] .tone-muted   { --tone-soft: rgba(148, 172, 190, .14); }

/* ================================================================== badges */

.badge-soft {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .28rem .6rem;
    border-radius: var(--radius-pill);
    font-size: .76rem;
    font-weight: 600;
    line-height: 1.3;
    background: var(--tone-soft, var(--ink-100));
    color: var(--tone, var(--ink-600));
    white-space: nowrap;
}

.badge-soft::before {
    content: "";
    inline-size: .45rem;
    block-size: .45rem;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 auto;
}

.badge-soft--plain::before {
    display: none;
}

/* ================================================================ elements */

.avatar {
    inline-size: 2.5rem;
    block-size: 2.5rem;
    flex: 0 0 auto;
    border-radius: var(--radius-pill);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .85rem;
    color: var(--brand-800);
    background: linear-gradient(140deg, var(--brand-100), var(--brand-200));
    text-transform: uppercase;
}

.avatar--sm { inline-size: 2rem; block-size: 2rem; font-size: .72rem; }
.avatar--lg { inline-size: 4rem; block-size: 4rem; font-size: 1.3rem; }

[data-theme="dark"] .avatar {
    color: var(--brand-100);
    background: linear-gradient(140deg, rgba(20, 168, 154, .3), rgba(20, 168, 154, .12));
}

.identity {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
}

.identity__name {
    display: block;
    font-weight: 600;
    color: var(--text-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.identity__meta {
    display: block;
    font-size: .78rem;
    color: var(--text-muted);
}

/* Reference numbers should never wrap mid-code. */
.table-modern td.tabular {
    white-space: nowrap;
}

/* buttons ---------------------------------------------------------------- */

.btn {
    --btn-bg: var(--bg-surface);
    --btn-fg: var(--text-body);
    --btn-border: var(--border-strong);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .5rem .95rem;
    border-radius: var(--radius);
    border: 1px solid var(--btn-border);
    background: var(--btn-bg);
    color: var(--btn-fg);
    font-family: inherit;
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    transition: filter var(--transition), box-shadow var(--transition), transform var(--transition);
    white-space: nowrap;
}

.btn:hover {
    filter: brightness(.97);
    color: var(--btn-fg);
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled,
.btn.disabled {
    opacity: .55;
    pointer-events: none;
}

.btn-primary {
    --btn-bg: linear-gradient(135deg, var(--brand-500), var(--brand-600));
    --btn-fg: #fff;
    --btn-border: transparent;
    box-shadow: 0 6px 16px rgba(14, 139, 128, .25);
}

.btn-accent {
    --btn-bg: var(--accent-500);
    --btn-fg: #fff;
    --btn-border: transparent;
}

.btn-danger {
    --btn-bg: var(--danger-500);
    --btn-fg: #fff;
    --btn-border: transparent;
}

.btn-success {
    --btn-bg: var(--success-500);
    --btn-fg: #fff;
    --btn-border: transparent;
}

.btn-ghost {
    --btn-bg: transparent;
    --btn-border: transparent;
    --btn-fg: var(--text-muted);
}

.btn-ghost:hover {
    background: var(--bg-subtle);
    color: var(--text-strong);
}

.btn-soft {
    --btn-bg: var(--brand-50);
    --btn-fg: var(--brand-700);
    --btn-border: transparent;
}

[data-theme="dark"] .btn-soft {
    --btn-bg: rgba(20, 168, 154, .16);
    --btn-fg: var(--brand-300);
}

.btn-sm {
    padding: .32rem .65rem;
    font-size: .8rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: .7rem 1.4rem;
    font-size: .98rem;
}

.btn-icon {
    padding: .45rem;
    inline-size: 2.35rem;
    block-size: 2.35rem;
    border-radius: var(--radius);
}

.btn-block {
    inline-size: 100%;
}

/* forms ------------------------------------------------------------------ */

.form-label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-strong);
    margin-block-end: .35rem;
}

.form-label .req {
    color: var(--danger-500);
    margin-inline-start: .15rem;
}

.form-control,
.form-select,
textarea {
    inline-size: 100%;
    padding: .55rem .8rem;
    font-family: inherit;
    font-size: .9rem;
    color: var(--text-strong);
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236b849c'%3E%3Cpath d='M8 11 3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left .75rem center;
    background-size: .9rem;
    padding-inline-end: .8rem;
    padding-inline-start: 2rem;
}

html[dir="ltr"] .form-select {
    background-position: right .75rem center;
    padding-inline-start: .8rem;
    padding-inline-end: 2rem;
}

.form-control:focus,
.form-select:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand-400);
    box-shadow: 0 0 0 3px rgba(56, 200, 184, .22);
}

.form-control::placeholder {
    color: var(--ink-400);
}

.form-hint {
    font-size: .76rem;
    color: var(--text-muted);
    margin-block-start: .25rem;
}

.field {
    margin-block-end: 1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 0 1rem;
}

.form-grid--tight {
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}

.field-validation-error,
.validation-message {
    display: block;
    font-size: .78rem;
    color: var(--danger-600, var(--danger-500));
    margin-block-start: .25rem;
}

.input-validation-error {
    border-color: var(--danger-500) !important;
    box-shadow: 0 0 0 3px rgba(225, 29, 72, .15);
}

.validation-summary-errors ul {
    margin: 0;
    padding-inline-start: 1.1rem;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: .88rem;
    cursor: pointer;
    user-select: none;
}

.check input[type="checkbox"] {
    inline-size: 1.1rem;
    block-size: 1.1rem;
    accent-color: var(--brand-500);
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .6rem 0;
}

/* A titled block that sits inside a card body as its own column. */
.contact-split {
    display: grid;
    gap: 1rem 1.75rem;
    grid-template-columns: 1fr;
}

@media (min-width: 900px) {
    .contact-split {
        grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
    }

    .contact-split__aside {
        padding-inline-start: 1.5rem;
        border-inline-start: 1px dashed var(--border-strong);
    }
}

@media (max-width: 899.98px) {
    .contact-split__aside {
        padding-block-start: 1.1rem;
        border-block-start: 1px dashed var(--border-strong);
    }
}

.subsection__title {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .95rem;
    font-weight: 700;
    color: var(--text-strong);
    margin: 0;
}

.subsection__title i {
    color: var(--danger-500);
}

/* search field with a leading icon */
.search {
    position: relative;
    flex: 1 1 16rem;
    min-width: 0;
}

.search i {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-start: .8rem;
    transform: translateY(-50%);
    color: var(--ink-400);
    pointer-events: none;
}

.search .form-control {
    padding-inline-start: 2.35rem;
}

/* toolbar above lists */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    margin-block-end: 1rem;
}

/* segmented control ------------------------------------------------------ */

.segmented {
    display: inline-flex;
    padding: .25rem;
    gap: .15rem;
    background: var(--bg-subtle);
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
    overflow-x: auto;
    max-width: 100%;
}

.segmented a {
    padding: .35rem .85rem;
    border-radius: var(--radius-pill);
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.segmented a.is-active {
    background: var(--bg-surface);
    color: var(--brand-700);
    box-shadow: var(--shadow-xs);
}

[data-theme="dark"] .segmented a.is-active {
    color: var(--brand-300);
}

/* tables ----------------------------------------------------------------- */

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-modern {
    inline-size: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.table-modern thead th {
    text-align: start;
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    font-weight: 700;
    padding: .75rem 1rem;
    background: var(--bg-subtle);
    border-block-end: 1px solid var(--border-color);
    white-space: nowrap;
}

.table-modern tbody td {
    padding: .8rem 1rem;
    border-block-end: 1px solid var(--border-color);
    vertical-align: middle;
}

.table-modern tbody tr:last-child td {
    border-block-end: none;
}

.table-modern tbody tr {
    transition: background var(--transition);
}

.table-modern tbody tr:hover {
    background: var(--bg-subtle);
}

.table-modern .actions {
    display: flex;
    gap: .3rem;
    justify-content: flex-end;
}

/* empty + loading states -------------------------------------------------- */

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.75rem;
    color: var(--ink-300);
    display: block;
    margin-block-end: .6rem;
}

.empty-state h3 {
    font-size: 1rem;
    margin: 0 0 .3rem;
}

.empty-state p {
    margin: 0 0 1rem;
    font-size: .875rem;
}

/* pagination -------------------------------------------------------------- */

.pager {
    display: flex;
    align-items: center;
    gap: .35rem;
    flex-wrap: wrap;
}

.pager__info {
    margin-inline-end: auto;
    font-size: .82rem;
    color: var(--text-muted);
}

.pager a,
.pager span {
    min-inline-size: 2.25rem;
    padding: .35rem .6rem;
    text-align: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-body);
    background: var(--bg-surface);
}

.pager .is-active {
    background: var(--brand-600);
    border-color: var(--brand-600);
    color: #fff;
}

.pager .is-disabled {
    opacity: .45;
    pointer-events: none;
}

/* alerts ------------------------------------------------------------------ */

.alert {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .8rem 1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: .88rem;
    margin-block-end: 1rem;
}

.alert i {
    font-size: 1.1rem;
    margin-block-start: .05rem;
}

.alert-success { background: var(--success-100); color: var(--success-700); border-color: color-mix(in srgb, var(--success-500) 25%, transparent); }
.alert-danger  { background: var(--danger-100); color: var(--danger-700); border-color: color-mix(in srgb, var(--danger-500) 25%, transparent); }
.alert-warning { background: var(--warning-100); color: var(--warning-700); border-color: color-mix(in srgb, var(--warning-500) 25%, transparent); }
.alert-info    { background: var(--info-100); color: var(--info-700); border-color: color-mix(in srgb, var(--info-500) 25%, transparent); }

/* toast stack ------------------------------------------------------------- */

.toast-stack {
    position: fixed;
    inset-block-end: calc(var(--bottom-nav-height) + 1rem);
    inset-inline-end: 1rem;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-inline-size: min(22rem, calc(100vw - 2rem));
}

@media (min-width: 992px) {
    .toast-stack {
        inset-block-end: 1.25rem;
    }
}

.toast-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .75rem .9rem;
    border-radius: var(--radius);
    background: var(--bg-raised);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    font-size: .87rem;
    animation: toast-in 260ms cubic-bezier(.2, .9, .3, 1);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

.toast-item--success { border-inline-start: 4px solid var(--success-500); }
.toast-item--error   { border-inline-start: 4px solid var(--danger-500); }
.toast-item--info    { border-inline-start: 4px solid var(--info-500); }

/* ============================================================ app specific */

/* appointment timeline / agenda */
.agenda {
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.agenda-item {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .8rem 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    border-inline-start: 4px solid var(--tone, var(--brand-500));
    transition: box-shadow var(--transition), transform var(--transition);
}

.agenda-item:hover {
    box-shadow: var(--shadow-sm);
}

.agenda-item__time {
    font-weight: 700;
    color: var(--text-strong);
    font-size: .95rem;
    min-inline-size: 4rem;
}

.agenda-item__time small {
    display: block;
    font-weight: 500;
    font-size: .72rem;
    color: var(--text-muted);
}

.agenda-item__body {
    flex: 1;
    min-width: 0;
}

/* bookable slots */
.slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(5.2rem, 1fr));
    gap: .5rem;
}

.slot {
    padding: .5rem .35rem;
    text-align: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-surface);
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-body);
    cursor: pointer;
    transition: all var(--transition);
}

.slot:hover:not(:disabled) {
    border-color: var(--brand-400);
    color: var(--brand-700);
}

.slot.is-selected {
    background: var(--brand-600);
    border-color: var(--brand-600);
    color: #fff;
}

.slot:disabled {
    background: var(--bg-subtle);
    color: var(--ink-400);
    text-decoration: line-through;
    cursor: not-allowed;
}

/* vitals grid */
.vitals {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
    gap: .75rem;
}

.vital {
    padding: .75rem;
    border-radius: var(--radius);
    background: var(--bg-subtle);
    text-align: center;
}

.vital__value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-strong);
}

.vital__label {
    font-size: .72rem;
    color: var(--text-muted);
}

/* definition list used on detail pages */
.data-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: .9rem 1.5rem;
    margin: 0;
}

.data-list dt {
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    font-weight: 600;
}

.data-list dd {
    margin: .1rem 0 0;
    color: var(--text-strong);
    font-weight: 500;
    overflow-wrap: anywhere;
}

/* simple bar chart, rendered without any charting library */
.bar-chart {
    display: flex;
    align-items: stretch;
    gap: .5rem;
    block-size: 10rem;
    padding-block-start: 1rem;
}

.bar {
    flex: 1;
    block-size: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: .35rem;
    min-inline-size: 0;
}

.bar__fill {
    inline-size: 100%;
    max-inline-size: 2.75rem;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: linear-gradient(180deg, var(--brand-400), var(--brand-600));
    min-block-size: 3px;
    transition: block-size var(--transition);
}

.bar__label {
    font-size: .68rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.bar__value {
    font-size: .72rem;
    font-weight: 700;
    color: var(--text-strong);
}

/* horizontal meter used for status breakdowns */
.meter {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-block-end: .6rem;
}

.meter__label {
    inline-size: 8rem;
    font-size: .8rem;
    color: var(--text-body);
    flex: 0 0 auto;
}

.meter__track {
    flex: 1;
    block-size: .5rem;
    border-radius: var(--radius-pill);
    background: var(--bg-subtle);
    overflow: hidden;
}

.meter__fill {
    block-size: 100%;
    border-radius: var(--radius-pill);
    background: var(--tone, var(--brand-500));
}

.meter__value {
    font-size: .78rem;
    font-weight: 700;
    color: var(--text-strong);
    min-inline-size: 2.5rem;
    text-align: end;
}

/* totals block on invoices */
.totals {
    margin-inline-start: auto;
    max-inline-size: 22rem;
    inline-size: 100%;
}

.totals__row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .35rem 0;
    font-size: .88rem;
}

.totals__row--grand {
    border-block-start: 1px solid var(--border-color);
    margin-block-start: .35rem;
    padding-block-start: .6rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-strong);
}

/* ============================================================ mobile shell */

.bottom-nav {
    display: none;
    position: fixed;
    inset-inline: 0;
    inset-block-end: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg-surface) 94%, transparent);
    backdrop-filter: blur(12px);
    border-block-start: 1px solid var(--border-color);
    padding-block: .35rem;
    padding-block-end: calc(.35rem + env(safe-area-inset-bottom));
}

.bottom-nav__list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    align-items: center;
}

.bottom-nav__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .1rem;
    padding: .35rem .2rem;
    font-size: .68rem;
    font-weight: 600;
    color: var(--text-muted);
}

.bottom-nav__link i {
    font-size: 1.3rem;
}

.bottom-nav__link.is-active {
    color: var(--brand-600);
}

[data-theme="dark"] .bottom-nav__link.is-active {
    color: var(--brand-300);
}

.fab {
    position: fixed;
    inset-block-end: calc(var(--bottom-nav-height) + 1rem + env(safe-area-inset-bottom));
    inset-inline-end: 1.1rem;
    z-index: 55;
    inline-size: 3.5rem;
    block-size: 3.5rem;
    border-radius: var(--radius-pill);
    display: none;
    place-items: center;
    font-size: 1.5rem;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
    box-shadow: 0 12px 28px rgba(14, 139, 128, .4);
    border: none;
}

/* off-canvas backdrop for the sidebar on small screens */
.scrim {
    position: fixed;
    inset: 0;
    background: rgba(9, 24, 33, .45);
    backdrop-filter: blur(2px);
    z-index: 39;
    display: none;
}

.scrim.is-open {
    display: block;
}

@media (max-width: 991.98px) {
    /* Off-canvas drawer anchored to the start edge. Transforms are not direction-aware,
       so the hidden offset is flipped explicitly for RTL. */
    .sidebar {
        position: fixed;
        inset-block: 0;
        inset-inline-start: 0;
        transform: translateX(-105%);
        transition: transform var(--transition);
        box-shadow: var(--shadow-lg);
    }

    html[dir="rtl"] .sidebar {
        transform: translateX(105%);
    }

    .sidebar.is-open,
    html[dir="rtl"] .sidebar.is-open {
        transform: none;
    }

    .bottom-nav {
        display: block;
    }

    .fab {
        display: grid;
    }

    .page {
        padding: 1rem .9rem calc(var(--bottom-nav-height) + 2rem);
    }

    .page-head h1 {
        font-size: 1.25rem;
    }

    .card__body {
        padding: 1rem;
    }
}

@media (min-width: 992px) {
    .sidebar-toggle {
        display: none !important;
    }
}

/* Tables collapse into stacked cards on narrow screens. */
@media (max-width: 640px) {
    .table-stack thead {
        display: none;
    }

    .table-stack tbody tr {
        display: block;
        padding: .85rem 1rem;
        border-block-end: 1px solid var(--border-color);
    }

    .table-stack tbody td {
        display: flex;
        justify-content: space-between;
        gap: 1rem;
        padding: .2rem 0;
        border: none;
        text-align: end;
    }

    .table-stack tbody td::before {
        content: attr(data-label);
        font-size: .74rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .04em;
        color: var(--text-muted);
        text-align: start;
    }

    .table-stack tbody td:first-child {
        padding-block-end: .5rem;
    }

    .table-modern .actions {
        justify-content: flex-start;
    }
}

/* ============================================================ auth screens */

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr;
    background: var(--bg-body);
}

@media (min-width: 992px) {
    .auth-shell {
        grid-template-columns: 1.05fr .95fr;
    }
}

.auth-aside {
    display: none;
    position: relative;
    padding: 3.5rem;
    color: #eafaf8;
    background:
        radial-gradient(900px 500px at 15% 15%, rgba(56, 200, 184, .35), transparent 60%),
        linear-gradient(150deg, #0b3b3a 0%, #0d2f35 55%, #071f27 100%);
    overflow: hidden;
}

@media (min-width: 992px) {
    .auth-aside {
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}

/* Sign-up carries a far taller form than sign-in, so the shell grows well past one screen and
   centring the pitch inside it would park the headline halfway down the page. Here it starts at
   the top and follows the reader down instead. */
@media (min-width: 992px) {
    .auth-aside--tall {
        justify-content: flex-start;
        /* The base panel clips to contain its gradient, but an overflow container also cancels
           position:sticky on everything inside it. Nothing here actually overflows. */
        overflow: visible;
    }

    .auth-aside__pinned {
        position: sticky;
        inset-block-start: 3.5rem;
    }
}

.auth-aside h2 {
    color: #fff;
    font-size: 2.1rem;
    line-height: 1.3;
    max-inline-size: 22ch;
}

.auth-aside p {
    color: rgba(255, 255, 255, .72);
    max-inline-size: 42ch;
}

.auth-aside__points {
    list-style: none;
    padding: 0;
    margin-block-start: 2rem;
    display: grid;
    gap: .85rem;
}

.auth-aside__points li {
    display: flex;
    align-items: center;
    gap: .7rem;
    color: rgba(255, 255, 255, .88);
    font-size: .92rem;
}

.auth-aside__points i {
    inline-size: 2rem;
    block-size: 2rem;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .1);
    color: var(--brand-300);
}

/* feature checklist on light surfaces (pricing cards, plan summaries) */
.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: .6rem;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: var(--text-body);
    font-size: .9rem;
}

.feature-list i {
    inline-size: 1.6rem;
    block-size: 1.6rem;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    color: var(--brand-500);
}

.feature-list li.is-off {
    color: var(--text-muted);
}

.feature-list li.is-off i {
    color: var(--text-muted);
}

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
}

.auth-card {
    inline-size: min(26rem, 100%);
}

.auth-card__mark {
    inline-size: 3.25rem;
    block-size: 3.25rem;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    background: linear-gradient(140deg, var(--brand-400), var(--brand-600));
    color: #fff;
    font-size: 1.6rem;
    margin-block-end: 1rem;
    box-shadow: 0 10px 24px rgba(14, 139, 128, .3);
}

.demo-accounts {
    display: grid;
    gap: .4rem;
    margin-block-start: 1.25rem;
    padding-block-start: 1rem;
    border-block-start: 1px dashed var(--border-strong);
}

.demo-accounts button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    inline-size: 100%;
    padding: .5rem .7rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-subtle);
    font-family: inherit;
    font-size: .8rem;
    color: var(--text-body);
    cursor: pointer;
}

.demo-accounts button:hover {
    border-color: var(--brand-400);
    color: var(--brand-700);
}

/* ================================================================ utilities */

.stack     { display: flex; flex-direction: column; gap: 1rem; }
.stack-sm  { display: flex; flex-direction: column; gap: .5rem; }
.row-flex  { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.grow      { flex: 1; }
.muted     { color: var(--text-muted); }
.strong    { color: var(--text-strong); font-weight: 600; }
.small     { font-size: .8rem; }
.nowrap    { white-space: nowrap; }
.text-end  { text-align: end; }
.text-center { text-align: center; }
.mt-0 { margin-block-start: 0; }
.mb-0 { margin-block-end: 0; }
.mt-1 { margin-block-start: .5rem; }
.mb-1 { margin-block-end: .5rem; }
.mt-2 { margin-block-start: 1rem; }
.mb-2 { margin-block-end: 1rem; }
.mt-3 { margin-block-start: 1.5rem; }
.mb-3 { margin-block-end: 1.5rem; }
.hidden { display: none !important; }

.grid-2 {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
}

.grid-sidebar {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 1100px) {
    .grid-sidebar {
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
        align-items: start;
    }
}

/* offline indicator injected by the service worker helper */
.offline-banner {
    display: none;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .45rem 1rem;
    background: var(--warning-100);
    color: var(--warning-700);
    font-size: .82rem;
    font-weight: 600;
}

body.is-offline .offline-banner {
    display: flex;
}

/* ==================================================================== print */

@media print {
    .sidebar,
    .topbar,
    .bottom-nav,
    .fab,
    .page-head__actions,
    .toolbar,
    .no-print {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .page {
        padding: 0;
        max-width: none;
    }

    .card {
        border: none;
        box-shadow: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
    }
}

/* ================================================= layout odds and ends */

.bottom-nav__link {
    background: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
}

.user-menu summary {
    padding: .25rem;
    border-radius: var(--radius);
}

.user-menu summary::-webkit-details-marker,
.user-menu summary::marker {
    display: none;
    content: "";
}

.user-menu summary:hover {
    background: var(--bg-subtle);
}

.user-menu .btn-block {
    justify-content: flex-start;
}

@media (max-width: 767.98px) {
    .d-none-mobile {
        display: none;
    }
}
