/* Panel theme: warm paper, dark-wood sidebar, terracotta accent.
   Fonts are self-hosted (fonts/OFL.txt): no third-party requests from the panel. */
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 100 1000; font-display: swap;
  src: url(../fonts/dm-sans-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 100 1000; font-display: swap;
  src: url(../fonts/dm-sans-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(../fonts/fraunces-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(../fonts/fraunces-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f3eadb; --card: #fbf7ee; --line: #dccbb1; --line-soft: #e7dac4; --grid-line: #e4d6be;
  --ink: #2b1e15; --ink-2: #4a3826; --muted: #6f5b47;
  --brand: #a9471f; --brand-hover: #8f3a18; --brand-ink: #fff6ea; --accent: #e0915f;
  --side: #2b1e15; --side-ink: #eadbc4; --side-hi: #fff3df; --side-active: #43301f; --side-hover: #3a2a1d; --side-muted: #b8a58a; --side-dim: #a18d72;
  --field: #fffdf8; --field-line: #d3c0a3; --seg: #eadcc4; --today: #f6ecd6;
  --ok: #dadec0; --ok-ink: #39401f; --err: #f4d6cc; --err-ink: #8f2f12; --warn: #f3e0ad; --warn-ink: #5c3d07;
  --danger: #a33b1f;
  --radius: 18px; --radius-sm: 12px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --hour: 64px;
  font-family: var(--sans);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.45; font-size: 15px; }
a { color: var(--brand); }
a:hover { color: var(--brand-hover); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; }
h1 { font-size: 2rem; margin: 0 0 1rem; }
h2 { font-size: 1.3rem; margin: 1.75rem 0 .75rem; }
h3 { font-size: 1.05rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ico { flex: none; }

/* ------------------------------------------------------------ shell */
.shell { display: flex; min-height: 100vh; }
.side { flex: 0 0 272px; background: var(--side); color: var(--side-ink); padding: 28px 20px; display: flex; flex-direction: column; gap: 24px; }
/* Desktop: as tall as the viewport and pinned while the content scrolls;
   a long menu scrolls inside. */
.side { position: sticky; top: 0; align-self: flex-start; height: 100vh; height: 100dvh; overflow-y: auto; overscroll-behavior: contain; }
.side-head { display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 4px; text-decoration: none; font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--side-hi); }
.side .brand:hover { color: var(--side-hi); }
.logo-bg { fill: var(--accent); } .logo-leaf { fill: var(--side); } .logo-vein { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }
.brand-out { color: var(--ink); justify-content: center; margin: 0 0 1.5rem; }
.side-body { display: flex; flex-direction: column; gap: 24px; flex: 1; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav-btn { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 10px; color: var(--side-ink);
  text-decoration: none; font: 400 15px var(--sans); background: none; border: 0; width: 100%; text-align: left; justify-content: flex-start; cursor: pointer; }
.nav a:hover, .nav-btn:hover { background: var(--side-hover); color: var(--side-hi); }
.nav a[aria-current] { background: var(--side-active); color: var(--side-hi); font-weight: 600; }
.nav-label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--side-muted); padding: 0 12px 6px; }
.nav-admin a { min-height: 36px; font-size: 14px; }
.nav-admin .ico { width: 18px; height: 18px; }
.nav-user { margin-top: auto; border-top: 1px solid var(--side-active); padding-top: 16px; }
.nav-user .who { color: var(--side-muted); font-size: 13px; padding: 0 12px 6px; }
.side :focus-visible { outline-color: var(--accent); }
.menu-toggle { display: none; margin-left: auto; background: none; border: 0; color: inherit; width: 44px; height: 44px; border-radius: 10px; cursor: pointer; place-items: center; }
.main { flex: 1; min-width: 0; padding: 32px 36px 56px; max-width: 1180px; }
.main.wide { max-width: none; }
.narrow { max-width: 440px; margin: 3.5rem auto; padding: 0 1rem; }
.narrow h1 { text-align: center; font-size: 1.7rem; }
/* Logged-out screens (login, invite, codes): centred buttons. */
.narrow .actions { justify-content: center; }
.choice { display: flex; flex-direction: column; gap: .75rem; }
.choice > p { margin: 0; }
.choice > button, .choice > .btn { width: 100%; }

@media (max-width: 960px) {
  .shell { flex-direction: column; }
  .side { flex: none; padding: 10px 16px; gap: 0; position: sticky; top: 0; z-index: 20; align-self: stretch; height: auto; overflow: visible; }
  .brand { font-size: 19px; }
  .brand .logo { width: 30px; height: 30px; }
  .menu-toggle { display: grid; }
  .side-body { display: none; padding: 12px 0 8px; }
  .side-body.open { display: flex; }
  .main { padding: 20px 16px 48px; }
  h1 { font-size: 1.6rem; }
}

/* ------------------------------------------------------------ building blocks */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
label { display: block; font-weight: 600; margin: .8rem 0 .3rem; font-size: .88rem; color: var(--ink-2); }
label.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; margin: .35rem 0; font-size: .95rem; color: var(--ink); }
/* Only the switch itself toggles: the label text (often a whole row wide)
   ignores clicks but still names the checkbox for screen readers. */
label.check { pointer-events: none; cursor: default; }
label.check input, label.check a, label.check button { pointer-events: auto; }
input[type=radio] { accent-color: var(--brand); width: 18px; height: 18px; margin: 0; }
/* Checkboxes render as toggle switches; the element stays a native checkbox
   (form value, keyboard, screen readers unchanged). */
input[type=checkbox] { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 36px; height: 20px; margin: 0;
  border-radius: 999px; background: var(--side-muted); border: 1px solid var(--side-muted); cursor: pointer; vertical-align: middle; transition: background-color .15s, border-color .15s; }
input[type=checkbox]::before { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--field); box-shadow: 0 1px 2px rgba(43, 30, 21, .25); transition: transform .15s; }
input[type=checkbox]:checked { background: var(--brand); border-color: var(--brand); }
input[type=checkbox]:checked::before { transform: translateX(16px); }
input[type=checkbox]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=checkbox]:disabled { opacity: .45; cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { input[type=checkbox], input[type=checkbox]::before { transition: none; } }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time],
input[type=datetime-local], input[type=search], input[type=tel], input[type=url], input[type=file], select, textarea {
  width: 100%; min-height: 44px; padding: .55rem .75rem; border: 1px solid var(--field-line); border-radius: var(--radius-sm);
  font: 400 15px var(--sans); color: var(--ink); background: var(--field); }
select { padding-right: 2rem; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
textarea { min-height: 7rem; resize: vertical; }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: var(--radius-sm); border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink);
  font: 600 14px var(--sans); cursor: pointer; text-decoration: none; }
button:hover, .btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--brand-ink); }
button.secondary, .btn.secondary { background: var(--card); color: var(--ink); border-color: var(--field-line); font-weight: 500; }
button.secondary:hover, .btn.secondary:hover { background: #fff; color: var(--ink); border-color: var(--line); }
button.danger { background: transparent; color: var(--err-ink); border-color: #b9765f; }
button.danger:hover { background: var(--err); color: var(--err-ink); border-color: #b9765f; }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: inherit; text-decoration: underline; font-weight: 400; }
.btn-icon { padding: 0 20px 0 14px; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; align-items: center; }
form.inline { display: inline; }
.flash { padding: .7rem 1rem; border-radius: var(--radius-sm); border: 1px solid transparent; }
.flash.ok { background: var(--ok); color: var(--ok-ink); border-color: #b5bb8e; }
.flash.err { background: var(--err); color: var(--err-ink); border-color: #ddae93; }
.warn { background: var(--warn); color: var(--warn-ink); padding: .6rem .9rem; border-radius: var(--radius-sm); }
.card.warn { border-color: #d9be76; }
.warn .conflicts { margin: .4rem 0 0; padding-left: 1.2rem; }
.series { margin: .4rem 0 0; padding-left: 1.2rem; }
.series-box { margin-top: .6rem; }
.series-box summary { cursor: pointer; font-weight: 600; }
.ferr { color: var(--err-ink); font-size: .85rem; }
.muted { color: var(--muted); font-size: .9rem; }
.kicker { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr:last-child > td { border-bottom: 0; }
th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; border-bottom-color: var(--line); }
td a { font-weight: 600; text-decoration: none; }
/* Rows of form fields: status text and buttons on the fields' line. */
table.middle td { vertical-align: middle; }
/* Users: rows of form fields aligned at the top (the name cell has the
   e-mail below the field); text and toggles centred on the 44px field. */
table.users td { vertical-align: top; }
table.users td.at-field { padding-top: calc(.65rem + 11px); }
table.users td.at-field input[type=checkbox] { margin-top: 1px; }
/* Buttons in a cell stay a table cell (not .actions, which is a flex bar). */
td.cell-actions { white-space: nowrap; }
td.cell-actions > * { vertical-align: middle; margin: 2px 0; }
td.cell-actions form.inline { display: inline-block; margin-left: .4rem; }
td a:hover { text-decoration: underline; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--seg); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge.pending { background: var(--warn); color: var(--warn-ink); }
.badge.confirmed, .badge.completed { background: var(--ok); color: var(--ok-ink); }
.badge.cancelled, .badge.rejected, .badge.expired, .badge.no_show { background: var(--err); color: var(--err-ink); }
.code-big { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.4rem; letter-spacing: .12em; }
.badge.inactive { background: var(--line-soft); color: var(--muted); }
.row { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; }
.row > * { flex: 1 1 8rem; }
.codes { font-family: ui-monospace, monospace; columns: 2; }
.qr { display: flex; justify-content: center; margin: 1rem 0; }
.center { text-align: center; }
ol.steps { padding-left: 1.3rem; } ol.steps li { margin: .25rem 0; }
.qr img { display: block; width: 200px; height: 200px; image-rendering: pixelated; background: #fff; padding: 8px; border-radius: var(--radius-sm); }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.filters > * { flex: 0 1 auto; }
.filters label { margin-top: 0; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; } dt { color: var(--muted); } dd { margin: 0; }

.card > h2:first-of-type, .card > h3:first-of-type, details.card > summary + * { margin-top: 0; }
.card + .card, .table-wrap + .card { margin-top: 1rem; }
.page-head { display: flex; gap: .75rem 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.sub { color: var(--muted); margin: -.6rem 0 1rem; }
/* Filters submit on change when JS runs; the button stays for no-JS. */
.js [data-autosubmit] .autosubmit-btn { display: none; }
/* Booking detail */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: .75rem 0; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }
.consents { margin: .25rem 0 0; padding-left: 1.1rem; font-size: .88rem; color: var(--muted); }
.action-block { border-top: 1px solid var(--line-soft); padding-top: 1rem; margin-top: 1rem; }
.action-block:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.action-block h3 { font-size: 1rem; margin: 0 0 .5rem; }
.inline-form { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.inline-form input[type=text] { flex: 1 1 16rem; width: auto; }
/* Collapsible cards (services) */
details.card > summary { cursor: pointer; list-style: none; display: flex; gap: .5rem 1rem; align-items: baseline; flex-wrap: wrap; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: "▸"; color: var(--muted); }
details.card[open] > summary::before { content: "▾"; }
details.card[open] > summary { margin-bottom: .75rem; }
summary .title { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; }
.thumb { width: 96px; height: 96px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); display: block; margin: .4rem 0; }
.flush { margin: 0; }
tr.new-row td { background: var(--today); }
tr.new-row .muted { display: none; }
.grid > .card, .grid > form.card { margin-top: 0; }
/* Tables become cards on phones */
@media (max-width: 640px) {
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr.head { display: none; }
  table.stack tr { padding: .65rem .8rem; border-bottom: 1px solid var(--line-soft); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { border: 0; padding: .12rem 0; }
  table.stack td[data-label] { display: flex; gap: .5rem; align-items: center; }
  table.stack td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85rem; flex: 0 0 6.5rem; }
  table.stack td.lead { font-weight: 600; }
  tr.new-row .muted { display: block; margin-bottom: .25rem; }
  .table-wrap { overflow-x: visible; }
}

/* ------------------------------------------------------------ specialist colours */
.c0 { --ev-bg: #f1d3c2; --ev-line: #ddae93; --ev-ink: #6a2a10; --ev-solid: #a9471f; }
.c1 { --ev-bg: #dadec0; --ev-line: #b5bb8e; --ev-ink: #39401f; --ev-solid: #5c6532; }
.c2 { --ev-bg: #f3e0ad; --ev-line: #d9be76; --ev-ink: #5c3d07; --ev-solid: #8e5c0c; }
.c3 { --ev-bg: #e6ced4; --ev-line: #cba4af; --ev-ink: #4a2230; --ev-solid: #6b3347; }
.c4 { --ev-bg: #cfe0dc; --ev-line: #9ebfb8; --ev-ink: #1f4640; --ev-solid: #2f6b61; }
.c5 { --ev-bg: #d5dae8; --ev-line: #a9b3cf; --ev-ink: #283456; --ev-solid: #45527a; }

/* ------------------------------------------------------------ sidebar: month and specialists */
.mini { display: flex; flex-direction: column; gap: 8px; }
.mini-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.mini-title { font-family: var(--serif); font-size: 17px; font-weight: 500; color: var(--side-hi); }
.mini-nav { display: flex; gap: 2px; }
.mini-nav a { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--side-ink); }
.mini-nav a:hover { background: var(--side-hover); color: var(--side-hi); }
.mini-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); text-align: center; font-size: 13px; border-radius: 10px; }
.mini-dow { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--side-muted); }
.mini-row.in-range { background: var(--side-hover); }
.mini-row a { display: grid; place-items: center; height: 32px; color: var(--side-ink); text-decoration: none; border-radius: 50%; }
.mini-row a:hover { color: var(--side-hi); background: var(--side-active); }
.mini-row a.out { color: var(--side-dim); }
.mini-row a.today { color: var(--accent); font-weight: 700; }
.mini-row a.sel { background: var(--accent); color: var(--side); font-weight: 600; }
.mini-row a { width: 32px; justify-self: center; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--ev-solid, var(--side-muted)); }
.side .dot { background: var(--ev-bg, var(--side-muted)); box-shadow: 0 0 0 2px var(--side); }
.side .dot-all, .dot-all { background: conic-gradient(#f1d3c2 0 25%, #dadec0 0 50%, #f3e0ad 0 75%, #e6ced4 0); }

/* ------------------------------------------------------------ bookings calendar */
.cal-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.cal-title { display: flex; flex-direction: column; gap: 4px; }
.cal-title h1 { margin: 0; font-size: 2.25rem; line-height: 1.1; }
.cal-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pager { display: flex; gap: 4px; }
.icon-btn { width: 44px; height: 44px; border: 1px solid var(--field-line); border-radius: var(--radius-sm); background: var(--card); color: var(--ink);
  display: grid; place-items: center; }
.icon-btn:hover { background: #fff; color: var(--ink); }
.seg { display: flex; padding: 4px; gap: 2px; border: 1px solid var(--field-line); border-radius: 14px; background: var(--seg); }
.seg a { display: flex; align-items: center; min-height: 34px; padding: 0 16px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 500; }
.seg a:hover { background: var(--card); color: var(--ink); }
.seg a[aria-current] { background: var(--ink); color: var(--side-hi); font-weight: 600; }
.spec-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.spec-chips a { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border: 1px solid var(--field-line);
  border-radius: 999px; background: var(--card); color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 500; }
.spec-chips a:hover { color: var(--ink); border-color: var(--ink-2); }
.spec-chips a[aria-current] { background: var(--ink); border-color: var(--ink); color: var(--side-hi); font-weight: 600; }
.spec-chips a[aria-current] .dot { box-shadow: 0 0 0 2px var(--ink); }
.cal-bar { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; margin: 14px 0; }
.cal-bar .filters { margin: 0; }
.cal-bar select { min-height: 40px; width: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--ink-2); }
.legend .check { display: flex; align-items: center; gap: 8px; margin: 0; }
.legend .check input { margin: 0; }
.legend .check:has(input:not(:checked)) { color: var(--muted); }
.legend .check:has(input:not(:checked)) .sw { opacity: .4; }
.sw { width: 18px; height: 14px; border-radius: 4px; }
.sw-booking { background: #f1d3c2; border: 1px solid #ddae93; }
.sw-pending { background: #fbf2ec; border: 1px dashed #b9765f; }
.sw-break { background: repeating-linear-gradient(135deg, #e7c3ae 0 3px, #f6e7dc 3px 6px); }
.sw-avail { background: color-mix(in srgb, var(--brand) 14%, transparent); border-left: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); }
.sw-off { background: repeating-linear-gradient(135deg, #e3d3ba 0 4px, #ede0cb 4px 8px); border: 1px dashed #bda783; }
.sw-hold { background: #eceae6; border: 1px dashed #9a948a; }
.sw-cancelled { background: #f1d3c2; border: 1px solid #ddae93; opacity: .55; background-image: linear-gradient(to bottom right, transparent 45%, #9a5b44 45% 55%, transparent 55%); }

.cal { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
/* One grid: column 1 = hours, then a header and a body per column (auto-flow by column). */
.cal-grid { display: grid; grid-template-rows: auto auto; grid-template-columns: 56px; grid-auto-columns: minmax(124px, 1fr); grid-auto-flow: column; }
.cal-corner { border-bottom: 1px solid var(--line); }
.cal-hours { font-size: 11px; color: var(--muted); text-align: right; }
.cal-hours div { height: var(--hour); padding: 4px 8px 0 0; }
.cal-colhead { border-left: 1px solid var(--line-soft); border-bottom: 1px solid var(--line); padding: 12px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.cal-colhead.today { background: var(--today); }
.avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--ev-solid); color: var(--brand-ink); display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.cal-colhead .who { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.cal-colhead .who strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-colhead .who span { font-size: 12px; color: var(--muted); }
.dayhead { display: flex; flex-direction: column; gap: 2px; color: var(--ink); text-decoration: none; }
.dayhead:hover { color: var(--brand); }
.dayhead .dow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.dayhead .num { font-family: var(--serif); font-size: 24px; font-weight: 500; line-height: 1.2; }
.dayhead .sub { font-size: 12px; color: var(--muted); }
.today .dayhead .dow { color: var(--brand); font-weight: 600; }
.today .dayhead .num { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-size: 21px; }
.cal-col { position: relative; display: grid; grid-auto-rows: calc(var(--hour) / 12); grid-template-columns: minmax(0, 1fr); border-left: 1px solid var(--line-soft);
  background-image: repeating-linear-gradient(to bottom, var(--grid-line) 0, var(--grid-line) 1px, transparent 1px, transparent var(--hour)); padding: 0 3px; }
.cal-col.today { background-color: var(--today); }
.lanes-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lanes-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lanes-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.lanes-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.lanes-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.lanes-7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.lanes-8 { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.ln-0 { grid-column: 1 / -1; } .ln-1 { grid-column: 1; } .ln-2 { grid-column: 2; } .ln-3 { grid-column: 3; } .ln-4 { grid-column: 4; }
.ln-5 { grid-column: 5; } .ln-6 { grid-column: 6; } .ln-7 { grid-column: 7; } .ln-8 { grid-column: 8; }

.ev { position: relative; z-index: 1; margin: 1px; display: flex; flex-direction: column; min-width: 0; overflow: hidden; padding: 4px 8px;
  border-radius: 8px; border: 1px solid var(--ev-line); background: var(--ev-bg); color: var(--ev-ink); font-size: 12px; line-height: 1.3; text-decoration: none; }
.ev:hover, .ev:focus-visible { color: var(--ev-ink); border: 2px solid var(--ink); padding: 3px 7px; box-shadow: 0 6px 16px rgba(43, 30, 21, .22); z-index: 2; }
.ev > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-name { font-weight: 600; font-size: 13px; }
.ev-tag { font-size: 11px; font-weight: 600; text-transform: lowercase; opacity: .85; }
.ev.short { flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 6px; padding-top: 2px; padding-bottom: 2px; }
.ev.short:hover, .ev.short:focus-visible { padding-top: 1px; padding-bottom: 1px; }
.ev.short .ev-tag { display: none; }
.ev.st-pending { background: color-mix(in srgb, var(--ev-bg) 45%, #fffdf8); border-style: dashed; border-color: var(--ev-solid); }
.ev.st-no_show, .ev.st-cancelled, .ev.st-rejected, .ev.st-expired { opacity: .6; }
.ev.st-no_show .ev-name, .ev.st-cancelled .ev-name, .ev.st-rejected .ev-name, .ev.st-expired .ev-name { text-decoration: line-through; }
.ev-break { margin: 0 1px 1px; border-radius: 0 0 8px 8px;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--ev-line) 70%, transparent) 0 3px, transparent 3px 6px); }
/* Working hours: a tint under everything else (first in the column, not positioned). */
.ev-avail { margin: 0 -3px; border-left: 3px solid color-mix(in srgb, var(--brand) 55%, transparent);
  background: color-mix(in srgb, var(--brand) 9%, transparent); display: flex; justify-content: flex-end; align-items: flex-start; overflow: hidden; }
.ev-avail span { font-size: 11px; color: var(--muted); padding: 2px 6px; white-space: nowrap; }
/* Team week: each specialist's hours in their lane and colour, with the name. */
.ev-avail.team { margin: 0 1px; border-left-color: var(--ev-solid); background: color-mix(in srgb, var(--ev-bg) 55%, transparent);
  flex-direction: column; justify-content: flex-start; align-items: stretch; }
.ev-avail.team strong { font-size: 11px; color: var(--ev-ink); padding: 2px 6px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-avail.team span { padding-top: 0; overflow: hidden; text-overflow: ellipsis; }
.ev-off { z-index: 0; margin: 1px; padding: 6px 10px; display: flex; flex-direction: column; overflow: hidden; border-radius: 8px; border: 1px dashed #bda783;
  background: repeating-linear-gradient(135deg, #e3d3ba 0 6px, #ede0cb 6px 12px); color: #5a4733; font-size: 12px; line-height: 1.3; }
.ev-off strong { font-size: 13px; }
.ev.ev-hold { background: #eceae6; border: 1px dashed #9a948a; color: #4f4a43; }
.now { grid-column: 1 / -1; align-self: start; height: 2px; margin: 0 -3px; background: #b8431f; z-index: 3; position: relative; pointer-events: none; }
.now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #b8431f; }
.cal-empty { margin-top: .75rem; }
@media (max-width: 640px) {
  .cal-title h1 { font-size: 1.7rem; }
  .cal-tools { gap: 8px; }
  .cal-grid { grid-template-columns: 44px; grid-auto-columns: minmax(112px, 1fr); }
  .cal-hours div { padding-right: 6px; }
}
.bio-preview { white-space: pre-wrap; margin: 0 0 .75rem; }
.svc-pick { position: relative; }
.svc-pick > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: .4rem; max-width: 260px;
  min-height: 36px; padding: 0 .65rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.svc-pick > summary::-webkit-details-marker { display: none; }
.svc-pick > summary::after { content: "▾"; color: var(--muted); flex: none; }
.svc-pick[open] > summary { border-color: var(--brand); }
.svc-pick .svc-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-pick.invalid > summary { border-color: var(--danger); color: var(--danger); }
.svc-group { margin: .25rem 0 .35rem; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.svc-group + .check, .svc-pop .check + .svc-group, .svc-quick + .svc-group { margin-top: 0; }
.svc-quick { margin: .1rem 0 .6rem; font-size: 13px; }
.svc-modes { border: 0; margin: 0 0 .5rem; padding: 0; }
.svc-modes .check { align-items: flex-start; white-space: normal; margin: .35rem 0; }
.svc-modes .check input { margin-top: .2rem; }
.svc-modes .muted { font-size: 12px; }
.svc-defs, .svc-res { border-top: 1px solid var(--line); padding-top: .5rem; margin-top: .25rem; }
/* Only the boxes that matter in the chosen mode. */
.svc-pick[data-mode="default"] .svc-defs, .svc-pick[data-mode="default"] .svc-res, .svc-pick[data-mode="plus"] .svc-defs { display: none; }
.svc-pop .actions { margin-top: .5rem; }
/* The list floats over the table (panel.js pins it to the viewport so the
   scrolling table does not clip it); opening it changes no row or column. */
.svc-pop { position: absolute; top: 100%; left: 0; z-index: 30; min-width: 260px; max-width: 320px; max-height: 60vh; overflow-y: auto; overflow-x: hidden; box-sizing: border-box; width: max-content;
  padding: .5rem .75rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.svc-pick .check { display: flex; align-items: flex-start; gap: .4rem; white-space: normal; overflow-wrap: anywhere; }
.svc-pick .check input { flex: none; margin-top: .2rem; }
.ph-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .2rem 0; }

/* Date and time fields: the panel's own picker (panel.js) replaces the
   browser popup; a calendar/clock icon marks them. */
input[type=date], input[type=time], input[type=datetime-local] { cursor: pointer; padding-right: 2.4rem; background-repeat: no-repeat;
  background-position: right .7rem center; background-size: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a6a58' stroke-width='1.7' stroke-linecap='round'%3E%3Crect x='3.5' y='5' width='17' height='15' rx='3'/%3E%3Cpath d='M3.5 10h17M8 3v4M16 3v4'/%3E%3C/svg%3E"); }
input[type=time] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a6a58' stroke-width='1.7' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 7.5V12l3 2'/%3E%3C/svg%3E"); }
input[type=date]::-webkit-calendar-picker-indicator, input[type=time]::-webkit-calendar-picker-indicator,
input[type=datetime-local]::-webkit-calendar-picker-indicator { display: none; }
.dp { position: fixed; z-index: 60; display: flex; flex-wrap: wrap; gap: 14px; max-width: calc(100vw - 16px); padding: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(43, 30, 21, .18); font-size: 14px; }
.dp-date { width: 266px; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-title { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; }
.dp-nav { min-height: 34px; width: 34px; padding: 0; border: 1px solid var(--field-line); border-radius: 10px; background: var(--card); color: var(--ink); font-size: 18px; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow { text-align: center; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 4px 0; }
.dp-day, .dp-t { min-height: 34px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font: 500 14px var(--sans); }
.dp-day:hover:not(:disabled), .dp-t:hover { background: var(--seg); }
.dp-day.today { box-shadow: inset 0 0 0 1px var(--brand); }
.dp-day.sel, .dp-t.sel { background: var(--ink); color: var(--side-hi); font-weight: 600; }
.dp-day:disabled { color: var(--muted); opacity: .45; cursor: not-allowed; }
.dp-foot { display: flex; justify-content: space-between; margin-top: 8px; font-size: 13px; }
.dp-time { display: flex; gap: 8px; }
.dp-col { display: flex; flex-direction: column; width: 64px; }
.dp-list { display: flex; flex-direction: column; gap: 2px; height: 252px; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
.dp-close { flex-basis: 100%; min-height: 36px; }

/* Confirm dialog (data-confirm in panel.js). */
dialog.confirm { max-width: min(440px, calc(100vw - 32px)); padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); color: var(--ink); box-shadow: 0 16px 40px rgba(43, 30, 21, .25); }
dialog.confirm::backdrop { background: rgba(43, 30, 21, .35); }
dialog.confirm p { margin: 0 0 1rem; font-size: 15px; line-height: 1.5; }
dialog.confirm .actions { justify-content: flex-end; margin: 0; }

[hidden] { display: none !important; }
