/* =====================================================================
   GLOW BY ZEINA - design system
   Mobile first. Every colour is a variable so Appearance settings can
   retheme the whole application without touching a component.
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. TOKENS
   --------------------------------------------------------------------- */

:root {
    /* Surfaces - warm ivory and pearl */
    --bg: #F8F4F1;
    --bg-deep: #F1E9E4;
    --bg-subtle: #F3EDE9;
    --surface: rgba(255, 255, 255, 0.74);
    --surface-solid: #FFFFFF;
    --surface-elevated: #FFFFFF;
    --surface-sunken: #F0E8E4;
    --scrim: rgba(38, 28, 34, 0.42);

    /* Text - deep charcoal plum */
    --text-primary: #33262F;
    --text-secondary: #786A74;
    --text-tertiary: #A3959D;
    --text-on-accent: #FFFFFF;

    /* Brand */
    --accent: #B98AA6;
    --accent-strong: #A2718F;
    --accent-soft: rgba(185, 138, 166, 0.13);
    --accent-line: rgba(185, 138, 166, 0.30);
    --gold: #C9A87C;
    --gold-soft: rgba(201, 168, 124, 0.16);
    --rose: #DFB6C3;
    --lavender: #BDB2DC;
    --beige: #E4D6CA;

    /* Status */
    --success: #5C8C70;
    --success-soft: rgba(92, 140, 112, 0.14);
    --warning: #C2884A;
    --warning-soft: rgba(194, 136, 74, 0.15);
    --danger: #BF5D68;
    --danger-soft: rgba(191, 93, 104, 0.13);
    --info: #6E86B0;
    --info-soft: rgba(110, 134, 176, 0.14);

    /* Lines */
    --border: rgba(51, 38, 47, 0.085);
    --border-strong: rgba(51, 38, 47, 0.16);
    --divider: rgba(51, 38, 47, 0.06);

    /* Depth */
    --shadow-xs: 0 1px 2px rgba(58, 42, 52, 0.05);
    --shadow-sm: 0 2px 8px rgba(58, 42, 52, 0.06);
    --shadow-md: 0 8px 24px rgba(58, 42, 52, 0.08);
    --shadow-lg: 0 18px 48px rgba(58, 42, 52, 0.12);
    --shadow-xl: 0 28px 70px rgba(58, 42, 52, 0.18);

    /* Shape */
    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-xl: 28px;
    --radius-pill: 999px;

    /* Rhythm */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-7: 32px;
    --sp-8: 40px;
    --sp-9: 56px;

    /* Type */
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI",
            "Inter", "Helvetica Neue", Arial, sans-serif;
    --font-display: var(--font);
    --font-mono: "SF Mono", ui-monospace, "Cascadia Mono", Menlo, monospace;

    --text-xs: 11px;
    --text-sm: 13px;
    --text-base: 15px;
    --text-md: 17px;
    --text-lg: 20px;
    --text-xl: 25px;
    --text-2xl: 31px;
    --text-3xl: 38px;

    /* Motion */
    --ease: cubic-bezier(0.32, 0.72, 0, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
    --dur-fast: 140ms;
    --dur: 240ms;
    --dur-slow: 380ms;

    /* Chrome */
    --nav-height: 62px;
    --header-height: 56px;
    --sidebar-width: 248px;
    --sidebar-compact: 76px;
    --content-max: 1180px;
    --blur: saturate(180%) blur(20px);

    /* Safe areas for notched phones */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);

    color-scheme: light;
}

[data-theme="dark"] {
    --bg: #131013;
    --bg-deep: #0D0B0D;
    --bg-subtle: #1A161A;
    --surface: rgba(34, 29, 34, 0.74);
    --surface-solid: #211C21;
    --surface-elevated: #272128;
    --surface-sunken: #191519;
    --scrim: rgba(0, 0, 0, 0.62);

    --text-primary: #F3ECEF;
    --text-secondary: #A79BA3;
    --text-tertiary: #786E76;
    --text-on-accent: #1A141A;

    --accent: #CFA7C4;
    --accent-strong: #DDBBD3;
    --accent-soft: rgba(207, 167, 196, 0.15);
    --accent-line: rgba(207, 167, 196, 0.30);
    --gold: #D6B98D;
    --gold-soft: rgba(214, 185, 141, 0.16);
    --rose: #C99BAA;
    --lavender: #A99EC9;
    --beige: #B9A796;

    --success: #7FB393;
    --success-soft: rgba(127, 179, 147, 0.16);
    --warning: #DBA96C;
    --warning-soft: rgba(219, 169, 108, 0.16);
    --danger: #DE8189;
    --danger-soft: rgba(222, 129, 137, 0.16);
    --info: #93A9D1;
    --info-soft: rgba(147, 169, 209, 0.16);

    --border: rgba(255, 255, 255, 0.075);
    --border-strong: rgba(255, 255, 255, 0.15);
    --divider: rgba(255, 255, 255, 0.06);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.34);
    --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.42);
    --shadow-lg: 0 20px 52px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 30px 74px rgba(0, 0, 0, 0.6);

    color-scheme: dark;
}

/* Compact density shrinks the rhythm, not the touch targets. */
[data-density="compact"] {
    --sp-4: 12px;
    --sp-5: 16px;
    --sp-6: 18px;
    --sp-7: 24px;
    --radius-lg: 18px;
    --radius-xl: 22px;
}

/* ---------------------------------------------------------------------
   2. RESET
   --------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior-y: none;
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

/* A soft, expensive-feeling wash behind everything. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(58rem 30rem at 8% -8%, var(--accent-soft), transparent 62%),
        radial-gradient(46rem 26rem at 104% 4%, var(--gold-soft), transparent 60%);
}

h1, h2, h3, h4, h5, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
a { color: var(--accent-strong); text-decoration: none; }
table { border-collapse: collapse; width: 100%; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

::selection { background: var(--accent-soft); }

/* Slim, unobtrusive scrollbars. */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--radius-pill);
    border: 3px solid transparent;
    background-clip: content-box;
}

/* ---------------------------------------------------------------------
   3. TYPOGRAPHY
   --------------------------------------------------------------------- */

.display   { font-size: var(--text-3xl); font-weight: 700; letter-spacing: -0.028em; line-height: 1.12; }
.title-1   { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -0.024em; line-height: 1.16; }
.title-2   { font-size: var(--text-xl);  font-weight: 660; letter-spacing: -0.02em;  line-height: 1.22; }
.title-3   { font-size: var(--text-lg);  font-weight: 640; letter-spacing: -0.016em; line-height: 1.3; }
.headline  { font-size: var(--text-md);  font-weight: 620; letter-spacing: -0.012em; }
.body      { font-size: var(--text-base); }
.callout   { font-size: var(--text-sm); color: var(--text-secondary); }
.caption   { font-size: var(--text-xs); color: var(--text-tertiary); }

.overline {
    font-size: var(--text-xs);
    font-weight: 640;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.muted     { color: var(--text-secondary); }
.dim       { color: var(--text-tertiary); }
.accented  { color: var(--accent-strong); }
.gold      { color: var(--gold); }
.numeric   { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.truncate  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2   { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3   { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.text-center { text-align: center; }
.nowrap    { white-space: nowrap; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------------
   4. LAYOUT SHELL
   --------------------------------------------------------------------- */

.app {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 60;
    padding: calc(var(--safe-top) + var(--sp-3)) var(--sp-4) var(--sp-3);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-bottom: 1px solid transparent;
    transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.app-header.is-scrolled { border-bottom-color: var(--divider); }
.app-header__titles { min-width: 0; flex: 1; }
.app-header__title { font-size: var(--text-lg); font-weight: 660; letter-spacing: -0.02em; }
.app-header__subtitle { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 1px; }
.app-header__actions { display: flex; align-items: center; gap: var(--sp-2); }

.app-main {
    flex: 1;
    padding: var(--sp-4) var(--sp-4) calc(var(--nav-height) + var(--safe-bottom) + var(--sp-8));
    max-width: var(--content-max);
    width: 100%;
    margin: 0 auto;
    padding-left: max(var(--sp-4), var(--safe-left));
    padding-right: max(var(--sp-4), var(--safe-right));
}

.view { animation: view-in var(--dur-slow) var(--ease-out) both; }

@keyframes view-in {
    from { opacity: 0; transform: translate3d(0, 10px, 0); }
    to   { opacity: 1; transform: none; }
}

.section { margin-bottom: var(--sp-6); }
.section__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--sp-3);
    margin-bottom: var(--sp-3);
    padding-inline: var(--sp-1);
}
.section__title { font-size: var(--text-md); font-weight: 640; letter-spacing: -0.012em; }
.section__action { font-size: var(--text-sm); color: var(--accent-strong); font-weight: 560; }

.stack   { display: flex; flex-direction: column; gap: var(--sp-3); }
.stack-2 { display: flex; flex-direction: column; gap: var(--sp-2); }
.stack-4 { display: flex; flex-direction: column; gap: var(--sp-4); }
.row     { display: flex; align-items: center; gap: var(--sp-3); }
.row-2   { display: flex; align-items: center; gap: var(--sp-2); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.row-wrap { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.spacer  { flex: 1; }
.grid-2  { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-3); }

/* Horizontal scrollers keep wide content off the page axis. */
.scroll-x {
    display: flex;
    gap: var(--sp-3);
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    padding: var(--sp-1) var(--sp-4);
    margin-inline: calc(var(--sp-4) * -1);
    scrollbar-width: none;
}
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x > * { scroll-snap-align: start; flex: 0 0 auto; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-md); }

/* ---------------------------------------------------------------------
   5. CARDS
   --------------------------------------------------------------------- */

.card {
    background: var(--surface);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--sp-4);
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
                border-color var(--dur) var(--ease);
}

.card--solid { background: var(--surface-solid); backdrop-filter: none; -webkit-backdrop-filter: none; }
.card--flat { box-shadow: none; }
.card--pad-lg { padding: var(--sp-5); }
.card--tight { padding: var(--sp-3); }

.card--interactive { cursor: pointer; }
.card--interactive:hover { box-shadow: var(--shadow-md); border-color: var(--accent-line); }
.card--interactive:active { transform: scale(0.985); }

.card--feature {
    background: linear-gradient(150deg,
        color-mix(in srgb, var(--accent) 15%, var(--surface-solid)),
        var(--surface-solid) 62%);
    border-color: var(--accent-line);
}

.card--gold {
    background: linear-gradient(150deg,
        color-mix(in srgb, var(--gold) 16%, var(--surface-solid)),
        var(--surface-solid) 62%);
    border-color: color-mix(in srgb, var(--gold) 34%, transparent);
}

.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.card__title { font-size: var(--text-md); font-weight: 620; letter-spacing: -0.012em; }
.card__meta { font-size: var(--text-xs); color: var(--text-tertiary); }
.card__footer { margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--divider); }

/* Stat tile - the dashboard's key numbers */
.stat {
    background: var(--surface);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--sp-4);
    box-shadow: var(--shadow-xs);
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
    min-width: 0;
}
.stat__label { font-size: var(--text-xs); color: var(--text-secondary); font-weight: 540; }
.stat__value {
    font-size: var(--text-xl);
    font-weight: 680;
    letter-spacing: -0.026em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.stat__value--sm { font-size: var(--text-lg); }
.stat__delta { font-size: var(--text-xs); font-weight: 580; display: inline-flex; align-items: center; gap: 3px; }
.stat__delta--up { color: var(--success); }
.stat__delta--down { color: var(--danger); }
.stat__icon {
    width: 30px; height: 30px; border-radius: 10px;
    display: grid; place-items: center;
    background: var(--accent-soft); color: var(--accent-strong);
    margin-bottom: var(--sp-1);
}

/* ---------------------------------------------------------------------
   6. BUTTONS
   --------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    min-height: 44px;
    padding: 0 var(--sp-5);
    border-radius: var(--radius-pill);
    font-size: var(--text-base);
    font-weight: 600;
    letter-spacing: -0.01em;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: transform var(--dur-fast) var(--ease),
                background-color var(--dur-fast) var(--ease),
                box-shadow var(--dur-fast) var(--ease),
                opacity var(--dur-fast) var(--ease);
}

.btn:active { transform: scale(0.96); }
.btn:disabled, .btn.is-disabled { opacity: 0.45; pointer-events: none; }

.btn--primary {
    background: var(--accent);
    color: var(--text-on-accent);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 34%, transparent);
}
.btn--primary:hover { background: var(--accent-strong); }

.btn--secondary {
    background: var(--surface-solid);
    color: var(--text-primary);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-xs);
}
.btn--secondary:hover { border-color: var(--accent-line); }

.btn--soft { background: var(--accent-soft); color: var(--accent-strong); }
.btn--ghost { background: transparent; color: var(--text-secondary); }
.btn--ghost:hover { background: var(--accent-soft); color: var(--accent-strong); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn--gold { background: var(--gold); color: #2A2019; }

.btn--sm { min-height: 36px; padding: 0 var(--sp-4); font-size: var(--text-sm); }
.btn--lg { min-height: 52px; padding: 0 var(--sp-6); font-size: var(--text-md); }
.btn--block { width: 100%; }
.btn--icon { min-height: 44px; width: 44px; padding: 0; border-radius: var(--radius-pill); }

.icon-btn {
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    background: var(--surface-solid);
    border: 1px solid var(--border);
    transition: all var(--dur-fast) var(--ease);
    position: relative;
}
.icon-btn:hover { color: var(--accent-strong); border-color: var(--accent-line); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn--plain { background: transparent; border-color: transparent; }

.icon-btn__badge {
    position: absolute; top: 4px; right: 4px;
    min-width: 17px; height: 17px; padding: 0 4px;
    border-radius: var(--radius-pill);
    background: var(--danger); color: #fff;
    font-size: 10px; font-weight: 700; line-height: 17px;
    text-align: center;
    border: 2px solid var(--bg);
}

/* Floating contextual action */
.fab {
    position: fixed;
    right: max(var(--sp-4), var(--safe-right));
    bottom: calc(var(--nav-height) + var(--safe-bottom) + var(--sp-4));
    z-index: 55;
    height: 56px;
    min-width: 56px;
    padding: 0 var(--sp-5);
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: var(--text-on-accent);
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    font-weight: 620;
    box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 42%, transparent);
    animation: fab-in var(--dur-slow) var(--ease-spring) both;
    transition: transform var(--dur-fast) var(--ease);
}
.fab:active { transform: scale(0.94); }
.fab[hidden] { display: none !important; }

@keyframes fab-in {
    from { opacity: 0; transform: scale(0.7) translateY(14px); }
    to   { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------------
   7. NAVIGATION
   --------------------------------------------------------------------- */

.bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 70;
    height: calc(var(--nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-top: 1px solid var(--divider);
}

.bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-tertiary);
    font-size: 10px;
    font-weight: 560;
    letter-spacing: -0.005em;
    transition: color var(--dur-fast) var(--ease);
    position: relative;
    min-height: 44px;
}
.bottom-nav__item svg { width: 22px; height: 22px; transition: transform var(--dur) var(--ease-spring); }
.bottom-nav__item.is-active { color: var(--accent-strong); }
.bottom-nav__item.is-active svg { transform: translateY(-1px) scale(1.06); }
.bottom-nav__item:active svg { transform: scale(0.88); }

.bottom-nav__item.is-active::before {
    content: "";
    position: absolute;
    top: 6px;
    width: 26px; height: 26px;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    z-index: -1;
}

.sidebar { display: none; }

/* ---------------------------------------------------------------------
   8. LIST ROWS
   --------------------------------------------------------------------- */

.list {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.list-row {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    min-height: 60px;
    border-bottom: 1px solid var(--divider);
    transition: background-color var(--dur-fast) var(--ease);
    text-align: left;
    width: 100%;
}
.list-row:last-child { border-bottom: 0; }
.list-row--tappable { cursor: pointer; }
.list-row--tappable:hover { background: var(--accent-soft); }
.list-row--tappable:active { background: var(--accent-soft); transform: scale(0.995); }
.list-row__body { flex: 1; min-width: 0; }
.list-row__title { font-weight: 580; font-size: var(--text-base); letter-spacing: -0.008em; }
.list-row__subtitle { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 1px; }
.list-row__meta { text-align: right; font-size: var(--text-sm); color: var(--text-secondary); flex-shrink: 0; }
.list-row__chevron { color: var(--text-tertiary); flex-shrink: 0; }

/* ---------------------------------------------------------------------
   9. AVATAR, BADGES, CHIPS
   --------------------------------------------------------------------- */

.avatar {
    width: 44px; height: 44px;
    border-radius: var(--radius-pill);
    display: grid; place-items: center;
    background: linear-gradient(140deg, var(--accent-soft), var(--gold-soft));
    color: var(--accent-strong);
    font-weight: 660;
    font-size: var(--text-sm);
    letter-spacing: 0.01em;
    flex-shrink: 0;
    border: 1px solid var(--border);
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 34px; height: 34px; font-size: var(--text-xs); }
.avatar--lg { width: 68px; height: 68px; font-size: var(--text-lg); }
.avatar--xl { width: 88px; height: 88px; font-size: var(--text-xl); }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.005em;
    background: var(--accent-soft);
    color: var(--accent-strong);
    white-space: nowrap;
}
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger  { background: var(--danger-soft);  color: var(--danger); }
.badge--info    { background: var(--info-soft);    color: var(--info); }
.badge--gold    { background: var(--gold-soft);    color: var(--gold); }
.badge--neutral { background: var(--surface-sunken); color: var(--text-secondary); }
.badge--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    min-height: 36px;
    padding: 0 var(--sp-4);
    border-radius: var(--radius-pill);
    background: var(--surface-solid);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 540;
    white-space: nowrap;
    transition: all var(--dur-fast) var(--ease);
    cursor: pointer;
}
.chip:hover { border-color: var(--accent-line); color: var(--text-primary); }
.chip.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-on-accent);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 30%, transparent);
}
.chip__count {
    font-size: var(--text-xs);
    padding: 1px 6px;
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, currentColor 14%, transparent);
}

/* Segmented control */
.segmented {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    background: var(--surface-sunken);
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
}
.segmented__item {
    padding: 7px var(--sp-4);
    border-radius: var(--radius-pill);
    font-size: var(--text-sm);
    font-weight: 560;
    color: var(--text-secondary);
    transition: all var(--dur) var(--ease);
    min-height: 34px;
}
.segmented__item.is-active {
    background: var(--surface-solid);
    color: var(--text-primary);
    box-shadow: var(--shadow-xs);
}

/* ---------------------------------------------------------------------
   10. FORMS
   --------------------------------------------------------------------- */

.field { margin-bottom: var(--sp-4); }

.field__label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 580;
    color: var(--text-secondary);
    margin-bottom: var(--sp-2);
    padding-left: 2px;
}
.field__label .req { color: var(--danger); margin-left: 2px; }

.field__hint { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 6px; padding-left: 2px; }
.field__error { font-size: var(--text-xs); color: var(--danger); margin-top: 6px; padding-left: 2px; font-weight: 540; }

.input, .select, .textarea {
    width: 100%;
    min-height: 50px;
    padding: 13px var(--sp-4);
    background: var(--surface-solid);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    color: var(--text-primary);
    transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease),
                background-color var(--dur-fast) var(--ease);
    appearance: none;
    -webkit-appearance: none;
}

.input::placeholder, .textarea::placeholder { color: var(--text-tertiary); }

.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.input.has-error, .select.has-error, .textarea.has-error {
    border-color: var(--danger);
    box-shadow: 0 0 0 4px var(--danger-soft);
}

.textarea { min-height: 108px; resize: vertical; line-height: 1.55; padding-top: var(--sp-3); }

.select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9' fill='none'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%23A3959D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--sp-4) center;
    padding-right: var(--sp-8);
}

.input-group { display: flex; gap: var(--sp-2); align-items: stretch; }
.input-group .input { flex: 1; }

.input-prefix {
    display: inline-flex;
    align-items: center;
    padding: 0 var(--sp-3);
    background: var(--surface-sunken);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 580;
    font-size: var(--text-sm);
}

/* Switch */
.switch { display: inline-flex; align-items: center; gap: var(--sp-3); cursor: pointer; min-height: 44px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track {
    width: 50px; height: 30px;
    border-radius: var(--radius-pill);
    background: var(--border-strong);
    position: relative;
    transition: background-color var(--dur) var(--ease);
    flex-shrink: 0;
}
.switch__track::after {
    content: "";
    position: absolute;
    top: 3px; left: 3px;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow-sm);
    transition: transform var(--dur) var(--ease-spring);
}
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 4px var(--accent-soft); }

/* Checkbox pills for multi-select fields */
.check-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    min-height: 40px;
    padding: 0 var(--sp-4);
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-strong);
    background: var(--surface-solid);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease);
}
.check-pill input { position: absolute; opacity: 0; pointer-events: none; }
.check-pill:has(input:checked) {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-strong);
    font-weight: 580;
}

/* Rating and slider */
.rating { display: inline-flex; gap: var(--sp-1); }
.rating__star { width: 34px; height: 34px; display: grid; place-items: center; color: var(--border-strong); transition: all var(--dur-fast) var(--ease); }
.rating__star.is-on { color: var(--gold); transform: scale(1.06); }

input[type="range"] {
    width: 100%; height: 30px; appearance: none; -webkit-appearance: none; background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track {
    height: 6px; border-radius: var(--radius-pill); background: var(--border-strong);
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%;
    background: var(--surface-solid); border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-sm); margin-top: -10px;
}

/* Search */
.search-field { position: relative; }
.search-field .input { padding-left: 46px; }
.search-field__icon {
    position: absolute; left: var(--sp-4); top: 50%; transform: translateY(-50%);
    color: var(--text-tertiary); pointer-events: none;
}

/* ---------------------------------------------------------------------
   11. SHEETS & MODALS
   --------------------------------------------------------------------- */

.scrim {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--scrim);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity var(--dur) var(--ease);
}
.scrim.is-open { opacity: 1; }

.sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 210;
    max-height: 92vh;
    max-height: 92dvh;
    display: flex;
    flex-direction: column;
    background: var(--surface-elevated);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: var(--shadow-xl);
    transform: translate3d(0, 100%, 0);
    transition: transform var(--dur-slow) var(--ease-out);
    padding-bottom: var(--safe-bottom);
}
.sheet.is-open { transform: none; }

.sheet__grabber {
    width: 38px; height: 5px;
    border-radius: var(--radius-pill);
    background: var(--border-strong);
    margin: var(--sp-3) auto var(--sp-1);
    flex-shrink: 0;
}

.sheet__head {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--divider);
    flex-shrink: 0;
}
.sheet__title { font-size: var(--text-md); font-weight: 640; letter-spacing: -0.014em; flex: 1; }

.sheet__body {
    padding: var(--sp-4);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

.sheet__footer {
    padding: var(--sp-3) var(--sp-4) var(--sp-4);
    border-top: 1px solid var(--divider);
    display: flex;
    gap: var(--sp-3);
    background: var(--surface-elevated);
    flex-shrink: 0;
}
.sheet__footer .btn { flex: 1; }

/* Confirmation sheet */
.confirm { text-align: center; padding: var(--sp-6) var(--sp-5) var(--sp-4); }
.confirm__icon {
    width: 56px; height: 56px; border-radius: var(--radius-pill);
    display: grid; place-items: center; margin: 0 auto var(--sp-4);
    background: var(--warning-soft); color: var(--warning);
}
.confirm__icon--danger { background: var(--danger-soft); color: var(--danger); }
.confirm__title { font-size: var(--text-lg); font-weight: 640; letter-spacing: -0.018em; margin-bottom: var(--sp-2); }
.confirm__body { color: var(--text-secondary); font-size: var(--text-sm); line-height: 1.55; }

/* Spotlight search overlay */
.spotlight {
    position: fixed;
    inset: 0;
    z-index: 220;
    padding: calc(var(--safe-top) + var(--sp-6)) var(--sp-4) var(--sp-4);
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    opacity: 0;
    transform: scale(1.02);
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.spotlight.is-open { opacity: 1; transform: none; }
.spotlight__results { overflow-y: auto; flex: 1; }
.spotlight__group-title { padding: var(--sp-3) var(--sp-2) var(--sp-2); }

/* ---------------------------------------------------------------------
   12. TOASTS
   --------------------------------------------------------------------- */

.toasts {
    position: fixed;
    left: 50%;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + var(--sp-4));
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    width: min(440px, calc(100vw - var(--sp-6)));
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-md);
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    font-size: var(--text-sm);
    font-weight: 540;
    pointer-events: auto;
    animation: toast-in var(--dur) var(--ease-spring) both;
}
.toast.is-leaving { animation: toast-out var(--dur-fast) var(--ease) both; }
.toast__icon { width: 22px; height: 22px; flex-shrink: 0; display: grid; place-items: center; }
.toast--success .toast__icon { color: var(--success); }
.toast--error   .toast__icon { color: var(--danger); }
.toast--warning .toast__icon { color: var(--warning); }
.toast--info    .toast__icon { color: var(--info); }
.toast__body { flex: 1; min-width: 0; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(16px) scale(0.96); }
    to   { opacity: 1; transform: none; }
}
@keyframes toast-out {
    to { opacity: 0; transform: translateY(8px) scale(0.98); }
}

/* ---------------------------------------------------------------------
   13. SKELETONS, EMPTY & ERROR STATES
   --------------------------------------------------------------------- */

.skeleton {
    background: linear-gradient(100deg,
        var(--surface-sunken) 30%,
        color-mix(in srgb, var(--surface-sunken) 55%, var(--surface-solid)) 50%,
        var(--surface-sunken) 70%);
    background-size: 220% 100%;
    animation: shimmer 1.5s linear infinite;
    border-radius: var(--radius-sm);
}
.skeleton--text { height: 12px; margin-bottom: var(--sp-2); }
.skeleton--title { height: 18px; width: 55%; margin-bottom: var(--sp-3); }
.skeleton--card { height: 96px; border-radius: var(--radius-lg); margin-bottom: var(--sp-3); }
.skeleton--row { height: 60px; border-radius: var(--radius-md); margin-bottom: var(--sp-2); }
.skeleton--avatar { width: 44px; height: 44px; border-radius: var(--radius-pill); }
.skeleton--stat { height: 88px; border-radius: var(--radius-md); }

@keyframes shimmer {
    from { background-position: 180% 0; }
    to   { background-position: -80% 0; }
}

.empty {
    text-align: center;
    padding: var(--sp-8) var(--sp-5);
    animation: view-in var(--dur-slow) var(--ease-out) both;
}
.empty__art {
    width: 76px; height: 76px;
    margin: 0 auto var(--sp-4);
    border-radius: var(--radius-xl);
    display: grid; place-items: center;
    background: linear-gradient(145deg, var(--accent-soft), var(--gold-soft));
    color: var(--accent-strong);
}
.empty__title { font-size: var(--text-md); font-weight: 620; letter-spacing: -0.014em; margin-bottom: var(--sp-2); }
.empty__body { color: var(--text-secondary); font-size: var(--text-sm); max-width: 34ch; margin: 0 auto var(--sp-5); line-height: 1.55; }

/* ---------------------------------------------------------------------
   14. PROGRESS
   --------------------------------------------------------------------- */

.progress {
    height: 8px;
    border-radius: var(--radius-pill);
    background: var(--surface-sunken);
    overflow: hidden;
}
.progress__bar {
    height: 100%;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--accent), var(--gold));
    transition: width var(--dur-slow) var(--ease-out);
}

.ring { position: relative; display: grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring__track { stroke: var(--surface-sunken); }
.ring__value { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset var(--dur-slow) var(--ease-out); }
.ring__label {
    position: absolute;
    font-size: var(--text-sm);
    font-weight: 660;
    font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------------
   15. CALENDAR
   --------------------------------------------------------------------- */

.cal-strip { display: flex; gap: var(--sp-2); overflow-x: auto; padding: var(--sp-1) 0; scrollbar-width: none; }
.cal-strip::-webkit-scrollbar { display: none; }

.cal-day {
    flex: 0 0 auto;
    width: 54px;
    padding: var(--sp-2) 0;
    border-radius: var(--radius-md);
    text-align: center;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    transition: all var(--dur-fast) var(--ease);
    cursor: pointer;
}
.cal-day__name { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-tertiary); font-weight: 620; }
.cal-day__num { font-size: var(--text-md); font-weight: 640; margin-top: 2px; font-variant-numeric: tabular-nums; }
.cal-day__dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin: 3px auto 0; }
.cal-day.is-today { border-color: var(--accent-line); }
.cal-day.is-selected {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-on-accent);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 34%, transparent);
}
.cal-day.is-selected .cal-day__name,
.cal-day.is-selected .cal-day__num { color: var(--text-on-accent); }
.cal-day.is-selected .cal-day__dot { background: var(--text-on-accent); }

.cal-month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-month__label { text-align: center; font-size: 10px; font-weight: 620; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.06em; padding-bottom: var(--sp-2); }
.cal-month__cell {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px;
    font-size: var(--text-sm);
    font-variant-numeric: tabular-nums;
    transition: background-color var(--dur-fast) var(--ease);
    cursor: pointer;
    min-height: 44px;
}
.cal-month__cell:hover { background: var(--accent-soft); }
.cal-month__cell.is-outside { color: var(--text-tertiary); opacity: 0.45; }
.cal-month__cell.is-today { font-weight: 700; color: var(--accent-strong); }
.cal-month__cell.is-selected { background: var(--accent); color: var(--text-on-accent); }
.cal-month__count { font-size: 9px; font-weight: 640; opacity: 0.8; }

/* Appointment card */
.appt {
    display: flex;
    gap: var(--sp-3);
    padding: var(--sp-3);
    border-radius: var(--radius-md);
    background: var(--surface-solid);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    position: relative;
    overflow: hidden;
    transition: all var(--dur-fast) var(--ease);
    cursor: pointer;
    animation: appt-in var(--dur) var(--ease-out) both;
}
.appt:hover { box-shadow: var(--shadow-sm); border-color: var(--accent-line); }
.appt:active { transform: scale(0.99); }
.appt::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--appt-colour, var(--accent));
}
.appt__time {
    flex-shrink: 0;
    width: 62px;
    padding-left: var(--sp-2);
    font-variant-numeric: tabular-nums;
}
.appt__start { font-weight: 640; font-size: var(--text-sm); }
.appt__end { font-size: var(--text-xs); color: var(--text-tertiary); }
.appt__body { flex: 1; min-width: 0; }
.appt__client { font-weight: 600; font-size: var(--text-base); letter-spacing: -0.008em; }
.appt__service { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 1px; }
.appt__side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.appt.is-dragging { opacity: 0.5; transform: scale(0.97); }
.appt.is-cancelled { opacity: 0.55; }
.appt.is-cancelled .appt__client { text-decoration: line-through; }

@keyframes appt-in {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: none; }
}

.drop-target {
    border: 2px dashed var(--accent);
    background: var(--accent-soft);
    border-radius: var(--radius-md);
    min-height: 54px;
    display: grid;
    place-items: center;
    font-size: var(--text-sm);
    color: var(--accent-strong);
    font-weight: 560;
}

.time-slot {
    display: flex;
    gap: var(--sp-3);
    align-items: flex-start;
    padding: var(--sp-1) 0;
    min-height: 46px;
}
.time-slot__label {
    width: 58px;
    flex-shrink: 0;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
    padding-top: 6px;
}
.time-slot__body { flex: 1; min-width: 0; }
.time-slot__free {
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border-strong);
    display: grid;
    place-items: center;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    opacity: 0;
    transition: opacity var(--dur-fast) var(--ease);
    cursor: pointer;
}
.time-slot:hover .time-slot__free { opacity: 1; }

/* ---------------------------------------------------------------------
   16. TIMELINE
   --------------------------------------------------------------------- */

.timeline { position: relative; padding-left: var(--sp-6); }
.timeline::before {
    content: "";
    position: absolute;
    left: 7px; top: 6px; bottom: 6px;
    width: 2px;
    background: linear-gradient(var(--accent-line), var(--divider));
    border-radius: var(--radius-pill);
}
.timeline__item { position: relative; padding-bottom: var(--sp-5); }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__dot {
    position: absolute;
    left: calc(var(--sp-6) * -1);
    top: 4px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--surface-solid);
    border: 3px solid var(--accent);
}
.timeline__dot--payment { border-color: var(--success); }
.timeline__dot--note { border-color: var(--gold); }
.timeline__dot--treatment { border-color: var(--lavender); }
.timeline__dot--follow_up { border-color: var(--warning); }
.timeline__date { font-size: var(--text-xs); color: var(--text-tertiary); font-weight: 580; }
.timeline__title { font-weight: 580; font-size: var(--text-base); margin-top: 2px; }
.timeline__body { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 2px; }

/* ---------------------------------------------------------------------
   17. TABS
   --------------------------------------------------------------------- */

.tabs {
    display: flex;
    gap: var(--sp-1);
    overflow-x: auto;
    border-bottom: 1px solid var(--divider);
    margin-bottom: var(--sp-4);
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    padding: var(--sp-3) var(--sp-4);
    font-size: var(--text-sm);
    font-weight: 580;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all var(--dur-fast) var(--ease);
    min-height: 44px;
}
.tab.is-active { color: var(--accent-strong); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------------
   18. TABLES (desktop reports)
   --------------------------------------------------------------------- */

.table { font-size: var(--text-sm); min-width: 560px; }
.table th {
    text-align: left;
    font-weight: 620;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    padding: var(--sp-3) var(--sp-3);
    border-bottom: 1px solid var(--border-strong);
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--surface-solid);
}
.table td { padding: var(--sp-3); border-bottom: 1px solid var(--divider); }
.table tbody tr:hover { background: var(--accent-soft); }
.table td.numeric { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------
   19. CHARTS
   --------------------------------------------------------------------- */

.chart { position: relative; width: 100%; height: 210px; }
.chart--tall { height: 260px; }
.chart--short { height: 150px; }

.legend { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-3); }
.legend__item { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--text-secondary); }
.legend__swatch { width: 9px; height: 9px; border-radius: 3px; }

/* ---------------------------------------------------------------------
   20. INSIGHTS
   --------------------------------------------------------------------- */

.insight {
    display: flex;
    gap: var(--sp-3);
    padding: var(--sp-4);
    border-radius: var(--radius-md);
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    box-shadow: var(--shadow-xs);
    transition: all var(--dur-fast) var(--ease);
}
.insight--warning { border-left-color: var(--warning); }
.insight--danger  { border-left-color: var(--danger); }
.insight--success { border-left-color: var(--success); }
.insight__icon {
    width: 32px; height: 32px; flex-shrink: 0;
    border-radius: 10px; display: grid; place-items: center;
    background: var(--accent-soft); color: var(--accent-strong);
}
.insight--warning .insight__icon { background: var(--warning-soft); color: var(--warning); }
.insight--danger  .insight__icon { background: var(--danger-soft);  color: var(--danger); }
.insight--success .insight__icon { background: var(--success-soft); color: var(--success); }
.insight__title { font-weight: 600; font-size: var(--text-sm); letter-spacing: -0.006em; line-height: 1.4; }
.insight__body { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 4px; line-height: 1.5; }
.insight__action { margin-top: var(--sp-3); }

/* "Last time" recall card */
.recall {
    background: linear-gradient(150deg,
        color-mix(in srgb, var(--gold) 12%, var(--surface-solid)),
        var(--surface-solid) 58%);
    border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent);
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
}
.recall__label {
    font-size: var(--text-xs);
    font-weight: 660;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: var(--sp-3);
}
.recall__grid { display: grid; gap: var(--sp-3); }
.recall__item { display: grid; gap: 2px; }
.recall__key { font-size: var(--text-xs); color: var(--text-tertiary); font-weight: 560; }
.recall__value { font-size: var(--text-sm); font-weight: 540; }

.clinical-note {
    display: flex;
    gap: var(--sp-2);
    padding: var(--sp-3);
    border-radius: var(--radius-sm);
    background: var(--warning-soft);
    color: var(--warning);
    font-size: var(--text-xs);
    line-height: 1.5;
    font-weight: 540;
    margin-top: var(--sp-3);
}

/* Laser session log - shown under the service picker while booking, and
   on the client profile. Lavender, so it reads apart from the gold
   "last time" recall card without competing with it. */
.laser {
    margin-bottom: var(--sp-4);
    padding: var(--sp-4);
    border-radius: var(--radius-lg);
    border: 1px solid color-mix(in srgb, var(--lavender) 45%, transparent);
    background: linear-gradient(150deg,
        color-mix(in srgb, var(--lavender) 15%, var(--surface-solid)),
        var(--surface-solid) 62%);
}
.laser__head { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.laser__icon {
    display: grid; place-items: center;
    width: 30px; height: 30px; flex: 0 0 auto;
    border-radius: 50%;
    background: color-mix(in srgb, var(--lavender) 34%, transparent);
}
.laser__title {
    font-size: var(--text-xs); font-weight: 660;
    letter-spacing: 0.08em; text-transform: uppercase;
}
.laser__head .badge { margin-left: auto; }
.laser .clinical-note { margin-bottom: var(--sp-1); }

.laser__last {
    margin-top: var(--sp-3);
    padding: var(--sp-3);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
}
.laser__last--empty {
    display: flex; gap: var(--sp-2); align-items: center;
    font-size: var(--text-xs); color: var(--text-secondary);
}
.laser__last--empty svg { flex: 0 0 auto; }
.laser__last-head {
    display: flex; justify-content: space-between; flex-wrap: wrap;
    gap: var(--sp-2); margin-bottom: var(--sp-3);
}
.laser__facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: var(--sp-3); }

.laser__toggle { margin-top: var(--sp-3); gap: var(--sp-2); }
.laser__history { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--divider); }

.laser__areas { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.laser__area {
    display: grid; gap: 1px;
    padding: 6px var(--sp-3);
    border-radius: var(--radius-pill);
    background: var(--surface-sunken);
}
.laser__area-name { font-size: var(--text-xs); font-weight: 620; }
.laser__area-meta { font-size: var(--text-xs); color: var(--text-tertiary); }

.laser__rows { display: flex; flex-direction: column; gap: var(--sp-2); }
.laser__row {
    display: flex; align-items: center; gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-sm);
    background: var(--surface-solid);
    border: 1px solid var(--divider);
}
.laser__row.is-dim { opacity: 0.55; }
.laser__row-num {
    flex: 0 0 auto;
    width: 26px; height: 26px;
    display: grid; place-items: center;
    border-radius: 50%;
    font-size: var(--text-xs); font-weight: 640;
    font-variant-numeric: tabular-nums;
    background: color-mix(in srgb, var(--lavender) 36%, transparent);
}
.laser__row-body { flex: 1; min-width: 0; }
.laser__row-title { font-size: var(--text-sm); font-weight: 560; }

.laser-card .card__title { display: flex; align-items: center; gap: 6px; }

/* ---------------------------------------------------------------------
   21. MISC
   --------------------------------------------------------------------- */

.divider { height: 1px; background: var(--divider); margin: var(--sp-4) 0; border: 0; }

.pill-group { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.drag-handle { color: var(--text-tertiary); cursor: grab; touch-action: none; }
.drag-handle:active { cursor: grabbing; }
.is-drag-over { background: var(--accent-soft); border-radius: var(--radius-md); }

.widget.is-dragging { opacity: 0.55; transform: scale(0.98); }

.count-up { font-variant-numeric: tabular-nums; }

.success-tick {
    width: 60px; height: 60px; margin: 0 auto;
    border-radius: 50%;
    background: var(--success-soft);
    display: grid; place-items: center;
    color: var(--success);
    animation: pop var(--dur-slow) var(--ease-spring) both;
}
@keyframes pop {
    0%   { transform: scale(0.3); opacity: 0; }
    60%  { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); }
}

.offline-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 400;
    padding: calc(var(--safe-top) + 6px) var(--sp-4) 6px;
    background: var(--warning);
    color: #241A0F;
    font-size: var(--text-xs);
    font-weight: 620;
    text-align: center;
}

/* ---------------------------------------------------------------------
   22. TABLET & DESKTOP
   --------------------------------------------------------------------- */

@media (min-width: 768px) {
    :root { --nav-height: 0px; }

    .bottom-nav { display: none; }

    .app { flex-direction: row; }

    .sidebar {
        display: flex;
        flex-direction: column;
        gap: var(--sp-1);
        width: var(--sidebar-width);
        flex-shrink: 0;
        padding: var(--sp-5) var(--sp-3);
        padding-top: calc(var(--safe-top) + var(--sp-5));
        border-right: 1px solid var(--divider);
        background: color-mix(in srgb, var(--bg) 60%, transparent);
        backdrop-filter: var(--blur);
        -webkit-backdrop-filter: var(--blur);
        position: sticky;
        top: 0;
        height: 100vh;
        height: 100dvh;
        overflow-y: auto;
        transition: width var(--dur) var(--ease);
    }

    .sidebar__brand {
        display: flex;
        align-items: center;
        gap: var(--sp-3);
        padding: var(--sp-2) var(--sp-3) var(--sp-5);
    }
    .sidebar__mark {
        width: 38px; height: 38px;
        border-radius: 12px;
        background: linear-gradient(140deg, var(--accent), var(--gold));
        display: grid; place-items: center;
        color: #fff; font-weight: 700; font-size: var(--text-md);
        flex-shrink: 0;
        box-shadow: var(--shadow-sm);
    }
    .sidebar__name { font-weight: 660; letter-spacing: -0.016em; font-size: var(--text-base); }
    .sidebar__role { font-size: var(--text-xs); color: var(--text-tertiary); }

    .sidebar__item {
        display: flex;
        align-items: center;
        gap: var(--sp-3);
        padding: var(--sp-3);
        border-radius: var(--radius-md);
        color: var(--text-secondary);
        font-size: var(--text-sm);
        font-weight: 560;
        transition: all var(--dur-fast) var(--ease);
        min-height: 44px;
        width: 100%;
        text-align: left;
    }
    .sidebar__item:hover { background: var(--accent-soft); color: var(--text-primary); }
    .sidebar__item.is-active {
        background: var(--accent-soft);
        color: var(--accent-strong);
        font-weight: 620;
    }
    .sidebar__item svg { width: 19px; height: 19px; flex-shrink: 0; }
    .sidebar__label { flex: 1; min-width: 0; }
    .sidebar__group-title {
        padding: var(--sp-4) var(--sp-3) var(--sp-2);
        font-size: 10px;
        font-weight: 680;
        letter-spacing: 0.09em;
        text-transform: uppercase;
        color: var(--text-tertiary);
    }
    .sidebar__footer { margin-top: auto; padding-top: var(--sp-4); }

    .app--compact .sidebar { width: var(--sidebar-compact); }
    .app--compact .sidebar__label,
    .app--compact .sidebar__name,
    .app--compact .sidebar__role,
    .app--compact .sidebar__group-title { display: none; }
    .app--compact .sidebar__item { justify-content: center; padding: var(--sp-3) 0; }
    .app--compact .sidebar__brand { justify-content: center; padding-inline: 0; }

    .app__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }

    .app-main {
        padding: var(--sp-6);
        padding-bottom: var(--sp-9);
    }

    .fab {
        bottom: var(--sp-6);
        right: var(--sp-6);
    }

    .toasts { bottom: var(--sp-6); left: auto; right: var(--sp-6); transform: none; }

    /* Desktop uses centred dialogs rather than bottom sheets. */
    .sheet {
        left: 50%;
        top: 50%;
        right: auto;
        bottom: auto;
        width: min(620px, calc(100vw - 64px));
        max-height: 86vh;
        border-radius: var(--radius-xl);
        transform: translate(-50%, -46%) scale(0.97);
        opacity: 0;
        transition: transform var(--dur) var(--ease-out), opacity var(--dur) var(--ease);
        padding-bottom: 0;
    }
    .sheet.is-open { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    .sheet--wide { width: min(880px, calc(100vw - 64px)); }
    .sheet__grabber { display: none; }

    .grid-2 { gap: var(--sp-4); }
    .stat__value { font-size: var(--text-2xl); }

    .spotlight {
        inset: 0;
        padding: 12vh var(--sp-4) var(--sp-4);
        align-items: center;
    }
    .spotlight > * { width: min(640px, 100%); }
}

@media (min-width: 1080px) {
    .grid-dash {
        display: grid;
        grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
        gap: var(--sp-5);
        align-items: start;
    }
    .grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); }
    .grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }
}

/* ---------------------------------------------------------------------
   23. PRINT
   --------------------------------------------------------------------- */

@media print {
    .bottom-nav, .sidebar, .fab, .app-header__actions, .toasts, .scrim, .sheet { display: none !important; }
    body { background: #fff; }
    body::before { display: none; }
    .card, .list { box-shadow: none; border: 1px solid #ddd; background: #fff; }
    .app-main { padding: 0; max-width: none; }
    .table { min-width: 0; }
}

/* ---------------------------------------------------------------------
   24. REDUCED MOTION
   --------------------------------------------------------------------- */

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

[data-motion="none"] *, [data-motion="none"] *::before, [data-motion="none"] *::after {
    animation: none !important;
    transition: none !important;
}

[data-motion="reduced"] * {
    transition-duration: 90ms !important;
}
[data-motion="reduced"] .skeleton { animation-duration: 2.4s !important; }
