:root {
  --rose-50: #fff6f8; --rose-100: #ffe8ee; --rose-200: #fdd0dd; --rose-300: #f7a8c0; --rose-500: #e0457b; --rose-600: #c9306a; --rose-700: #a52358;
  --ink: #2c1a23; --muted: #7b6670; --line: #f0dbe3; --card: #ffffff; --bg: #fff9fb;
  --ok: #1b8a5a; --ok-bg: #e3f6ec; --warn: #a96a00; --warn-bg: #fff2d6; --bad: #b3261e; --bad-bg: #fde7e5; --info-bg: #eee9fb; --info: #5a3fb3;
  --radius: 16px; --shadow: 0 2px 10px rgba(201, 48, 106, .08);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); min-height: 100vh; }
a { color: var(--rose-600); }
h1 { font-size: 1.6rem; margin: .4em 0 .6em; line-height: 1.2; }
h2 { font-size: 1.15rem; margin: 1.4em 0 .5em; }
h3 { font-size: 1rem; margin: 1em 0 .4em; }
p { margin: .4em 0; }
small, .hint { color: var(--muted); font-size: .85rem; }
.hint { display: block; margin: .3em 0 .6em; }
code { background: var(--rose-50); padding: 1px 5px; border-radius: 6px; font-size: .85em; }
.empty { color: var(--muted); text-align: center; padding: 1.2em .5em; }
.loading::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; border: 2px solid var(--rose-300); border-top-color: var(--rose-600); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* chrome */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; color: var(--rose-600); text-decoration: none; }
.mainnav { display: flex; gap: 4px; margin-left: 8px; }
.mainnav a { padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 600; }
.mainnav a.on { background: var(--rose-100); color: var(--rose-700); }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar .who { color: var(--ink); font-weight: 600; text-decoration: none; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewas-banner { position: sticky; top: 0; z-index: 30; display: flex; gap: 12px; align-items: center; justify-content: center; padding: 8px 12px; background: #ffd94a; color: #4a3a00; font-weight: 600; flex-wrap: wrap; }
.viewas-banner + .topbar { top: 46px; }
.viewas [data-write]:disabled { opacity: .45; cursor: not-allowed; }
.page { max-width: 880px; margin: 0 auto; padding: 8px 16px 110px; }
.page.narrow { max-width: 560px; }
.page.wide { max-width: 1100px; }
@media (max-width: 640px) { .mainnav a { padding: 8px 9px; font-size: .92rem; } .brand span { display: none; } }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--rose-600); color: #fff; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; touch-action: manipulation; }
.btn:hover:not(:disabled) { background: var(--rose-700); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.busy { opacity: .7; }
.btn.ghost { background: transparent; color: var(--rose-700); box-shadow: inset 0 0 0 1.5px var(--rose-300); }
.btn.ghost:hover:not(:disabled) { background: var(--rose-100); }
.btn.danger { background: var(--bad); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.icon-btn { position: relative; min-width: 44px; min-height: 44px; border: 0; background: transparent; border-radius: 50%; font-size: 1.15rem; cursor: pointer; color: inherit; }
.icon-btn:hover { background: var(--rose-100); }
.badge-n { position: absolute; top: 4px; right: 2px; min-width: 18px; padding: 0 4px; border-radius: 9px; background: var(--rose-600); color: #fff; font-size: .7rem; font-weight: 700; line-height: 18px; }
.field { display: block; margin: 0 0 14px; }
.field .lbl { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
input, select, textarea { width: 100%; min-height: 44px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 12px; font: inherit; background: #fff; color: var(--ink); }
input[type=checkbox] { width: 22px; height: 22px; min-height: 0; accent-color: var(--rose-600); flex: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--rose-300); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-weight: 500; cursor: pointer; }
.checklist { display: grid; gap: 2px; max-height: 260px; overflow: auto; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 12px; }
.row { display: flex; gap: 10px; align-items: center; margin: 10px 0; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }
.row.wrap { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 560px) { .grid3 { grid-template-columns: 1fr; } }
.cards3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 10px 0; }
.toolbar > * { margin: 0; }
.toolbar input, .toolbar select { width: auto; flex: 1 1 140px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chips input[type=date], .chips select { width: auto; }
.chip-btn { min-height: 38px; padding: 0 14px; border: 1.5px solid var(--rose-300); border-radius: 999px; background: #fff; color: var(--rose-700); font: inherit; font-weight: 600; cursor: pointer; }
.chip-btn.on { background: var(--rose-600); color: #fff; border-color: var(--rose-600); }
.chip { background: var(--rose-100); color: var(--rose-700); padding: 4px 12px; border-radius: 999px; font-weight: 600; font-size: .9rem; }
.branchsel { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.branchsel select { width: auto; min-width: 180px; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 12px; box-shadow: var(--shadow); }
.card h3 { margin-top: 0; }
.card.note { background: var(--warn-bg); border-color: transparent; }
.card.error-card { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.card.inactive { opacity: .6; }
.card.hl { outline: 3px solid var(--rose-300); }
.card.choice { display: block; width: 100%; text-align: left; font: inherit; cursor: pointer; border: 2px solid var(--line); }
.card.choice b { display: block; font-size: 1.1rem; }
.card.choice span, .card.choice small { display: block; color: var(--muted); }
.card.choice.on, .card.choice:hover { border-color: var(--rose-500); }
.card.pick { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 12px 14px; }
.card.pick:has(input:checked) { border-color: var(--rose-500); background: var(--rose-50); }
.pick-main { flex: 1; display: grid; gap: 2px; justify-items: start; }
.price { font-weight: 800; white-space: nowrap; }
.note { font-size: .92rem; }
.note.approval { color: var(--warn); } .note.instant { color: var(--ok); } .note.error { color: var(--bad); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.badge.instant { background: var(--ok-bg); color: var(--ok); }
.badge.approval { background: var(--warn-bg); color: var(--warn); }
.pill { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--info-bg); color: var(--info); white-space: nowrap; }
.pill.confirmed, .pill.approved, .pill.completed, .pill.received, .pill.final, .pill.sent { background: var(--ok-bg); color: var(--ok); }
.pill.pending, .pill.pending_manager, .pill.pending_staff, .pill.draft, .pill.queued { background: var(--warn-bg); color: var(--warn); }
.pill.cancelled, .pill.rejected, .pill.no_show, .pill.disputed, .pill.failed { background: var(--bad-bg); color: var(--bad); }

/* stepper + summary bar */
.stepper { display: flex; gap: 6px; list-style: none; margin: 0 0 14px; padding: 0; }
.stepper li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: .78rem; }
.stepper li span { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--rose-100); font-weight: 700; }
.stepper li.on span, .stepper li.done span { background: var(--rose-600); color: #fff; }
.stepper li.on { color: var(--rose-700); font-weight: 700; }
.stepper em { font-style: normal; }
.lead { font-size: 1.05rem; color: var(--muted); }
.sumbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; align-items: center; gap: 10px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0, 0, 0, .06); justify-content: center; flex-wrap: wrap; }
.sumbar .sum { margin-right: auto; display: grid; }
.sumbar .btn { min-width: 150px; }
.review ul { list-style: none; margin: 8px 0; padding: 0; }
.review li, .plain li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.plain { list-style: none; padding: 0; margin: 6px 0; }
.total { text-align: right; }
.chosen { font-weight: 700; color: var(--rose-700); min-height: 1.5em; }

/* date strip + slots */
.datestrip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.day { flex: none; width: 62px; min-height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; font: inherit; cursor: pointer; scroll-snap-align: center; }
.day b { font-size: 1.25rem; } .day small { font-size: .72rem; }
.day.on { background: var(--rose-600); color: #fff; border-color: var(--rose-600); } .day.on small { color: #ffe0ea; }
.slotgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin: 6px 0; }
.slotgrid .empty { grid-column: 1 / -1; }
.slot { min-height: 46px; border: 1.5px solid var(--rose-300); border-radius: 12px; background: #fff; color: var(--rose-700); font: inherit; font-weight: 700; cursor: pointer; }
.slot.on { background: var(--rose-600); color: #fff; border-color: var(--rose-600); }

/* success + tracking */
.done { text-align: center; }
.done .tick { width: 68px; height: 68px; margin: 12px auto; display: grid; place-items: center; border-radius: 50%; background: var(--ok-bg); color: var(--ok); font-size: 2rem; font-weight: 800; }
.done .tick.wait { background: var(--warn-bg); color: var(--warn); }
.codecard { text-align: center; }
.codecard p, .codecard ul { text-align: left; }
.bigcode { font-size: 2.2rem; font-weight: 900; letter-spacing: .06em; color: var(--rose-600); margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 14px; -webkit-overflow-scrolling: touch; }
.tabs button { flex: none; min-height: 42px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--rose-600); color: #fff; }
.tabs.small button.on { background: var(--rose-100); color: var(--rose-700); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 3px solid var(--rose-200); }
.timeline li { position: relative; padding: 0 0 14px 14px; }
.timeline li::before { content: ""; position: absolute; left: -26px; top: 5px; width: 13px; height: 13px; border-radius: 50%; background: var(--rose-500); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--rose-300); }
.timeline small { display: block; }

/* portal */
.portal-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.portal-top h1 { margin: .3em 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 10px 0 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; box-shadow: var(--shadow); }
.stat b { font-size: 1.35rem; } .bigmoney { font-size: 1.8rem; font-weight: 800; color: var(--rose-600); }
.appt .time { font-size: 1.05rem; }
.day-h { position: sticky; top: 56px; background: var(--bg); padding: 6px 0; margin: 14px 0 6px; font-size: 1rem; color: var(--rose-700); z-index: 2; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin-bottom: 14px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--rose-50); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.ctr, th.ctr { text-align: center; } td.detail { max-width: 340px; word-break: break-word; }
tfoot td { font-weight: 800; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 2px 14px; margin: 8px 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.kv .tot { font-weight: 800; color: var(--ink); border-top: 1px solid var(--line); padding-top: 4px; }
.cartrow { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.cartrow .qty { display: inline-flex; align-items: center; gap: 4px; } .cartrow .pr { display: inline-flex; align-items: center; gap: 4px; } .cartrow .pr input { width: 100px; }
.schedrow { display: grid; grid-template-columns: 90px 1fr auto 1fr; gap: 8px; align-items: center; margin: 4px 0; }
details > summary { cursor: pointer; font-weight: 700; min-height: 32px; }
.payslip { border-top: 1px solid var(--line); padding: 10px 0; }
.matrix td { vertical-align: middle; }
.notes { display: grid; gap: 8px; margin-bottom: 10px; max-height: 60vh; overflow: auto; }
.note-item { display: grid; gap: 2px; text-align: left; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font: inherit; cursor: pointer; }
.note-item.unread { background: var(--rose-50); border-color: var(--rose-300); } .note-item span { color: var(--muted); }

/* modal + toast */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(44, 26, 35, .45); display: grid; place-items: center; padding: 12px; overflow: auto; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 24px); overflow: auto; background: #fff; border-radius: 20px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.modal.wide { width: min(760px, 100%); }
.modal-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 10px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 14px 20px 20px; }
#toasts { position: fixed; z-index: 100; left: 0; right: 0; bottom: 84px; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast { pointer-events: auto; max-width: 480px; padding: 12px 18px; border-radius: 14px; background: var(--ink); color: #fff; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); animation: pop .2s ease-out; }
.toast.error { background: var(--bad); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
