:root {
  --brand: #b8893e;
  --accent: var(--brand);
  --accent-ink: #fff;
  --accent-ink: #1a1307;
  --accent-soft: #f6efe3;
  --accent-line: #e0c9a3;
  --accent-dark: #7a5a28;
  --accent-shadow: rgba(184, 137, 62, .38);
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-2: #faf8f5;
  --text: #1d1a17;
  --muted: #6e665e;
  --border: #e6e0d7;
  --ink: #0e0d0b;
  --ink-2: #1f1c17;
  --green: #1e8a4f;  --green-soft: #e4f4ea;
  --amber: #b26b00;  --amber-soft: #fdf1dc;
  --red: #c23a33;    --red-soft: #fbe9e7;
  --blue: #2a62c9;   --blue-soft: #e7eefb;
  --violet: #6a44c4; --violet-soft: #efeafb;
  --gray: #6f7782;   --gray-soft: #eef0f2;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(29 26 23 / 6%), 0 2px 6px rgb(29 26 23 / 4%);
  --shadow-lg: 0 18px 48px rgb(29 26 23 / 22%);
  --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
/* iPhone Safari paints unstyled button text blue and auto-links numbers; keep our colours. */
button, input, select, textarea { color: inherit; font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a[x-apple-data-detectors], a[href^="tel"]:not(.btn) { color: inherit !important; text-decoration: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: .95rem; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.tiny { font-size: .75rem; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.center { text-align: center; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-size: .9rem; font-weight: 600; line-height: 1.2;
  padding: 9px 15px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); border-color: #d6cec2; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(.94); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-soft); border-color: #f1c6c2; }
.btn.danger.solid, .btn.danger.solid:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn.danger.solid:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgb(0 0 0 / 5%); }
.btn.wa { color: #13894a; }
.btn.wa:hover { background: #e6f6ed; border-color: #bde5cd; }
.btn.wa.solid, .btn.wa.solid:hover { background: #19a35a; color: #fff; border-color: #19a35a; }
.btn.wa.solid:hover { filter: brightness(1.08); }
.btn.sm { padding: 6px 11px; font-size: .82rem; border-radius: 9px; }
.btn.lg { padding: 13px 20px; font-size: 1rem; border-radius: 13px; }
.btn.block { width: 100%; }
.btn svg { width: 17px; height: 17px; flex: none; }
.icon-btn { border: 0; background: none; cursor: pointer; font-size: 1.05rem; color: var(--muted); padding: 6px 8px; border-radius: 8px; }
.icon-btn:hover { background: rgb(0 0 0 / 5%); color: var(--text); }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .label { font-size: .8rem; font-weight: 600; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 11px; background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 76px; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); margin: 0; }
input[type=color] { padding: 2px; height: 40px; width: 64px; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: .92rem; }
.check input { margin-top: 3px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.switch-row:last-child { border-bottom: 0; }
.inline-num { display: inline-flex; align-items: center; gap: 8px; }
.inline-num input { width: 84px; text-align: center; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.pill.green { color: var(--green); background: var(--green-soft); }
.pill.amber { color: var(--amber); background: var(--amber-soft); }
.pill.red { color: var(--red); background: var(--red-soft); }
.pill.blue { color: var(--blue); background: var(--blue-soft); }
.pill.violet { color: var(--violet); background: var(--violet-soft); }
.pill.gray { color: var(--gray); background: var(--gray-soft); }
.pill.accent { color: var(--accent); background: var(--accent-soft); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 1rem; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.stars { color: #d9d2c7; letter-spacing: 1px; white-space: nowrap; }
.stars .on { color: #e8a317; }
.stars.lg { font-size: 1.4rem; }

.avatar {
  width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .92rem;
}
.logo-img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }

/* ---------- owner app shell ---------- */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 18px 12px; background: var(--ink); color: #efe8dc;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; }
.brand .avatar { background: var(--accent); color: var(--accent-ink); overflow: hidden; }
.brand strong { display: block; color: #fff; line-height: 1.25; }
.brand small { color: #a99a82; font-size: .76rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: #e2d9c9; font-weight: 500; font-size: .94rem;
}
.nav a svg { width: 19px; height: 19px; opacity: .8; flex: none; }
.nav a:hover { background: var(--ink-2); color: #fff; }
.nav a.active { background: var(--ink-2); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
[dir=rtl] .nav a.active { box-shadow: inset -3px 0 0 var(--accent); }
.nav .badge { margin-inline-start: auto; }
.badge { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .72rem; font-weight: 700; line-height: 20px; text-align: center; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.side-foot .btn { background: transparent; color: #d6c8ae; border-color: #2e2a23; justify-content: flex-start; }
.side-foot .btn:hover { background: var(--ink-2); color: #fff; }
.lang-select { background: #1f1c17; color: #efe8dc; border-color: #2e2a23; padding: 7px 10px; font-size: .85rem; }
.trial { font-size: .76rem; color: #cdbd9f; background: #1f1c17; border-radius: 10px; padding: 8px 10px; }

.main { padding: 24px 28px 70px; min-width: 0; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin-top: 2px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.banner { padding: 11px 16px; border-radius: 12px; margin-bottom: 14px; font-weight: 500; font-size: .92rem; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.banner.warn { background: var(--amber-soft); color: #7a4a00; }
.banner.err { background: var(--red-soft); color: #8d2520; }
.banner.info { background: var(--accent-soft); color: var(--text); border: 1px solid var(--accent-line); }
.banner.good { background: var(--green-soft); color: #145e36; }
.banner a { font-weight: 700; color: inherit; text-decoration: underline; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 14px 16px; }
.kpi .label { display: block; }
.kpi .value { font-size: 1.45rem; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .78rem; color: var(--muted); }
.kpi.accent { background: var(--ink); border-color: var(--ink); color: #fff; }
.kpi.accent .label, .kpi.accent .sub { color: #b3a488; }

.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { font: inherit; font-size: .85rem; font-weight: 600; border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--ink); color: #fff; }

/* ---------- day grid ---------- */
.day-nav { display: flex; align-items: center; gap: 6px; }
.day-nav input { width: auto; padding: 8px 10px; }
.grid-wrap { overflow-x: auto; }
.dgrid { position: relative; display: grid; min-width: 100%; }
.dgrid .times { position: relative; }
.dgrid .times div { position: absolute; inset-inline-end: 8px; font-size: .72rem; color: var(--muted); transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.dgrid .col { position: relative; border-inline-start: 1px solid var(--border); }
.dgrid .col-head { position: sticky; top: 0; z-index: 3; padding: 10px 8px; text-align: center; font-weight: 700; font-size: .9rem; background: var(--surface); border-bottom: 1px solid var(--border); border-inline-start: 1px solid var(--border); }
.dgrid .col-head small { display: block; font-weight: 500; color: var(--muted); font-size: .72rem; }
.slot-line { position: absolute; inset-inline: 0; border-top: 1px solid #f0ebe4; }
.slot-line.hour { border-top-color: #e2dbd1; }
.off { position: absolute; inset-inline: 0; background: repeating-linear-gradient(135deg, #f3f0eb 0 6px, #ece8e1 6px 12px); }
.free-cell { position: absolute; inset-inline: 2px; border-radius: 6px; cursor: pointer; }
.free-cell:hover { background: var(--accent-soft); outline: 1px dashed var(--accent-line); }
.free-cell:hover::after { content: '+'; position: absolute; inset-inline-start: 8px; top: 0; color: var(--accent); font-weight: 700; }
.now-line { position: absolute; inset-inline: 0; border-top: 2px solid var(--red); z-index: 2; pointer-events: none; }
.now-line::before { content: ''; position: absolute; inset-inline-start: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.appt {
  position: absolute; inset-inline: 4px; z-index: 1; overflow: hidden; cursor: pointer;
  border-radius: 9px; padding: 5px 8px; font-size: .78rem; line-height: 1.3;
  background: var(--accent-soft); border: 1px solid var(--accent-line); border-inline-start: 4px solid var(--accent);
  transition: box-shadow .15s, transform .1s;
}
.appt:hover { box-shadow: var(--shadow-lg); z-index: 4; transform: scale(1.01); }
.appt .who { font-weight: 700; font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt .what { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt .flags { position: absolute; top: 4px; inset-inline-end: 6px; display: flex; gap: 2px; font-size: .78rem; }
.appt.att-yes { background: #e8f6ee; border-color: #b9e2c8; border-inline-start-color: var(--green); }
.appt.att-maybe { background: #fdf4e3; border-color: #f1d7a4; border-inline-start-color: var(--amber); }
.appt.att-asked { background: #fff; border-color: #e0d9ce; border-inline-start-color: #b9b0a4; }
.appt.s-done { background: #f1efec; border-color: #e3ded6; border-inline-start-color: #a9a196; opacity: .8; }
.appt.s-noshow { background: var(--red-soft); border-color: #f1c6c2; border-inline-start-color: var(--red); opacity: .85; }
.appt.s-rescheduling { background: var(--violet-soft); border-color: #d5c8f3; border-inline-start-color: var(--violet); border-style: dashed; }

/* list rows (mobile day, customers, messages...) */
.list > .item + .item { border-top: 1px solid var(--border); }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.item.click { cursor: pointer; }
.item.click:hover { background: var(--surface-2); }
.item .main-col { flex: 1; min-width: 0; }
.item .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .meta { display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; font-size: .8rem; color: var(--muted); margin-top: 2px; }
.item .time { width: 58px; flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.item.dim { opacity: .6; }
.alerts { display: grid; gap: 8px; margin-bottom: 14px; }
.alert-link { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.alert-link:hover { border-color: var(--accent-line); }
.alert-link .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }
.alert-link .go { margin-inline-start: auto; color: var(--muted); }
[dir=rtl] .alert-link .go { transform: scaleX(-1); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: start; font-size: .76rem; font-weight: 600; color: var(--muted); padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
.progress { height: 7px; border-radius: 99px; background: var(--gray-soft); overflow: hidden; min-width: 60px; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.searchbox { position: relative; flex: 1; max-width: 420px; }
.searchbox input { padding-inline-start: 38px; }
.searchbox svg { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); width: 17px; color: var(--muted); }

.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs button { font: inherit; font-weight: 600; font-size: .9rem; color: var(--muted); background: none; border: 0; padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }

.insight { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.insight:last-child { border-bottom: 0; }
.insight .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; font-size: .95rem; }
.insight.warn .ic { background: var(--amber-soft); }
.insight.good .ic { background: var(--green-soft); }
.insight.idea .ic { background: var(--violet-soft); }
.insight.info .ic { background: var(--blue-soft); }
.ai-box { white-space: pre-wrap; padding: 16px 18px; line-height: 1.7; }

.hours-grid { display: grid; grid-template-columns: 120px auto 1fr; gap: 8px 12px; align-items: center; }
.hours-grid .times-inp { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hours-grid input[type=time] { width: 118px; padding: 8px; }

/* ---------- modal & toast ---------- */
.backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgb(20 17 14 / 50%); animation: fade .15s; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); animation: pop .18s ease; }
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 4px; }
.modal-head h2 { flex: 1; }
.modal-body { padding: 14px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 14px 20px 18px; border-top: 1px solid var(--border); }
.modal-foot .start { margin-inline-end: auto; }
.box { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: .92rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.picker { position: relative; }
.picker-list { position: absolute; inset-inline: 0; top: calc(100% + 4px); z-index: 5; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 250px; overflow-y: auto; }
.picker-list button { display: flex; width: 100%; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 0; background: none; font: inherit; text-align: start; cursor: pointer; }
.picker-list button:hover { background: var(--surface-2); }
.picker-list .new { color: var(--accent); font-weight: 600; border-top: 1px solid var(--border); }
.chosen { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; background: var(--accent-soft); }
.chosen strong { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: .88rem; font-weight: 600; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
#toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { padding: 11px 18px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 500; font-size: .9rem; box-shadow: var(--shadow-lg); animation: pop .2s; }
.toast.err { background: var(--red); }

/* ---------- queue ---------- */
.chairs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.chair { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.chair-now { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--green-soft); }
.next-btn { font-size: 1.15rem; padding: 16px; }
.ticket-no {
  min-width: 46px; height: 46px; padding: 0 8px; border-radius: 14px; flex: none; display: grid; place-items: center;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums;
}
.q-item { flex-wrap: wrap; }
.q-item.called { background: var(--amber-soft); }
.q-item .q-actions { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 600px) { .q-item .q-actions { width: 100%; } .q-item .q-actions .btn { flex: 1; } }

/* ---------- mobile helpers ---------- */
.mob-only { display: none !important; }
.fab {
  position: fixed; inset-inline-end: 18px; bottom: 24px; z-index: 45; width: 60px; height: 60px; border-radius: 20px; border: 0;
  background: var(--accent); color: var(--accent-ink); font-size: 2rem; font-weight: 400; line-height: 1; cursor: pointer;
  box-shadow: 0 10px 26px var(--accent-shadow); transition: transform .15s;
}
.fab:active { transform: scale(.94); }
.sheet-btn { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); font: inherit; font-weight: 600; font-size: 1rem; cursor: pointer; text-align: start; color: var(--text); }
.sheet-btn:hover { background: var(--surface-2); }
.sheet-btn .ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 1.3rem; flex: none; background: var(--accent-soft); }
.sheet-btn small { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; }
.more-list { display: grid; gap: 10px; }
.greet { font-size: .95rem; color: var(--muted); }

@media (min-width: 901px) { .fab { display: none; } }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: auto 0 0 0; height: auto; z-index: 40; flex-direction: row; padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
  }
  .brand, .side-foot, .desk-only { display: none !important; }
  .mob-only { display: flex !important; }
  .fab { bottom: calc(78px + env(safe-area-inset-bottom)); }
  .nav a { min-height: 54px; justify-content: center; }
  .item { padding: 14px 16px; min-height: 64px; }
  .item .time { width: 70px; white-space: nowrap; font-size: .95rem; }
  .kpis { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .kpi { padding: 12px; }
  .kpi .value { font-size: 1.1rem; }
  .kpi .label { font-size: .72rem; }
  .btn { min-height: 42px; }
  .btn.sm { min-height: 36px; }
  .main .page-head h1 { font-size: 1.35rem; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 3px; padding: 6px 2px; font-size: .68rem; flex: 1; text-align: center; }
  .nav a.active, [dir=rtl] .nav a.active { box-shadow: none; }
  .nav a .badge { position: absolute; top: 1px; inset-inline-end: 16%; min-width: 17px; line-height: 17px; font-size: .62rem; }
  .main { padding: 16px 14px 92px; }
  #toasts { bottom: 86px; }
  .hours-grid { grid-template-columns: 1fr auto; }
  .hours-grid .times-inp { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  h1 { font-size: 1.25rem; }
  .backdrop { place-items: end center; padding: 0; }
  .modal, .modal.wide { border-radius: 18px 18px 0 0; max-height: 92vh; }
  .page-head { align-items: flex-start; }
}
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photo-cell { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 6px; }
.photo-cell img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 10px; display: block; margin-bottom: 4px; }

/* =====================================================================
   Modern layer: dark mode, glass, motion, skeletons (works on old phones:
   everything degrades gracefully when a feature is missing)
   ===================================================================== */
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
.btn { border-radius: 12px; }
/* the gradient never gets darker than the brand colour itself, so the text on it stays readable (set per shop colour in ui.js setBrand) */
.btn.primary { background: var(--btn-grad, linear-gradient(135deg, #ecca85, var(--accent))); color: var(--accent-ink); border-color: transparent;
  box-shadow: 0 0 0 1px var(--accent-line), 0 6px 18px var(--accent-shadow), 0 0 28px var(--accent-shadow); transition: box-shadow .2s, filter .2s, transform .1s; }
.btn.primary:hover { filter: brightness(1.07); box-shadow: 0 0 0 1px var(--accent), 0 8px 24px var(--accent-shadow), 0 0 44px var(--accent-shadow); }
.btn.primary.lg, .next-btn, .fab { animation: btnGlow 3s ease-in-out infinite; }
@keyframes btnGlow { 50% { box-shadow: 0 0 0 1px var(--accent), 0 8px 26px var(--accent-shadow), 0 0 48px var(--accent-shadow); } }
@media (prefers-reduced-motion: reduce) { .btn.primary.lg, .next-btn, .fab { animation: none; } }
.btn:active, .sheet-btn:active, .chip:active, .svc:active, .day:active { transform: scale(.97); }
.card { border-radius: 16px; transition: box-shadow .2s, transform .2s; }
.kpi.accent { background: linear-gradient(135deg, var(--ink) 0%, var(--accent-dark) 100%); border: 0; }
.stat-grid .accent { background: linear-gradient(135deg, var(--ink) 0%, var(--accent-dark) 100%) !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* view transitions */
.view-enter > * { animation: viewIn .32s cubic-bezier(.2, .8, .2, 1) both; }
.view-enter > *:nth-child(2) { animation-delay: .04s; }
.view-enter > *:nth-child(3) { animation-delay: .08s; }
.view-enter > *:nth-child(4) { animation-delay: .12s; }
.view-enter > *:nth-child(n+5) { animation-delay: .16s; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { .view-enter > * { animation: none; } html { scroll-behavior: auto; } }

/* skeleton loading */
.skel { border-radius: 14px; background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border: 1px solid var(--border); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* glass bottom bar + bottom sheets on phones */
@media (max-width: 900px) {
  .side { background: rgba(14, 13, 11, .88); -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); border-top: 1px solid rgba(255, 255, 255, .08); }
  .nav a { border-radius: 14px; transition: background .2s, color .2s; }
  .nav a.active { background: rgba(201, 160, 99, .18); color: #fff; }
  .nav a.active svg { color: #e7c47a; opacity: 1; }
  .modal::before { content: ''; display: block; width: 42px; height: 5px; border-radius: 99px; background: var(--border); margin: 10px auto 0; }
  .backdrop { -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
  .modal { animation: sheetUp .28s cubic-bezier(.2, .8, .2, 1); }
  @keyframes sheetUp { from { transform: translateY(40px); opacity: .4; } }
}

/* ---------- dark mode ---------- */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0a09; --surface: #16140f; --surface-2: #1e1b15; --text: #f1ebe0; --muted: #a89a84; --border: #2d2820;
  --ink: #050504; --ink-2: #16140f;
  --green-soft: #12301f; --amber-soft: #3b2c0d; --red-soft: #3e1719; --blue-soft: #14233d; --violet-soft: #26194d; --gray-soft: #221f19;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 14px rgb(0 0 0 / 25%);
  --shadow-lg: 0 18px 48px rgb(0 0 0 / 55%);
}
[data-theme="dark"] body { background: var(--bg); }
/* only plain buttons get the dark hover; coloured ones (gold, red, green, black) keep their colour so the text stays readable */
[data-theme="dark"] .btn:not(.primary):not(.solid):not(.dark):hover { background: var(--surface-2); border-color: #4a3f2d; }
[data-theme="dark"] .btn.ghost:hover, [data-theme="dark"] .icon-btn:hover { background: rgb(255 255 255 / 7%); }
[data-theme="dark"] .btn.wa:not(.solid):hover { background: #12301f; border-color: #1f5236; }
[data-theme="dark"] .btn.danger:not(.solid):hover { background: var(--red-soft); border-color: #6b2a2c; }
[data-theme="dark"] .banner.warn { color: #fcd58a; }
[data-theme="dark"] .banner.err { color: #fca5a5; }
[data-theme="dark"] .banner.info { color: var(--text); }
[data-theme="dark"] .banner.good { color: #86efac; }
[data-theme="dark"] .pill.green { color: #6ee7a8; } [data-theme="dark"] .pill.amber { color: #fbbf5a; } [data-theme="dark"] .pill.red { color: #fb8f8f; }
[data-theme="dark"] .pill.blue { color: #8db6ff; } [data-theme="dark"] .pill.violet { color: #c4b1ff; } [data-theme="dark"] .pill.gray { color: #a9b8cd; }
[data-theme="dark"] .off { background: repeating-linear-gradient(135deg, #13110d 0 6px, #0f0e0b 6px 12px); }
[data-theme="dark"] .slot-line { border-top-color: #1d1a14; }
[data-theme="dark"] .slot-line.hour { border-top-color: #2d2820; }
[data-theme="dark"] .appt.att-asked { background: var(--surface-2); border-color: var(--border); }
[data-theme="dark"] .appt.att-yes { background: #12301f; border-color: #1f5236; }
[data-theme="dark"] .appt.att-maybe { background: #3b2c0d; border-color: #6b5218; }
[data-theme="dark"] .appt.s-done { background: #1a1712; border-color: #2d2820; }
[data-theme="dark"] .appt.s-in { background: #12301f; }
[data-theme="dark"] .q-item.called { background: #3b2c0d; }
[data-theme="dark"] .chair-now { background: #12301f; }
[data-theme="dark"] .ticket-no { background: #3a3022; }
[data-theme="dark"] .toast { background: #3a3022; }
[data-theme="dark"] .stars { color: #3a3326; }
[data-theme="dark"] .photo-cell, [data-theme="dark"] .sheet-btn { background: var(--surface); }
[data-theme="dark"] .picker-list button:hover { background: var(--surface-2); }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: #100f0c; }

/* ---------- subscription page ---------- */
.trial { display: block; text-decoration: none; }
.trial.expired { color: var(--red); }
.bill-status { padding: 14px 16px; border-radius: 14px; font-weight: 600; margin-bottom: 14px; border: 1px solid var(--border); background: var(--surface); }
.bill-status.green { border-color: var(--green); background: var(--green-soft); }
.bill-status.amber { border-color: var(--amber); background: var(--amber-soft); }
.bill-status.red { border-color: var(--red); background: var(--red-soft); }
.bill-seg { align-self: flex-start; }
.save-tag { font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); margin-inline-start: 4px; }
.plan-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan-opt { display: flex; flex-direction: column; gap: 4px; text-align: start; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font: inherit; color: inherit; }
.plan-opt.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.plan-opt .pp { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.plan-opt .pp small { font-size: .75rem; font-weight: 500; color: var(--muted); }
.bill-steps { margin: 0; padding-inline-start: 20px; line-height: 1.9; }
.pm-list { display: grid; gap: 10px; }
.pm-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 14px; border: 1px dashed var(--accent-line); background: var(--accent-soft); }
.pm-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.pm-acc { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 1.15rem; font-weight: 700; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.bill-nudge { display: block; margin-bottom: 14px; text-decoration: none; font-weight: 600; }
@media (max-width: 520px) { .plan-opts { grid-template-columns: 1fr; } }

.btn.copied { border-color: var(--green); color: var(--green); }

.link-row { cursor: default; }
.link-row .spacer { min-width: 0; }
.link-row .spacer small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: end; }
.link-acts { display: flex; gap: 6px; flex: none; }

/* phone number with country code */
.phone-field { display: flex; gap: 6px; direction: ltr; }
.phone-field input { flex: 1; min-width: 0; }
.cc-pick { position: relative; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font-weight: 600; font-size: .92rem; cursor: pointer; white-space: nowrap; }
.cc-pick::after { content: '▾'; font-size: .7rem; color: var(--muted); }
.cc-pick select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }

.pm-qr { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.pm-qr-code { width: 210px; height: 210px; padding: 10px; background: #fff; border-radius: 16px; }
.pm-qr-code svg { width: 100%; height: 100%; display: block; }

/* settings: pin the shop on the map */
.loc-map { height: 280px; border-radius: 14px; border: 1px solid var(--border); overflow: hidden; z-index: 0; background: #ece7dd; }
.leaflet-container { direction: ltr; font-family: var(--font); }
.loc-status { min-height: 1.4em; margin: 2px 0; color: var(--muted); }
.loc-status.good { color: var(--green); }
.loc-status.warn { color: var(--amber); }
.loc-status.bad { color: var(--red); }
.pick-pin { background: none; border: 0; }
.pick-pin span { position: absolute; left: 1px; top: 0; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  border: 3px solid #fff; box-shadow: 0 6px 14px rgb(0 0 0 / 35%); font-size: 15px; line-height: 1; }
.pick-pin span::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 1px; border: 7px solid transparent; border-top: 10px solid #fff; }

/* plan limits (team, gallery) and the plan lists on "My subscription" */
.limit-note { margin: 12px 2px 0; color: var(--muted); }
.limit-note.full { color: var(--amber); font-weight: 600; }
.limit-note a { color: var(--accent); font-weight: 700; }
.plan-feats { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: .82rem; text-align: start; }
.plan-feats li { display: flex; gap: 6px; color: var(--text); }
.plan-feats li::before { content: '✓'; color: var(--green); font-weight: 700; }
.plan-feats li.hi { font-weight: 700; }
.plan-feats li.no { color: var(--muted); }
.plan-feats li.no::before { content: '✕'; color: var(--muted); }

/* features that are switched off for now ("coming soon") */
.soon-box { border: 1px dashed var(--border); border-radius: 14px; padding: 6px 12px 10px; margin: 10px 0 0; opacity: .6; min-width: 0; max-width: 100%; }
.soon-box legend { font-weight: 700; font-size: .9rem; padding: 0 6px; display: flex; align-items: center; gap: 8px; }
.soon-banner { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 14px; margin-bottom: 14px; border: 1px dashed var(--accent-line); background: var(--accent-soft); }
.soon-banner b { display: block; }
.soon-banner small { color: var(--muted); }

/* live notices: bell button, notice toasts, the list */
.bell-btn { position: relative; font-size: 1.05rem; padding-inline: 12px; }
.bell-btn .badge { position: absolute; top: -6px; inset-inline-end: -6px; background: var(--red); color: #fff; }
.toast.notice-toast { display: flex; align-items: center; gap: 10px; text-align: start; border: 0; font: inherit; cursor: pointer; max-width: min(460px, calc(100vw - 32px));
  padding: 12px 16px; border-radius: 14px; background: var(--ink-2); color: #fff; box-shadow: var(--shadow-lg); border-inline-start: 4px solid var(--accent); animation: ntIn .3s ease; }
.toast.notice-toast { pointer-events: auto; }
@keyframes ntIn { from { transform: translateY(10px); opacity: 0; } }
.nt-ic { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgb(255 255 255 / 10%); font-size: 1.05rem; }
.nt-sound { align-self: stretch; }
.nt-sound button { flex: 1; }
.nt-push { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.nt-push b { display: block; }
.nt-push small { display: block; color: var(--muted); font-size: .8rem; }
.nt-list { display: flex; flex-direction: column; }
.nt-row { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--border); }
.nt-row .nt-ic { background: var(--surface-2); }
.nt-row small { display: block; color: var(--muted); font-size: .78rem; margin-top: 2px; }
.push-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
