:root {
  --maroon:       #5D001D;
  --maroon-dark:  #440015;
  --maroon-light: #7A1235;
  --gold:         #B59040;
  --gold-light:   #D9BD7A;
  --blush:        #EDC9BD;
  --blush-light:  #F7E6DF;
  --cream:        #FAF1EC;

  /* ── Complementary palette ── */
  --rose-maroon:     #A83256;
  --rose-maroon-mid: #C96A8A;
  --rose-maroon-bg:  #FAEDF2;
  --mauve:           #9B4F72;
  --mauve-mid:       #C48DA7;
  --mauve-bg:        #F5E8EF;
  --taupe:           #8C7460;
  --taupe-mid:       #B5A494;
  --taupe-bg:        #F2EDE8;

  /* ── Chart colour sequence (4 series) ── */
  --chart-1: #A83256;
  --chart-2: #9B4F72;
  --chart-3: #8C7460;
  --chart-4: #B59040;

  --bg:        #FAF8F6;
  --surface:   #ffffff;
  --surface2:  #F7F1ED;
  --border:    #E8DDD5;
  --text:      #2A1015;
  --text2:     #6B4C52;
  --text3:     #A0888C;

  --accent:       var(--maroon);
  --accent2:      var(--maroon-dark);
  --accent-light: var(--blush-light);

  --green:    #2D7A4F; --green-bg: #E8F5EE;
  --red:      #C0392B; --red-bg:   #FDECEA;
  --blue:     #1A6896; --blue-bg:  #E8F2FA;
  --teal:     #0E7490; --teal-bg:  #E0F7FA;
  --purple:   #7C3AED; --purple-bg:#EDE9FE;

  --shadow:   0 2px 14px rgba(93,0,29,.07);
  --shadow-lg:0 8px 28px rgba(93,0,29,.12);
  --radius:   12px;
  --radius-sm:8px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body { background: var(--bg); font-family: var(--font); color: var(--text); font-size: 14px; margin: 0; }
a { color: var(--maroon); text-decoration: none; }

/* ═══ ICONS (Lucide) ═══ */
.i { display: inline-flex; align-items: center; justify-content: center; width: 1em; height: 1em; vertical-align: -0.125em; }
.i svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-18 { width: 18px; height: 18px; }
.ic-20 { width: 20px; height: 20px; }
.ic-24 { width: 24px; height: 24px; }
.ic-16 { width: 16px; height: 16px; }

/* ═══ LOGIN ═══ */
#loginScreen { position: fixed; inset: 0; background: linear-gradient(135deg, var(--maroon) 0%, var(--maroon-dark) 100%); align-items: center; justify-content: center; z-index: 999; }
.login-box { background: var(--surface); border-radius: 20px; padding: 44px 40px; width: 360px; box-shadow: var(--shadow-lg); }
.login-box img { display: block; max-width: 180px; margin: 0 auto 18px auto; }
.login-box h2 { font-size: 16px; color: var(--text2); margin-bottom: 26px; font-weight: 400; text-align: center; }
.fg { margin-bottom: 14px; }
.fg label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 5px; }
.fg input, .fg select, .fg textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: var(--font); color: var(--text); background: var(--surface);
  transition: border-color .15s;
}
.fg input:focus, .fg select:focus, .fg textarea:focus { outline: none; border-color: var(--maroon); }
.login-err { color: var(--red); font-size: 12.5px; text-align: center; margin-top: 10px; min-height: 18px; }

/* ═══ APP SHELL ═══ */
#appShell { display: flex; height: 100vh; overflow: hidden; }

/* ═══ SIDEBAR — icon rail with hover flyouts ═══ */
#sidebar {
  width: 78px; height: 100vh; background: #6E1A32; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; position: relative; z-index: 50;
  box-shadow: 3px 0 20px rgba(93,0,29,.18);
}
.sb-logo { padding: 18px 0 14px 0; text-align: center; width: 100%; border-bottom: 1px solid rgba(255,255,255,.14); }
.sb-logo img { display: none; }
.sb-logo p { display: none; }
.sb-initials { width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,.22); display: flex; align-items: center; justify-content: center; margin: 0 auto; font-size: 15px; font-weight: 800; color: #fff; letter-spacing: 1px; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.role-badge {
  display: block; margin: 6px auto 0; font-size: 8px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--gold-light); background: rgba(255,255,255,.13);
  padding: 2px 6px; border-radius: 10px; width: fit-content;
}

nav { flex: 1; width: 100%; padding: 10px 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
nav::-webkit-scrollbar { width: 3px; }
nav::-webkit-scrollbar-track { background: transparent; }
nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 2px; }

.nav-group { position: relative; }
.nav-main-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 13px 4px; cursor: pointer; color: rgba(255,255,255,.68);
  transition: background .18s, color .18s, transform .12s; position: relative;
}
.nav-main-item .i { width: 22px; height: 22px; transition: transform .18s; }
.nav-main-item span.label { font-size: 9.5px; font-weight: 600; letter-spacing: .2px; }
.nav-main-item:hover, .nav-main-item.flyout-open {
  background: rgba(255,255,255,.13); color: #fff;
}
.nav-main-item:hover .i { transform: scale(1.12); }
.nav-main-item.current { color: #fff; background: rgba(255,255,255,.08); }
.nav-main-item.current::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  background: var(--gold-light); border-radius: 0 3px 3px 0;
  box-shadow: 0 0 10px var(--gold);
}

/* Flyout panel */
.nav-flyout {
  position: fixed; left: 78px; top: 0; min-width: 220px; background: var(--surface);
  border-radius: 0 14px 14px 0; box-shadow: var(--shadow-lg); padding: 10px; z-index: 100;
  opacity: 0; visibility: hidden; transform: translateX(-6px); transition: opacity .12s, transform .12s, visibility .12s;
  border: 1px solid var(--border); border-left: none;
  max-height: calc(100vh - 16px); overflow-y: auto;
}
.nav-flyout.open { opacity: 1; visibility: visible; transform: translateX(0); }
.nav-flyout-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text3); padding: 6px 12px 8px 12px; }
.nav-sub-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text2); font-size: 13.5px; font-weight: 500; transition: background .12s, color .12s, transform .12s;
}
.nav-sub-item .i { width: 17px; height: 17px; color: var(--text3); flex-shrink: 0; }
.nav-sub-item:hover { background: var(--blush-light); color: var(--maroon); transform: translateX(2px); }
.nav-sub-item:hover .i { color: var(--maroon); }
.nav-sub-item.active { background: var(--maroon); color: #fff; }
.nav-sub-item.active .i { color: #fff; }

.sb-bottom { width: 100%; padding: 14px 6px; border-top: 1px solid rgba(255,255,255,.12); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.sb-bottom .btn { width: 100%; flex-direction: column; gap: 3px; padding: 9px 2px; font-size: 9.5px; background: transparent; color: rgba(255,255,255,.72); border: none; }
.sb-bottom .btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.sb-bottom .btn .i { width: 18px; height: 18px; }

#syncStatus { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; transition: background .2s, color .2s; }
#syncStatus .i { width: 18px; height: 18px; }
#syncStatus.online  { background: rgba(45,122,79,.25);  color: #8FE3B3; }
#syncStatus.offline { background: rgba(192,57,43,.25);  color: #F5A8A1; }
#syncStatus.syncing { background: rgba(181,144,64,.3);  color: var(--gold-light); }
#syncStatus.unsynced { background: rgba(230,126,34,.3); color: #f5b041; }

/* ═══ MAIN AREA ═══ */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
#content { flex: 1; overflow-y: auto; padding: 22px 26px 40px 26px; min-width: 0; }
#content:has(#page-billing.active), #content.content-billing { overflow: hidden; padding: 16px 26px 16px 26px; display: flex; flex-direction: column; }
#page-billing.active { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px;
  border-radius: var(--radius-sm); border: none; cursor: pointer;
  font-size: 13px; font-weight: 600; transition: all .15s; font-family: var(--font);
}
.btn .i { width: 15px; height: 15px; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 11px; }
.btn-primary  { background: var(--maroon); color: #fff; }
.btn-primary:hover { background: var(--maroon-dark); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success  { background: var(--green-bg);  color: var(--green);  border: 1px solid #a8d8be; }
.btn-success:hover { background: #d5f0e0; }
.btn-danger   { background: var(--red-bg);    color: var(--red);    border: 1px solid #f5b8b3; }
.btn-danger:hover { background: #fbdad6; }
.btn-ghost    { background: transparent;       color: var(--text2);  border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: #9c7a35; }

/* ═══ CARDS ═══ */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-header h3 { font-size: 15px; font-weight: 700; color: var(--text); margin: 0; display: flex; align-items: center; gap: 8px; }
.card-header h3 .i { color: var(--maroon); width: 18px; height: 18px; }
.card-body { padding: 18px 20px; }

/* ═══ DATA CARD GRID — replaces dense tables ═══ */
.dcard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.dcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; transition: box-shadow .15s, border-color .15s;
}
.dcard:hover { box-shadow: var(--shadow); border-color: var(--blush); }
.dcard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.dcard-title { font-weight: 700; font-size: 14.5px; color: var(--text); }
.dcard-sub { font-size: 12px; color: var(--text3); margin-top: 2px; }
.dcard-amt { font-weight: 700; font-size: 16px; color: var(--maroon); white-space: nowrap; }
.dcard-row { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--text2); padding: 4px 0; border-top: 1px dashed var(--border); }
.dcard-row:first-of-type { border-top: none; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }
.dcard-row span:first-child { color: var(--text3); }
.dcard-foot { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.dcard-foot .badge { font-size: 10.5px; }

/* Stat summary cards (KPI tiles) */
.sgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.sc { border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.sc .lbl { font-size: 11.5px; font-weight: 600; opacity: .85; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.sc .lbl .i { width: 14px; height: 14px; }
.sc .val { font-size: 22px; font-weight: 800; line-height: 1.1; }
.sc .sub { font-size: 11px; opacity: .75; margin-top: 4px; }
.sc.green  { background: var(--green-bg);  color: var(--green); }
.sc.amber  { background: #FCF3E3; color: #9c7a35; }
.sc.teal   { background: var(--teal-bg);   color: var(--teal); }
.sc.purple { background: var(--purple-bg); color: var(--purple); }
.sc.blue   { background: var(--blue-bg);   color: var(--blue); }
.sc.rose   { background: var(--blush-light); color: var(--maroon); }
.sc.maroon { background: var(--maroon); color: #fff; }
.sc.maroon .lbl { color: rgba(255,255,255,.8); }

/* ═══ BADGES ═══ */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge .i { width: 11px; height: 11px; }
.bg-blue { background: var(--blue-bg); color: var(--blue); }
.bg-green { background: var(--green-bg); color: var(--green); }
.bg-red { background: var(--red-bg); color: var(--red); }
.bg-amber { background: #FCF3E3; color: #9c7a35; }
.bg-gray { background: var(--surface2); color: var(--text2); }
.bg-maroon { background: var(--blush-light); color: var(--maroon); }

/* ═══ TABS ═══ */
.tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--border); flex-wrap: wrap; }
.tab { display: flex; align-items: center; gap: 6px; padding: 10px 18px; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text3); border-bottom: 2.5px solid transparent; margin-bottom: -2px; transition: color .15s, border-color .15s; }
.tab .i { width: 16px; height: 16px; }
.tab:hover { color: var(--maroon); }
.tab.active { color: var(--maroon); border-bottom-color: var(--maroon); }

/* ═══ FILTER BAR ═══ */
.fbar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 18px; background: var(--surface); padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); }
.fbar .fg { margin-bottom: 0; min-width: 130px; }

/* ═══ EMPTY STATE ═══ */
.empty { text-align: center; padding: 50px 20px; color: var(--text3); }
.empty .ei { width: 44px; height: 44px; margin: 0 auto 10px; color: var(--border); }
.empty .ei svg { width: 100%; height: 100%; }
.empty p { font-size: 13px; }

/* ═══ FORMS / SERVICE ROWS ═══ */
.svc-row { display: grid; grid-template-columns: 1.8fr 1.1fr 88px 32px; border-bottom: 1px solid var(--border); align-items: center; }
.svc-row select, .svc-row input { border: none; padding: 9px 8px; font-size: 13px; background: transparent; width: 100%; color: var(--text); }
.svc-row select:focus, .svc-row input:focus { outline: none; background: var(--surface2); }
.del-btn { background: none; border: none; color: var(--red); cursor: pointer; font-size: 15px; padding: 6px; display: flex; align-items: center; justify-content: center; }
.del-btn:hover { background: var(--red-bg); border-radius: 6px; }
.del-btn .i { width: 16px; height: 16px; }

.pkg-svc-hdr { background: var(--surface2); display: grid; grid-template-columns: 1.8fr 1.1fr 88px 32px; font-size: 10px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .5px; }
.pkg-svc-hdr > span { padding: 8px; }

.prod-svc-hdr { background: var(--surface2); display: grid; grid-template-columns: 2fr 1fr 88px 32px; font-size: 10px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .5px; }
.prod-svc-hdr > span { padding: 8px; }
.prod-svc-row { display: grid; grid-template-columns: 2fr 1fr 88px 32px; border-bottom: 1px solid var(--border); }
.prod-svc-row select, .prod-svc-row input[type=number] { border: none; padding: 9px 8px; font-size: 13px; background: transparent; width: 100%; color: var(--text); }

.pkg-sell-hdr { background: var(--surface2); display: grid; grid-template-columns: 1.8fr 1fr 1fr 1fr 32px; font-size: 10px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .5px; }
.pkg-sell-hdr > span { padding: 8px; }
.pkg-sell-row { display: grid; grid-template-columns: 1.8fr 1fr 1fr 1fr 32px; border-bottom: 1px solid var(--border); }
.pkg-sell-row select, .pkg-sell-row input[type=number] { border: none; padding: 9px 8px; font-size: 13px; background: transparent; width: 100%; color: var(--text); }

.mem-svc-hdr { background: var(--surface2); display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 32px; font-size: 10px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .5px; }
.mem-svc-hdr > span { padding: 8px; }
.mem-svc-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 32px; border-bottom: 1px solid var(--border); }
.mem-svc-row input { border: none; padding: 9px 8px; font-size: 13px; background: transparent; width: 100%; color: var(--text); }

.bill-no-tag { background: var(--blush-light); color: var(--maroon); font-weight: 700; font-size: 12px; padding: 4px 10px; border-radius: 20px; }

/* ═══ TOAST ═══ */
#toast { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast-item { background: var(--text); color: #fff; padding: 12px 18px; border-radius: var(--radius-sm); font-size: 13px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px; animation: toastIn .2s ease; }
.toast-item.ok { background: var(--green); }
.toast-item.error { background: var(--red); }
@keyframes toastIn { from { opacity:0; transform: translateY(10px);} to { opacity:1; transform: translateY(0);} }

/* ═══ MODAL ═══ */
.modal-overlay { position: fixed; inset: 0; background: rgba(42,16,21,.55); display: flex; align-items: center; justify-content: center; z-index: 500; }
.modal { background: var(--surface); border-radius: 16px; max-width: 480px; width: 92%; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 16px; margin: 0; color: var(--maroon); display: flex; align-items: center; gap: 8px; }
.close-btn { background: none; border: none; cursor: pointer; color: var(--text3); display: flex; padding: 4px; border-radius: 6px; }
.close-btn:hover { background: var(--surface2); color: var(--text); }
.close-btn .i { width: 18px; height: 18px; }
.modal-body { padding: 20px 22px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 22px; border-top: 1px solid var(--border); }

/* ═══ PANELS (billing/menu/inventory tabs) ═══ */
.bill-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.bill-panel[style*="display:none"] { display: none !important; }
#bill-membership.bill-panel, #bill-package.bill-panel { overflow-y: auto; display: block; }
#bill-redeem.bill-panel { overflow-y: auto; }
.menu-tab-panel { display: block; }
.menu-tab-panel[style*="display:none"] { display: none !important; }
.inv-tab-panel { display: block; }
.inv-tab-panel[style*="display:none"] { display: none !important; }

/* ═══ LOW STOCK ═══ */
.row-warning { border-color: #f0c674 !important; background: #FFF8E9; }
.row-warning .dcard-amt, .row-warning .dcard-title { color: #9c7a35; }

/* ═══ PIE CHART ═══ */
.pie-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.pie-legend { display: flex; flex-direction: column; gap: 5px; min-width: 120px; }
.pie-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text2); }
.pie-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ── chart-wrap / legend (used by UTIL_pieChart) ── */
.chart-wrap { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; padding: 4px 0; }
.chart-legend { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 160px; padding-top: 12px; }
.chart-legend-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 8px; cursor: default;
  transition: background .14s;
}
.chart-legend-row:hover { background: var(--surface2); }
.chart-legend-swatch {
  width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.chart-legend-label {
  flex: 1; font-size: 12.5px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chart-legend-val {
  font-size: 11.5px; color: var(--text3); font-weight: 500;
}
.chart-legend-pct {
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
  flex-shrink: 0;
}

/* ═══ BAR / TREND CHART ═══ */
.trend-chart { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding: 6px 0; }
.trend-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.trend-bar {
  width: 100%; max-width: 28px; background: var(--chart-1); border-radius: 4px 4px 0 0;
  transition: filter .15s, transform .12s; position: relative; cursor: pointer;
  transform-origin: bottom;
}
.trend-bar:hover { filter: brightness(1.18); transform: scaleY(1.04); }
.trend-bar::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: rgba(42,16,21,.92); color: #fff; font-size: 10px; white-space: nowrap;
  padding: 4px 8px; border-radius: 6px; pointer-events: none;
  opacity: 0; transition: opacity .15s; z-index: 10;
}
.trend-bar:hover::after { opacity: 1; }
.trend-bar.secondary { background: var(--chart-4); }
.trend-bar.chart-2   { background: var(--chart-2); }
.trend-bar.chart-3   { background: var(--chart-3); }

/* ═══ PIE CHART ═══ */
.pie-slice { cursor: pointer; transition: opacity .18s, filter .18s; }
.pie-slice:hover { opacity: .82; filter: brightness(1.12); }

/* ═══ HORIZONTAL BAR CHART (dashboard breakdowns) ═══ */
.hbar-chart { display: flex; flex-direction: column; gap: 9px; }
.hbar-row { display: flex; align-items: center; gap: 8px; }
.hbar-lbl { width: 110px; font-size: 11.5px; color: var(--text2); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.hbar-track { flex: 1; height: 22px; background: var(--surface2); border-radius: 4px; overflow: hidden; position: relative; }
.hbar-fill { height: 100%; border-radius: 4px; transition: width .5s ease; display: flex; align-items: center; padding-left: 8px; }
.hbar-fill span { font-size: 10.5px; color: #fff; font-weight: 600; white-space: nowrap; }
.hbar-val { width: 72px; font-size: 11px; color: var(--text2); font-weight: 600; text-align: right; }
.hbar-track:hover .hbar-fill { filter: brightness(1.1); }

/* ═══ GRID / LIST TOGGLE ═══ */
.view-toggle { display: flex; gap: 4px; }
.view-toggle .btn { padding: 5px 9px; }
.view-toggle .btn.active { background: var(--maroon); color: #fff; border-color: var(--maroon); }
.trend-label { font-size: 9.5px; color: var(--text3); white-space: nowrap; }

/* ═══ MISC ═══ */
.role-badge2 { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; background: var(--blush-light); color: var(--maroon); }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.info-box { background: var(--blush-light); color: var(--maroon-dark); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 12.5px; line-height: 1.5; }


/* ── Pay mode chips ───────────────────────────────────── */
.pay-chip {
  padding: 5px 14px; border-radius: 20px; font-size: 13px; font-weight: 600;
  border: 2px solid var(--border); background: var(--surface); color: var(--text2);
  cursor: pointer; transition: border-color .12s, background .12s, color .12s;
}
.pay-chip:hover { border-color: var(--maroon); color: var(--maroon); }
.pay-chip.selected { background: var(--maroon); border-color: var(--maroon); color: #fff; }

@media print {
  @page { size: 80mm auto; margin: 0; }
  body * { visibility: hidden; }
  #receiptArea, #receiptArea * { visibility: visible; }
  #receiptArea {
    display: block !important;
    position: fixed;
    top: 0; left: 0;
    width: 72mm;
    padding: 4mm 4mm 8mm 4mm;
    font-size: 11px;
    line-height: 1.45;
    color: #000;
    background: #fff;
  }
  #receiptArea * { color: #000 !important; background: transparent !important; }
  #receiptArea img { max-width: 100%; }
  #receiptModal { display: none !important; }
}

#rcptBody { width: 72mm; margin: 0 auto; font-family: 'Courier New', monospace; font-size: 12px; }

@media (max-width: 900px) {
  #sidebar { width: 64px; }
  .sb-logo img { width: 32px; height: 32px; }
  .nav-main-item span.label { font-size: 8.5px; }
  .nav-flyout { left: 64px; }
  #content { padding: 16px; }
  .sgrid { grid-template-columns: repeat(2, 1fr); }
  .dcard-grid { grid-template-columns: 1fr; }
}

/* ═══ SERVICE TABLE HEADER (billing rows) ═══ */
.svc-hdr { background: var(--surface2); display: grid; grid-template-columns: 1.8fr 1.1fr 1.1fr 88px 32px; font-size: 10px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .5px; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.svc-hdr > span { padding: 8px; }
#svcContainer .svc-row { grid-template-columns: 1.8fr 1.1fr 1.1fr 88px 32px; }
#svcContainer, #prodBillContainer, #pkgSellContainer, #pkgSvcContainer { border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius-sm) var(--radius-sm); overflow: hidden; }

/* ═══ GST SUMMARY BOX ═══ */
.gst-box { background: var(--surface2); border-radius: var(--radius-sm); padding: 14px 16px; margin-top: 16px; }
.gst-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text2); padding: 4px 0; }
.gst-row.total { font-size: 16px; font-weight: 800; color: var(--maroon); border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; }

/* ═══ LEGACY TABLE WRAPPER (kept for any remaining table use) ═══ */
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
table th { text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .4px; background: var(--surface2); white-space: nowrap; }
table td { padding: 9px 12px; border-bottom: 1px solid var(--border); }
table tfoot td { font-weight: 700; background: var(--surface2); }

/* ═══ UPLOAD AREA ═══ */
.upload-area { border: 2px dashed var(--border); border-radius: var(--radius); padding: 28px; text-align: center; cursor: pointer; transition: all .15s; }
.upload-area:hover { border-color: var(--maroon); background: var(--blush-light); }
.upload-area .uic { width: 32px; height: 32px; margin: 0 auto 8px; color: var(--maroon); }
.upload-area p { color: var(--text2); font-size: 13px; }
.upload-area .hint { font-size: 11px; color: var(--text3); margin-top: 4px; }

/* ═══ WALLET DISPLAY ═══ */
.wallet-display { background: linear-gradient(135deg, var(--maroon) 0%, var(--maroon-dark) 100%); border-radius: var(--radius); padding: 20px; color: #fff; }
.wallet-display .wd-lbl { font-size: 12px; opacity: .8; margin-bottom: 6px; }
.wallet-display .wd-val { font-size: 28px; font-weight: 800; }
.wallet-display .wd-sub { font-size: 11.5px; opacity: .75; margin-top: 4px; }

/* ═══ MEMBERSHIP / PACKAGE CARDS ═══ */
.member-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 18px; box-shadow: var(--shadow); }
.member-card .mc-name { font-size: 14.5px; font-weight: 700; margin-bottom: 3px; }
.member-card .mc-sub { font-size: 12px; color: var(--text3); margin-bottom: 10px; }
.member-card .mc-bar-wrap { background: var(--surface2); border-radius: 4px; height: 8px; overflow: hidden; margin: 6px 0; }
.member-card .mc-bar { height: 100%; border-radius: 4px; transition: width .6s; }
.member-card .mc-bar.green { background: var(--green); }
.member-card .mc-bar.amber { background: var(--gold); }
.member-card .mc-bar.red   { background: var(--red);  }
.members-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; margin-top: 4px; }

/* ═══ BAR CHART (legacy fallback) ═══ */
.bar-chart { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: flex; align-items: center; gap: 8px; }
.bar-lbl { width: 115px; font-size: 12px; color: var(--text2); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.bar-track { flex: 1; height: 20px; background: var(--surface2); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; transition: width .6s ease; display: flex; align-items: center; padding-left: 6px; }
.bar-fill span { font-size: 10px; color: #fff; font-weight: 600; white-space: nowrap; }
.bar-val { width: 80px; font-size: 11.5px; color: var(--text2); font-weight: 600; }

/* ═══ PAGES (shown/hidden by JS) ═══ */
.page { display: none; }
.page.active { display: block; }

/* ═══ TODAY'S APPOINTMENTS STRIP (billing page) ═══ */
.appt-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.appt-strip-card {
  flex-shrink: 0; min-width: 168px; max-width: 200px; background: var(--blush-light);
  border: 1.5px solid var(--blush); border-radius: var(--radius-sm); padding: 10px 12px;
  cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.appt-strip-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--maroon); }
.appt-strip-time { font-size: 11px; font-weight: 700; color: var(--maroon); margin-bottom: 3px; }
.appt-strip-name { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.appt-strip-items { font-size: 11px; color: var(--text2); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ═══ APPOINTMENT TIME-SLOT PICKER (counter booking + public page) ═══ */
.bk-time-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin-bottom: 16px; }
.bk-time-slot { text-align: center; padding: 9px 4px; border-radius: 9px; border: 1.5px solid var(--border); cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text2); transition: all .15s; }
.bk-time-slot:hover { border-color: var(--gold); }
.bk-time-slot.selected { background: var(--maroon); color: #fff; border-color: var(--maroon); }

/* ═══ APPOINTMENT ITEM ROW (counter booking form) ═══ */
.appt-svc-row { display: grid; grid-template-columns: 1fr 32px; gap: 8px; align-items: center; border-bottom: 1px solid var(--border); padding: 6px 0; }
.appt-svc-row select { border: 1px solid var(--border); border-radius: 6px; padding: 8px; font-size: 13px; width: 100%; }

/* ═══════════════════════════════════════════════
   POS BILLING LAYOUT — fixed-height 3 column (client 20% | services 50% | cart ~26% within content,
   sidebar nav rail accounts for the remaining ~10% of full window width)
   ═══════════════════════════════════════════════ */
.pos-top-strip { flex-shrink: 0; }
.pos-grid {
  display: grid; grid-template-columns: minmax(0,24%) minmax(0,1fr) minmax(0,26%); gap: 14px;
  flex: 1; min-height: 0; min-width: 0; align-items: stretch; overflow: hidden;
}
@media (max-width: 1200px) { .pos-grid { grid-template-columns: minmax(0,230px) minmax(0,1fr) minmax(0,300px); } }
@media (max-width: 980px)  { .pos-grid { grid-template-columns: minmax(0,1fr); height: auto; overflow: visible; } }

/* ── Column 1: Client Info ── */
.pos-col-client { display: flex; flex-direction: column; gap: 14px; min-height: 0; min-width: 0; overflow-y: auto; }
.pos-client-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.pos-client-card h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text2); margin: 0 0 10px; display: flex; align-items: center; gap: 6px; }
.pos-client-card h4 .i { color: var(--maroon); width: 14px; height: 14px; }
.pos-client-name { font-size: 16px; font-weight: 800; color: var(--text); margin-bottom: 2px; }
.pos-client-meta { font-size: 12px; color: var(--text3); display: flex; align-items: center; gap: 5px; margin-top: 4px; }
.pos-client-meta .i { width: 13px; height: 13px; color: var(--text3); }
.pos-client-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.pos-client-stat { text-align: center; }
.pos-client-stat .v { font-size: 15px; font-weight: 800; color: var(--maroon); }
.pos-client-stat .l { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .3px; margin-top: 1px; }
.pos-membership-row { display: flex; align-items: center; justify-content: space-between; background: var(--blush-light); border-radius: var(--radius-sm); padding: 9px 11px; margin-top: 10px; }
.pos-membership-row .nm { font-size: 12.5px; font-weight: 700; color: var(--maroon); }
.pos-membership-row .sub { font-size: 10.5px; color: var(--text2); margin-top: 1px; }
.pos-membership-row .pct { font-size: 16px; font-weight: 800; color: var(--maroon); }
.pos-empty-client { text-align: center; padding: 18px 8px; color: var(--text3); font-size: 12.5px; }
.pos-empty-client .i { width: 30px; height: 30px; margin: 0 auto 8px; color: var(--border); }

/* ── Column 2: Service Search + Grid (the ONLY scrolling region) ── */
.pos-col-services { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.pos-search-wrap { position: relative; margin-bottom: 10px; flex-shrink: 0; }
.pos-search-wrap input { width: 100%; padding: 11px 14px 11px 38px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 14px; }
.pos-search-wrap input:focus { outline: none; border-color: var(--maroon); }
.pos-search-wrap .i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text3); width: 16px; height: 16px; }
.pos-cat-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; flex-shrink: 0; }
.pos-cat-pill {
  display: inline-flex; align-items: center;
  padding: 5px 12px; border-radius: 20px; border: 1.5px solid var(--border); cursor: pointer;
  background: var(--surface); transition: all .15s;
}
.pos-cat-pill .i { display: none; }
.pos-cat-pill span.lbl { font-size: 12px; font-weight: 600; color: var(--text2); white-space: nowrap; }
.pos-cat-pill:hover { border-color: var(--gold); }
.pos-cat-pill.active { background: var(--maroon); border-color: var(--maroon); }
.pos-cat-pill.active span.lbl { color: #fff; }
.pos-section-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--text); margin: 4px 0 10px; }
.pos-section-label .i { color: var(--gold); width: 15px; height: 15px; }
.pos-svc-scroll { flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; }
.pos-svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.pos-svc-card {
  position: relative; background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px;
  padding: 13px 10px; cursor: pointer; transition: all .15s; text-align: center;
}
.pos-svc-card:hover { border-color: var(--gold); box-shadow: var(--shadow); }
.pos-svc-card.in-cart { border-color: var(--maroon); background: var(--blush-light); }
.pos-svc-card .star-badge { position: absolute; top: 8px; right: 8px; width: 16px; height: 16px; color: var(--gold); }
.pos-svc-card .nm { font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.25; margin-bottom: 5px; min-height: 33px; display: flex; align-items: center; justify-content: center; }
.pos-svc-card .pr { font-size: 14px; font-weight: 800; color: var(--maroon); }
.pos-svc-card .cart-qty { position: absolute; top: -7px; right: -7px; background: var(--maroon); color: #fff; font-size: 11px; font-weight: 800; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); }
.pos-add-custom { border: 1.5px dashed var(--border); border-radius: 12px; padding: 12px; text-align: center; color: var(--maroon); font-size: 13px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 8px; flex-shrink: 0; }
.pos-add-custom:hover { background: var(--blush-light); border-color: var(--maroon); }
.pos-hint { text-align: center; font-size: 11.5px; color: var(--text3); padding: 4px 0; flex-shrink: 0; }

/* ── Column 3: Current Bill / Cart (fully visible, no scroll needed at normal item counts; cart-body itself scrolls if it overflows) ── */
.pos-cart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; min-height: 0; min-width: 0; height: 100%; }
.pos-cart-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.pos-cart-head h3 { font-size: 14px; font-weight: 800; color: var(--text); margin: 0; display: flex; align-items: center; gap: 7px; }
.pos-cart-head h3 .i { color: var(--maroon); width: 16px; height: 16px; }
.pos-cart-head .clear-link { font-size: 11.5px; color: var(--red); font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 4px; }
.pos-cart-body { padding: 10px 16px; overflow-y: auto; flex: 1; min-height: 60px; }
.pos-cart-item { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.pos-cart-item:last-child { border-bottom: none; }
.pos-cart-item .info { flex: 1; min-width: 0; }
.pos-cart-item .nm-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.pos-cart-item .nm { font-size: 12.5px; font-weight: 700; color: var(--text); }
.pos-cart-item .amt-input { width: 72px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 12.5px; font-weight: 700; text-align: right; color: var(--text); }
.pos-cart-item .amt-input:focus { outline: none; border-color: var(--maroon); }
.pos-cart-item select.tech-sel { font-size: 11.5px; color: var(--text3); border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; margin-top: 4px; max-width: 140px; }
.pos-cart-item .qty-row { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.pos-cart-item .qty-btn { width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface2); display: flex; align-items: center; justify-content: center; cursor: pointer; font-weight: 700; color: var(--text2); }
.pos-cart-item .qty-val { font-size: 12px; font-weight: 700; min-width: 14px; text-align: center; }
.pos-cart-item .del-icon { color: var(--red); cursor: pointer; display: flex; margin-left: auto; }
.pos-cart-empty { text-align: center; padding: 24px 10px; color: var(--text3); font-size: 12.5px; }
.pos-cart-empty .i { width: 30px; height: 30px; margin: 0 auto 8px; color: var(--border); }
.pos-summary { padding: 8px 16px 10px; flex-shrink: 0; border-top: 1px solid var(--border); }
.pos-summary-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text2); padding: 4px 0; }
.pos-summary-row.disc { color: var(--green); }
.pos-summary-row.cashback { color: var(--maroon); }
.pos-summary-row.total { font-size: 16px; font-weight: 800; color: var(--text); border-top: 1.5px solid var(--border); margin-top: 5px; padding-top: 8px; }
.pos-summary-row.total .v { color: var(--maroon); }
.pos-cashback-input { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; }
.pos-cashback-input label { font-size: 12.5px; color: var(--text2); display: flex; align-items: center; gap: 5px; }
.pos-cashback-input label .i { width: 13px; height: 13px; color: var(--maroon); }
.pos-cashback-input input { width: 90px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 7px; font-size: 12.5px; text-align: right; }
.pos-payreact-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 16px 10px; flex-shrink: 0; }
.pos-payreact-row .fg { margin: 0; }
.pos-payreact-row label { font-size: 10.5px; }
.pos-meta-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text3); flex-shrink: 0; }
.pos-meta-row .seg { display: flex; align-items: center; gap: 5px; }
.pos-meta-row .i { width: 13px; height: 13px; }
.pos-checkout-actions { padding: 10px 16px 14px; flex-shrink: 0; }
.pos-checkout-actions .btn-primary { width: 100%; justify-content: center; padding: 12px; font-size: 14px; margin-bottom: 8px; }
.pos-checkout-actions .row2 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.pos-checkout-actions .row2 .btn { justify-content: center; }
.billing-draft-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #fff8e1; border-bottom: 1px solid #f59e0b; flex-wrap: wrap; }
.draft-bar-label { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--text2); white-space: nowrap; }
.draft-chip { display: inline-flex; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; font-size: 12px; overflow: hidden; }
.draft-chip span { padding: 4px 10px; cursor: pointer; font-weight: 600; color: var(--text); }
.draft-chip span:hover { background: var(--hover); }
.draft-chip button { border: none; background: none; padding: 4px 8px; cursor: pointer; color: var(--text3); display: flex; align-items: center; border-left: 1px solid var(--border); }
.draft-chip button:hover { background: #fee2e2; color: var(--red); }

/* ── Product grid variant (uses same .pos-svc-card pattern) ── */
.pos-prod-card .stock-tag { font-size: 10px; color: var(--text3); margin-top: 2px; }
.pos-prod-card.out-of-stock { opacity: .5; pointer-events: none; }

/* ── Collapsible Today's Appointments strip ── */
.pos-appt-collapsed .card-body { display: none; }
.pos-appt-toggle { cursor: pointer; }
#apptStripChevron { transition: transform .15s; transform: rotate(-90deg); }
.pos-appt-collapsed #apptStripChevron { transform: rotate(0deg); }

/* ═══ BILL HISTORY — LIST VIEW ═══ */
.hist-list { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.hist-list-head {
  display: grid; grid-template-columns: 32px 80px 70px 140px 1fr 80px 70px 110px;
  background: var(--surface2); padding: 8px 12px; gap: 8px; align-items: center;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text2);
}
.hist-list-row {
  display: grid; grid-template-columns: 32px 80px 70px 140px 1fr 80px 70px 110px;
  padding: 9px 12px; gap: 8px; align-items: center; font-size: 12.5px;
  border-top: 1px solid var(--border); background: var(--surface); transition: background .1s;
}
.hist-list-row:hover { background: var(--surface2); }
.hist-row-sel { background: var(--blush-light) !important; }
.hist-cb-wrap { display: flex; align-items: center; justify-content: center; }
.hist-col-date { color: var(--text3); white-space: nowrap; }
.hist-col-client { line-height: 1.3; }
.hist-col-svc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text2); font-size: 12px; }
@media (max-width: 1100px) {
  .hist-list-head, .hist-list-row { grid-template-columns: 32px 75px 65px 120px 1fr 70px 65px 90px; }
}

/* ══════════════════════════════════════════════════════════════
   CALENDAR VIEWS  (Daily · Weekly · Monthly)
   ══════════════════════════════════════════════════════════════ */

/* ── Container ── */
.cal-container {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

/* ── Toolbar (nav + label + view toggle) ── */
.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}
.cal-nav-group {
  display: flex;
  gap: 5px;
  align-items: center;
}
.cal-nav-btn { padding: 5px 10px !important; }
.cal-view-label {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  min-width: 120px;
}
.cal-view-toggle {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.cal-vbtn {
  padding: 5px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text2);
  background: var(--surface);
  border: none;
  cursor: pointer;
  transition: background .12s, color .12s;
  font-family: var(--font);
  border-right: 1px solid var(--border);
}
.cal-vbtn:last-child { border-right: none; }
.cal-vbtn:hover { background: var(--surface2); }
.cal-vbtn.active { background: var(--maroon); color: #fff; }

/* ── Today highlight shared ── */
.cal-today-num {
  background: var(--maroon) !important;
  color: #fff !important;
  border-radius: 50% !important;
}

/* ══ DAILY VIEW ══ */
.cal-daily-wrap {
  display: flex;
  overflow: auto;
  max-height: 600px;
  border: 1px solid var(--border);
  border-radius: 10px;
  -webkit-overflow-scrolling: touch;
}
.cal-time-axis {
  flex-shrink: 0;
  width: 52px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  left: 0;
  z-index: 2;
}
.cal-time-row {
  border-top: 1px solid var(--border);
  padding-left: 6px;
}
.cal-cols-scroll {
  display: flex;
  flex: 1;
  gap: 0;
  min-width: 0;
}
.cal-staff-col {
  flex: 0 0 160px;
  min-width: 140px;
  border-right: 1px solid var(--border);
}
.cal-staff-col:last-child { border-right: none; }
.cal-staff-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  min-height: 56px;
  position: sticky;
  top: 0;
  z-index: 1;
}
.cal-staff-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blush-light);
  color: var(--maroon);
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cal-staff-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-staff-count {
  font-size: 10.5px;
  color: var(--text3);
}
.cal-col-body { position: relative; }
.cal-slot-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
}
.cal-appt-block {
  position: absolute;
  left: 4px;
  right: 4px;
  border-radius: 6px;
  padding: 4px 7px;
  cursor: pointer;
  overflow: hidden;
  transition: box-shadow .12s, opacity .12s;
  z-index: 1;
}
.cal-appt-block:hover {
  box-shadow: 0 2px 10px rgba(93,0,29,.18);
  opacity: .93;
  z-index: 2;
}
.cal-appt-time {
  font-size: 10px;
  font-weight: 700;
  margin-bottom: 1px;
  opacity: .8;
}
.cal-appt-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-appt-svc {
  font-size: 10.5px;
  opacity: .75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* ══ WEEKLY VIEW ══ */
.cal-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-top: 1px solid var(--border);
  min-height: 300px;
}
.cal-week-col {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.cal-week-col:last-child { border-right: none; }
.cal-week-today { background: var(--blush-light); }
.cal-week-head {
  text-align: center;
  padding: 8px 4px 6px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  background: var(--surface2);
  transition: background .12s;
}
.cal-week-head:hover { background: var(--blush-light); }
.cal-week-dow {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text3);
}
.cal-week-num {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2px auto;
}
.cal-week-mon {
  font-size: 10px;
  color: var(--text3);
}
.cal-week-body {
  flex: 1;
  padding: 5px 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  max-height: 280px;
}
.cal-week-chip {
  border-radius: 5px;
  padding: 3px 6px;
  cursor: pointer;
  transition: opacity .12s;
  overflow: hidden;
}
.cal-week-chip:hover { opacity: .82; }
.cal-week-chip-time {
  font-size: 9.5px;
  font-weight: 700;
  display: block;
  margin-bottom: 1px;
}
.cal-week-chip-name {
  font-size: 11px;
  font-weight: 600;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-week-empty {
  color: var(--text3);
  font-size: 12px;
  text-align: center;
  padding: 16px 0;
}

/* ══ MONTHLY VIEW ══ */
.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-month-header {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  padding: 8px 4px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.cal-month-cell {
  min-height: 72px;
  padding: 5px 6px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
  vertical-align: top;
}
.cal-month-cell:nth-child(7n) { border-right: none; }
.cal-month-cell:hover { background: var(--blush-light); }
.cal-month-out {
  background: var(--surface2);
  opacity: .45;
  cursor: default;
}
.cal-month-out:hover { background: var(--surface2); }
.cal-month-today { background: var(--blush-light); }
.cal-month-day-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  border-radius: 50%;
}
.cal-month-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
}
.cal-month-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cal-month-more {
  font-size: 9.5px;
  color: var(--text3);
  font-weight: 700;
}

/* ── Appointment detail popup ── */
.cal-detail-popup {
  margin-top: 14px;
  border: 2px solid var(--maroon);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.cal-detail-inner {
  padding: 14px 16px;
}

/* ── Client Profiles grid ── */
.cp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.cp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cp-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); transform: translateY(-2px); }
.cp-card-incomplete { border-left: 3px solid var(--gold); }
.cp-card-atrisk     { border-left: 3px solid #dc2626; background: #fffaf9; }
.cp-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: #fff;
  background: var(--maroon);
  flex-shrink: 0;
}
.cp-avatar.female { background: #be185d; }
.cp-avatar.male   { background: #1d4ed8; }
.cp-avatar.other  { background: #6d28d9; }
.cp-info { flex: 1; min-width: 0; }
.cp-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cp-mob {
  font-size: 12px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.cp-meta {
  font-size: 11px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.cp-stats {
  display: flex;
  gap: 10px;
}
.cp-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  background: var(--surface2);
  border-radius: 6px;
  padding: 6px 4px;
}
.cp-stat .v { font-size: 14px; font-weight: 700; color: var(--maroon); }
.cp-stat .l { font-size: 10px; color: var(--text3); margin-top: 1px; }
.cp-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.cp-gender-pill {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
  background: var(--surface2);
  color: var(--text2);
}
.cp-gender-pill.female { background: #fce7f3; color: #9d174d; }
.cp-gender-pill.male   { background: #dbeafe; color: #1e40af; }

/* ── AI Chat Panel ── */
.ai-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1200;
  background: linear-gradient(135deg, var(--maroon,#6d2b4e), #C4819A);
  color: #fff;
  border: none;
  border-radius: 28px;
  padding: 0 18px;
  height: 48px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(109,43,78,0.45);
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.3px;
}
.ai-fab:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(109,43,78,0.55); }

.ai-chat-panel {
  position: fixed;
  bottom: 82px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 100px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  z-index: 1199;
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.ai-chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  background: linear-gradient(135deg, var(--maroon,#6d2b4e) 0%, #C4819A 100%);
}
.ai-header-left { display: flex; align-items: center; gap: 10px; }
.ai-avatar {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.ai-title  { color: #fff; font-weight: 700; font-size: 15px; }
.ai-sub    { color: rgba(255,255,255,0.7); font-size: 11px; }
.ai-close  { background: rgba(255,255,255,0.15); border: none; color: #fff; cursor: pointer;
             border-radius: 50%; width: 28px; height: 28px; font-size: 12px;
             display: flex; align-items: center; justify-content: center; }
.ai-close:hover { background: rgba(255,255,255,0.3); }

.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-msg {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
}
.ai-msg-user {
  align-self: flex-end;
  background: var(--maroon,#6d2b4e);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-msg-assistant {
  align-self: flex-start;
  background: var(--surface2);
  color: var(--text1);
  border-bottom-left-radius: 4px;
}
.ai-msg-assistant ul { margin: 6px 0 0 14px; padding: 0; }
.ai-msg-assistant li { margin-bottom: 3px; }
.ai-msg-assistant strong { color: var(--maroon,#6d2b4e); }

.ai-loading { min-width: 52px; }
.ai-dots { display: inline-flex; gap: 4px; align-items: center; height: 20px; }
.ai-dots span {
  width: 6px; height: 6px;
  background: var(--text3);
  border-radius: 50%;
  animation: ai-bounce 1.2s infinite;
}
.ai-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ai-bounce {
  0%,60%,100% { transform: translateY(0); opacity: 0.5; }
  30%          { transform: translateY(-5px); opacity: 1; }
}

.ai-quick-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  scrollbar-width: none;
}
.ai-quick-scroll::-webkit-scrollbar { display: none; }
.ai-quick-btn {
  flex-shrink: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 5px 12px;
  font-size: 11px;
  color: var(--text2);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.ai-quick-btn:hover { background: var(--maroon,#6d2b4e); color: #fff; border-color: var(--maroon,#6d2b4e); }

.ai-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px 14px;
  border-top: 1px solid var(--border);
}
.ai-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text1);
  outline: none;
}
.ai-input:focus { border-color: var(--maroon,#6d2b4e); }
.ai-send {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--maroon,#6d2b4e);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s;
}
.ai-send:hover { background: #8b3a62; }

@media (max-width: 480px) {
  .ai-chat-panel { right: 8px; bottom: 74px; width: calc(100vw - 16px); }
  .ai-fab { right: 16px; bottom: 16px; }
}

/* ═══ STAFF MODE — full-width mobile-first layout ═══ */
body.staff-mode #sidebar { display: none !important; }
body.staff-mode #main { flex-direction: column; display: flex; height: 100vh; overflow: hidden; }
body.staff-mode #staffTopBar { display: flex !important; }
body.staff-mode #content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
body.staff-mode .page { padding: 16px; max-width: 640px; margin: 0 auto; }

/* Belt-and-suspenders: force-hide nav groups staff must never see */
body.staff-mode .nav-main-item { display: none !important; }

/* Staff top bar */
#staffTopBar {
  display: none;
  background: #6E1A32;
  padding: 12px 16px;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(93,0,29,.28);
}
.stb-left { display: flex; align-items: center; gap: 10px; }
.stb-initials {
  width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255,255,255,.22);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.stb-name { color: #fff; font-size: 14px; font-weight: 700; line-height: 1.2; }
.stb-role { color: #F7D9A6; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stb-logout {
  background: rgba(255,255,255,.15); color: #fff;
  border: 1px solid rgba(255,255,255,.3); border-radius: 8px;
  padding: 7px 14px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.stb-logout:hover { background: rgba(255,255,255,.28); }
