:root {
  --bg:        #f6f8fb;
  --bg-soft:   #eef1f6;
  --panel:     #ffffff;
  --side-bg:   #ffffff;
  --ink:       #0b1424;
  --ink-soft:  #1d2939;
  --muted:     #667085;
  --rule:      #e4e7ec;
  --rule-soft: #eef0f3;
  --accent:    #1849a9;
  --accent-hover: #143a86;
  --accent-soft: #e8efff;
  --accent-ink:  #ffffff;
  --ok:        #027a48;
  --warn:      #b54708;
  --bad:       #b42318;
  --info:      #1849a9;
  --side-w:    240px;
  --radius:    6px;
  --radius-sm: 4px;

  --sans:  'Geist', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono:  'Geist Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss03';
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

main { max-width: 1100px; margin: 2rem auto; padding: 0 1.5rem; }
main.with-sidebar { max-width: none; margin: 0 0 0 var(--side-w); padding: 1.5rem 1.25rem 3rem; }
@media (min-width: 1400px) {
  main.with-sidebar { padding: 1.75rem 2rem 3rem; }
}

/* ─── SIDEBAR ─────────────────────────────────────────────────────── */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w);
  background: var(--side-bg);
  border-right: 1px solid var(--rule);
  display: flex; flex-direction: column;
  padding: 1.25rem 0;
}

.sidebar .brand {
  display: block;
  font-weight: 700; font-size: 1.05rem;
  letter-spacing: -0.015em; line-height: 1.2;
  color: var(--ink); text-decoration: none;
  padding: 0 1.25rem;
}
.sidebar .brand::after { content: none; }
.sidebar .brand:hover { text-decoration: none; }

.side-meta {
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0.2rem 1.25rem 1.25rem;
  border-bottom: 1px solid var(--rule);
  letter-spacing: 0;
  text-transform: none;
  font-family: var(--sans);
}
.side-meta .live {
  display: inline-flex; align-items: center; color: var(--muted);
  font-weight: 500; font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.side-meta .live::before {
  content: ''; display: inline-block;
  width: 6px; height: 6px; background: var(--ok);
  border-radius: 50%; margin-right: 0.4em;
}
.side-meta .dot { display: none; }

.side-cta {
  display: flex; align-items: center; justify-content: center;
  gap: 0.4em;
  margin: 1rem 1rem 0.4rem; padding: 0.55rem 0.9rem;
  background: var(--ink); color: var(--bg);
  text-decoration: none;
  font-family: var(--sans); font-size: 0.82rem; font-weight: 500;
  letter-spacing: -0.005em;
  border: 1px solid var(--ink); border-radius: var(--radius-sm);
  transition: background 0.15s, border-color 0.15s;
}
.side-cta:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.side-cta .cta-arrow { font-size: 0.85rem; opacity: 0.7; }

.side-nav-label {
  font-size: 0.66rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted);
  padding: 1.1rem 1.25rem 0.4rem;
}

.side-nav { display: flex; flex-direction: column; }
.side-nav .nav-item {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.45rem 1.25rem; color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.88rem; font-weight: 500;
  letter-spacing: -0.005em;
  border-left: 2px solid transparent;
  transition: background 0.12s, color 0.12s;
}
.side-nav .nav-item::before { content: none; }
.side-nav .nav-item:hover { background: var(--bg-soft); color: var(--ink); text-decoration: none; }

body[data-nav="bookings"]  .nav-bookings,
body[data-nav="customers"] .nav-customers,
body[data-nav="teams"]     .nav-teams,
body[data-nav="services"]  .nav-services,
body[data-nav="extras"]    .nav-extras,
body[data-nav="locations"] .nav-locations,
body[data-nav="settings"]  .nav-settings {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.side-foot {
  margin-top: auto; padding: 1rem 1rem 0;
  border-top: 1px solid var(--rule);
}
.user-card {
  display: flex; flex-direction: column; gap: 0.1rem;
  padding: 0.55rem 0.7rem; margin-bottom: 0.55rem;
  background: var(--bg-soft); border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
}
.user-card .user-label {
  font-size: 0.66rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted);
}
.user-card .user-email {
  font-size: 0.78rem; color: var(--ink); word-break: break-all;
}
.side-foot .logout { margin: 0; }
.side-foot .logout button {
  width: 100%; background: var(--panel); border: 1px solid var(--rule);
  padding: 0.45rem 0.7rem; cursor: pointer;
  font-family: var(--sans); font-size: 0.78rem; font-weight: 500;
  color: var(--ink-soft); border-radius: var(--radius-sm);
  transition: 0.12s;
}
.side-foot .logout button:hover { background: var(--bg-soft); border-color: var(--ink-soft); color: var(--ink); }

/* ─── HEADINGS ────────────────────────────────────────────────────── */
h1, h2, h3 { font-family: var(--sans); font-weight: 600; letter-spacing: -0.018em; line-height: 1.2; color: var(--ink); }
h1 { font-size: 1.65rem; margin: 0 0 0.5rem; font-weight: 700; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 0.6rem; }
h3 { font-size: 0.95rem; margin: 1.1rem 0 0.5rem; }

.page-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.5rem; padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
  gap: 1rem; flex-wrap: wrap;
}
.page-head h1 {
  font-size: 1.75rem; line-height: 1.15; letter-spacing: -0.025em;
  font-weight: 700;
}
.page-head h1::before { content: none; }
.head-actions { display: flex; gap: 0.5rem; align-items: center; }
.head-actions form { margin: 0; }

/* ─── BUTTONS ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.4em; padding: 0.5rem 0.85rem;
  border: 1px solid var(--rule); background: var(--panel);
  color: var(--ink-soft); cursor: pointer;
  font-family: var(--sans); font-size: 0.82rem; font-weight: 500;
  letter-spacing: -0.005em;
  text-decoration: none; border-radius: var(--radius-sm);
  transition: 0.12s;
}
.btn:hover { background: var(--bg-soft); border-color: var(--ink-soft); color: var(--ink); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn.danger { background: var(--panel); color: var(--bad); border-color: var(--rule); }
.btn.danger:hover { background: var(--bad); color: var(--panel); border-color: var(--bad); }

/* ─── SEARCH ──────────────────────────────────────────────────────── */
.search { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; max-width: 600px; }
.search input {
  flex: 1; padding: 0.5rem 0.75rem;
  border: 1px solid var(--rule);
  background: var(--panel); font: inherit; font-family: var(--sans);
  border-radius: var(--radius-sm);
  color: var(--ink);
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search button {
  padding: 0.5rem 1rem; background: var(--ink); color: var(--bg);
  border: 1px solid var(--ink);
  font-family: var(--sans); font-size: 0.82rem; font-weight: 500;
  cursor: pointer; border-radius: var(--radius-sm);
  transition: 0.12s;
}
.search button:hover { background: var(--accent); border-color: var(--accent); }

/* ─── TABLES ──────────────────────────────────────────────────────── */
table.data {
  width: 100%; border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--rule); border-radius: var(--radius);
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
table.data th {
  text-align: left; padding: 0.7rem 0.95rem;
  font-family: var(--sans); font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); background: var(--bg-soft);
  border-bottom: 1px solid var(--rule);
}
table.data td {
  padding: 0.75rem 0.95rem; border-bottom: 1px solid var(--rule-soft);
  vertical-align: middle;
}
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background 0.1s; }
table.data tbody tr:hover { background: var(--bg-soft); }
table.data td.empty {
  text-align: center; color: var(--muted); padding: 3rem 1rem;
  font-style: normal; font-size: 0.9rem;
}
table.data td a { color: var(--accent); border-bottom: none; }
table.data td a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ─── FORMS ───────────────────────────────────────────────────────── */
.form { max-width: 720px; }
.form label {
  display: block; margin: 1rem 0 0.35rem;
  font-family: var(--sans); font-size: 0.78rem; font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: -0.005em;
}
.form input, .form textarea, .form select {
  width: 100%; padding: 0.5rem 0.7rem;
  border: 1px solid var(--rule);
  background: var(--panel); font: inherit; font-family: var(--sans);
  border-radius: var(--radius-sm);
  color: var(--ink);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.form input:focus, .form textarea:focus, .form select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form textarea { min-height: 90px; resize: vertical; }
.form .grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem; }
.form label.check {
  display: flex; align-items: center; gap: 0.5rem; margin-top: 0.9rem;
  font-size: 0.88rem; color: var(--ink); font-weight: 400;
}
.form label.check input { width: auto; accent-color: var(--accent); }
.form .actions {
  display: flex; gap: 0.6rem; margin-top: 1.75rem;
  padding-top: 1.1rem; border-top: 1px solid var(--rule);
}
small.error { color: var(--bad); display: block; margin-top: 0.3rem; font-size: 0.78rem; font-weight: 500; }

/* ─── TABS ────────────────────────────────────────────────────────── */
.tabs {
  display: flex; flex-wrap: wrap; gap: 0;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}
.tab {
  padding: 0.55rem 0.95rem; text-decoration: none; color: var(--muted);
  font-family: var(--sans); font-size: 0.85rem; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  border-radius: 0;
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ─── BADGES ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 0.4em;
  padding: 0.18rem 0.55rem; border: 1px solid var(--rule);
  background: var(--bg-soft);
  font-family: var(--sans); font-size: 0.72rem; font-weight: 500;
  color: var(--ink-soft); border-radius: 999px;
  white-space: nowrap;
}
.badge::before {
  content: ''; width: 6px; height: 6px;
  background: var(--muted); border-radius: 50%;
  flex-shrink: 0;
}
.badge.st-unassigned::before, .badge.st-pending::before { background: var(--warn); }
.badge.st-upcoming::before, .badge.st-authorized::before, .badge.st-payment_authorized::before, .badge.st-assigned::before { background: var(--info); }
.badge.st-completed::before, .badge.st-charged::before, .badge.st-captured::before, .badge.st-payment_captured::before, .badge.st-payment_succeeded::before, .badge.st-created::before { background: var(--ok); }
.badge.st-declined::before, .badge.st-failed::before, .badge.st-payment_failed::before, .badge.st-deleted::before { background: var(--bad); }
.badge.st-cancelled::before { background: var(--muted); }
.badge.st-updated::before { background: #6366f1; }

/* ─── CARDS ───────────────────────────────────────────────────────── */
.card {
  background: var(--panel); border: 1px solid var(--rule);
  padding: 1.25rem 1.5rem; margin: 1rem 0;
  border-radius: var(--radius);
}
.card h2 { margin-top: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 1rem; }
.card.link {
  text-decoration: none; color: inherit; display: block;
  position: relative; transition: 0.12s;
  padding-right: 2.75rem;
}
.card.link::after {
  content: '→'; position: absolute; right: 1.25rem; top: 1.4rem;
  color: var(--muted); font-size: 1rem;
  transition: transform 0.15s, color 0.15s;
}
.card.link:hover { border-color: var(--ink-soft); }
.card.link:hover::after { color: var(--accent); transform: translateX(2px); }
.card.error-banner { border-color: var(--bad); color: var(--bad); background: #fef3f2; }
.card.success-banner { border-color: var(--ok); color: #054f31; background: #f0faf5; }
.card.notice { border-color: var(--ok); color: #054f31; background: #f0faf5; }

/* ─── KEY/VALUE LIST ──────────────────────────────────────────────── */
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 0.6rem 1.25rem; margin: 0; }
.kv dt {
  font-size: 0.78rem; font-weight: 500;
  color: var(--muted); align-self: center;
}
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }
/* `.kv-flow` wraps each <dt><dd> pair in a `.kv-row` div so we can flow
   them into newspaper-style columns without forcing rows in the two
   columns to share the tallest cell's height. Avoids the "lone short
   value next to a long label" look on cards like custom fields. */
.kv-flow { margin: 0; }
.kv-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 0.4rem 1rem; padding: 0.45rem 0; break-inside: avoid; }
.kv-row + .kv-row { border-top: 1px solid var(--rule-soft); }
.kv-row dt {
  font-size: 0.78rem; font-weight: 500;
  color: var(--muted); align-self: start; padding-top: 0.1rem;
}
.kv-row dd { margin: 0; font-variant-numeric: tabular-nums; }
.kv-row .cf-multi-list { margin: 0; padding-left: 1.1rem; }
@media (min-width: 1100px) {
  .kv-flow { column-count: 2; column-gap: 2rem; column-rule: 1px solid var(--rule-soft); }
  .kv-row + .kv-row { border-top: 1px solid var(--rule-soft); }
  .kv-row:first-child { padding-top: 0; }
}
@media (min-width: 1600px) {
  .kv-flow { column-count: 3; }
}

/* ─── BOOKINGS LIST: filter sidebar + calendar ────────────────────────
   Mobile-first: filter stacks above table at narrow widths.
   ──────────────────────────────────────────────────────────────────── */
.bookings-grid { display: flex; flex-direction: column; gap: 1rem; }
.bookings-main { min-width: 0; width: 100%; order: 2; }
.bookings-main table.data { font-size: 0.86rem; }
.bookings-main table.data td,
.bookings-main table.data th { padding: 0.55rem 0.7rem; }
.bookings-main td.bk-date { white-space: nowrap; }

.bookings-filter {
  order: 1;
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 0.75rem 0.85rem 0.85rem;
  width: 100%; max-width: 360px; align-self: center;
}
.bookings-filter select {
  width: 100%; padding: 0.45rem 0.55rem;
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  background: var(--panel); font: inherit; font-family: var(--sans); color: var(--ink);
}
.bookings-filter > form > label {
  display: block; margin: 0 0 0.6rem;
  font-size: 0.78rem; font-weight: 500; color: var(--ink-soft);
}

.cal { margin-top: 0.75rem; border-top: 1px solid var(--rule); padding-top: 0.85rem; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.55rem; }
.cal-label { font-weight: 600; font-size: 0.92rem; color: var(--ink); }
.cal-nav {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  color: var(--ink-soft); text-decoration: none; font-size: 1rem; line-height: 1;
}
.cal-nav:hover { background: var(--bg-soft); border-color: var(--ink-soft); color: var(--ink); text-decoration: none; }

.cal-grid { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 0.78rem; }
.cal-grid th {
  font-weight: 600; color: var(--muted);
  padding: 0.25rem 0; text-align: center; font-size: 0.7rem;
}
.cal-grid td { padding: 1px; text-align: center; vertical-align: middle; }
.cal-day a {
  display: flex; align-items: center; justify-content: center; gap: 2px;
  height: 32px; border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none; font-variant-numeric: tabular-nums;
}
.cal-day a:hover { background: var(--bg-soft); text-decoration: none; }
.cal-day.out a { color: #c2c8d2; }
.cal-day.today a { background: #fef3c7; color: var(--ink); font-weight: 600; }
.cal-day.selected a { outline: 1.5px solid var(--ink); outline-offset: -1px; }
.cal-day.today.selected a { background: #fde68a; }
.cal-day .c { font-size: 0.62rem; font-weight: 600; color: var(--accent); margin-left: 1px; }

.cal-views {
  display: flex; gap: 1px; margin-top: 0.85rem;
  background: var(--rule); border: 1px solid var(--rule);
  border-radius: var(--radius-sm); overflow: hidden;
}
.cal-view-btn {
  flex: 1; padding: 0.5rem 0.4rem;
  background: var(--panel); color: var(--ink-soft);
  text-decoration: none; text-align: center;
  font-size: 0.78rem; font-weight: 500;
}
.cal-view-btn:hover { background: var(--bg-soft); text-decoration: none; }
.cal-view-btn.active { background: var(--ink); color: var(--bg); }

/* desktop: 2-column grid w/ filter pinned right */
@media (min-width: 900px) {
  .bookings-grid {
    display: grid; grid-template-columns: minmax(0, 1fr) 230px;
    gap: 1.25rem; align-items: start;
  }
  .bookings-main { order: 0; }
  .bookings-filter {
    order: 0; width: auto; max-width: none; align-self: stretch;
  }
  .cal-day a { height: 28px; }
}

/* ─── LOCATION CHECKLIST (teams form) ─────────────────────────────── */
.loc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.4rem 1rem; margin: 0.5rem 0; }
.loc-check { margin: 0; padding: 0.3rem 0; font-size: 0.88rem; font-weight: 400; }

/* ─── EXTRAS LIST (booking form) ──────────────────────────────────── */
.extras-list { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.extra-row { padding: 0.5rem 0; border-top: 1px solid var(--rule-soft); }
.extra-row:first-child { border-top: none; }
.extra-toggle { display: flex; align-items: center; gap: 0.55rem; cursor: pointer; margin: 0; font-size: 0.9rem; color: var(--ink); font-weight: 500; }
.extra-toggle input { width: auto; accent-color: var(--accent); }
.extra-toggle .extra-name { flex: 0 1 auto; }
.extra-toggle .extra-summary { font-size: 0.78rem; color: var(--muted); font-weight: 400; }
.extra-params { display: none; padding: 0.5rem 0 0.25rem 1.55rem; }
.extra-params.open { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.65rem; }

/* ─── PARAM VALUE ROWS (booking form) ─────────────────────────────── */
.pv-grid { display: flex; flex-direction: column; gap: 0.85rem; }
.pv-row { display: grid; grid-template-columns: 1fr 88px; align-items: center; gap: 0 0.6rem; margin: 0.35rem 0; }
.pv-row .pv-label { font-size: 0.82rem; font-weight: 500; color: var(--ink-soft); }
.pv-row input { padding: 0.4rem 0.55rem; border: 1px solid var(--rule); background: var(--panel); border-radius: var(--radius-sm); font: inherit; font-family: var(--mono); text-align: right; }
.pv-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pv-row small { grid-column: 1 / -1; font-size: 0.74rem; color: var(--muted); }

/* ─── PARAMS TABLE (services form) ────────────────────────────────── */
fieldset.params { border: 1px solid var(--rule); padding: 0.5rem 1.25rem 1.1rem; margin: 1.5rem 0; border-radius: var(--radius); background: var(--panel); }
fieldset.params legend { padding: 0 0.5rem; font-size: 0.74rem; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
fieldset.params.hidden .params-table, fieldset.params.hidden #paramActions, fieldset.params.hidden .param-cards { display: none; }
.params-hint { font-size: 0.85rem; color: var(--muted); margin: 0.5rem 0 1rem; }
.param-cards { display: flex; flex-direction: column; gap: 0.75rem; margin: 0.5rem 0 1rem; }
.param-card { border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 0.75rem; background: var(--panel-muted, var(--panel)); }
.param-card .param-row.top { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: end; }
.param-card .param-row.top label { flex: 1 1 8rem; display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.03em; }
.param-card .param-row.top input, .param-card .param-row.top select { padding: 0.35rem 0.5rem; border: 1px solid var(--rule); border-radius: var(--radius-sm); font: inherit; background: var(--panel); color: var(--ink); }
.param-card .param-numeric { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.6rem; }
.param-card .param-numeric label { flex: 1 1 6rem; display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.03em; }
.param-card .param-numeric input { padding: 0.35rem 0.5rem; border: 1px solid var(--rule); border-radius: var(--radius-sm); font: inherit; background: var(--panel); color: var(--ink); }
.param-card .param-options { margin-top: 0.6rem; }
.param-card .option-rows { width: 100%; font-size: 0.86rem; }
.param-card .option-rows td input, .param-card .option-rows td textarea { width: 100%; padding: 0.35rem 0.5rem; border: 1px solid var(--rule); border-radius: var(--radius-sm); font: inherit; background: var(--panel); resize: vertical; }
.param-card .option-rows td textarea { font-family: var(--mono, monospace); font-size: 0.78rem; min-height: 1.8rem; }
.param-card .add-option { margin-top: 0.4rem; padding: 0.3rem 0.6rem; font-size: 0.74rem; }
fieldset.pv-radio-group { border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 0.4rem 0.75rem 0.6rem; margin: 0.3rem 0 0; }
fieldset.pv-radio-group legend.pv-label { padding: 0 0.3rem; font-size: 0.78rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600; }
.pv-radio { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0; cursor: pointer; }
.pv-radio input { margin: 0; }
.pv-radio span { flex: 1; }
table.params-table { margin: 0.5rem 0 1rem; font-size: 0.86rem; box-shadow: none; border-radius: var(--radius-sm); }
table.params-table th { padding: 0.5rem 0.6rem; }
table.params-table td { padding: 0.4rem 0.5rem; }
table.params-table tbody tr:hover { background: transparent; }
table.params-table input { width: 100%; padding: 0.35rem 0.5rem; border: 1px solid var(--rule); background: var(--panel); font: inherit; font-family: var(--sans); border-radius: var(--radius-sm); color: var(--ink); }
table.params-table input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
table.params-table .btn { padding: 0.3rem 0.6rem; font-size: 0.74rem; }
#paramActions { margin: 0.5rem 0 0; padding: 0; border: none; }

/* ─── FIELDSET ────────────────────────────────────────────────────── */
fieldset.customfields {
  border: 1px solid var(--rule); padding: 0.4rem 1.25rem 1.2rem;
  margin: 1.5rem 0; border-radius: var(--radius); background: var(--panel);
}
fieldset.customfields legend {
  padding: 0 0.5rem; font-size: 0.74rem; font-weight: 600;
  color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em;
}

/* ─── MISC ────────────────────────────────────────────────────────── */
.muted { color: var(--muted); }
.error { color: var(--bad); }
.swatch { display: inline-block; width: 0.85rem; height: 0.85rem; vertical-align: middle; margin-right: 0.4rem; border: 1px solid rgba(0,0,0,0.1); border-radius: 2px; }
.actions.wrap { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.mt { margin-top: 1rem; }

pre.copy {
  background: var(--ink-soft); color: #d4dae4;
  padding: 0.85rem 1rem; font-family: var(--mono); font-size: 0.82rem;
  white-space: pre-wrap; word-break: break-all;
  border: 1px solid var(--ink-soft); border-radius: var(--radius-sm);
}
pre.copy::before { content: none; }

form.inline { display: inline-flex; gap: 0.4rem; align-items: center; margin: 0; }
form.inline select, form.inline input {
  padding: 0.4rem 0.55rem; border: 1px solid var(--rule);
  background: var(--panel); font: inherit; font-family: var(--sans);
  border-radius: var(--radius-sm); color: var(--ink);
}
form.inline select:focus, form.inline input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* ─── HISTORY ─────────────────────────────────────────────────────── */
ol.history { list-style: none; padding: 0; margin: 0; }
ol.history > li { padding: 0.85rem 0; border-bottom: 1px solid var(--rule-soft); position: relative; padding-left: 1rem; }
ol.history > li::before {
  content: ''; position: absolute; left: 0; top: 1.2rem;
  width: 5px; height: 5px; background: var(--accent); border-radius: 50%;
}
ol.history > li:last-child { border-bottom: none; }
.history-meta {
  display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--muted); margin-bottom: 0.35rem;
}
.history-meta .actor { color: var(--ink); font-weight: 500; }
ul.changes { margin: 0.4rem 0 0; padding-left: 1.2rem; font-size: 0.88rem; }
ul.changes code { font-family: var(--mono); background: var(--bg-soft); border: 1px solid var(--rule); padding: 0 0.3rem; font-size: 0.82em; border-radius: 3px; }

/* ─── REL LIST ────────────────────────────────────────────────────── */
ul.rel-list { list-style: none; padding: 0; margin: 0 0 1rem; }
ul.rel-list > li {
  padding: 0.55rem 0; border-bottom: 1px solid var(--rule-soft);
  display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap;
}
ul.rel-list > li:last-child { border-bottom: none; }

ul.inline-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.3rem; }

/* ─── AUTH ────────────────────────────────────────────────────────── */
.auth-card {
  max-width: 380px; margin: 5rem auto;
  padding: 2rem 2rem 1.75rem;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 12px rgba(16, 24, 40, 0.04);
}
.auth-card::before, .auth-card::after { content: none; }
.auth-card h1 {
  font-family: var(--sans); font-style: normal; font-weight: 700;
  font-size: 1.5rem; margin: 0 0 0.25rem; letter-spacing: -0.02em;
}
.auth-card h1::after { content: none; }
.auth-card p.muted { font-size: 0.85rem; margin: 0 0 1.5rem; }
.auth-card label {
  display: block; margin: 1rem 0 0.35rem;
  font-size: 0.78rem; font-weight: 500;
  color: var(--ink-soft); letter-spacing: -0.005em;
}
.auth-card input {
  display: block; width: 100%; padding: 0.5rem 0.7rem;
  border: 1px solid var(--rule);
  background: var(--panel); font: inherit; font-size: 0.92rem;
  font-family: var(--sans); border-radius: var(--radius-sm); color: var(--ink);
}
.auth-card input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.auth-card button {
  width: 100%; padding: 0.6rem;
  background: var(--accent); color: var(--accent-ink);
  border: 1px solid var(--accent); border-radius: var(--radius-sm);
  font-family: var(--sans); font-size: 0.88rem; font-weight: 500;
  cursor: pointer; margin-top: 1.25rem; transition: 0.12s;
}
.auth-card button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.auth-card .error { color: var(--bad); margin: 0 0 0.5rem; font-size: 0.82rem; font-weight: 500; }

/* ─── MOBILE TOP BAR & DRAWER ─────────────────────────────────────── */
.mobile-bar { display: none; }
.nav-backdrop { display: none; }
.nav-toggle {
  width: 40px; height: 40px; padding: 0;
  background: transparent; border: 1px solid var(--rule);
  border-radius: var(--radius-sm); cursor: pointer;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.nav-toggle span { display: block; width: 18px; height: 2px; background: var(--ink); }
.mobile-brand { font-weight: 700; font-size: 1rem; color: var(--ink); text-decoration: none; letter-spacing: -0.015em; }

/* ─── RESPONSIVE ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .mobile-bar {
    display: flex; align-items: center; gap: 0.75rem;
    position: fixed; top: 0; left: 0; right: 0; z-index: 40;
    height: 56px; padding: 0 1rem;
    background: var(--panel); border-bottom: 1px solid var(--rule);
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 50;
    width: 280px;
    box-shadow: 2px 0 24px rgba(11, 20, 36, 0.08);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-backdrop {
    display: block;
    position: fixed; inset: 0; z-index: 45;
    background: rgba(11, 20, 36, 0.4);
  }

  main.with-sidebar {
    margin-left: 0;
    padding: 5rem 1rem 3rem;
  }
  main { padding: 1rem; margin: 0; }

  .page-head {
    flex-direction: column; align-items: flex-start;
    margin-bottom: 1.25rem; padding-bottom: 0.85rem;
  }
  .page-head h1 { font-size: 1.4rem; }
  .head-actions { width: 100%; flex-wrap: wrap; }

  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.05rem; }

  .form .grid.two { grid-template-columns: 1fr; gap: 0.5rem 0; }
  .kv { grid-template-columns: 1fr; gap: 0.1rem 0; }
  .kv dt { margin-top: 0.6rem; }

  table.data {
    display: block; overflow-x: auto; white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  table.data th, table.data td { padding: 0.6rem 0.75rem; }

  .pv-grid { grid-template-columns: 1fr; }
  .extra-params.open { grid-template-columns: 1fr; }

  .search { flex-direction: column; max-width: none; }
  .search button { width: 100%; }

  .cards { grid-template-columns: 1fr; }

  .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .tab { white-space: nowrap; }

  .auth-card {
    margin: 2rem 1rem;
    padding: 1.5rem 1.25rem 1.25rem;
  }

  fieldset.params, fieldset.customfields { padding: 0.4rem 0.85rem 1rem; }
  table.params-table { font-size: 0.78rem; }
  table.params-table input { padding: 0.3rem 0.4rem; font-size: 0.82rem; }

  pre.copy { font-size: 0.74rem; padding: 0.7rem 0.85rem; }

  .actions { flex-wrap: wrap; }
  .actions .btn { flex: 1 1 auto; }
}

@media (max-width: 480px) {
  main.with-sidebar { padding: 4.5rem 0.85rem 2.5rem; }
  .page-head h1 { font-size: 1.25rem; }
  .btn { font-size: 0.78rem; padding: 0.45rem 0.7rem; }
  .side-cta { font-size: 0.78rem; }
}

/* ---- Picker (typeahead, MUI Autocomplete style) ----
   Mirrors MUI: outlined 1px border, 4px radius, focus = 2px primary,
   listbox = paper with shadow, options padded 6/16, selected highlight.
*/
.picker {
  position: relative;
  display: block;
}
.picker-input-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(0, 0, 0, 0.23);
  border-radius: 4px;
  padding: 6px 36px 6px 10px;            /* right room for end adornment */
  background: #fff;
  min-height: 40px;
  cursor: text;
  transition: border-color 120ms, box-shadow 120ms;
}
.picker-input-row:hover { border-color: rgba(0, 0, 0, 0.87); }
.picker-input-row:focus-within {
  border-color: #1976d2;
  box-shadow: inset 0 0 0 1px #1976d2;   /* mimic MUI 2px outline */
}
/* Override .form input styling — picker search is naked inside the box */
.form .picker .picker-search,
.picker .picker-search {
  flex: 1 1 6rem;
  min-width: 4rem;
  border: 0 !important;
  outline: none;
  padding: 4px 0 !important;
  margin: 0;
  width: auto;
  font: inherit;
  color: rgba(0, 0, 0, 0.87);
  background: transparent !important;
  border-radius: 0;
  box-shadow: none !important;
}
.form .picker .picker-search:focus,
.picker .picker-search:focus { border: 0 !important; box-shadow: none !important; }
.picker-search::placeholder { color: rgba(0, 0, 0, 0.6); }

/* End adornment: clear and popup-arrow buttons, absolute right */
.picker-end {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
}
.picker-end button {
  background: transparent;
  border: 0;
  color: rgba(0, 0, 0, 0.54);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  font-size: 14px;
  line-height: 1;
}
.picker-end button:hover { background: rgba(0, 0, 0, 0.04); color: rgba(0, 0, 0, 0.87); }
.picker-clear { visibility: hidden; }
.picker-input-row:hover .picker-clear,
.picker-input-row:focus-within .picker-clear { visibility: visible; }
.picker-single .picker-input-row:not(:has(input.picker-search:not([value=""]))) .picker-clear {
  visibility: hidden !important;
}
.picker-arrow svg {
  transition: transform 200ms;
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.picker:has(.picker-results:not(:empty)) .picker-arrow svg { transform: rotate(180deg); }

/* Chips inline within input row (multi-select only) */
.picker .chips-list { display: contents; }
.picker .chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.87);
  border-radius: 16px;
  padding: 0 4px 0 10px;
  font-size: 13px;
  line-height: 1;
  height: 24px;
  white-space: nowrap;
  max-width: calc(100% - 6px);
}
.picker .chip-label { overflow: hidden; text-overflow: ellipsis; }
.picker .chip-adhoc { background: rgba(245, 158, 11, 0.18); }
.picker .chip-x {
  background: transparent;
  border: 0;
  color: rgba(0, 0, 0, 0.4);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Hidden until the chip is hovered, so casual clicks on the chip body
     don't accidentally hit the × button. pointer-events also turned off
     so coordinate-based clicks pass through to the row. */
  visibility: hidden;
  pointer-events: none;
}
.picker .chip:hover .chip-x,
.picker .chip:focus-within .chip-x {
  visibility: visible;
  pointer-events: auto;
}
.picker .chip-x:hover { background: rgba(0, 0, 0, 0.16); color: rgba(0, 0, 0, 0.87); }

/* Dropdown (Paper + Listbox) */
.picker-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  background: #fff;
  border-radius: 4px;
  max-height: 40vh;
  overflow-y: auto;
  box-shadow:
    0 5px 5px -3px rgba(0, 0, 0, 0.2),
    0 8px 10px 1px rgba(0, 0, 0, 0.14),
    0 3px 14px 2px rgba(0, 0, 0, 0.12);
}
.picker-results:empty { display: none; }
.picker-results-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
}
.picker-results-list li button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 6px 16px;
  min-height: 36px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  color: rgba(0, 0, 0, 0.87);
}
.picker-results-list li button small { color: rgba(0, 0, 0, 0.6); margin-left: 4px; }
.picker-results-list li button:hover,
.picker-results-list li button:focus {
  background: rgba(0, 0, 0, 0.04);
  outline: none;
}
.picker-results-list li button[aria-selected="true"] {
  background: rgba(25, 118, 210, 0.08);
}

/* No-match / inline-add panel */
.picker-empty {
  padding: 12px 16px;
  font-size: 14px;
}
.picker-empty .muted { color: rgba(0, 0, 0, 0.6); margin-bottom: 8px; }
.picker-empty .error { color: #d32f2f; margin-bottom: 8px; font-size: 13px; }
.picker-add-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.picker-add-form input {
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid rgba(0, 0, 0, 0.23);
  border-radius: 4px;
  background: #fff;
}
.picker-add-form input:focus { border-color: #1976d2; outline: none; box-shadow: inset 0 0 0 1px #1976d2; }
.picker-add-form input[name=_add_in_name] { grid-column: 1 / -1; }
.picker-add-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}
.picker-add-actions .btn { font-size: 13px; padding: 6px 12px; }

/* ─── CUSTOMER PROFILE: profile + bookings sidebar ─────────────────── */
.profile-grid { display: block; }
.profile-side { margin-top: 0; }
.cust-bookings { list-style: none; padding: 0; margin: 0; max-height: 60vh; overflow-y: auto; border: 1px solid var(--rule-soft); border-radius: 6px; }
.cust-bookings li { border-top: 1px solid var(--rule-soft); }
.cust-bookings li:first-child { border-top: none; }
.cb-link { display: block; padding: 0.55rem 0.75rem; text-decoration: none; color: inherit; }
.cb-link:hover { background: var(--accent-soft, #f0f4ff); }
.cb-row { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.cb-row + .cb-row { margin-top: 0.15rem; }
.cb-date { font-size: 0.85rem; color: var(--ink); }
.cb-date small { color: var(--muted); }
.cb-svc { font-size: 0.92rem; font-weight: 500; }
.cb-price { font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.cb-team { font-size: 0.78rem; margin-top: 0.1rem; }

@media (min-width: 1100px) {
  .profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 1.25rem;
    align-items: start;
  }
  .profile-side { position: sticky; top: 1rem; }
  .cust-bookings { max-height: calc(100vh - 8rem); }
}

/* ─── BOOKING HISTORY: tighter event labels, comment styling ─────────── */
.hist-event { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.hist-body { margin-top: 0.15rem; }
.hist-comment {
  margin-top: 0.25rem; padding: 0.55rem 0.75rem;
  background: var(--accent-soft, #f0f4ff);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  white-space: pre-wrap;
}
.hist-comment::before { content: "💬 "; color: var(--accent); }

/* ─── BOOKING HISTORY: comment form ─────────────────────────────────── */
.comment-form { display: flex; gap: 0.5rem; align-items: flex-start; margin: 0 0 1rem; }
.comment-form textarea {
  flex: 1; padding: 0.5rem 0.7rem;
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  font: inherit; font-family: var(--sans); resize: vertical;
}
.comment-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.comment-form button { white-space: nowrap; }

/* ─── BOOKING HISTORY: comment edit/delete ──────────────────────────── */
.comment-actions { margin-left: auto; display: inline-flex; gap: 0.4rem; align-items: center; }
.comment-actions form.inline { display: inline; margin: 0; }
.btn-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: var(--accent); font-size: 0.78rem;
  text-decoration: underline; text-underline-offset: 2px;
}
.btn-link:hover { color: var(--accent-hover); }
.btn-link.danger { color: var(--bad); }
.btn-link.danger:hover { color: #8a1c12; }
.history-meta { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.comment-edit-form { margin-top: 0.4rem; }
.comment-edit-form textarea {
  width: 100%; padding: 0.5rem 0.7rem;
  border: 1px solid var(--rule); border-radius: var(--radius-sm);
  font: inherit; font-family: var(--sans); resize: vertical;
}
.comment-edit-form .actions { display: flex; justify-content: flex-end; gap: 0.4rem; margin-top: 0.4rem; }

.hist-edited { font-size: 0.72rem; color: var(--muted); margin-left: 0.4rem; }

/* ─── SCHEDULER ────────────────────────────────────────────────────── */
.sched-toolbar {
  display: flex; align-items: center; gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}
.sched-week-label { margin-left: 0.75rem; color: var(--muted); }

.sched-scroller {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.sched-grid {
  display: grid;
  grid-template-columns: 200px repeat(7, minmax(140px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 60vh;
  min-width: 1180px;
}
.sched-corner, .sched-day-head, .sched-row-head, .sched-cell {
  background: var(--panel);
  padding: 0.5rem 0.6rem;
}
.sched-day-head {
  font-weight: 600;
  font-size: 0.85rem;
  text-align: center;
  color: var(--ink-soft);
  position: sticky; top: 0; z-index: 2;
}
.sched-day-head.today, .sched-cell.today { background: var(--accent-soft); }
.sched-row-head {
  display: flex; align-items: center; gap: 0.45rem;
  flex-wrap: wrap;
  border-left: 3px solid var(--team-color, var(--rule));
  font-weight: 500;
}
.sched-row-head.foreign { background: #fff7ed; }
.sched-row-head .sched-row-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--team-color, var(--muted));
  display: inline-block;
}
.sched-row-head small { width: 100%; font-size: 0.7rem; }

.sched-cell {
  min-height: 70px;
  display: flex; flex-direction: column; gap: 0.3rem;
}
.sched-cell.drag-over { outline: 2px dashed var(--accent); outline-offset: -3px; }

.sched-chip {
  display: flex; flex-direction: column; gap: 1px;
  position: relative;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--team-color, var(--rule));
  background: color-mix(in srgb, var(--team-color, #94a3b8) 14%, var(--panel));
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.2;
  cursor: grab;
  text-decoration: none;
}
.sched-chip:hover { text-decoration: none; filter: brightness(0.97); }
.sched-chip.dragging { opacity: 0.5; }
.sched-chip.unassigned {
  border-color: var(--warn);
  background: color-mix(in srgb, var(--warn) 10%, var(--panel));
}
.sched-chip.pending-preview {
  background: transparent;
  border-style: dashed;
  border-color: var(--team-color, var(--muted));
  cursor: pointer;
}
.sched-chip.pending-preview .sched-chip-time,
.sched-chip.pending-preview .sched-chip-customer { color: var(--ink-soft); }
.sched-chip-time { font-family: var(--mono); font-weight: 500; color: var(--ink-soft); font-size: 0.74rem; }
.sched-chip-service { font-weight: 600; }
.sched-chip-customer { color: var(--muted); font-size: 0.72rem; }

.sched-chip-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border: 0; border-radius: 999px;
  background: var(--warn); color: white;
  font-size: 0.7rem; font-weight: 600;
  cursor: pointer; line-height: 18px;
}
.sched-chip-broadcast {
  position: absolute; bottom: 2px; right: 2px;
  width: 18px; height: 18px;
  border: 1px solid var(--rule); border-radius: 50%;
  background: white; color: var(--accent);
  font-size: 0.85rem; line-height: 14px;
  cursor: pointer;
}

.sched-unavail {
  display: block;
  padding: 0.25rem 0.4rem;
  margin-bottom: 0.25rem;
  font-size: 0.72rem;
  border: 1px dashed var(--muted);
  border-radius: var(--radius);
  background: repeating-linear-gradient(
    -45deg,
    rgba(148, 163, 184, 0.10) 0px,
    rgba(148, 163, 184, 0.10) 4px,
    rgba(148, 163, 184, 0.20) 4px,
    rgba(148, 163, 184, 0.20) 8px
  );
  color: var(--ink-soft);
}
.sched-unavail .sched-chip-time { font-size: 0.7rem; }
.sched-unavail-label { display: block; font-style: italic; }

.sched-chip.has-conflict {
  outline: 2px solid #f97316;
  outline-offset: -2px;
}
.sched-chip.has-conflict::after {
  content: "!";
  position: absolute; top: 2px; right: 2px;
  width: 14px; height: 14px;
  background: #f97316; color: white;
  border-radius: 50%;
  font-size: 0.7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* Portal week view: single-team grid — no row-head column, compact day-row. */
.sched-grid-portal {
  grid-template-columns: repeat(7, minmax(140px, 1fr));
  grid-auto-rows: min-content;
  min-width: 980px;
  min-height: 0;
}
.sched-grid-portal .sched-day-head {
  padding: 0.2rem 0.4rem;
  font-size: 0.72rem;
  line-height: 1.2;
  position: static;
}
.sched-grid-portal .sched-cell { min-height: 90px; }

.portal-week-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 900px) {
  .portal-week-layout { grid-template-columns: 1fr; }
}

.portal-cal {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.6rem 0.7rem;
  font-size: 0.8rem;
}
.portal-cal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.5rem;
}
.portal-cal-nav {
  padding: 0.1rem 0.5rem;
  text-decoration: none;
  color: var(--ink-soft);
  border-radius: var(--radius);
}
.portal-cal-nav:hover { background: var(--accent-soft); }
.portal-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.portal-cal-dow {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.15rem 0;
}
.portal-cal-day {
  text-align: center;
  padding: 0.3rem 0;
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.portal-cal-day:hover { background: var(--accent-soft); }
.portal-cal-day.oom { color: var(--muted); opacity: 0.55; }
.portal-cal-day.today { font-weight: 700; outline: 1px solid var(--accent); }
.portal-cal-day.in-week { background: var(--accent-soft); }

.sched-modal-host:empty { display: none; }
.sched-modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.sched-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(11, 20, 36, 0.4);
}
.sched-modal-card {
  position: relative; z-index: 1;
  background: var(--panel);
  border-radius: var(--radius);
  max-width: 520px; width: calc(100% - 2rem);
  max-height: 80vh; overflow: auto;
  padding: 1rem 1.25rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.sched-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.75rem;
}
.sched-modal-close {
  background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.sched-modal-list { list-style: none; padding: 0; margin: 0; }
.sched-modal-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--rule-soft);
}
.sched-modal-row:last-child { border-bottom: 0; }
.sched-modal-row-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.sched-modal-row-actions form { margin: 0; }
.sched-modal-note { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.8rem; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 500;
}
.badge-warn { background: #fef0c7; color: var(--warn); }
.page-head-meta { display: flex; align-items: center; gap: 0.6rem; }

.icon-field {
  margin: 0.25rem 0 0.5rem;
}
.icon-preview {
  position: relative;
  display: inline-block;
  padding: 4px;
  border: 1px solid var(--rule-soft);
  border-radius: 6px;
  background: #fff;
}
.icon-preview img { display: block; }
.icon-remove-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.icon-remove-btn:hover { background: var(--bg-soft); }

/* ---- Chat -------------------------------------------------------------- */
.chat-page { display: grid; grid-template-columns: 260px 1fr; gap: 1rem; align-items: start; }
@media (max-width: 720px) { .chat-page { grid-template-columns: 1fr; } }
.chat-rail { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; padding: 0.5rem; }
.chat-rail-head { padding: 0.25rem 0.5rem 0.4rem; }
.chat-rail-head h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; margin: 0; color: var(--muted); }
.chat-conv-list { list-style: none; margin: 0 0 0.5rem; padding: 0; }
.chat-conv a { display: flex; flex-direction: column; padding: 0.4rem 0.55rem; border-radius: 6px; text-decoration: none; color: var(--ink); }
.chat-conv a:hover { background: var(--bg-soft); }
.chat-conv.active a { background: var(--bg-soft); }
.chat-conv.unread .chat-conv-name { font-weight: 600; }
.chat-conv-name { font-size: 0.95rem; }
.chat-conv-preview { color: var(--muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-conv-role { font-size: 0.72rem; }
.chat-conv-badge {
  align-self: flex-end;
  background: #2563eb; color: #fff; font-size: 0.72rem;
  border-radius: 999px; padding: 0 0.45rem; min-width: 1.1rem; text-align: center;
}
.chat-thread { background: var(--panel); border: 1px solid var(--rule); border-radius: 8px; display: flex; flex-direction: column; min-height: 60vh; }
.chat-empty { padding: 2rem; }
.chat-thread-head { padding: 0.75rem 1rem; border-bottom: 1px solid var(--rule-soft); display: flex; gap: 0.5rem; align-items: baseline; }
.chat-thread-head h1 { margin: 0; font-size: 1.05rem; }
.chat-bubbles { list-style: none; margin: 0; padding: 1rem; flex: 1; overflow-y: auto; max-height: 60vh; }
.chat-bubble { margin: 0.35rem 0; max-width: 75%; padding: 0.5rem 0.7rem; border-radius: 12px; }
.chat-bubble.me   { margin-left: auto; background: #dbeafe; }
.chat-bubble.them { margin-right: auto; background: var(--bg-soft); }
.chat-bubble.kind-booking_forward { background: #fff7ed; border: 1px dashed #f59e0b; }
.chat-bubble .chat-body { white-space: pre-wrap; word-break: break-word; }
.chat-time { display: block; font-size: 0.7rem; color: var(--muted); margin-top: 0.25rem; }
.chat-system { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.chat-system-label { font-weight: 600; color: #92400e; }
.chat-send { display: flex; gap: 0.5rem; padding: 0.75rem; border-top: 1px solid var(--rule-soft); }
.chat-send textarea { flex: 1; resize: vertical; min-height: 2.2rem; }
.btn.small { padding: 0.15rem 0.5rem; font-size: 0.8rem; }
.chat-badge {
  display: inline-block; min-width: 1.1rem; padding: 0 0.4rem;
  border-radius: 999px; font-size: 0.7rem; line-height: 1.3;
  background: transparent; color: transparent;
}
.chat-badge.badge-on { background: #2563eb; color: #fff; }
.nav-item .chat-badge { margin-left: 0.4rem; }
