/* =========================================================
   Spa Management — Warm Spa Luxe design system
   Mobile-first. Breakpoints: 640 / 900 / 1200
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
    /* surfaces */
    --cream:        #FBF7F0;
    --cream-deep:   #F4EDE2;
    --surface:      #FFFFFF;
    --surface-alt:  #FCFAF6;

    /* brand */
    --emerald:      #14503C;
    --emerald-900:  #103F30;
    --emerald-600:  #1B6A4E;
    --emerald-300:  #7FB39F;
    --emerald-50:   #E9F2EE;
    --emerald-rgb:  20, 80, 60;

    --gold:         #C2A25C;
    --gold-600:     #B69350;
    --gold-soft:    #E4D3AA;
    --gold-50:      #FAF4E6;
    --gold-ink:     #8A6E22;
    --gold-rgb:     194, 162, 92;

    /* ink */
    --ink:          #2A2621;
    --ink-2:        #5B534A;
    --ink-3:        #8C8378;
    --line:         #E7DFD3;

    /* status */
    --ok:           #2E7D52;
    --ok-bg:        #E6F3EC;
    --warn:         #A9761B;
    --warn-bg:      #FBF1DD;
    --danger:       #A63A2E;
    --danger-bg:    #FAE8E5;
    --info:         #2F5D8A;
    --info-bg:      #E7EFF7;

    /* shape */
    --r-sm: 8px;
    --r:    14px;
    --r-lg: 20px;
    --r-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(42, 38, 33, .06);
    --shadow:    0 4px 16px rgba(42, 38, 33, .07);
    --shadow-lg: 0 18px 48px rgba(42, 38, 33, .16);

    --sidebar-w: 254px;
    --topbar-h:  62px;

    --ff-display: "Cormorant Garamond", "Playfair Display", Georgia, serif;
    --ff-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--ff-body);
    background: var(--cream);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }

.display { font-family: var(--ff-display); font-weight: 600; letter-spacing: .002em; }

/* ---------- Utility ---------- */
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.tiny  { font-size: 12px; }
.strong { font-weight: 600; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hide { display: none !important; }
.mt-0{margin-top:0}.mt-1{margin-top:6px}.mt-2{margin-top:12px}.mt-3{margin-top:20px}.mt-4{margin-top:28px}
.gap-row { display: flex; align-items: center; gap: 10px; }
.gap-row-sm { display: flex; align-items: center; gap: 6px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.gold-rule {
    height: 1px; border: 0; margin: 0;
    background: linear-gradient(90deg, var(--gold-soft), rgba(228,211,170,0));
}

/* ================= AUTH ================= */
.auth {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr;
    background: var(--cream);
}
.auth__art {
    display: none;
    position: relative;
    background:
        radial-gradient(120% 90% at 15% 10%, rgba(194,162,92,.28), transparent 60%),
        linear-gradient(160deg, var(--emerald-900) 0%, var(--emerald) 45%, var(--emerald-900) 100%);
    color: #fff;
    padding: 48px;
    overflow: hidden;
}
.auth__art::after {
    content: "";
    position: absolute; inset: auto -80px -140px auto;
    width: 380px; height: 380px; border-radius: 50%;
    background: radial-gradient(circle, rgba(228,211,170,.22), transparent 70%);
}
.auth__art-inner { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; }
.auth__quote { margin-top: auto; }
.auth__quote h2 { font-family: var(--ff-display); font-size: 40px; line-height: 1.15; font-weight: 500; }
.auth__quote p { color: rgba(255,255,255,.72); margin-top: 14px; max-width: 34ch; }

.auth__panel {
    display: flex; align-items: center; justify-content: center;
    padding: 32px 20px calc(32px + env(safe-area-inset-bottom));
}
.auth__card { width: 100%; max-width: 400px; }
.auth__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; }
.auth h1 { font-family: var(--ff-display); font-size: 34px; font-weight: 600; }
.auth__sub { color: var(--ink-3); margin-top: 6px; }
.auth form { margin-top: 26px; }
.auth__meta { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.auth__foot { margin-top: 26px; text-align: center; color: var(--ink-3); font-size: 13px; }
/* Sign-in / setup failures. Sits between the subtitle and the form. */
.auth__alert {
    display: flex; align-items: flex-start; gap: 9px;
    margin-top: 20px; padding: 11px 13px; border-radius: 12px;
    background: var(--danger-bg); color: var(--danger);
    font-size: 13.5px; line-height: 1.45;
}
.auth__alert svg { flex: none; margin-top: 1px; }

/* brand mark */
.mark {
    width: 40px; height: 40px; border-radius: 12px; flex: none;
    display: grid; place-items: center;
    background: linear-gradient(145deg, var(--emerald-600), var(--emerald));
    color: var(--gold-soft);
    font-family: var(--ff-display); font-size: 20px; font-weight: 700;
    box-shadow: var(--shadow-sm);
}
.mark--lg { width: 46px; height: 46px; border-radius: 14px; font-size: 23px; }
.mark--ghost { background: rgba(255,255,255,.12); color: var(--gold-soft); }
.brand-name { font-family: var(--ff-display); font-size: 21px; font-weight: 600; line-height: 1.1; }
.brand-tag { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field > label {
    display: block; font-size: 12.5px; font-weight: 600;
    letter-spacing: .02em; color: var(--ink-2); margin-bottom: 7px;
}
.input, .select, .textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none; appearance: none;
}
.textarea { min-height: 92px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: #B6ADA1; }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--emerald-300);
    box-shadow: 0 0 0 3px rgba(127,179,159,.25);
}
.select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238C8378' stroke-width='1.6'%3E%3Cpath d='M4 6.5 8 10.5 12 6.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 38px;
}
.input-group { position: relative; }
.input-group .input { padding-left: 42px; }
.input-group__icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--ink-3); pointer-events: none; display: flex;
}
.input-group__btn {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    background: none; border: 0; padding: 8px; color: var(--ink-3); border-radius: var(--r-sm);
}
.input-group__btn:hover { color: var(--ink); background: var(--cream-deep); }

.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--emerald); }
.link { color: var(--emerald-600); font-size: 13.5px; font-weight: 500; }
.link:hover { text-decoration: underline; }

.form-grid { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-grid--2 { grid-template-columns: 1fr 1fr; } }
.field--full { grid-column: 1 / -1; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 18px;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    font-size: 14px; font-weight: 600; letter-spacing: .01em;
    transition: background .15s, border-color .15s, color .15s, transform .06s;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--emerald); color: #fff; }
.btn--primary:hover { background: var(--emerald-600); }
.btn--gold { background: var(--gold); color: var(--ink); }
.btn--gold:hover { background: var(--gold-600); }
.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn--ghost:hover { border-color: var(--emerald-300); color: var(--emerald); }
.btn--quiet { background: transparent; color: var(--ink-2); }
.btn--quiet:hover { background: var(--cream-deep); }
.btn--danger { background: var(--danger-bg); color: var(--danger); }
.btn--danger:hover { background: #F5DBD7; }
.btn--block { width: 100%; }
.btn--lg { padding: 13px 22px; font-size: 15px; }
.btn--sm { padding: 7px 12px; font-size: 13px; border-radius: 7px; }
.btn--icon { padding: 9px; border-radius: var(--r-sm); }

/* ---------- Badges / pills ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: var(--r-pill);
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge--ok     { background: var(--ok-bg);     color: var(--ok); }
.badge--warn   { background: var(--warn-bg);   color: var(--warn); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--info   { background: var(--info-bg);   color: var(--info); }
.badge--muted  { background: var(--cream-deep);color: var(--ink-2); }
.badge--plain::before { display: none; }

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: var(--r-pill);
    border: 1px solid var(--line); background: var(--surface);
    font-size: 13px; font-weight: 500; color: var(--ink-2);
    transition: .15s;
}
.chip:hover { border-color: var(--emerald-300); color: var(--emerald); }
.chip.is-active { background: var(--emerald); border-color: var(--emerald); color: #fff; }
.chip__count { font-size: 11.5px; opacity: .7; }

/* avatar */
.avatar {
    width: 38px; height: 38px; border-radius: 50%; flex: none;
    display: grid; place-items: center;
    background: var(--emerald-50); color: var(--emerald);
    font-size: 13px; font-weight: 700; letter-spacing: .02em;
    border: 1px solid rgba(var(--emerald-rgb),.10);
}
.avatar--sm { width: 30px; height: 30px; font-size: 11px; }
.avatar--lg { width: 54px; height: 54px; font-size: 17px; }
.avatar--gold { background: var(--gold-50); color: var(--gold-ink); border-color: rgba(var(--gold-rgb),.24); }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -9px; box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ================= APP SHELL ================= */
.app { min-height: 100vh; min-height: 100dvh; }

.sidebar {
    position: fixed; z-index: 60;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--emerald) 0%, var(--emerald-900) 100%);
    color: rgba(255,255,255,.78);
    display: flex; flex-direction: column;
    transform: translateX(-100%);
    transition: transform .26s cubic-bezier(.4,0,.2,1);
    padding-bottom: env(safe-area-inset-bottom);
}
.sidebar.is-open { transform: translateX(0); }
.sidebar__head {
    display: flex; align-items: center; gap: 11px;
    padding: 18px 18px 16px;
}
.sidebar__head .brand-name { color: #fff; }
.sidebar__head .brand-tag { color: rgba(228,211,170,.72); }
.sidebar__close {
    margin-left: auto; background: none; border: 0; color: rgba(255,255,255,.6);
    padding: 6px; border-radius: 8px; display: flex;
}
.sidebar__close:hover { background: rgba(255,255,255,.1); color: #fff; }

.sidebar__scroll { flex: 1; overflow-y: auto; padding: 6px 12px 18px; }
.nav-label {
    font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase;
    color: rgba(228,211,170,.55); padding: 16px 10px 8px;
}
.nav-item {
    display: flex; align-items: center;
    gap: 11px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255,255,255,.76);
    transition: background .15s, color .15s;
}
.nav-item svg { flex: none; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.is-active {
    background: rgba(228,211,170,.15);
    color: #fff;
    box-shadow: inset 2px 0 0 var(--gold);
}
.nav-item.is-active svg { color: var(--gold-soft); opacity: 1; }
.nav-item__badge {
    margin-left: auto; font-size: 11px; font-weight: 700;
    background: var(--gold); color: var(--ink);
    padding: 1px 7px; border-radius: var(--r-pill);
}

.sidebar__foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.09); }
.sidebar__user { display: flex; align-items: center; gap: 10px; }
.sidebar__user .avatar { background: rgba(228,211,170,.16); color: var(--gold-soft); border-color: transparent; }
.sidebar__user .name { color: #fff; font-size: 13.5px; font-weight: 600; }
.sidebar__user .role { color: rgba(255,255,255,.5); font-size: 11.5px; }
.sidebar__user a.icon-btn { color: rgba(255,255,255,.6); margin-left: auto; }
.sidebar__user a.icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }

.scrim {
    position: fixed; inset: 0; z-index: 55;
    background: rgba(30,26,22,.5);
    opacity: 0; visibility: hidden;
    transition: opacity .22s, visibility .22s;
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.scrim.is-open { opacity: 1; visibility: visible; }

/* main column */
.main { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

.topbar {
    position: sticky; top: 0; z-index: 40;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 10px;
    padding: 0 14px;
    background: rgba(251,247,240,.9);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--line);
}
.topbar__title { font-family: var(--ff-display); font-size: 20px; font-weight: 600; }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.icon-btn {
    position: relative;
    width: 38px; height: 38px; flex: none;
    display: grid; place-items: center;
    border: 0; background: transparent; color: var(--ink-2);
    border-radius: 10px; transition: .15s;
}
.icon-btn:hover { background: var(--cream-deep); color: var(--ink); }
.icon-btn__dot {
    position: absolute; top: 8px; right: 8px;
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--gold); box-shadow: 0 0 0 2px var(--cream);
}

.topbar__search { display: none; position: relative; max-width: 330px; flex: 1; }
.topbar__search .input { padding: 9px 14px 9px 38px; background: var(--surface-alt); border-radius: var(--r-pill); }

.content {
    flex: 1;
    padding: 20px 14px calc(88px + env(safe-area-inset-bottom));
    max-width: 1360px; width: 100%; margin: 0 auto;
}

/* page heading */
.page-head { margin-bottom: 18px; }
.page-head h1 { font-family: var(--ff-display); font-size: 27px; font-weight: 600; line-height: 1.2; }
.page-head p { color: var(--ink-3); font-size: 14px; margin-top: 3px; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
}
.card__head {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}
.card__head h3 { font-family: var(--ff-display); font-size: 18px; }
.card__head .btn, .card__head .icon-btn { margin-left: auto; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }
.card__foot { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-alt); border-radius: 0 0 var(--r) var(--r); }

/* ---------- Stat cards ---------- */
.stat-grid {
    display: grid; gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 18px;
}
.stat {
    position: relative; overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 15px;
    box-shadow: var(--shadow-sm);
}
.stat::after {
    content: ""; position: absolute; right: -30px; top: -30px;
    width: 96px; height: 96px; border-radius: 50%;
    background: var(--gold-50); opacity: .55;
}
.stat > * { position: relative; z-index: 1; }
.stat__icon {
    width: 34px; height: 34px; border-radius: 10px;
    display: grid; place-items: center; margin-bottom: 12px;
    background: var(--emerald-50); color: var(--emerald);
}
.stat__icon--gold { background: var(--gold-50); color: var(--gold-ink); }
.stat__icon--info { background: var(--info-bg); color: var(--info); }
.stat__icon--warn { background: var(--warn-bg); color: var(--warn); }
.stat__label { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.stat__value { font-family: var(--ff-display); font-size: 30px; font-weight: 600; line-height: 1.1; margin-top: 3px; }
.stat__value small { font-family: var(--ff-body); font-size: 13px; font-weight: 500; color: var(--ink-3); }
.stat__delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; margin-top: 8px; }
.stat__delta--up { color: var(--ok); }
.stat__delta--down { color: var(--danger); }
.stat__delta span { color: var(--ink-3); font-weight: 400; }

/* ---------- Layout grids ---------- */
.grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
.card-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { min-width: 620px; font-size: 14px; }
.table thead th {
    text-align: left; font-size: 11.5px; font-weight: 600;
    letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
    padding: 11px 18px; background: var(--surface-alt);
    border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table tbody td { padding: 13px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-alt); }
.table .cell-main { font-weight: 600; }
.table .cell-sub { font-size: 12.5px; color: var(--ink-3); }

/* mobile: cards instead of table */
.list { display: grid; gap: 10px; }
.list-item {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
}
.list-item__body { flex: 1; min-width: 0; }
.list-item__title { font-weight: 600; font-size: 14.5px; }
.list-item__meta { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.list-item__end { text-align: right; flex: none; }

/* rows inside cards (no border card) */
.row-list > li {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 18px; border-bottom: 1px solid var(--line);
}
.row-list > li:last-child { border-bottom: 0; }
.row-list > li:hover { background: var(--surface-alt); }

/* timeline / schedule */
.slot {
    display: grid; grid-template-columns: 58px 1fr; gap: 12px;
    padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.slot:last-child { border-bottom: 0; }
.slot:hover { background: var(--surface-alt); }
.slot__time { font-size: 13px; font-weight: 600; color: var(--ink-2); padding-top: 1px; }
.slot__time small { display: block; font-weight: 400; font-size: 11px; color: var(--ink-3); }
.slot__card {
    border-left: 3px solid var(--emerald-300);
    padding-left: 12px;
}
.slot__card--gold   { border-left-color: var(--gold); }
.slot__card--danger { border-left-color: var(--danger); }
.slot__card--muted  { border-left-color: var(--line); }

/* toolbar */
.toolbar {
    display: flex; gap: 8px; align-items: center;
    margin-bottom: 14px; flex-wrap: wrap;
}
.toolbar__search { position: relative; flex: 1 1 220px; min-width: 0; }
.toolbar__search .input { padding-left: 38px; border-radius: var(--r-pill); }
.filter-scroll {
    display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.filter-scroll::-webkit-scrollbar { display: none; }
.filter-scroll .chip { flex: none; }

/* segmented control */
.segment {
    display: inline-flex; padding: 3px; gap: 2px;
    background: var(--cream-deep); border-radius: var(--r-pill);
}
/* Anchors as well as buttons: a range switch that reloads the page is a
   link, and has to sit in the same track. */
.segment button, .segment a {
    border: 0; background: transparent; color: var(--ink-2);
    padding: 7px 15px; border-radius: var(--r-pill);
    font-size: 13px; font-weight: 600; transition: .15s;
}
.segment button.is-active, .segment a.is-active {
    background: var(--surface); color: var(--emerald); box-shadow: var(--shadow-sm);
}

/* service tile */
.service {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r); padding: 16px; box-shadow: var(--shadow-sm);
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.service:hover { border-color: var(--emerald-300); box-shadow: var(--shadow); }
.service__top { display: flex; align-items: flex-start; gap: 12px; }
.service__name { font-family: var(--ff-display); font-size: 18px; font-weight: 600; }
.service__price { font-family: var(--ff-display); font-size: 20px; font-weight: 600; color: var(--emerald); }
.service__foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }

/* POS */
.pos { display: grid; gap: 16px; grid-template-columns: 1fr; }
.pos__menu { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0,1fr)); }
.pos-tile {
    text-align: left; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--r);
    padding: 13px; box-shadow: var(--shadow-sm); transition: .15s;
}
.pos-tile:hover { border-color: var(--emerald-300); transform: translateY(-1px); box-shadow: var(--shadow); }
.pos-tile__name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.pos-tile__meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.pos-tile__price { font-family: var(--ff-display); font-size: 17px; font-weight: 600; color: var(--emerald); margin-top: 8px; }

.ticket__line { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.ticket__line:last-of-type { border-bottom: 0; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r-pill); overflow: hidden; }
.qty button { width: 26px; height: 26px; border: 0; background: var(--surface-alt); color: var(--ink-2); display: grid; place-items: center; }
.qty button:hover { background: var(--emerald-50); color: var(--emerald); }
.qty span { min-width: 28px; text-align: center; font-size: 13px; font-weight: 600; }

.totals { margin-top: 6px; }
.totals__row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; color: var(--ink-2); }
.totals__row--grand {
    margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line);
    font-family: var(--ff-display); font-size: 22px; font-weight: 600; color: var(--ink);
}

.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.pay-methods .chip { justify-content: center; padding: 10px 6px; flex-direction: column; gap: 4px; font-size: 12px; }

/* progress bar */
.bar { height: 6px; background: var(--cream-deep); border-radius: var(--r-pill); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--emerald-600), var(--emerald-300)); }
.bar--gold > i { background: linear-gradient(90deg, var(--gold), var(--gold-soft)); }

/* empty state */
.empty { text-align: center; padding: 44px 20px; }
.empty__icon {
    width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 16px;
    display: grid; place-items: center; background: var(--cream-deep); color: var(--ink-3);
}
.empty h3 { font-family: var(--ff-display); font-size: 19px; }
.empty p { color: var(--ink-3); font-size: 14px; margin-top: 4px; }

/* ---------- Modal / sheet ---------- */
.modal {
    position: fixed; inset: 0; z-index: 80;
    display: flex; align-items: flex-end; justify-content: center;
    visibility: hidden;
}
.modal.is-open { visibility: visible; }
.modal__backdrop {
    position: absolute; inset: 0; background: rgba(30,26,22,.5);
    opacity: 0; transition: opacity .22s;
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.modal.is-open .modal__backdrop { opacity: 1; }
.modal__panel {
    position: relative; width: 100%; max-width: 560px;
    max-height: 92vh; max-height: 92dvh; overflow-y: auto;
    background: var(--cream);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    box-shadow: var(--shadow-lg);
    transform: translateY(100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    padding-bottom: env(safe-area-inset-bottom);
}
.modal.is-open .modal__panel { transform: translateY(0); }
.modal__grab { width: 38px; height: 4px; border-radius: 3px; background: var(--line); margin: 10px auto 0; }
.modal__head {
    position: sticky; top: 0; z-index: 2;
    display: flex; align-items: center; gap: 12px;
    padding: 14px 18px; background: var(--cream);
    border-bottom: 1px solid var(--line);
}
.modal__head h3 { font-family: var(--ff-display); font-size: 20px; }
.modal__head .icon-btn { margin-left: auto; }
.modal__body { padding: 18px; }
.modal__foot {
    position: sticky; bottom: 0;
    display: flex; gap: 10px; padding: 14px 18px;
    background: var(--cream); border-top: 1px solid var(--line);
}
.modal__foot .btn { flex: 1; }

/* Destructive action, kept below the save row so it is never the reflex
   click. Hidden unless the record can actually be removed. */
.modal__danger { padding: 0 18px 18px; }

/* ---------- Notices ----------
   Result of the last write, shown once after the redirect. */
.notice {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px; margin-bottom: 18px;
    border-radius: var(--r);
    background: var(--ok-bg); color: var(--ok);
    font-size: 14px; line-height: 1.45;
}
.notice svg { flex: none; margin-top: 1px; }
.notice--danger { background: var(--danger-bg); color: var(--danger); }
.notice--warn   { background: var(--warn-bg);   color: var(--warn); }
.notice--info   { background: var(--info-bg);   color: var(--info); }

/* A one-button form sitting in a row of icon buttons: it must not
   introduce a line box of its own. */
.inline-form { display: inline-flex; margin: 0; }

/* Deactivated records stay visible but read as switched off. */
.is-dimmed { opacity: .58; }
.is-dimmed:hover, .is-dimmed:focus-within { opacity: 1; }

/* ---------- Mobile bottom nav ---------- */
.tabbar {
    position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
    display: grid; grid-template-columns: repeat(5, 1fr);
    background: rgba(255,255,255,.94);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 9px 2px 8px; font-size: 10.5px; font-weight: 600;
    color: var(--ink-3); transition: color .15s;
}
.tabbar a.is-active { color: var(--emerald); }
.tabbar a.is-active svg { color: var(--emerald); }
.tabbar__fab {
    margin-top: -20px;
    width: 46px; height: 46px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--emerald); color: #fff;
    box-shadow: 0 6px 16px rgba(var(--emerald-rgb),.34);
}

/* ---------- Toast ---------- */
.toast-host {
    position: fixed; z-index: 90; left: 12px; right: 12px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    display: grid; gap: 8px; pointer-events: none;
}
.toast {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; border-radius: var(--r);
    background: var(--ink); color: #fff; font-size: 13.5px;
    box-shadow: var(--shadow-lg);
    animation: toast-in .24s ease both;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* =========================================================
   Breakpoints
   ========================================================= */
@media (min-width: 640px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
    .content { padding: 24px 22px calc(92px + env(safe-area-inset-bottom)); }
    .card-grid--2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .pos__menu { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
    .page-head__actions { margin-top: 0; }
    .modal { align-items: center; padding: 20px; }
    .modal__panel { border-radius: var(--r-lg); transform: translateY(14px) scale(.98); opacity: 0; transition: transform .22s, opacity .22s; }
    .modal.is-open .modal__panel { transform: none; opacity: 1; }
    .modal__grab { display: none; }
    .auth { grid-template-columns: 1fr; }
}

@media (min-width: 900px) {
    .auth { grid-template-columns: 1.05fr 1fr; }
    .auth__art { display: block; }
    .auth__panel { padding: 40px; }

    .sidebar { transform: none; }
    .sidebar__close { display: none; }
    .scrim { display: none; }
    .main { margin-left: var(--sidebar-w); }
    .topbar { padding: 0 22px; }
    .topbar__search { display: block; }
    .tabbar { display: none; }
    .content { padding: 26px 22px 40px; }
    .toast-host { left: auto; right: 20px; bottom: 20px; width: 340px; }

    .stat-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
    .grid--main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
    .grid--halves { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .card-grid--3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .pos { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; }
    .pos__ticket { position: sticky; top: calc(var(--topbar-h) + 20px); }
    .pos__menu { grid-template-columns: repeat(3, minmax(0,1fr)); }

    .page-head h1 { font-size: 31px; }
    .hide-desktop { display: none !important; }
}

@media (min-width: 1200px) {
    .card-grid--4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
    .pos__menu { grid-template-columns: repeat(4, minmax(0,1fr)); }
    .content { padding: 30px 30px 44px; }
}

@media (max-width: 899px) {
    .hide-mobile { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
/* =========================================================
   Themes
   ---------------------------------------------------------
   Only the brand ramp changes; surfaces, ink and status
   colours stay put so contrast stays predictable. The owner
   picks one in Settings › Appearance, and app.js stamps
   data-theme on <html>.
   ========================================================= */
[data-theme="plum"] {
    --emerald-900:  #31182D;
    --emerald-rgb:  74, 37, 69;
    --gold-600:     #B3776A;
    --gold-ink:     #8A5B4E;
    --gold-rgb:     201, 139, 126;
    --emerald:      #4A2545;
    --emerald-600:  #633159;
    --emerald-300:  #A87F9F;
    --emerald-50:   #F1E9EF;
    --gold:         #C98B7E;
    --gold-soft:    #E8C9C1;
    --gold-50:      #FBF0ED;
}
[data-theme="indigo"] {
    --emerald-900:  #18274A;
    --emerald-rgb:  36, 58, 107;
    --gold-600:     #B3945A;
    --gold-ink:     #8A6F32;
    --gold-rgb:     201, 169, 106;
    --emerald:      #243A6B;
    --emerald-600:  #304C8A;
    --emerald-300:  #8598C4;
    --emerald-50:   #E8EDF7;
    --gold:         #C9A96A;
    --gold-soft:    #E7D6B2;
    --gold-50:      #FAF5EA;
}
[data-theme="teal"] {
    --emerald-900:  #0B4145;
    --emerald-rgb:  18, 94, 99;
    --gold-600:     #AE6A40;
    --gold-ink:     #8A5326;
    --gold-rgb:     197, 123, 78;
    --emerald:      #125E63;
    --emerald-600:  #197B81;
    --emerald-300:  #7CB8BC;
    --emerald-50:   #E4F1F1;
    --gold:         #C57B4E;
    --gold-soft:    #E6C1A6;
    --gold-50:      #FBF1EA;
}
[data-theme="rose"] {
    --emerald-900:  #571D30;
    --emerald-rgb:  123, 43, 69;
    --gold-600:     #B98C4E;
    --gold-ink:     #8A6524;
    --gold-rgb:     207, 161, 94;
    --emerald:      #7B2B45;
    --emerald-600:  #97374F;
    --emerald-300:  #C68AA0;
    --emerald-50:   #F7E9ED;
    --gold:         #CFA15E;
    --gold-soft:    #EBD3AB;
    --gold-50:      #FBF4E8;
}
[data-theme="charcoal"] {
    --emerald-900:  #1F2324;
    --emerald-rgb:  47, 52, 54;
    --gold-600:     #9E8C69;
    --gold-ink:     #6F6144;
    --gold-rgb:     180, 161, 124;
    --emerald:      #2F3436;
    --emerald-600:  #434A4D;
    --emerald-300:  #949C9E;
    --emerald-50:   #EBEDED;
    --gold:         #B4A17C;
    --gold-soft:    #DCD0B8;
    --gold-50:      #F7F3EA;
}

/* ---------- Theme picker (Settings › Appearance) ---------- */
.gs-theme-grid {
    display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
}
.gs-theme { display: block; cursor: pointer; }
.gs-theme input {
    position: absolute; opacity: 0; width: 0; height: 0;
}
.gs-theme__body {
    display: block; height: 100%;
    border: 2px solid var(--line); border-radius: var(--r);
    padding: 10px;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.gs-theme:hover .gs-theme__body { transform: translateY(-1px); box-shadow: var(--shadow); }
.gs-theme input:checked + .gs-theme__body {
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px var(--emerald-50);
}
.gs-theme input:focus-visible + .gs-theme__body {
    outline: 2px solid var(--emerald); outline-offset: 2px;
}
.gs-theme__bar { display: block; height: 40px; border-radius: var(--r-sm); }
.gs-theme__name { display: block; font-size: 13.5px; font-weight: 600; margin-top: 9px; }
.gs-theme__note { display: block; font-size: 11.5px; color: var(--ink-3); }
.gs-theme__dots { display: flex; gap: 4px; margin-top: 8px; }
.gs-theme__dots span {
    width: 13px; height: 13px; border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(42,38,33,.08);
}

/* =========================================================
   Booking service rows
   ---------------------------------------------------------
   One row per service: what, who does it, and what it costs.
   The fee prefills from the service but stays editable.
   ========================================================= */
.svc-row {
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface-alt);
    padding: 12px 12px 4px;
    margin-bottom: 10px;
}
.svc-row__grid { display: grid; gap: 0 12px; grid-template-columns: 1fr; }
.svc-row__grid .field { margin-bottom: 12px; }
.svc-row__foot {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding-bottom: 8px;
}
.svc-row__foot .icon-btn { flex: none; }
/* A single service needs no remove button. */
.svc-row:only-child [data-remove-row] { display: none; }

@media (min-width: 560px) {
    .svc-row__grid { grid-template-columns: 1fr 1fr 110px; }
    .svc-row__service { grid-column: 1 / -1; }
}
@media (min-width: 760px) {
    .svc-row__grid { grid-template-columns: minmax(0,1.6fr) minmax(0,1fr) 110px; }
    .svc-row__service { grid-column: auto; }
}

/* =========================================================
   Payment panels (point of sale)
   ========================================================= */
.pay-methods--4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 420px) { .pay-methods--4 { grid-template-columns: repeat(4, 1fr); } }

.pay-panel {
    margin-top: 12px; padding: 12px;
    border: 1px solid var(--line); border-radius: var(--r);
    background: var(--surface-alt);
}

/* =========================================================
   Fixes
   ========================================================= */

/* Bar charts and stat rows must never widen the page: the money labels
   above each column are nowrap, so the track scrolls instead. */
.chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.chart-cols { display: flex; align-items: flex-end; gap: 10px; height: 190px; min-width: 460px; }
.chart-cols > * { flex: 1 1 0; min-width: 56px; }
.chart-bar { border-radius: 8px 8px 4px 4px; min-height: 6px; background: linear-gradient(180deg, var(--emerald-600), var(--emerald-300)); }

/* Long service names inside POS tiles and slot cards were pushing the
   grid wider than its track. */
.pos-tile { min-width: 0; overflow-wrap: anywhere; }
.pos__menu { min-width: 0; }
.slot { min-width: 0; }
.slot__card { min-width: 0; overflow-wrap: anywhere; }
.stat { min-width: 0; }
.stat__value { overflow-wrap: anywhere; }
.list-item__body { overflow-wrap: anywhere; }

/* Grid children default to min-content:auto, which lets wide content
   stretch the whole layout. */
.grid > *, .card-grid > *, .stat-grid > *, .pos > * { min-width: 0; }

/* Service lines inside a booking slot: what, who, how much. */
.svc-lines { display: grid; gap: 4px; }
.svc-lines > li {
    display: flex; align-items: baseline; gap: 8px;
    padding: 4px 8px; border-radius: var(--r-sm);
    background: var(--surface-alt);
    min-width: 0;
}
.svc-lines > li > .grow { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
.svc-lines .tiny svg { vertical-align: -1px; }
/* The row a therapist is personally working. */
.svc-lines > li.is-mine {
    background: var(--emerald-50);
    box-shadow: inset 2px 0 0 var(--emerald);
}
