/* =============================================================================
   miBooks: styles
   Plain CSS, no build step. Design tokens live in :root.

   Themes (data-theme on <html>, chosen in the menu or on the login page):
     light (default) · dark · contrast (high contrast)
   With no data-theme ("System"), the device's settings decide:
   prefers-color-scheme: dark → dark, prefers-contrast: more → contrast.
   ========================================================================== */

:root {
    /* Neutrals (slate) */
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-2: #334155;
    --muted: #64748b;
    --faint: #94a3b8;

    /* Accent (indigo) */
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-fg: #ffffff;               /* text on accent buttons */
    --accent-soft: #eef2ff;
    --accent-soft-2: #e0e7ff;
    --accent-text: #4338ca;
    --accent-border: #c7d2fe;
    --brand-1: #6366f1;                 /* logo gradient */
    --brand-2: #4338ca;
    --ring: 0 0 0 3px rgba(79, 70, 229, 0.28);

    /* Feedback */
    --danger: #be123c;
    --danger-soft: #fff1f2;
    --danger-border: #fecdd3;
    --success: #047857;
    --success-soft: #ecfdf5;
    --success-border: #a7f3d0;
    --warning: #92400e;
    --warning-soft: #fffbeb;
    --warning-border: #fde68a;
    --now: #f43f5e;

    /* Status pills */
    --st-booked-bg: #eef2ff;     --st-booked-fg: #4338ca;
    --st-checked_in-bg: #fef3c7; --st-checked_in-fg: #92400e;
    --st-checked_out-bg: #d1fae5;--st-checked_out-fg: #065f46;
    --st-no_show-bg: #ffe4e6;    --st-no_show-fg: #9f1239;
    --st-cancelled-bg: #f1f5f9;  --st-cancelled-fg: #475569;

    /* Surfaces and lines used by the calendar and dialogs */
    --surface-glass: rgba(255, 255, 255, 0.88);
    --grid-faint: #f5f7fa;
    --off-bg: #f8fafc;
    --off-hatch: rgba(148, 163, 184, 0.13);
    --toast-bg: #0f172a;
    --toast-fg: #ffffff;
    --backdrop: rgba(15, 23, 42, 0.32);
    --glow-1: #e0e7ff;
    --glow-2: #ede9fe;

    /* Appointment cards: staff colour mixed into this base */
    --appt-base: #ffffff;
    --appt-tint: 15%;
    --appt-border: 35%;
    --appt-tint-done: 7%;

    /* Lines and focus (High contrast makes these bolder) */
    --bw: 1px;
    --focus: 2px solid transparent;

    /* Shape */
    --radius-sm: 8px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px -4px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, 0.25), 0 4px 12px rgba(15, 23, 42, 0.06);

    color-scheme: light;

    /* Layout */
    --sidebar-w: 232px;
    --sidebar-w-collapsed: 72px;
    --header-h: 64px;
    --tap: 40px;                         /* control height; 48px on touch screens */
    --details-w: 400px;                  /* docked booking details on wide screens */

    /* Calendar */
    --gutter-w: 64px;
    --col-min-w: 180px;
    --head-h: 48px;

    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-feature-settings: "cv11", "ss01";
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ============================================================== Themes ==== */
:root[data-theme="dark"] {
    --bg: #0b1120;
    --surface: #1e293b;
    --surface-2: #273449;
    --border: #334155;
    --border-strong: #475569;
    --text: #f8fafc;
    --text-2: #e2e8f0;
    --muted: #94a3b8;
    --faint: #64748b;

    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-fg: #ffffff;
    --accent-soft: rgba(129, 140, 248, 0.14);
    --accent-soft-2: rgba(129, 140, 248, 0.24);
    --accent-text: #a5b4fc;
    --accent-border: rgba(129, 140, 248, 0.45);
    --brand-1: #818cf8;
    --brand-2: #6366f1;
    --ring: 0 0 0 3px rgba(129, 140, 248, 0.4);

    --danger: #fb7185;
    --danger-soft: rgba(244, 63, 94, 0.12);
    --danger-border: rgba(244, 63, 94, 0.4);
    --success: #34d399;
    --success-soft: rgba(16, 185, 129, 0.12);
    --success-border: rgba(16, 185, 129, 0.4);
    --warning: #fcd34d;
    --warning-soft: rgba(245, 158, 11, 0.12);
    --warning-border: rgba(245, 158, 11, 0.4);

    --st-booked-bg: rgba(99, 102, 241, 0.22);    --st-booked-fg: #c7d2fe;
    --st-checked_in-bg: rgba(245, 158, 11, 0.2); --st-checked_in-fg: #fcd34d;
    --st-checked_out-bg: rgba(16, 185, 129, 0.2);--st-checked_out-fg: #6ee7b7;
    --st-no_show-bg: rgba(244, 63, 94, 0.2);     --st-no_show-fg: #fda4af;
    --st-cancelled-bg: rgba(148, 163, 184, 0.16);--st-cancelled-fg: #cbd5e1;

    --surface-glass: rgba(15, 23, 42, 0.88);
    --grid-faint: #172033;
    --off-bg: #0f172a;
    --off-hatch: rgba(148, 163, 184, 0.07);
    --toast-bg: #f8fafc;
    --toast-fg: #0b1120;
    --backdrop: rgba(0, 0, 0, 0.6);
    --glow-1: rgba(99, 102, 241, 0.22);
    --glow-2: rgba(139, 92, 246, 0.12);

    --appt-base: #1e293b;
    --appt-tint: 24%;
    --appt-border: 45%;
    --appt-tint-done: 12%;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 4px 12px -4px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.7), 0 4px 12px rgba(0, 0, 0, 0.4);

    color-scheme: dark;
}
:root[data-theme="contrast"] {
    /* Black on white, no greys, 2px borders, bold focus. For bright light or low vision. */
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #ffffff;
    --border: #000000;
    --border-strong: #000000;
    --text: #000000;
    --text-2: #000000;
    --muted: #000000;
    --faint: #000000;

    --accent: #0000c8;                  /* 11:1 on white */
    --accent-hover: #000080;
    --accent-fg: #ffffff;
    --accent-soft: #ffffff;
    --accent-soft-2: #e8e8ff;
    --accent-text: #0000c8;
    --accent-border: #000000;
    --brand-1: #000000;
    --brand-2: #000000;
    --ring: 0 0 0 3px #000000;

    --danger: #a00000;
    --danger-soft: #ffffff;
    --danger-border: #a00000;
    --success: #005a00;
    --success-soft: #ffffff;
    --success-border: #005a00;
    --warning: #000000;
    --warning-soft: #ffff00;
    --warning-border: #000000;
    --now: #d00000;

    --st-booked-bg: #ffffff;      --st-booked-fg: #000000;
    --st-checked_in-bg: #ffff00;  --st-checked_in-fg: #000000;
    --st-checked_out-bg: #000000; --st-checked_out-fg: #ffffff;
    --st-no_show-bg: #a00000;     --st-no_show-fg: #ffffff;
    --st-cancelled-bg: #ffffff;   --st-cancelled-fg: #000000;

    --surface-glass: #ffffff;
    --grid-faint: #bfbfbf;
    --off-bg: #ffffff;
    --off-hatch: rgba(0, 0, 0, 0.35);
    --toast-bg: #000000;
    --toast-fg: #ffffff;
    --backdrop: rgba(0, 0, 0, 0.7);
    --glow-1: #ffffff;
    --glow-2: #ffffff;

    --appt-base: #ffffff;
    --appt-tint: 0%;
    --appt-border: 100%;
    --appt-tint-done: 0%;

    --bw: 2px;
    --focus: 3px solid #000000;

    --shadow-sm: none;
    --shadow: none;
    --shadow-lg: 0 0 0 2px #000000;

    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg: #0b1120;
        --surface: #1e293b;
        --surface-2: #273449;
        --border: #334155;
        --border-strong: #475569;
        --text: #f8fafc;
        --text-2: #e2e8f0;
        --muted: #94a3b8;
        --faint: #64748b;

        --accent: #6366f1;
        --accent-hover: #818cf8;
        --accent-fg: #ffffff;
        --accent-soft: rgba(129, 140, 248, 0.14);
        --accent-soft-2: rgba(129, 140, 248, 0.24);
        --accent-text: #a5b4fc;
        --accent-border: rgba(129, 140, 248, 0.45);
        --brand-1: #818cf8;
        --brand-2: #6366f1;
        --ring: 0 0 0 3px rgba(129, 140, 248, 0.4);

        --danger: #fb7185;
        --danger-soft: rgba(244, 63, 94, 0.12);
        --danger-border: rgba(244, 63, 94, 0.4);
        --success: #34d399;
        --success-soft: rgba(16, 185, 129, 0.12);
        --success-border: rgba(16, 185, 129, 0.4);
        --warning: #fcd34d;
        --warning-soft: rgba(245, 158, 11, 0.12);
        --warning-border: rgba(245, 158, 11, 0.4);

        --st-booked-bg: rgba(99, 102, 241, 0.22);    --st-booked-fg: #c7d2fe;
        --st-checked_in-bg: rgba(245, 158, 11, 0.2); --st-checked_in-fg: #fcd34d;
        --st-checked_out-bg: rgba(16, 185, 129, 0.2);--st-checked_out-fg: #6ee7b7;
        --st-no_show-bg: rgba(244, 63, 94, 0.2);     --st-no_show-fg: #fda4af;
        --st-cancelled-bg: rgba(148, 163, 184, 0.16);--st-cancelled-fg: #cbd5e1;

        --surface-glass: rgba(15, 23, 42, 0.88);
        --grid-faint: #172033;
        --off-bg: #0f172a;
        --off-hatch: rgba(148, 163, 184, 0.07);
        --toast-bg: #f8fafc;
        --toast-fg: #0b1120;
        --backdrop: rgba(0, 0, 0, 0.6);
        --glow-1: rgba(99, 102, 241, 0.22);
        --glow-2: rgba(139, 92, 246, 0.12);

        --appt-base: #1e293b;
        --appt-tint: 24%;
        --appt-border: 45%;
        --appt-tint-done: 12%;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 4px 12px -4px rgba(0, 0, 0, 0.5);
        --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.7), 0 4px 12px rgba(0, 0, 0, 0.4);

        color-scheme: dark;
    }
}
@media (prefers-contrast: more) {
    :root:not([data-theme]) {
        /* Black on white, no greys, 2px borders, bold focus. For bright light or low vision. */
        --bg: #ffffff;
        --surface: #ffffff;
        --surface-2: #ffffff;
        --border: #000000;
        --border-strong: #000000;
        --text: #000000;
        --text-2: #000000;
        --muted: #000000;
        --faint: #000000;

        --accent: #0000c8;                  /* 11:1 on white */
        --accent-hover: #000080;
        --accent-fg: #ffffff;
        --accent-soft: #ffffff;
        --accent-soft-2: #e8e8ff;
        --accent-text: #0000c8;
        --accent-border: #000000;
        --brand-1: #000000;
        --brand-2: #000000;
        --ring: 0 0 0 3px #000000;

        --danger: #a00000;
        --danger-soft: #ffffff;
        --danger-border: #a00000;
        --success: #005a00;
        --success-soft: #ffffff;
        --success-border: #005a00;
        --warning: #000000;
        --warning-soft: #ffff00;
        --warning-border: #000000;
        --now: #d00000;

        --st-booked-bg: #ffffff;      --st-booked-fg: #000000;
        --st-checked_in-bg: #ffff00;  --st-checked_in-fg: #000000;
        --st-checked_out-bg: #000000; --st-checked_out-fg: #ffffff;
        --st-no_show-bg: #a00000;     --st-no_show-fg: #ffffff;
        --st-cancelled-bg: #ffffff;   --st-cancelled-fg: #000000;

        --surface-glass: #ffffff;
        --grid-faint: #bfbfbf;
        --off-bg: #ffffff;
        --off-hatch: rgba(0, 0, 0, 0.35);
        --toast-bg: #000000;
        --toast-fg: #ffffff;
        --backdrop: rgba(0, 0, 0, 0.7);
        --glow-1: #ffffff;
        --glow-2: #ffffff;

        --appt-base: #ffffff;
        --appt-tint: 0%;
        --appt-border: 100%;
        --appt-tint-done: 0%;

        --bw: 2px;
        --focus: 3px solid #000000;

        --shadow-sm: none;
        --shadow: none;
        --shadow-lg: 0 0 0 2px #000000;

        color-scheme: light;
    }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); font-size: 14px; line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); }
[hidden] { display: none !important; }
/* Keyboard focus is always visible (bold in High contrast). */
:focus-visible { outline: var(--focus); outline-offset: 2px; }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.9; flex: none; }
.muted { color: var(--muted); }
h1, h2, h3 { letter-spacing: -0.01em; }

/* ============================================================== Shell ==== */

.app { display: flex; height: 100vh; height: 100dvh; }

.sidebar {
    width: var(--sidebar-w); flex: none;
    background: var(--surface); border-right: var(--bw) solid var(--border);
    display: flex; flex-direction: column; padding: 14px 12px;
    transition: width .2s ease;
    z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; text-decoration: none; color: var(--text); }
.brand-mark {
    width: 34px; height: 34px; border-radius: 10px; flex: none;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); color: #fff;
    font-weight: 700; font-size: 18px; box-shadow: 0 4px 10px -2px color-mix(in srgb, var(--brand-2) 45%, transparent);
}
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    height: 40px; padding: 0 12px; border-radius: var(--radius);
    color: var(--text-2); text-decoration: none; font-weight: 500;
    border: 0; background: none; cursor: pointer; width: 100%; text-align: left;
    transition: background .15s, color .15s;
    white-space: nowrap; overflow: hidden;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-text); }
.nav-link.active svg { color: var(--accent); }
.collapse-toggle { color: var(--muted); }

.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
.sidebar-collapsed .sidebar .brand-name,
.sidebar-collapsed .sidebar .nav-link span { display: none; }
.sidebar-collapsed .sidebar .nav-link { justify-content: center; padding: 0; }
.sidebar-collapsed .sidebar .brand { justify-content: center; padding-left: 0; padding-right: 0; }
.sidebar-collapsed .collapse-toggle svg { transform: scaleX(-1); }

.sidebar-backdrop { position: fixed; inset: 0; background: var(--backdrop); backdrop-filter: blur(2px); z-index: 35; }

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

.header {
    height: var(--header-h); flex: none;
    display: flex; align-items: center; gap: 12px;
    padding: 0 24px; background: var(--surface-glass);
    backdrop-filter: saturate(1.4) blur(8px);
    border-bottom: var(--bw) solid var(--border);
    position: relative; z-index: 30;
}
.header-title { min-width: 0; flex: 1; display: flex; align-items: baseline; gap: 10px; }
/* Salon name first (large, bold), then the page name (smaller, muted). */
.header-salon { min-width: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-title h1.header-page { margin: 0; flex: none; font-size: 15px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn.menu-btn { display: none; }

.user-menu { position: relative; }
.user-menu summary {
    list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer;
    padding: 4px 8px 4px 4px; border-radius: 999px; transition: background .15s;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover, .user-menu[open] summary { background: var(--surface-2); }
.user-menu .user-name { font-weight: 500; }
.user-menu .chev { width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
.user-menu[open] .chev { transform: rotate(180deg); }
.menu {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px;
    background: var(--surface); border: var(--bw) solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); padding: 6px; z-index: 50;
    animation: pop .14s ease-out;
}
.menu-head { padding: 8px 10px 10px; display: grid; }
.menu-head span { color: var(--muted); font-size: 12px; }
.menu a, .menu button {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 10px; border-radius: var(--radius-sm); border: 0; background: none;
    color: var(--text-2); text-decoration: none; cursor: pointer; text-align: left;
}
.menu a:hover, .menu button:hover { background: var(--surface-2); color: var(--text); }
.menu svg { width: 16px; height: 16px; color: var(--muted); }
.menu hr { border: 0; border-top: var(--bw) solid var(--border); margin: 6px 0; }
.menu form { margin: 0; }
.theme-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; color: var(--text-2); }
.theme-row .segmented button { height: 28px; padding: 0 9px; display: inline-grid; place-items: center; }
.theme-row .segmented svg { width: 15px; height: 15px; }
.auth-theme { position: fixed; top: 16px; right: 16px; }

.avatar {
    width: 40px; height: 40px; border-radius: 50%; flex: none;
    display: grid; place-items: center;
    background: var(--accent-soft-2); color: var(--accent-text); font-weight: 600; font-size: 14px;
}
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }

/* ========================================================== Controls ==== */

.btn {
    height: 38px; padding: 0 14px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: var(--bw) solid var(--border); border-radius: var(--radius); background: var(--surface);
    color: var(--text-2); font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .icon-btn:focus-visible, .nav-link:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-fg); }
.btn-soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); box-shadow: none; }
.btn-soft:hover { background: var(--accent-soft-2); color: var(--accent-text); }
.btn-ghost { background: none; border-color: transparent; box-shadow: none; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.btn-lg { height: 44px; padding: 0 18px; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }

.icon-btn {
    width: 38px; height: 38px; border-radius: var(--radius); border: 1px solid transparent;
    display: inline-grid; place-items: center; background: none; color: var(--text-2); cursor: pointer;
    transition: background .15s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.bordered { border-color: var(--border); background: var(--surface); box-shadow: var(--shadow-sm); }

.input, .field textarea, .form-stack input, .form-stack select, .form-stack textarea {
    height: 38px; padding: 0 12px; width: 100%;
    border: var(--bw) solid var(--border-strong); border-radius: var(--radius); background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}
textarea.input, .field textarea, .form-stack textarea { height: auto; min-height: 80px; padding: 9px 12px; resize: vertical; }
.input:focus, .field textarea:focus, .form-stack input:focus, .form-stack select:focus, .form-stack textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: var(--ring);
}
select.input, .form-stack select {
    appearance: none; padding-right: 34px;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
}
input[type="color"].input, .form-stack input[type="color"] { padding: 4px; width: 64px; cursor: pointer; }

.segmented { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: var(--radius); gap: 2px; }
.segmented button {
    border: 0; background: none; height: 32px; padding: 0 14px; border-radius: 8px;
    font-weight: 500; color: var(--muted); cursor: pointer; transition: all .15s;
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.search-input { position: relative; }
.search-input svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; height: 16px; pointer-events: none; }
.search-input .input { padding-left: 34px; }

.toggle { display: inline-flex !important; grid-auto-flow: column; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.toggle input { appearance: none; width: 38px !important; height: 22px !important; padding: 0 !important; border: 0 !important; border-radius: 999px !important; background: var(--border-strong) !important; position: relative; cursor: pointer; transition: background .15s; margin: 0; flex: none; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.toggle input:checked { background: var(--accent) !important; }
.toggle input:checked::after { transform: translateX(16px); }

.pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
    background: var(--surface-2); color: var(--text-2);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.pill.plain::before { display: none; }
.pill[data-status="booked"]      { background: var(--st-booked-bg);      color: var(--st-booked-fg); }
.pill[data-status="checked_in"]  { background: var(--st-checked_in-bg);  color: var(--st-checked_in-fg); }
.pill[data-status="checked_out"] { background: var(--st-checked_out-bg); color: var(--st-checked_out-fg); }
.pill[data-status="no_show"]     { background: var(--st-no_show-bg);     color: var(--st-no_show-fg); }
.pill[data-status="cancelled"]   { background: var(--st-cancelled-bg);   color: var(--st-cancelled-fg); }
.pill.accent { background: var(--accent-soft-2); color: var(--accent-text); }
.pill.off { background: var(--surface-2); color: var(--muted); }

/* ============================================================= Pages ==== */

.page { flex: 1; overflow: auto; padding: 24px; }
.page-inner { max-width: 1180px; margin: 0 auto; }
.page-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.page-toolbar .grow { flex: 1; }
.page-toolbar .search-input { width: min(360px, 100%); }
.count { color: var(--faint); font-weight: 500; }

.card {
    background: var(--surface); border: var(--bw) solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card + .card { margin-top: 16px; }
.card h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.card .card-desc { color: var(--muted); margin: 0 0 16px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-top: 16px; }
.card-grid .card + .card { margin-top: 0; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th, .table td { text-align: left; padding: 12px 16px; border-bottom: var(--bw) solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--bg); white-space: nowrap; }
.table th:first-child { border-top-left-radius: var(--radius-lg); }
.table th:last-child { border-top-right-radius: var(--radius-lg); }
.table th button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.table th button:hover { color: var(--text); }
.table th button.sorted { color: var(--accent-text); }
.table th svg { width: 14px; height: 14px; }
.table tbody tr { transition: background .1s; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--accent-soft); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .primary { font-weight: 600; color: var(--text); }
.table .sub { color: var(--muted); font-size: 13px; }
.table tr.dim td { color: var(--faint); }
.table tr.dim .primary { color: var(--muted); }
.table-empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.group-row td { background: var(--bg); font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding-top: 9px; padding-bottom: 9px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: var(--bw) solid var(--border); color: var(--muted); flex-wrap: wrap; }
.pager-buttons { display: flex; gap: 6px; align-items: center; }
.pager select.input { width: auto; height: 32px; }

.notice, .alert { border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; }
.warning { background: var(--warning-soft); color: var(--warning); border: 1px solid var(--warning-border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; }
.notice { background: var(--success-soft); color: var(--success); border: 1px solid var(--success-border); }
.alert { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-border); }

.form-stack { display: grid; gap: 14px; }
.form-stack label, .field { display: grid; gap: 6px; align-content: start; font-weight: 500; font-size: 13px; color: var(--text-2); }
.form-stack small, .field small { font-weight: 400; color: var(--muted); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* Settings layout: section list + content */
.settings-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; align-items: start; }
.settings-nav { position: sticky; top: 0; display: grid; gap: 2px; }
.settings-nav a {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius);
    color: var(--text-2); text-decoration: none; font-weight: 500; border: 1px solid transparent;
}
.settings-nav a:hover { background: var(--surface); }
.settings-nav a.active { background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow-sm); border-color: var(--border); }
.settings-nav svg { width: 17px; height: 17px; }
.settings-content { min-width: 0; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-weight: 500; margin-bottom: 12px; }
.back-link:hover { color: var(--text); }
.back-link svg { width: 16px; height: 16px; }

.rota { display: grid; gap: 8px; }
.rota-row { display: grid; grid-template-columns: 150px 1fr 1fr; gap: 10px; align-items: center; }
.rota-row .input:disabled { background: var(--surface-2); color: var(--faint); }

.staff-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.day-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.day-chip { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); color: var(--faint); }
.day-chip.on { background: var(--accent-soft-2); color: var(--accent-text); }

.inline-form summary { list-style: none; }
.inline-form summary::-webkit-details-marker { display: none; }
.inline-form form { display: flex; gap: 6px; margin-top: 8px; }
.inline-form .input { width: 180px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: flex-start; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.input-with-button { display: flex; gap: 6px; }
.input-with-button input { flex: 1; min-width: 0; }

.role-form select.input { height: 32px; width: auto; min-width: 150px; }
.audit-details summary { cursor: pointer; }
.audit-details summary::marker { color: var(--faint); }
.diff { margin-top: 8px; border-collapse: collapse; font-size: 13px; }
.diff th { text-align: left; color: var(--muted); font-weight: 500; padding: 3px 12px 3px 0; white-space: nowrap; vertical-align: top; }
.diff td { padding: 3px 10px 3px 0; vertical-align: top; overflow-wrap: anywhere; }
.diff td.was { color: var(--muted); text-decoration: line-through; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft-2); color: var(--accent-text); margin-left: 6px; vertical-align: 1px; }

/* =========================================================== Calendar ==== */

.calendar-page { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 16px 24px 24px; gap: 14px; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar-group { display: flex; align-items: center; gap: 6px; }
.toolbar .spacer { flex: 1; }
#employee-filter { width: 190px; }

.date-label {
    position: relative; height: 38px; min-width: 210px; padding: 0 14px; white-space: nowrap;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border-radius: var(--radius); cursor: pointer; font-weight: 600; font-size: 15px;
}
.date-label:hover { background: var(--surface-2); }
/* Boxed like the buttons beside it: ‹ [Today] [date] › */
#date-button { border: var(--bw) solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); font-weight: 700; align-self: stretch; height: auto; }
.date-label svg { width: 16px; height: 16px; color: var(--muted); }
.date-label { background: none; border: 0; color: var(--text); font-family: inherit; }

.calendar-card { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.calendar { position: absolute; inset: 0; overflow: auto; touch-action: pan-x pan-y; /* pinch zooms the grid, not the page */ }
/* Zoomed out: tighter cards so more fits. */
.cal-grid.compact .appt { padding: 1px 5px 1px 9px; font-size: 11px; line-height: 1.2; }
.cal-grid.compact .appt::before { top: 2px; bottom: 2px; }
.cal-grid.compact .cal-head { font-size: 12px; gap: 5px; }
.cal-head .head-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cal-grid.compact .cal-head .avatar { display: none; }
.cal-grid.compact .cal-head { border-bottom: 3px solid var(--border); }
.cal-grid.compact .cal-off-label { display: none; }
.calendar-status {
    position: absolute; top: 60px; left: 50%; transform: translateX(-50%);
    background: var(--surface); border: var(--bw) solid var(--border); border-radius: 999px;
    padding: 6px 14px; box-shadow: var(--shadow); z-index: 30; font-size: 13px; color: var(--muted);
}
.calendar-status.error { color: var(--danger); border-color: var(--danger-border); }

.cal-grid { display: grid; min-width: min-content; }
.cal-corner, .cal-head {
    position: sticky; top: 0; z-index: 20;
    height: var(--head-h); background: var(--surface-glass); backdrop-filter: blur(6px);
    border-bottom: var(--bw) solid var(--border);
}
.cal-corner { left: 0; z-index: 25; }
.cal-head {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-weight: 600; font-size: 13px; color: var(--text);
    padding: 0 8px; overflow: hidden; white-space: nowrap;
}
.cal-head .avatar { width: 26px; height: 26px; font-size: 11px; color: #fff; }
.cal-head.today { color: var(--accent-text); }
.cal-head .day-num { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 999px; padding: 0 6px; }
.cal-head.today .day-num { background: var(--accent); color: #fff; }

.cal-gutter { position: sticky; left: 0; z-index: 15; background: var(--surface); }
.cal-hour-label {
    position: absolute; right: 10px; transform: translateY(-50%);
    font-size: 11px; font-weight: 500; color: var(--faint); white-space: nowrap;
}
.cal-hour-label:first-child { transform: none; top: 6px !important; }

.cal-col {
    position: relative; border-left: var(--bw) solid var(--border); cursor: cell;
    background-image:
        linear-gradient(to bottom, var(--border) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-faint) 1px, transparent 1px);
    background-size: 100% var(--hour-px), 100% var(--slot-px);
}

.cal-off {
    position: absolute; left: 0; right: 0; pointer-events: none;
    background-color: var(--off-bg);
    background-image: repeating-linear-gradient(-45deg, var(--off-hatch) 0 1px, transparent 1px 9px);
}
.cal-off-label { position: absolute; top: 8px; left: 10px; font-size: 11px; font-weight: 500; color: var(--faint); }

.cal-hover {
    position: absolute; left: 4px; right: 4px; display: none; z-index: 1; pointer-events: none;
    border-radius: var(--radius-sm); background: var(--accent-soft); border: var(--bw) dashed var(--accent-border);
    color: var(--accent-text); font-size: 11px; font-weight: 600; padding: 3px 8px;
}
.cal-col:hover .cal-hover.show { display: block; }

.cal-now { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--now); z-index: 6; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--now); box-shadow: 0 0 0 3px rgba(244, 63, 94, .2); }

/* Appointment cards: tinted with the staff colour (--c, set inline). */
.appt {
    --c: var(--accent);
    position: absolute; z-index: 5;
    display: flex; flex-direction: column; justify-content: flex-start; gap: 1px;
    padding: 5px 8px 5px 12px; overflow: hidden; cursor: pointer; text-align: left;
    border-radius: var(--radius-sm);
    /* Fallback for Safari before 16.2 (older iPads), which can't do color-mix. */
    background: var(--surface-2);
    border: var(--bw) solid var(--border-strong);
    background: color-mix(in srgb, var(--c) var(--appt-tint), var(--appt-base));
    border: var(--bw) solid color-mix(in srgb, var(--c) var(--appt-border), var(--appt-base));
    color: var(--text); font-size: 12px; line-height: 1.35;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .15s, transform .15s;
}
.appt::before { content: ""; position: absolute; left: 3px; top: 4px; bottom: 4px; width: 3px; border-radius: 3px; background: var(--c); }
.appt:hover { box-shadow: var(--shadow); transform: translateY(-1px); z-index: 7; }
.appt:focus-visible { outline: none; box-shadow: var(--ring); z-index: 7; }
.appt-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.appt-client { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.appt-line { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.appt-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.appt { container-type: inline-size; }
.appt .pill { font-size: 10px; padding: 0 6px; flex: none; }
/* Narrow cards (overlaps, phones): the name matters more than the pill. */
@container (max-width: 150px) { .appt .pill { display: none; } }
.appt .pill::before { width: 5px; height: 5px; }
.appt[data-status="checked_out"] { background: color-mix(in srgb, var(--c) var(--appt-tint-done), var(--appt-base)); }
.appt[data-status="checked_out"] .appt-client, .appt[data-status="checked_out"] .appt-line { color: var(--muted); }
.appt[data-status="no_show"] { background: var(--danger-soft); border-color: var(--danger-border); }
.appt-repeat { color: var(--muted); font-size: 12px; flex: none; }
/* Clean-up time after a booking: staff busy, client gone. */
.appt-buffer {
    --c: var(--accent);
    position: absolute; z-index: 4; pointer-events: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    background-color: var(--surface-2);
    background-image: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--c) 22%, transparent) 0 2px, transparent 2px 7px);
    border: 1px dashed color-mix(in srgb, var(--c) 35%, transparent);
    border-top: 0;
    font-size: 10px; font-weight: 600; color: var(--muted); padding: 1px 8px; overflow: hidden; white-space: nowrap;
}
.appt[data-status="no_show"]::before { background: var(--danger); }

/* ============================================================ Dialogs ==== */

.modal {
    border: 0; padding: 0; border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg); color: var(--text); background: var(--surface);
    max-height: calc(100dvh - 32px);
}
.modal[open] { animation: pop .18s ease-out; }
.modal::backdrop { background: var(--backdrop); backdrop-filter: blur(4px); animation: fade .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Side sheet (appointment and client details) */
.sheet {
    margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: 440px; max-width: 100vw;
    border-radius: var(--radius-xl) 0 0 var(--radius-xl);
}
.sheet[open] { display: flex; flex-direction: column; animation: slide-in .22s cubic-bezier(.2, .8, .2, 1); }
.sheet-header { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; }
.sheet-title { flex: 1; min-width: 0; }
.sheet-title h2 { margin: 0; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.sheet-title .sub { display: flex; gap: 6px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.sheet-body { flex: 1; overflow: auto; padding: 0 20px 20px; display: grid; gap: 16px; align-content: start; }
.sheet-footer { padding: 16px 20px 20px; border-top: var(--bw) solid var(--border); display: grid; gap: 8px; }
.sheet-footer .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.info-group { background: var(--bg); border: var(--bw) solid var(--border); border-radius: var(--radius-lg); padding: 4px 14px; }
.info-group h3 { margin: 10px 0 2px; font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
.info-row { display: flex; gap: 12px; padding: 9px 0; border-bottom: var(--bw) solid var(--border); align-items: flex-start; }
.info-row:last-child { border-bottom: 0; }
.info-row svg { color: var(--faint); width: 17px; height: 17px; margin-top: 1px; }
.info-row .label { width: 82px; flex: none; color: var(--muted); }
.info-row .value { flex: 1; min-width: 0; font-weight: 500; overflow-wrap: anywhere; white-space: pre-line; }
.info-row .value a { color: var(--accent-text); text-decoration: none; }
.info-row .value a:hover { text-decoration: underline; }
.svc-line + .svc-line { margin-top: 6px; }
.info-row .value small { display: block; color: var(--muted); font-weight: 400; }

.history { display: grid; gap: 8px; }
.history h3 { margin: 4px 0 0; font-size: 11px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
.history-item { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: var(--bw) solid var(--border); border-radius: var(--radius); }
.history-item .when { width: 52px; flex: none; text-align: center; line-height: 1.15; }
.history-item .when strong { display: block; font-size: 17px; }
.history-item .when span { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.history-item .what { flex: 1; min-width: 0; }
.history-item .what div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item .what .sub { color: var(--muted); font-size: 12px; }

/* Centered form dialog */
.modal-form { width: 600px; max-width: calc(100vw - 32px); }
.modal-form > form { display: flex; flex-direction: column; max-height: calc(100dvh - 32px); }
.mf-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: var(--bw) solid var(--border); }
.mf-header h2 { margin: 0; font-size: 17px; font-weight: 700; }
.mf-body { padding: 18px 22px; display: grid; gap: 16px; overflow: auto; }
.mf-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: var(--bw) solid var(--border); background: var(--bg); border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
.mf-footer .left { margin-right: auto; }
.field-label { font-weight: 500; font-size: 13px; color: var(--text-2); }
.field-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.field-row.two { grid-template-columns: 1fr 1fr; }
/* Grid children may shrink below their content (iOS date/time inputs otherwise overflow). */
.field-row > *, .form-row > * { min-width: 0; }
input[type="date"], input[type="time"] { min-width: 0; max-width: 100%; display: block; }
input[type="date"]::-webkit-date-and-time-value, input[type="time"]::-webkit-date-and-time-value { text-align: left; }
/* iPhone/iPad Safari draws date and time boxes at its own fixed width with the
   value centred, so they spill out of narrow layouts. Reset them to behave like
   the other boxes (this @supports test only matches iOS/iPadOS Safari). */
@supports (-webkit-touch-callout: none) {
    input[type="date"], input[type="time"] {
        -webkit-appearance: none;
        appearance: none;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        height: 38px;
        line-height: normal;
        text-align: left;
        padding-right: 36px;
        background-repeat: no-repeat;
        background-position: right 11px center;
        background-size: 16px 16px;
    }
    input[type="date"] {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E");
    }
    input[type="time"] {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
    }
    input[type="date"]::-webkit-date-and-time-value, input[type="time"]::-webkit-date-and-time-value {
        text-align: left;
        margin: 0;
        padding: 0;
    }
    /* The toolbar's invisible date picker covers its label; keep it full-size and hidden. */
    .date-label input[type="date"] { height: 100%; padding: 0; background: none; }
}
.form-error { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-border); border-radius: var(--radius); padding: 9px 12px; }
.dup-choices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.dup-choices .btn { color: var(--text-2); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-text); cursor: pointer; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.link-btn svg { width: 14px; height: 14px; }

.client-picker { position: relative; }
.client-results {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 5; margin: 6px 0 0;
    background: var(--surface); border: var(--bw) solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    max-height: 240px; overflow: auto; list-style: none; padding: 6px;
}
.client-results li button { width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.client-results li button:hover, .client-results li button:focus { background: var(--accent-soft); outline: none; }
.client-results small { color: var(--muted); }
.client-chip { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: var(--bw) solid var(--accent-border); border-radius: var(--radius); padding: 8px 12px; background: var(--accent-soft); }

.service-list { border: var(--bw) solid var(--border); border-radius: var(--radius-lg); max-height: 250px; overflow: auto; }
.service-group-title { padding: 7px 12px; font-size: 11px; font-weight: 700; color: var(--faint); background: var(--bg); position: sticky; top: 0; text-transform: uppercase; letter-spacing: .05em; border-bottom: var(--bw) solid var(--border); }
.service-item { display: flex !important; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--surface-2); cursor: pointer; font-weight: 400 !important; color: var(--text) !important; }
.service-item:hover { background: var(--accent-soft); }
.service-item input { accent-color: var(--accent); width: 16px; height: 16px; }
.service-item .meta { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.service-summary { font-size: 13px; color: var(--muted); }

/* ============================================================== Toast ==== */

.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: var(--toast-bg); color: var(--toast-fg); padding: 10px 16px; border-radius: var(--radius);
    box-shadow: var(--shadow-lg); z-index: 100; font-size: 13px; font-weight: 500;
}
.toast.error { background: var(--danger); }


/* ============================================================== Sign in ==== */
/* Split screen on wide screens (brand panel + form); a focused card on phones. */
.auth-page { min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.auth-shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(380px, 46%) 1fr; }
.auth-brand {
    position: relative; overflow: hidden; color: #fff;
    display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
    padding: max(40px, env(safe-area-inset-top)) 48px max(32px, env(safe-area-inset-bottom)) max(48px, env(safe-area-inset-left));
    background:
        radial-gradient(900px 500px at 0% 0%, rgba(255, 255, 255, .16), transparent 60%),
        radial-gradient(700px 500px at 100% 100%, rgba(255, 255, 255, .10), transparent 55%),
        linear-gradient(150deg, var(--brand-1), var(--brand-2));
}
.auth-brand::after { /* subtle dotted texture */
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .18;
    background-image: radial-gradient(rgba(255, 255, 255, .7) 1px, transparent 1px); background-size: 22px 22px;
}
.auth-brand > * { position: relative; z-index: 1; }
.auth-brand .brand { color: #fff; padding: 0; }
.auth-brand .brand-mark { background: rgba(255, 255, 255, .18); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35); }
.auth-brand-copy h2 { font-size: clamp(28px, 3vw, 40px); line-height: 1.12; font-weight: 800; letter-spacing: -0.025em; margin: 0 0 14px; }
.auth-brand-copy p { font-size: 16px; opacity: .88; margin: 0 0 28px; max-width: 30em; }
.auth-brand-copy ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.auth-brand-copy li { display: flex; align-items: center; gap: 12px; font-weight: 500; }
.auth-brand-copy li svg { width: 20px; height: 20px; padding: 7px; box-sizing: content-box; border-radius: 10px; background: rgba(255, 255, 255, .16); }
.auth-brand small { opacity: .7; }

.auth-main {
    position: relative; display: grid; place-items: center;
    padding: max(72px, calc(env(safe-area-inset-top) + 64px)) max(20px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    background: radial-gradient(900px 600px at 100% 0%, var(--glow-1), transparent 60%), var(--bg);
}
.auth-tools { position: absolute; top: max(16px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); }
.auth-card {
    width: 100%; max-width: 420px; background: var(--surface);
    border: var(--bw) solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 36px;
}
.auth-card-brand { display: none; padding: 0 0 24px; }
.auth-card h1 { margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.auth-card > .muted { margin: 0 0 22px; font-size: 15px; }
.auth-form { gap: 16px; }
.auth-form .label-row { display: flex; justify-content: space-between; align-items: baseline; }
.auth-form .label-row a { font-weight: 600; text-decoration: none; }
.auth-form .label-row a:hover { text-decoration: underline; }
.auth-footer { margin: 20px 0 0; text-align: center; font-size: 14px; }
.auth-footer a { text-decoration: none; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.auth-footer svg { width: 15px; height: 15px; }

/* Inputs with a leading icon (and optional trailing show/hide button) */
.input-icon { position: relative; display: block; }
.input-icon > svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--faint); pointer-events: none; }
.form-stack .input-icon input { padding-left: 42px; height: 48px; }
.password-field input { padding-right: 48px !important; }
.password-toggle {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted);
    display: grid; place-items: center; cursor: pointer;
}
.password-toggle:hover { background: var(--surface-2); color: var(--text); }
.password-toggle svg { width: 18px; height: 18px; }

.check { display: flex !important; align-items: center; gap: 10px; font-weight: 500 !important; cursor: pointer; grid-auto-flow: column; }
.check input { width: 20px !important; height: 20px !important; padding: 0 !important; margin: 0; accent-color: var(--accent); flex: none; }

/* Button loading state */
.btn .spinner { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.btn.is-loading { pointer-events: none; opacity: .85; }
.btn.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Dismissible alerts */
.alert-dismissible { align-items: center; padding-right: 6px; animation: pop .18s ease-out; }
.alert-dismissible > span { flex: 1; }
.alert-close { border: 0; background: none; color: inherit; width: 32px; height: 32px; border-radius: var(--radius-sm); display: grid; place-items: center; cursor: pointer; opacity: .8; flex: none; }
.alert-close:hover { opacity: 1; background: color-mix(in srgb, currentColor 10%, transparent); }
.alert-close svg { width: 16px; height: 16px; }

@media (max-width: 960px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-card-brand { display: flex; }
}
@media (max-width: 480px) {
    .auth-main { place-items: start center; }
    .auth-card { padding: 28px 22px; border-radius: var(--radius-lg); }
}

/* ======================================================= Touch & iOS ==== */
/* Never let Safari zoom into a field: 16px text in every box, everywhere. */
.input, .field textarea, .form-stack input, .form-stack select, .form-stack textarea, select, textarea { font-size: 16px; }

/* Thumb-friendly targets on touch screens (iPhone, iPad, Android). */
@media (pointer: coarse) {
    :root { --tap: 48px; }
    .btn, .icon-btn, .input, .form-stack input, .form-stack select, .nav-link { min-height: 48px; }
    .btn, .icon-btn { min-width: 48px; }
    .segmented button { min-height: 42px; min-width: 44px; }
    .btn-sm { min-height: 44px; }
    .menu a, .menu button { min-height: 48px; }
    .service-item { min-height: 52px; }
    .client-results li button { min-height: 48px; }
    .table td { padding-top: 14px; padding-bottom: 14px; }
}

/* iPhone notch / Dynamic Island / home bar */
.header { padding-top: env(safe-area-inset-top); height: calc(var(--header-h) + env(safe-area-inset-top)); padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
.calendar-page { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.page { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.sheet .sheet-footer { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.toast { bottom: max(24px, calc(env(safe-area-inset-bottom) + 12px)); }
.sidebar { padding-top: max(14px, env(safe-area-inset-top)); padding-bottom: max(14px, env(safe-area-inset-bottom)); }


/* ======================================================== Booking form ==== */
.modal-form { width: 640px; }
.form-section { display: grid; gap: 12px; padding-bottom: 18px; border-bottom: var(--bw) solid var(--border); }
.form-section:last-child { border-bottom: 0; padding-bottom: 0; }
.form-section h3 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.form-section .step {
    width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
    background: var(--accent-soft-2); color: var(--accent-text); font-size: 12px; font-weight: 800;
}
.service-item .svc-name { font-weight: 500; }
.service-item.not-offered { opacity: .45; cursor: not-allowed; }
.service-item.not-offered:has(input:checked) { opacity: 1; background: var(--danger-soft); }
.service-item[hidden], .service-group-title[hidden] { display: none !important; }
.fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.fieldset legend { font-weight: 600; font-size: 13px; color: var(--text-2); padding: 0; margin-bottom: 2px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 16px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.swatch { position: relative; display: flex !important; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px 8px;
    border: var(--bw) solid var(--border); border-radius: var(--radius); cursor: pointer; font-weight: 500 !important; text-align: center; }
.swatch input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.swatch .dot { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35); }
.swatch .swatch-label { font-size: 12px; color: var(--muted); line-height: 1.2; }
.swatch:has(input:checked) { border-color: var(--accent); box-shadow: var(--ring); }
.swatch:has(input:checked) .swatch-label { color: var(--text); font-weight: 700; }
.swatch.taken { cursor: not-allowed; opacity: .5; }
.swatch.taken .dot { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35), 0 0 0 2px var(--surface), 0 0 0 3px var(--border-strong); }
.swatch.custom input[type=color] { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.swatch.custom input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.swatch.custom input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.skills-note { margin: -4px 0 0; font-size: 13px; color: var(--muted); }
.skills-note.warn { color: var(--danger); }
.service-item .meta { font-variant-numeric: tabular-nums; }

.slots { display: grid; gap: 8px; }
.slots-note { margin: 0; font-size: 13px; color: var(--muted); }
.slot-pills { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; max-height: 176px; overflow: auto; padding: 2px; }
.slot {
    height: 40px; border-radius: 999px; border: var(--bw) solid var(--border-strong); background: var(--surface);
    font-weight: 600; font-size: 14px; color: var(--text-2); cursor: pointer; font-variant-numeric: tabular-nums;
    transition: background .12s, border-color .12s, color .12s;
}
.slot:hover { border-color: var(--accent); color: var(--accent-text); }
.slot.active { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
@media (pointer: coarse) { .slot { height: 48px; } }

.mf-footer { align-items: center; position: sticky; bottom: 0; }
.mf-summary { margin-right: auto; display: grid; line-height: 1.3; min-width: 0; }
.mf-summary strong { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.mf-summary small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ======================================================== Status key ==== */

/* ============================================= Split view (iPad & desktop) ==== */
/* Booking details dock beside the calendar instead of covering it. */
.sheet.docked {
    position: fixed; inset: calc(var(--header-h) + env(safe-area-inset-top)) 0 0 auto;
    width: var(--details-w); height: auto; max-height: none; margin: 0; z-index: 25;
    border-radius: 0; border-left: var(--bw) solid var(--border); box-shadow: var(--shadow);
}
.sheet.docked[open] { animation: slide-in .2s ease-out; }
html.details-docked .calendar-page { margin-right: var(--details-w); transition: margin .2s ease; }
@media (min-width: 1024px) and (max-width: 1279px) { :root { --details-w: 360px; } }

/* ========================================================= Responsive ==== */

/* Tablet (e.g. iPad at the reception desk, up to landscape width): icon-only sidebar. */
@media (max-width: 1200px) {
    .sidebar { width: var(--sidebar-w-collapsed); }
    .sidebar .brand-name, .sidebar .nav-link span, .collapse-toggle { display: none !important; }
    .sidebar .nav-link { justify-content: center; padding: 0; }
    .sidebar .brand { justify-content: center; padding-left: 0; padding-right: 0; }
    .settings-layout { grid-template-columns: 1fr; gap: 16px; }
    .settings-nav { position: static; display: flex; overflow-x: auto; gap: 4px; }
    .settings-nav a { white-space: nowrap; }
}

/* Phone: sidebar becomes a slide-out drawer. */
@media (max-width: 760px) {
    .sidebar {
        position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w) !important;
        transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg);
    }
    .sidebar .brand-name, .sidebar .nav-link span { display: inline !important; }
    .sidebar .nav-link { justify-content: flex-start; padding: 0 12px; }
    .sidebar .brand { justify-content: flex-start; padding: 4px 8px 18px; }
    .sidebar-open .sidebar { transform: none; }
    .icon-btn.menu-btn { display: inline-grid; }
    .header { padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); gap: 6px; }
    .user-menu .user-name, .user-menu .chev { display: none; }
    .header-salon { font-size: 17px; }
    .header-title h1.header-page { display: none; } /* phones: just the salon name (the menu shows which page) */
    .header-actions .btn-label { display: none; }
    .page { padding: 16px; }
    .calendar-page { padding: 12px; gap: 10px; }
    /* Two rows: [‹ Today date ›] / [staff  Day|Week  refresh] */
    .toolbar { gap: 8px; }
    .toolbar .spacer { flex-basis: 100%; height: 0; order: 4; } /* line break */
    .toolbar-group { flex: 1 1 100%; min-width: 0; }
    .date-label { min-width: 0; flex: 1 1 120px; font-size: 14px; padding: 0 8px; }
    #employee-filter { width: auto; flex: 1; min-width: 0; order: 5; }
    #view-switch { order: 6; }
    #waitlist-btn { order: 7; }
    #refresh { order: 8; }
    :root { --gutter-w: 50px; --col-min-w: 150px; }
    .field-row { grid-template-columns: 1fr 1fr; }
    /* Booking form: Date gets its own row; Start and Employee share the next. */
    .datetime-row > :first-child { grid-column: 1 / -1; }
    /* iOS Safari zooms into any box with text under 16px; keep them at 16px on phones. */
    .input, .field textarea, .form-stack input, .form-stack select, .form-stack textarea { font-size: 16px; }
    .sheet { width: 100vw; border-radius: 0; }
    .rota-row { grid-template-columns: 1fr 1fr; }
    .rota-row > :first-child { grid-column: 1 / -1; }
    .table .hide-sm { display: none; }
    .mf-footer { flex-wrap: wrap; }
    .mf-summary { flex-basis: 100%; }
    .mf-footer .btn { flex: 1; }
}

/* ===================================================== High contrast extras ==== */
:root[data-theme="contrast"] .pill { border: 2px solid #000; }
:root[data-theme="contrast"] .btn, :root[data-theme="contrast"] .icon-btn.bordered, :root[data-theme="contrast"] .input, :root[data-theme="contrast"] .menu, :root[data-theme="contrast"] .modal, :root[data-theme="contrast"] .card, :root[data-theme="contrast"] .segmented { border-width: 2px; border-color: #000; }
:root[data-theme="contrast"] .btn-soft, :root[data-theme="contrast"] .btn-ghost, :root[data-theme="contrast"] .link-btn { border: 2px solid #000; }
:root[data-theme="contrast"] .segmented button.active { outline: 2px solid #000; }
:root[data-theme="contrast"] .nav-link.active { outline: 2px solid #000; }
:root[data-theme="contrast"] a, :root[data-theme="contrast"] .link-btn { text-decoration: underline; }
:root[data-theme="contrast"] .cal-col, :root[data-theme="contrast"] .cal-head, :root[data-theme="contrast"] .table th, :root[data-theme="contrast"] .table td { border-color: #000; }
:root[data-theme="contrast"] .appt { border-color: #000; }
:root[data-theme="contrast"] .cal-off-label, :root[data-theme="contrast"] .cal-hour-label { font-weight: 700; }
@media (prefers-contrast: more) {
    :root:not([data-theme]) .pill { border: 2px solid #000; }
    :root:not([data-theme]) .btn, :root:not([data-theme]) .icon-btn.bordered, :root:not([data-theme]) .input, :root:not([data-theme]) .menu, :root:not([data-theme]) .modal, :root:not([data-theme]) .card, :root:not([data-theme]) .segmented { border-width: 2px; border-color: #000; }
    :root:not([data-theme]) .btn-soft, :root:not([data-theme]) .btn-ghost, :root:not([data-theme]) .link-btn { border: 2px solid #000; }
    :root:not([data-theme]) .segmented button.active { outline: 2px solid #000; }
    :root:not([data-theme]) .nav-link.active { outline: 2px solid #000; }
    :root:not([data-theme]) a, :root:not([data-theme]) .link-btn { text-decoration: underline; }
    :root:not([data-theme]) .cal-col, :root:not([data-theme]) .cal-head, :root:not([data-theme]) .table th, :root:not([data-theme]) .table td { border-color: #000; }
    :root:not([data-theme]) .appt { border-color: #000; }
    :root:not([data-theme]) .cal-off-label, :root:not([data-theme]) .cal-hour-label { font-weight: 700; }
}

/* Weekly overview email: day + time side by side */
.weekly-email-row { display: flex; flex-wrap: wrap; gap: 8px; }
.weekly-email-row select { flex: 1 1 160px; max-width: 220px; }
.field-warn { color: var(--warning, #b45309); }

/* Numbered set-up steps (Settings → Text reminders) */
.steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; color: var(--text); line-height: 1.5; }
.steps code { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 1px 5px; font-size: .9em; }

/* Calendar date picker popover */
.datepop {
    position: absolute; z-index: 60; display: flex; gap: 10px; padding: 12px;
    background: var(--surface); border: var(--bw) solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
    max-width: calc(100vw - 16px);
}
.datepop[hidden] { display: none; }
.dp-month { width: 308px; display: grid; gap: 6px; }
.dp-head { display: flex; align-items: center; gap: 4px; }
.dp-nav { width: 36px; height: 36px; border: 0; background: none; border-radius: 10px; font-size: 22px; line-height: 1; color: var(--text-2); cursor: pointer; }
.dp-nav:hover, .dp-day:hover, .dp-quick:hover, .dp-today:hover { background: var(--surface-2); }
.dp-select { flex: 1; min-width: 0; height: 36px; border: 0; background: none; font: inherit; font-weight: 700; font-size: 16px; color: var(--text); text-align: center; text-align-last: center; cursor: pointer; border-radius: 10px; }
.dp-select:hover { background: var(--surface-2); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-wd { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 0; }
.dp-day {
    position: relative; aspect-ratio: 1; border: 0; background: none; border-radius: 999px;
    font: inherit; font-size: 15px; color: var(--text); cursor: pointer; display: grid; place-items: center;
}
.dp-day.other { color: var(--muted); opacity: .55; }
.dp-day.closed:not(.selected) { color: var(--muted); }
.dp-day.today::after { content: ''; position: absolute; bottom: 5px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--accent); }
.dp-day.selected { background: var(--accent); color: #fff; font-weight: 700; }
.dp-day.selected.today::after { background: #fff; }
.dp-day:focus-visible, .dp-quick:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dp-today { justify-self: center; border: 0; background: none; color: var(--accent-text); font: inherit; font-weight: 600; padding: 6px 14px; border-radius: 10px; cursor: pointer; }
.dp-quicks { display: grid; gap: 6px; align-content: start; width: 150px; padding-left: 10px; border-left: var(--bw) solid var(--border); }
.dp-quicks-title { font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 2px 2px; }
.dp-quick {
    display: grid; gap: 1px; text-align: left; padding: 9px 12px; cursor: pointer;
    background: var(--surface); border: var(--bw) solid var(--border); border-radius: 12px; font: inherit; color: var(--text);
}
.dp-quick span { font-weight: 600; font-size: 14px; }
.dp-quick small { color: var(--muted); font-size: 12px; }
@media (max-width: 560px) {
    .datepop { flex-direction: column; left: 8px !important; right: 8px; }
    .dp-month { width: auto; }
    .dp-quicks { width: auto; padding: 10px 0 0; border-left: 0; border-top: var(--bw) solid var(--border); grid-template-columns: repeat(3, 1fr); }
    .dp-quicks-title { grid-column: 1 / -1; padding-top: 0; }
}

/* Rebook panel (details sheet) */
.rebook-btn { width: 100%; }
.rb-weeks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rb-week {
    position: relative; display: grid; gap: 1px; text-align: left; padding: 10px 12px; cursor: pointer; font: inherit; color: var(--text);
    background: var(--surface); border: var(--bw) solid var(--border); border-radius: 12px; min-height: 52px;
}
.rb-week:hover { background: var(--surface-2); }
.rb-week span { font-weight: 600; }
.rb-week small { color: var(--muted); font-size: 12px; }
.rb-week em { position: absolute; top: 6px; right: 8px; font-style: normal; font-size: 10px; font-weight: 700; color: var(--accent-text); background: var(--accent-soft); border-radius: 999px; padding: 1px 6px; }
.rb-week.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.rb-stylist { margin-top: 12px; }
.rb-note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; margin-bottom: 12px; border-radius: 12px;
    background: var(--warning-soft); color: var(--warning); border: 1px solid var(--warning-border); font-size: 14px; }
.rb-note svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.rb-week-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 8px; font-weight: 600; }
.rb-day { padding: 10px 12px; border: var(--bw) solid var(--border); border-radius: 12px; margin-bottom: 8px; }
.rb-day.target { border-color: var(--accent); }
.rb-day-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.slot.same { border-color: var(--accent); font-weight: 700; }
@media (max-width: 420px) { .rb-weeks { grid-template-columns: repeat(2, 1fr); } }

/* No-shows */
.text-danger { color: var(--danger); }
.text-warn { color: var(--warning); }
.btn-warn { color: var(--warning); }
.noshow-banner { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; padding: 10px 12px; border-radius: 12px; font-size: 14px;
    background: var(--warning-soft); color: var(--warning); border: var(--bw) solid var(--warning-border); }
.noshow-banner.danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.noshow-banner svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }

/* Clean-up switched off (Settings → General) */
[data-clean-up="0"] .cleanup-field { display: none !important; }

/* Holiday closures in the calendar */
.cal-off.closed { background-color: var(--surface-2); }
.cal-off.closed .cal-off-label { color: var(--text-2); font-weight: 700; font-size: 12px; }
.cal-grid.compact .cal-off.closed .cal-off-label { display: block; }

/* Colour records (client panel) and patch test note (booking form) */
.patch-status { display: flex; align-items: center; gap: 8px; font-weight: 600; padding: 8px 0; }
.patch-status svg { width: 18px; height: 18px; }
.patch-status.ok { color: var(--success, #047857); }
.patch-status.warn { color: var(--warning); }
.patch-status.danger { color: var(--danger); }
.colour-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.colour-list li { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 8px 10px; border: var(--bw) solid var(--border); border-radius: 10px; font-size: 14px; }
.colour-list li small { display: block; color: var(--muted); }
.colour-list .icon-btn { width: 32px; height: 32px; flex: none; color: var(--muted); }
.formula-text { display: block; white-space: pre-wrap; margin-top: 3px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--text); }
.colour-sub { margin: 14px 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.colour-add summary { cursor: pointer; color: var(--accent-text); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; padding: 4px 0; list-style: none; }
.colour-add summary::-webkit-details-marker { display: none; }
.colour-add summary svg { width: 16px; height: 16px; }
.colour-form { display: grid; gap: 10px; padding: 10px 0 4px; }
.colour-form .btn { justify-self: start; }
.patch-ok { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; color: var(--success, #047857); font-size: 13px; font-weight: 600; }
.patch-ok svg { width: 16px; height: 16px; }

/* Waiting list */
#waitlist-btn { position: relative; }
#waitlist-btn .badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
#waitlist-btn .badge[hidden] { display: none; }
.wl-item { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; padding: 12px; border: var(--bw) solid var(--border); border-radius: 12px; margin-bottom: 8px; }
.wl-main { min-width: 0; display: grid; gap: 2px; }
.wl-main .sub { font-size: 13px; color: var(--text-2); }
.wl-contact { display: flex; gap: 14px; margin-top: 6px; font-size: 13px; font-weight: 600; }
.wl-contact a { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-text); text-decoration: none; }
.wl-contact svg, .wl-actions svg { width: 16px; height: 16px; }
.wl-actions { display: flex; gap: 4px; flex: none; }
.wl-form { display: contents; }
@media (max-width: 760px) { #waitlist-btn .btn-label { display: none; } }

/* Duplicate finder and add-a-mobile prompt */
.dupe-group { border: var(--bw) solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; display: grid; gap: 8px; }
.dupe-reason { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.dupe-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.dupe-row:first-of-type { border-top: 0; padding-top: 0; }
.dupe-main { min-width: 0; display: grid; gap: 2px; }
.dupe-main a { color: var(--text); text-decoration: none; }
.dupe-main .sub { font-size: 13px; color: var(--text-2); }
.dupe-group .link-btn { justify-self: start; }
.add-phone { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); border: var(--bw) solid var(--border); }
.add-phone .field > span:first-child { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.add-phone svg, .add-phone-msg svg { width: 16px; height: 16px; }
.add-phone-msg { margin: 6px 0 0; font-size: 13px; color: var(--danger); }
.add-phone-msg.ok { display: flex; align-items: center; gap: 6px; color: var(--success); font-weight: 600; margin-top: 8px; }
.doc-page { background: var(--bg); }
.doc { max-width: 720px; margin: 0 auto; padding: 32px 20px 64px; line-height: 1.6; color: var(--text); }
.doc h1 { font-size: 30px; margin: 8px 0 4px; letter-spacing: -.02em; }
.doc h2 { font-size: 18px; margin: 28px 0 6px; }
.doc ul { padding-left: 20px; }
.doc-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; margin: 0; }

/* Drag and drop bookings */
.appt { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.appt.dragging { opacity: .35; }
.cal-grid.is-dragging, .cal-grid.is-dragging * { cursor: grabbing !important; }
.cal-grid.is-dragging .cal-hover { display: none; }
.appt-ghost {
    position: absolute; left: 3px; right: 3px; z-index: 6; pointer-events: none;
    border: 2px dashed var(--c, var(--accent)); border-radius: 8px;
    background: color-mix(in srgb, var(--c, var(--accent)) 18%, transparent);
    font-size: 12px; font-weight: 700; color: var(--text); padding: 4px 8px;
}

/* Add to Home Screen tip (iPhone Safari, once) */
.a2hs-tip {
    position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 80;
    display: flex; gap: 12px; align-items: flex-start; padding: 12px 12px 12px 14px; font-size: 14px; line-height: 1.4;
    background: var(--surface); color: var(--text); border: var(--bw) solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg);
}
.a2hs-tip .brand-mark { flex: none; }
.a2hs-tip .icon-btn { flex: none; margin-left: auto; width: 32px; height: 32px; }
.a2hs-share { width: 16px; height: 16px; vertical-align: -3px; color: var(--accent-text); }

/* Edit client details in place (booking details, client panel) */
.contact-edit { display: contents; }
.info-row.editable { cursor: text; }
.info-row.editable .value { display: flex; align-items: center; gap: 4px; min-width: 0; }
.inline-input {
    flex: 1; min-width: 0; width: 100%; font: inherit; color: var(--text); background: transparent;
    border: var(--bw) solid transparent; border-radius: 8px; padding: 4px 8px; margin: -5px 0 -5px -9px;
}
.inline-input:hover { border-color: var(--border); }
.inline-input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.inline-input::placeholder { color: var(--faint); }
.contact-act { flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--accent-text); }
.contact-act:hover { background: var(--surface-2); }
.contact-act svg { width: 16px; height: 16px; }
.contact-save { display: flex; justify-content: flex-end; gap: 8px; padding-top: 10px; }
.contact-save[hidden] { display: none; }
.contact-msg { margin: 8px 0 0; font-size: 13px; color: var(--danger); }

/* Service lines with stages (booking form) */
.lines { display: grid; gap: 8px; margin-top: 12px; }
.stage-head, .stage-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.3fr) minmax(0, 1fr) 76px 36px; gap: 6px; align-items: center; }
.stage-head { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 2px; }
.stage-line { border: var(--bw) solid var(--border); border-radius: 12px; padding: 8px; display: grid; gap: 6px; background: var(--surface); }
.stage-row .input { height: 36px; padding: 0 8px; font-size: 14px; min-width: 0; }
.stage-row.sub { color: var(--text-2); }
.stage-row.sub .st-name { padding-left: 14px; position: relative; font-weight: 500; }
.stage-row.sub .st-name::before { content: ''; position: absolute; left: 4px; top: 50%; width: 6px; height: 1px; background: var(--border-strong, var(--border)); }
.st-name { font-weight: 600; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-time { font-size: 14px; color: var(--text-2); padding-left: 8px; }
.st-muted { font-size: 13px; color: var(--muted); padding-left: 8px; }
.stage-mins { text-align: right; }
.st-remove { width: 36px; height: 36px; color: var(--muted); }
.st-remove:hover { color: var(--danger); }
.st-add { justify-self: start; font-size: 13px; }
.show-all-services { margin: 0 0 8px; }
.svc-stage { display: block; color: var(--muted); padding-left: 10px; }
@media (max-width: 600px) {
    .stage-head { display: none; }
    .stage-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 68px 32px; }
    .stage-row .st-name { grid-column: 1 / -1; }
    .stage-row:not(.sub) .st-remove { grid-row: 1; grid-column: 4; }
}

/* Platform banners (support login, account status, announcements) */
.platform-banner { padding: 8px 16px; font-size: 14px; font-weight: 600; text-align: center; background: var(--accent-soft); color: var(--accent-text); border-bottom: 1px solid var(--border); }
.platform-banner.warning { background: var(--warning-soft); color: var(--warning); }
.platform-banner.danger { background: var(--danger-soft); color: var(--danger); }
.platform-banner.support { background: #fef3c7; color: #92400e; }
