:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --ink: #1f1d2b;
  --muted: #6b6676;
  --line: #e7e2da;
  --accent: #8a4b2d;
  --accent-ink: #ffffff;
  --accent-soft: #f6ebe3;
  --ok: #1e7a4c;
  --warn: #a45d00;
  --bad: #b42318;
  --shade: #f1eee9;
  --radius: 10px;
  --tap: 44px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
h1 { font-size: 1.45rem; margin: .4rem 0 .8rem; line-height: 1.2; }
h2 { font-size: 1.1rem; margin: 1rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.owe { color: var(--bad); }
.spacer { flex: 1; }

input, select, textarea, button { font: inherit; color: inherit; }
input:where(:not([type=checkbox], [type=color], [type=file])), select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: .5rem .7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
input[type=checkbox] { width: 1.2rem; height: 1.2rem; accent-color: var(--accent); flex: none; }
input[type=color] { width: 4rem; height: var(--tap); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
textarea { resize: vertical; }
:focus-visible { outline: 3px solid #c98b62; outline-offset: 2px; }
label { display: block; font-weight: 600; font-size: .9rem; margin: .7rem 0 .3rem; }
label.check { display: flex; align-items: center; gap: .55rem; font-weight: 500; margin: .5rem 0; }
label.inline { display: inline-flex; align-items: center; gap: .4rem; margin: 0; font-weight: 500; }
label.inline select { width: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: var(--tap); padding: .45rem 1rem;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); cursor: pointer; font-weight: 600;
}
.btn:hover { border-color: #cfc6ba; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); border-color: #f0c9c5; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; padding: .3rem .8rem; font-size: .9rem; }
.btn.big { min-height: 52px; font-size: 1.05rem; padding: .6rem 1.4rem; }
.btn.wide { width: 100%; margin-top: 1rem; }
.btn:disabled { opacity: .55; cursor: progress; }
.link { background: none; border: 0; padding: .2rem 0; color: var(--accent); cursor: pointer; text-decoration: underline; min-height: 32px; }
.link.danger { color: var(--bad); }
.icon-btn { width: 36px; height: 36px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; cursor: pointer; font-size: 1.1rem; line-height: 1; flex: none; }
.icon-btn.danger { color: var(--bad); }

.row { display: flex; gap: .5rem; align-items: center; }
.row > input { flex: 1; }
.row.wrap { flex-wrap: wrap; }
.row.wrap .field { flex: 1 1 140px; }
.stack > * + * { margin-top: .5rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: .8rem 0; }
.two-col { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .two-col { grid-template-columns: 1fr 1fr; } }
.field label { margin-top: .5rem; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: .1rem .45rem; border-radius: 999px; background: #e6f4ec; color: var(--ok); margin-left: .3rem; vertical-align: middle; }
.badge.warn { background: #fdf0dc; color: var(--warn); }
.badge.bad { background: #fde7e5; color: var(--bad); }
.badge.soft { background: var(--shade); color: var(--muted); }
.dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .45rem; vertical-align: middle; }
.empty { color: var(--muted); padding: 1.2rem 0; }
.loading-text { color: var(--muted); padding: 1.2rem 0; }
.error-box { background: #fff6f5; border: 1px solid #f0c9c5; border-radius: var(--radius); padding: 1rem; color: var(--bad); }
.error-box p { margin: .2rem 0 .6rem; }
.warn-box { background: #fff8ec; border: 1px solid #f3d9ad; border-radius: var(--radius); padding: .6rem 1rem; color: var(--warn); }
.warn-box p { margin: .3rem 0; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: .4rem 0; border-bottom: 1px solid var(--line); }

.notice {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 100;
  width: min(560px, calc(100% - 2rem));
  display: flex; gap: .8rem; align-items: flex-start;
  padding: .8rem 1rem; border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.18); font-weight: 500;
}
.notice.error { background: #7a1c13; color: #fff; }
.notice.ok { background: #1d4d36; color: #fff; }
.notice span { flex: 1; }
.notice-close { background: none; border: 0; color: inherit; font-size: 1.4rem; line-height: 1; cursor: pointer; min-width: 32px; min-height: 32px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  padding: .5rem max(1rem, env(safe-area-inset-left));
  background: var(--ink); color: #fff;
}
.brand { font-weight: 800; letter-spacing: .02em; color: #f2c38b; text-decoration: none; font-size: 1.1rem; }
.top-actions { display: flex; align-items: center; gap: .8rem; margin-left: auto; }
.topbar .link { color: #fff; }
.who { font-size: .85rem; opacity: .8; }
.lang-switch { display: inline-flex; border: 1px solid rgba(255,255,255,.35); border-radius: 8px; overflow: hidden; }
.lang-switch button { background: none; border: 0; color: #fff; padding: .3rem .6rem; min-height: 34px; cursor: pointer; font-weight: 700; font-size: .85rem; }
.lang-switch button.on { background: #f2c38b; color: var(--ink); }
.tabs { display: flex; gap: .2rem; overflow-x: auto; scrollbar-width: none; order: 3; width: 100%; }
.tabs a { color: #ddd; text-decoration: none; padding: .45rem .75rem; border-radius: 8px; white-space: nowrap; font-weight: 600; font-size: .95rem; }
.tabs a.on { background: rgba(242,195,139,.18); color: #f2c38b; }
@media (min-width: 1000px) { .tabs { order: 0; width: auto; } }

.client-main { max-width: 560px; margin: 0 auto; padding: 1rem 1rem 6rem; }
.stepper { display: flex; gap: .3rem; list-style: none; padding: 0; margin: .3rem 0 1rem; counter-reset: s; }
.stepper li { flex: 1; font-size: .78rem; color: var(--muted); border-top: 4px solid var(--line); padding-top: .3rem; }
.stepper li.done { border-color: #d8b49c; }
.stepper li.now { border-color: var(--accent); color: var(--ink); font-weight: 700; }
.back { background: none; border: 0; color: var(--accent); cursor: pointer; padding: .3rem 0; min-height: 36px; font-weight: 600; }
.group h2 { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; margin-top: 1.4rem; }
.choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: .15rem;
  width: 100%; text-align: left; margin: .45rem 0; padding: .85rem 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; min-height: 56px;
}
.choice:hover { border-color: #cfc6ba; }
.choice.featured { border: 2px solid var(--accent); background: var(--accent-soft); }
.choice-main { font-weight: 650; }
.choice-sub { color: var(--muted); font-size: .9rem; }
.day-chips { display: flex; gap: .45rem; overflow-x: auto; padding: .2rem 0 .6rem; scroll-snap-type: x proximity; }
.chip {
  flex: none; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center;
  min-width: 64px; padding: .45rem .4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer;
}
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip:disabled { opacity: .45; cursor: not-allowed; }
.chip-wd { font-size: .78rem; text-transform: capitalize; }
.chip-d { font-weight: 700; }
.chip-x { font-size: .7rem; }
.day-title { text-transform: capitalize; }
.slot-group h3 { color: var(--muted); font-size: .85rem; margin: .8rem 0 .3rem; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .45rem; }
.slot { min-height: var(--tap); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-weight: 650; font-variant-numeric: tabular-nums; }
.slot:hover { border-color: var(--accent); color: var(--accent); }
.summary { line-height: 1.6; }
.sum-main { font-weight: 700; font-size: 1.05rem; }
.sum-price { color: var(--muted); }
.done { text-align: center; }
.done .card { text-align: left; }
.big-check { width: 64px; height: 64px; line-height: 64px; margin: 1rem auto .3rem; border-radius: 50%; background: #e6f4ec; color: var(--ok); font-size: 2rem; font-weight: 800; }
.done .stack { display: flex; flex-direction: column; gap: .5rem; }
.booking .btn { margin-top: .6rem; }
.prefs summary { cursor: pointer; font-weight: 650; min-height: 32px; }

.desk-main { padding: .8rem max(1rem, env(safe-area-inset-left)) 6rem; max-width: 1500px; margin: 0 auto; }
.login-wrap { max-width: 440px; margin: 2rem auto; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.toolbar input[type=date], .toolbar input[type=search] { width: auto; min-width: 150px; }
.toolbar h1 { margin: 0 .4rem; }
.day-head { font-size: 1.15rem; text-transform: capitalize; }

.grid-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.grid { display: flex; min-width: min-content; }
.axis-wrap { flex: none; width: 64px; position: sticky; left: 0; background: var(--surface); z-index: 3; border-right: 1px solid var(--line); }
.axis { position: relative; }
.tick { position: absolute; right: 6px; transform: translateY(-50%); font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tick:first-child { transform: none; }
.cols { display: flex; flex: 1; }
.col-wrap { flex: 1 0 150px; border-right: 1px solid var(--line); }
.col-head { height: 40px; display: flex; align-items: center; padding: 0 .5rem; font-weight: 700; font-size: .88rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col { position: relative; cursor: copy; }
.shade { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, var(--shade) 0 6px, #f7f5f1 6px 12px); }
.off-block { position: absolute; left: 0; right: 0; background: #ece7f3; color: #5b4f75; font-size: .75rem; padding: .2rem .4rem; border-top: 2px solid #b9a8d6; }
.hour-line { position: absolute; left: 0; right: 0; border-top: 1px dashed #eee8df; pointer-events: none; }
.now-line { position: absolute; left: 0; right: 0; border-top: 2px solid var(--bad); z-index: 2; pointer-events: none; }
.appt {
  position: absolute; left: 3px; right: 3px; z-index: 1;
  display: flex; flex-direction: column; align-items: flex-start; gap: 0;
  padding: .2rem .4rem; overflow: hidden; text-align: left; cursor: pointer;
  background: #fff7f0; border: 1px solid #ecd9c8; border-left: 5px solid; border-radius: 6px;
  font-size: .78rem; line-height: 1.25;
}
.appt:hover { box-shadow: 0 2px 8px rgba(0,0,0,.12); z-index: 2; }
.appt-time { font-variant-numeric: tabular-nums; color: var(--muted); }
.appt-client { font-weight: 700; }
.appt .badge { margin: .1rem 0 0; }
.appt.short { flex-direction: row; flex-wrap: wrap; column-gap: .35rem; align-content: flex-start; }
.appt.short .appt-svc, .appt.short .badge { display: none; }
.appt.st-arrived { background: #eef8f1; border-color: #bfe2cc; }
.appt.st-started { background: #eef3fd; border-color: #c3d4f5; }
.appt.st-finished { background: #f5f0fd; border-color: #d9c8f3; }
.appt.st-done { background: #f3f3f3; border-color: #ddd; opacity: .8; }
.appt.st-cancelled { background: #fafafa; text-decoration: line-through; opacity: .55; }
.appt.st-no_show { background: repeating-linear-gradient(135deg, #fff1f0 0 6px, #fff 6px 12px); }

.overlay { position: fixed; inset: 0; background: rgba(20,18,28,.45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 14px; width: min(480px, 100%); padding: 1rem 1.2rem 1.2rem; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.modal.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.modal-head h2 { margin: .2rem 0; }
dl.facts { display: grid; grid-template-columns: minmax(0, 40%) minmax(0, 1fr); gap: .3rem 1rem; margin: .5rem 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
.picker .results { display: flex; flex-direction: column; gap: .2rem; margin-top: .3rem; max-height: 220px; overflow-y: auto; }
.picker .result { display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.picker .result:hover { border-color: var(--accent); }
.picker .chosen { display: flex; gap: .8rem; align-items: center; padding: .55rem .7rem; border-radius: 8px; background: var(--accent-soft); }
.picker .row { justify-content: space-between; margin-top: .3rem; }
.new-client { border-left: 3px solid var(--accent-soft); padding-left: .8rem; }

.checkout h1 { margin-top: 0; }
.co-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 900px) { .co-grid { grid-template-columns: minmax(280px, 2fr) 3fr; align-items: start; } .co-left { position: sticky; top: 110px; } }
.co-left, .co-right { margin: 0; }
.seg { display: flex; flex-wrap: wrap; gap: .3rem; margin: .5rem 0; }
.seg button { min-height: 40px; padding: .3rem .8rem; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; cursor: pointer; font-weight: 600; }
.seg button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.seg.small button { min-height: 34px; padding: .2rem .6rem; font-size: .88rem; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .45rem; margin-top: .5rem; max-height: 60vh; overflow-y: auto; }
.item { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; text-align: left; min-height: 60px; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-weight: 600; font-size: .92rem; }
.item:hover, .item:active { border-color: var(--accent); background: var(--accent-soft); }
.item .muted { font-weight: 400; font-size: .82rem; }
.lines { margin: .6rem 0; }
.line { padding: .55rem 0; border-bottom: 1px solid var(--line); }
.line-name { font-weight: 650; margin-bottom: .35rem; }
.line-ctrl { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.line-ctrl select { flex: 1 1 140px; width: auto; }
.qty { display: flex; align-items: center; gap: .4rem; }
.qty span { min-width: 1.4rem; text-align: center; font-weight: 700; }
.money-in { max-width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.row-line { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .35rem 0; flex-wrap: wrap; }
.row-line.sub { padding-left: .8rem; }
.row-line select { width: auto; }
.row-line .row { flex-wrap: nowrap; }
dl.totals { display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; margin: .8rem 0; font-variant-numeric: tabular-nums; }
dl.totals dt { color: var(--muted); }
dl.totals dd { margin: 0; text-align: right; }
dl.totals .grand { color: var(--ink); font-weight: 800; font-size: 1.15rem; border-top: 1px solid var(--line); padding-top: .3rem; }
.payments h3 { margin-top: .4rem; }
.balance { margin: .6rem 0; padding: .55rem .8rem; border-radius: 8px; font-weight: 700; }
.balance.owe { background: #fdf0dc; color: var(--warn); }
.balance.even { background: #e6f4ec; color: var(--ok); }
.balance.over { background: #fde7e5; color: var(--bad); }

.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: .55rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: .82rem; color: var(--muted); font-weight: 700; background: #fbfaf8; }
.table.compact th[scope=row] { font-weight: 500; color: var(--ink); background: none; font-size: 1rem; }
.table tr.total th, .table tr.total td { font-weight: 800; border-top: 2px solid var(--ink); }
.table tr.sub th, .table tr.sub td { color: var(--muted); font-size: .88rem; }
.table .num { text-align: right; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover { background: #fbf7f2; }
.table tr.inactive { opacity: .5; }
@media (max-width: 640px) { .table { display: block; overflow-x: auto; } }

.receipt { max-width: 420px; margin: .8rem auto; }
.receipt header { text-align: center; border-bottom: 1px dashed var(--line); padding-bottom: .5rem; margin-bottom: .5rem; }
.receipt header h2 { margin: 0; }
.r-lines { width: 100%; border-collapse: collapse; }
.r-lines td { padding: .3rem 0; vertical-align: top; }
.receipt footer { text-align: center; margin-top: 1rem; }
.ticket-view .actions { justify-content: center; }

.report { max-width: 860px; margin: 0 auto; }
.report header { border-bottom: 2px solid var(--ink); padding-bottom: .5rem; margin-bottom: .8rem; }
.report h1 { margin-bottom: .2rem; }
.report section { margin: 1rem 0; break-inside: avoid; }
.report .table.compact { max-width: 480px; }
.report .sign { display: flex; flex-wrap: wrap; gap: 2rem; margin-top: 2rem; color: var(--muted); }

.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 .8rem; }
.hours { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 .8rem; }
.hours label { text-transform: capitalize; }

@media (max-width: 600px) {
  .who { display: none; }
  h1 { font-size: 1.25rem; }
  .toolbar h1.day-head { width: 100%; order: -1; margin: 0; }
  .col-wrap { flex-basis: 140px; }
}

@media print {
  @page { margin: 12mm; }
  body { background: #fff; font-size: 12pt; }
  .topbar, .no-print, .notice, #modalRoot, .toolbar { display: none !important; }
  .desk-main { padding: 0; }
  .card { border: 0; padding: 0; }
  .receipt { max-width: 80mm; margin: 0; }
  .table { border: 0; }
  .table th, .table td { padding: .25rem .4rem; }
  a { color: inherit; text-decoration: none; }
}
