:root {
  --bg: #f6f5fb; --panel: #fff; --ink: #1d1a2b; --muted: #6b6780; --line: #e4e1ef;
  --brand: #6a3df0; --brand-ink: #fff; --ok: #1f8a4c; --warn: #b26a00; --bad: #c0392b;
  --radius: 10px; --shadow: 0 1px 2px rgba(20, 10, 60, .06), 0 4px 16px rgba(20, 10, 60, .05);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.45; font-size: 15px; }
a { color: var(--brand); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* App shell */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: #1d1a2b; color: #ddd8f0; padding: 1rem .75rem; position: sticky; top: 0; height: 100vh; overflow: auto; }
.side .logo { font-weight: 800; font-size: 1.3rem; color: #fff; padding: .25rem .5rem 1rem; display: block; text-decoration: none; }
.side nav a { display: block; padding: .5rem .6rem; border-radius: 8px; color: inherit; text-decoration: none; }
.side nav a:hover, .side nav a.on { background: rgba(255, 255, 255, .09); color: #fff; }
.side .sep { border-top: 1px solid rgba(255, 255, 255, .1); margin: .75rem 0; }
.side form button { background: none; border: 0; color: inherit; padding: .5rem .6rem; cursor: pointer; font: inherit; }
.main { padding: 1.5rem 2rem; min-width: 0; }
.topbar { display: flex; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; }
.btn.menu-toggle { display: none; margin-bottom: .75rem; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .btn.menu-toggle { display: inline-block; }
  .main { padding: 1rem; }
}

/* Panels and forms */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 160px; }
label { display: block; font-size: .85rem; font-weight: 600; margin: .6rem 0 .25rem; }
label.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; font-size: .95rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=tel], input[type=datetime-local], select, textarea {
  width: 100%; padding: .55rem .65rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 7rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }
.btn { display: inline-block; padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.danger { color: var(--bad); }
.btn.small { padding: .3rem .6rem; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: default; }
.actions { display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.flash.ok { background: #e7f6ec; color: #145c33; }
.flash.err { background: #fdecea; color: #8a1f14; }
.flash.warn { background: #fff4e0; color: #7a4a00; }
.flash ul { margin: 0; padding-left: 1.2rem; }

table.list { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; }
table.list th, table.list td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #faf9fd; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 99px; font-size: .78rem; font-weight: 600; background: #eeeaf9; color: #4b3a8f; }
.badge.ok { background: #e7f6ec; color: #145c33; }
.badge.warn { background: #fff4e0; color: #7a4a00; }
.badge.bad { background: #fdecea; color: #8a1f14; }
code, .code { background: #f1eff8; padding: .15rem .35rem; border-radius: 5px; font-size: .85em; word-break: break-all; }
pre.code { padding: .75rem; white-space: pre-wrap; }

/* Calendar */
.cal-toolbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .75rem; }
.cal-toolbar select, .cal-toolbar input { width: auto; }
.cal-toolbar .title { font-weight: 700; margin: 0 .5rem; min-width: 12rem; }
.cal { display: grid; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: calc(100vh - 170px); position: relative; }
.cal-head { position: sticky; top: 0; z-index: 3; background: #faf9fd; border-bottom: 1px solid var(--line); padding: .5rem; font-weight: 600; font-size: .9rem; text-align: center; }
.cal-head .dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .3rem; }
.cal-times { position: sticky; left: 0; z-index: 2; background: var(--panel); border-right: 1px solid var(--line); }
.cal-time { height: 48px; font-size: .75rem; color: var(--muted); text-align: right; padding: 0 .4rem; transform: translateY(-.5em); }
.cal-col { position: relative; border-right: 1px solid var(--line); min-width: 140px; background: #f0eef6; }
.cal-col .hour { height: 48px; border-top: 1px solid var(--line); }
.cal-col .work { position: absolute; left: 0; right: 0; background: #fff; }
.cal-ev { position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: .2rem .35rem; font-size: .78rem; overflow: hidden; background: #e8e1ff; border-left: 4px solid var(--brand); cursor: pointer; z-index: 1; line-height: 1.25; }
.cal-ev.block { background: repeating-linear-gradient(45deg, #ecebf1, #ecebf1 6px, #e2e0ea 6px, #e2e0ea 12px); border-left-color: #9a96ab; color: #555; }
.cal-ev.status-arrived, .cal-ev.status-in_progress { border-left-color: var(--warn); }
.cal-ev.status-completed { opacity: .7; border-left-color: var(--ok); }
.cal-ev.status-no_show { opacity: .6; text-decoration: line-through; border-left-color: var(--bad); }
.cal-ev.dragging { opacity: .6; box-shadow: 0 4px 12px rgba(0, 0, 0, .2); z-index: 5; }
.cal-ev b { display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.cal-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--bad); z-index: 2; pointer-events: none; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(20, 15, 40, .45); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 1rem; z-index: 100; overflow: auto; }
.modal { background: #fff; border-radius: 12px; width: min(560px, 100%); padding: 1.25rem 1.5rem; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
.modal h2 { margin-top: 0; }
.suggest { position: relative; }
.suggest-list { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--line); border-radius: 8px; z-index: 5; box-shadow: var(--shadow); }
.suggest-list div { padding: .45rem .6rem; cursor: pointer; }
.suggest-list div:hover { background: #f3f0fc; }

/* Public pages */
.public { max-width: 980px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.public header.site { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.public header.site .logo { font-weight: 800; font-size: 1.4rem; color: var(--ink); text-decoration: none; }
.hero { padding: 2rem 0; }
.hero h1 { font-size: 2.2rem; line-height: 1.15; max-width: 22ch; }
.narrow { max-width: 440px; margin: 0 auto; }
.honey { position: absolute; left: -9999px; }

/* Booking page */
.bk { max-width: 640px; margin: 0 auto; padding: 1rem; }
.bk header { text-align: center; padding: 1rem 0; }
.bk header h1 { margin: 0; }
.bk .steps { display: flex; gap: .25rem; margin: 1rem 0; }
.bk .steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.bk .steps span.on { background: var(--brand); }
.opt { display: flex; justify-content: space-between; gap: 1rem; align-items: center; width: 100%; text-align: left; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-bottom: .5rem; cursor: pointer; font: inherit; color: inherit; }
.opt:hover { border-color: var(--brand); }
.opt.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, #fff); box-shadow: inset 0 0 0 1px var(--brand); }
.opt .meta { color: var(--muted); font-size: .85rem; }
.days { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .5rem; }
.days button { flex: 0 0 auto; width: 4.2rem; padding: .5rem 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font: inherit; color: inherit; }
.days button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.days button small { display: block; font-size: .72rem; opacity: .8; }
.times { display: grid; grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr)); gap: .4rem; margin-top: .75rem; }
.times button { padding: .55rem 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font: inherit; color: inherit; }
.times button.on, .times button:hover { border-color: var(--brand); color: var(--brand); font-weight: 600; }
.summary { background: #faf9fd; border: 1px solid var(--line); border-radius: 10px; padding: .75rem 1rem; margin: 1rem 0; }
.bk .foot { display: flex; justify-content: space-between; gap: .5rem; margin-top: 1rem; position: sticky; bottom: 0; background: var(--bg); padding: .75rem 0; }
.tabs { display: flex; gap: .5rem; margin: .5rem 0; }
.tabs label { flex: 1; margin: 0; }
.tabs input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tabs input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.tabs span { display: block; text-align: center; padding: .55rem; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 600; }
.tabs input:checked + span { border-color: var(--brand); color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.spinner { color: var(--muted); padding: 1rem 0; }
