/* Admin dashboard */
:root {
  --ink: #0a0f1c; --bg: #f4f6fa; --surface: #fff; --line: #e4e8f0; --text: #0a0f1c; --muted: #5b6579;
  --brand: #2563eb; --brand-soft: #e8f0ff; --green: #0f9d58; --green-soft: #e7f7ee; --amber: #b7791f; --amber-soft: #fff4dc;
  --red: #dc2626; --red-soft: #fdecec; --gold: #f5b301;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
svg { display: inline-block; vertical-align: -0.2em; flex: none; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; line-height: 1.2; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #c2cbe0; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #1d4fd7; border-color: #1d4fd7; }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-danger { color: var(--red); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.input { width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; font-size: 15px; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
textarea.input { min-height: 80px; resize: vertical; }
label.lbl { display: block; font-weight: 700; font-size: 13px; margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.alert-warn { background: var(--amber-soft); color: #7a4f00; }
.alert-error { background: var(--red-soft); color: #9b1c1c; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--ink); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 20px; padding: 32px; }

/* layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #fff; padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; padding: 4px 8px 22px; }
.brand small { display: block; font-size: 11px; opacity: .55; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.side nav { display: grid; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: rgba(255, 255, 255, .7); font-weight: 600; }
.side nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side nav a.active { background: rgba(37, 99, 235, .22); color: #fff; }
.side .bottom { margin-top: auto; display: grid; gap: 4px; }
.side .bottom a, .side .bottom button { color: rgba(255, 255, 255, .6); background: none; border: 0; text-align: left; padding: 8px 12px; cursor: pointer; font-size: 14px; }
.main { padding: 26px 32px 60px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { font-size: 26px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.card h3 { font-size: 16px; margin-bottom: 14px; }
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi .val { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.kpis-4 { grid-template-columns: repeat(4, 1fr); }
.code { font-family: ui-monospace, Menlo, monospace; letter-spacing: .03em; white-space: nowrap; }
.code-input { text-transform: uppercase; font-size: 17px; letter-spacing: .04em; }
.code-input::placeholder { text-transform: none; letter-spacing: 0; }
.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }

/* bar chart */
.bars { display: flex; align-items: flex-end; gap: 2px; height: 180px; padding-top: 10px; border-bottom: 1px solid var(--line); position: relative; }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; cursor: default; }
.bar-col .bar { width: 70%; max-width: 44px; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; transition: opacity .15s; }
.bars:hover .bar { opacity: .45; }
.bars .bar-col:hover .bar { opacity: 1; }
.bar-col .tip { position: absolute; bottom: calc(100% - 4px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 6px 9px; border-radius: 8px; font-size: 12px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 2; }
.bar-col:hover .tip { opacity: 1; }
.bar-labels { display: flex; gap: 2px; margin-top: 6px; }
.bar-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); }

/* lists / tables */
.list-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .input { width: auto; }
.seg { display: inline-flex; background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; font-weight: 700; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--ink); color: #fff; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: #f8faff; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.status { display: inline-block; font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.s-confirmed { background: var(--brand-soft); color: var(--brand); }
.s-in_progress { background: var(--amber-soft); color: var(--amber); }
.s-completed { background: var(--green-soft); color: var(--green); }
.s-cancelled, .s-no_show { background: #eef0f4; color: var(--muted); }
.tag { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 6px; background: #eef0f4; color: var(--muted); }
.tag-gold { background: #fff4d0; color: #7a5a00; }
.empty { padding: 36px; text-align: center; color: var(--muted); }

/* day view */
.day-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.timeline { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.tl-hour { height: 64px; border-bottom: 1px solid var(--line); display: flex; }
.tl-hour span { width: 64px; flex: none; font-size: 12px; color: var(--muted); padding: 6px 10px; border-right: 1px solid var(--line); }
.tl-block { position: absolute; left: 72px; right: 10px; border-radius: 10px; padding: 7px 11px; font-size: 13px; cursor: pointer; overflow: hidden; border-left: 4px solid var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 2px #fff; }
.tl-block.completed { border-left-color: var(--green); background: var(--green-soft); }
.tl-block.in_progress { border-left-color: var(--amber); background: var(--amber-soft); }
.tl-block b { display: block; }
.tl-now { position: absolute; left: 64px; right: 0; height: 2px; background: var(--red); z-index: 3; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 15, 28, .5); display: flex; justify-content: flex-end; z-index: 100; }
.modal { background: #fff; width: 100%; max-width: 560px; height: 100%; overflow-y: auto; padding: 26px; animation: slide .2s ease; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 18px; }
.modal-head h2 { font-size: 22px; }
.x { border: 0; background: var(--bg); width: 36px; height: 36px; border-radius: 10px; cursor: pointer; font-size: 20px; flex: none; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; font-size: 14px; margin-bottom: 18px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.section-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }
.box { background: var(--bg); border-radius: 12px; padding: 14px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 200; opacity: 0; transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.hours-row { display: grid; grid-template-columns: 100px 1fr 1fr 90px; gap: 8px; align-items: center; margin-bottom: 8px; }
.edit-table td, .edit-table th { padding: 6px; border: 0; background: none; }
.edit-table .input { padding: 7px 9px; font-size: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 13px; font-weight: 600; margin: 0 6px 6px 0; }
.chip button { border: 0; background: #fff; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; line-height: 1; }
.mobile-tabs { display: none; }
.m-only { display: none; }

@media (max-width: 1100px) { .kpis-4 { grid-template-columns: repeat(2, 1fr); } .kpis { grid-template-columns: repeat(3, 1fr); } .dash-grid, .settings-grid { grid-template-columns: 1fr; } }
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 18px 14px 96px; }
  .kpis, .kpis-4 { grid-template-columns: 1fr 1fr; }
  .mobile-tabs a { font-size: 10px; min-width: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .mobile-tabs { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--ink); z-index: 50; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .mobile-tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: rgba(255, 255, 255, .6); font-size: 11px; font-weight: 700; padding: 6px 0; }
  .mobile-tabs a.active { color: #fff; }
  .hide-m { display: none; }
  .m-only { display: inline-flex; }
  .hours-row { grid-template-columns: 1fr 1fr 1fr; }
  .hours-row > :first-child { grid-column: 1 / -1; }
  .kv { grid-template-columns: 110px 1fr; }
}

/* QR scan + phone checkout */
.alert-ok { background: var(--green-soft); color: #0b6b3c; }
.scan-wrap { max-width: 560px; margin: 0 auto; }
.scan-cam { position: relative; background: #000; border-radius: 18px; overflow: hidden; aspect-ratio: 3 / 4; max-height: 62vh; width: 100%; }
.scan-cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-cam-wide { aspect-ratio: 4 / 3; }
.scan-cam-wide .scan-frame { inset: 30% 8%; }
.scan-cam.off { aspect-ratio: auto; min-height: 140px; display: grid; place-items: center; }
.scan-cam.off video, .scan-cam.off .scan-frame { display: none; }
.scan-frame { position: absolute; inset: 18% 14%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); pointer-events: none; }
.scan-msg { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 16px; color: #fff; font-weight: 700; text-align: center; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); }
.scan-cam.off .scan-msg { position: static; background: none; font-weight: 600; padding: 20px; }
.checkout { border: 2px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 4px; }
.co-head { font-weight: 800; font-size: 17px; margin-bottom: 10px; }
.addon-picks, .pay-picks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.addon, .pay { border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 12px; font-weight: 600; font-size: 14px; cursor: pointer; text-align: left; min-height: 44px; }
.addon b { color: var(--muted); font-weight: 700; margin-left: 2px; }
.addon.on, .pay.on { border-color: var(--brand); background: var(--brand-soft); color: #1e40af; }
.addon.on b { color: #1e40af; }
.pay { flex: 1; min-width: 0; padding: 10px 6px; text-align: center; }
.co-other { margin: 4px 0 10px; }
.co-other > summary { cursor: pointer; font-weight: 700; font-size: 14px; color: var(--muted); }
.co-lines { background: var(--bg); border-radius: 12px; padding: 10px 14px; margin: 12px 0 4px; }
.co-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 14px; }
.co-row.green span:last-child { color: var(--green); font-weight: 700; }
.co-row.total { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; font-weight: 800; font-size: 17px; }
.co-done { width: 100%; padding: 14px; font-size: 16px; margin-top: 12px; border-radius: 12px; }
.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (max-width: 800px) { .scan-cam { border-radius: 14px; } }
