/* Defeem Group of Companies — corporate theme, built around the Feem brand purple (#8B3893). */
:root {
  --brand: #8b3893;        /* logo purple */
  --brand-deep: #5a1f66;   /* headers, emphasis */
  --brand-ink: #3a1442;
  --bg: #f5f4f7;
  --surface: #ffffff;
  --surface-2: #f3f1f5;
  --text: #221c27;
  --muted: #6a6372;
  --border: #e2dee7;
  --line: #eeebf1;
  --accent: #7b2d86;       /* buttons/links: brand purple, darkened for contrast with white text */
  --accent-text: #ffffff;
  --danger: #b42318;
  --ok: #1f7a4d;
  --now: #d92d20;
  --radius: 8px;
  --px-per-min: 1.1px;
  --time-w: 56px;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #c37ccc;
    --brand-deep: #2a1430;
    --brand-ink: #e9d5ee;
    --bg: #141116;
    --surface: #1d1920;
    --surface-2: #26212a;
    --text: #ece8ef;
    --muted: #a59dad;
    --border: #352e3a;
    --line: #2a242e;
    --accent: #c98bd3;
    --accent-text: #1b0f1f;
    --danger: #f97066;
    --ok: #47c48a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }

/* Header: brand stripe + logo + company name */
header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 28px; background: var(--surface);
  border-top: 4px solid var(--brand); border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(34, 28, 39, .06);
}
header.top h1 { font-size: 18px; margin: 0; }
header.top nav a { text-decoration: none; font-size: 14px; }
.brand { display: flex; align-items: center; gap: 16px; text-decoration: none; color: inherit; min-width: 0; }
.brand .logo { height: 40px; width: auto; display: block; }
.brand-text { display: grid; gap: 1px; padding-left: 16px; border-left: 1px solid var(--border); min-width: 0; }
.brand-text .company {
  font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--brand);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-text h1 { font-size: 18px; font-weight: 600; color: var(--text); letter-spacing: -.01em; white-space: nowrap; }
@media (prefers-color-scheme: dark) { .brand .logo { content: url("logo-white.png"); } }

main { padding: 16px 20px 40px; max-width: 1400px; margin: 0 auto; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.toolbar h2 { font-size: 17px; margin: 0 8px; min-width: 200px; }

button, .btn {
  font: inherit; font-size: 14px; padding: 7px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
button:hover { background: var(--surface-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
button:disabled { opacity: .5; cursor: default; }

.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented button { border: 0; border-radius: 0; }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

input, select, textarea {
  font: inherit; font-size: 14px; padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); width: 100%;
}
.toolbar input, .toolbar select { width: auto; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

/* ---------- Calendar ---------- */
.calendar {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow-x: auto;
}
.cal-grid { display: grid; min-width: fit-content; }
.cal-head {
  position: sticky; top: 0; z-index: 3; background: var(--surface);
  padding: 10px 8px; border-bottom: 1px solid var(--border); border-left: 1px solid var(--line);
  font-weight: 600; font-size: 14px; text-align: center;
}
.cal-head small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 2px; }
.cal-head.today { color: var(--accent); }
.cal-head .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
.cal-corner { border-bottom: 1px solid var(--border); }

.time-col { position: relative; }
.time-col span {
  position: absolute; right: 8px; transform: translateY(-50%);
  font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.day-col {
  position: relative; border-left: 1px solid var(--line); cursor: copy;
  background-image:
    linear-gradient(to bottom, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 100% calc(60 * var(--px-per-min)), 100% calc(30 * var(--px-per-min));
}
.day-col.past { background-color: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.day-col .hover-slot {
  position: absolute; left: 3px; right: 3px; border-radius: 6px; pointer-events: none;
  background: color-mix(in srgb, var(--accent) 14%, transparent); border: 1px dashed var(--accent);
  font-size: 12px; color: var(--accent); padding: 2px 6px; display: none;
}
.day-col:hover .hover-slot.on { display: block; }

.booking {
  position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: 3px 7px;
  font-size: 12px; line-height: 1.3; overflow: hidden; cursor: pointer; z-index: 2;
  color: #fff; border-left: 4px solid rgba(0,0,0,.25);
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.booking:hover { filter: brightness(1.08); }
.booking strong { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.booking .meta { opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.booking.mine { outline: 2px solid var(--text); outline-offset: -2px; }

.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--now); z-index: 4; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--now); }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; color: var(--muted); font-size: 13px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Dialogs ---------- */
dialog {
  border: 1px solid var(--border); border-radius: 14px; padding: 0; width: min(440px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgba(10, 14, 22, .45); }
dialog form, dialog .body { padding: 20px; }
dialog h3 { margin: 0 0 14px; font-size: 17px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
dialog .actions .left { margin-right: auto; }
.error { color: var(--danger); font-size: 14px; min-height: 1.2em; margin: 4px 0 0; }
.detail-list { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; }

/* ---------- Dashboard ---------- */
main.dash { max-width: 1500px; }
.muted { color: var(--muted); }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.panel-head h2 { font-size: 15px; margin: 0; }
.panel-head .muted { font-size: 13px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04); min-width: 0; position: relative; overflow: hidden;
}
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent); opacity: .85; }
.kpi.free::before { background: var(--ok); }
.kpi.busy::before { background: var(--now); }
.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover { border-color: var(--accent); }
.kpi-label { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kpi-value { font-size: 24px; font-weight: 700; margin: 6px 0 2px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; }
.status-pill i { width: 12px; height: 12px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); }
.kpi.busy .status-pill i, .busy > .status-pill i { background: var(--now); box-shadow: 0 0 0 4px color-mix(in srgb, var(--now) 20%, transparent); }
.kpi.free .kpi-value { color: var(--ok); }
.kpi.busy .kpi-value { color: var(--now); }
.status-pill.small { font-size: 14px; font-weight: 600; gap: 6px; }
.status-pill.small i { width: 8px; height: 8px; box-shadow: none; }
.room-status-list { display: grid; gap: 4px; margin-top: 6px; font-size: 13px; }
.room-status-list > div { display: flex; justify-content: space-between; gap: 8px; }
.meter { height: 8px; border-radius: 999px; background: var(--surface-2); margin-top: 10px; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

.dash-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.cal-panel .calendar { border-radius: 10px; }
.cal-panel .toolbar { margin-bottom: 12px; }
.side { display: grid; gap: 16px; position: sticky; top: 16px; }

.agenda { display: grid; gap: 8px; }
.agenda-item {
  display: grid; grid-template-columns: 4px 52px 1fr; gap: 10px; align-items: start; text-align: left;
  padding: 10px 12px 10px 0; border-radius: 10px; background: var(--surface-2); border: 1px solid transparent;
  width: 100%; overflow: hidden;
}
.agenda-item:hover { border-color: var(--border); background: var(--surface-2); }
.agenda-item.mine { border-color: var(--accent); }
.agenda-item.done { opacity: .55; }
.agenda-item.now { background: color-mix(in srgb, var(--now) 8%, var(--surface)); border-color: color-mix(in srgb, var(--now) 40%, transparent); }
.agenda-bar { align-self: stretch; border-radius: 0 4px 4px 0; }
.agenda-time { display: grid; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.agenda-time strong { color: var(--text); font-size: 14px; }
.agenda-body { display: grid; gap: 2px; min-width: 0; font-size: 13px; color: var(--muted); }
.agenda-body > strong { color: var(--text); font-size: 14px; display: flex; align-items: center; gap: 6px; }
.tag { font-style: normal; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--border); color: var(--muted); }
.tag.now { background: var(--now); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.chip.equip { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
.chip.internal { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 45%, transparent); color: var(--ok); font-weight: 600; }
.chip.external { background: color-mix(in srgb, #c2702b 14%, var(--surface)); border-color: color-mix(in srgb, #c2702b 50%, transparent); color: #b5651d; font-weight: 600; }
.equip-today { display: grid; gap: 8px; }
.equip-row { display: grid; gap: 2px; font-size: 13px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.equip-row:last-child { border-bottom: 0; padding-bottom: 0; }
.equip-name { font-weight: 600; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.equip-name .count { font-size: 12px; color: var(--accent); }
.empty.small { padding: 14px 4px; margin: 0; font-size: 14px; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-main { grid-template-columns: 1fr; }
  .side { position: static; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}

/* ---------- Equipment checkboxes ---------- */
fieldset.equip { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
fieldset.equip legend { font-size: 13px; color: var(--muted); padding: 0; margin-bottom: 6px; }
fieldset.equip legend span { opacity: .8; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label {
  display: inline-flex; align-items: center; gap: 6px; margin: 0; cursor: pointer;
  font-size: 14px; color: var(--text); padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
}
.checks input { width: auto; margin: 0; accent-color: var(--accent); }
.checks label:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.booking .equip-line { opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-style: italic; }

/* ---------- Sign-in ---------- */
.user-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.user-nav button { padding: 5px 12px; font-size: 13px; }
.user-nav a { margin-left: 4px; }
.who { font-size: 14px; }
.who small { color: var(--muted); margin-left: 4px; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
label .opt { opacity: .75; }
.checks input[type="radio"] { width: auto; margin: 0; accent-color: var(--accent); }
.booked-as { font-size: 14px; color: var(--muted); margin: 0 0 4px; }
.booked-as strong { color: var(--text); font-weight: 600; }
dialog.wide { width: min(560px, calc(100vw - 32px)); }
.mine-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.mine-item .dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.mine-item .info { flex: 1; min-width: 0; font-size: 14px; }
.mine-item .info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-item .info span { color: var(--muted); font-size: 13px; }
.mine-item button { padding: 5px 10px; font-size: 13px; }

/* ---------- Admin ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card h2 { margin: 0 0 14px; font-size: 17px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
td.actions { white-space: nowrap; text-align: right; }
td.actions button { padding: 5px 10px; font-size: 13px; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge.on { color: var(--ok); }
input[type="color"] { padding: 2px; height: 36px; width: 60px; }
.table-wrap { overflow-x: auto; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 8px; font-size: 14px;
  transition: all .2s; pointer-events: none; z-index: 100; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--danger); color: #fff; }

/* ---------- Phone-only pieces (hidden on desktop) ---------- */
.day-strip, .fab, .phone-only { display: none; }

/* ---------- Phone layout ---------- */
@media (max-width: 640px) {
  :root { --px-per-min: 1.5px; --time-w: 46px; }   /* taller slots = easier to tap */
  body { font-size: 16px; }
  header.top, main { padding-left: 16px; padding-right: 16px; }
  header.top {
    flex-wrap: wrap; position: sticky; top: 0; z-index: 10;
    padding-top: calc(10px + env(safe-area-inset-top)); padding-bottom: 10px;
  }
  header.top h1 { font-size: 17px; }
  .user-nav { gap: 6px; }
  .who small { display: block; margin: 0; font-size: 12px; }
  main { padding-top: 12px; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

  /* Toolbar: title on top, then ‹ Today › and the date picker; the floating button replaces "+ New booking". */
  .toolbar { gap: 6px; margin-bottom: 10px; }
  .toolbar h2 { min-width: 0; width: 100%; order: -2; margin: 0 0 2px; font-size: 18px; }
  #newBooking, .toolbar .spacer { display: none; }
  .toolbar .segmented { display: flex; width: 100%; order: -1; }
  .toolbar .segmented button { flex: 1; min-height: 40px; }
  .toolbar button { min-height: 40px; min-width: 40px; }
  .toolbar input[type="date"] { flex: 1; min-height: 40px; }
  .toolbar select { flex: 1 1 100%; min-height: 40px; }

  /* Mon–Fri day strip */
  .day-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 12px; }
  .day-chip {
    display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 0 4px;
    border-radius: 12px; min-height: 58px;
  }
  .day-chip .dow { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
  .day-chip .dnum { font-size: 18px; font-weight: 600; }
  .day-chip .dots { font-size: 11px; line-height: 10px; height: 10px; color: var(--accent); letter-spacing: 1px; }
  .day-chip.today .dnum { color: var(--accent); }
  .day-chip.selected { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
  .day-chip.selected .dow, .day-chip.selected .dots, .day-chip.selected .dnum { color: var(--accent-text); }

  .cal-head { padding: 8px 6px; }
  .time-col span { right: 6px; font-size: 11px; }
  .booking { padding: 4px 8px; font-size: 13px; }
  .booking strong { font-size: 14px; }

  /* Floating "+" book button */
  .fab {
    display: grid; place-items: center; position: fixed; z-index: 20;
    right: 18px; bottom: calc(18px + env(safe-area-inset-bottom));
    width: 58px; height: 58px; border-radius: 50%; padding: 0;
    font-size: 30px; line-height: 1; font-weight: 300;
    background: var(--accent); color: var(--accent-text); border: 0;
    box-shadow: 0 6px 18px rgba(0,0,0,.28);
  }
  .fab:hover { background: var(--accent); filter: brightness(1.08); }

  .desk-only { display: none; }
  .phone-only { display: inline; }
  .legend { font-size: 13px; }

  /* Dialogs become bottom sheets */
  dialog {
    width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 18px 18px 0 0;
    max-height: 92vh; overflow-y: auto; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  dialog.wide { width: 100%; }
  dialog form, dialog .body { padding: 18px 16px 20px; }
  dialog .actions button { flex: 1; min-height: 46px; font-size: 16px; }
  dialog .actions .left { flex: 1 1 100%; order: 2; }
  dialog .actions { flex-wrap: wrap; }
  /* 16px inputs stop iPhones zooming in when a field is tapped */
  input, select, textarea { font-size: 16px; min-height: 44px; }
  input[type="checkbox"] { min-height: 0; }
  .checks label { padding: 9px 14px; font-size: 15px; }

  /* Dashboard on phones: status card full width, others 2-up; calendar panel loses its frame */
  .kpis { gap: 10px; margin-bottom: 12px; }
  .kpis .kpi:first-child, .kpis .kpi:last-child { grid-column: 1 / -1; }
  .kpi { padding: 12px 14px; }
  .kpi-value { font-size: 19px; }
  .kpis .kpi:first-child .kpi-value { font-size: 22px; }
  .kpi-sub { font-size: 12.5px; white-space: normal; }
  .cal-panel { padding: 0; border: 0; background: transparent; box-shadow: none; }
  .side { grid-template-columns: 1fr; }

  /* Admin page */
  .card { padding: 16px; }
  .toolbar input[type="search"] { width: 100% !important; flex: 1 1 100%; order: 5; }
  th, td { padding: 9px 6px; }
}

/* =====================================================================
   Corporate refinements (Defeem). Kept last so they override the base.
   ===================================================================== */
main, main.dash { padding: 22px 28px 40px; }
button, .btn { border-radius: 6px; font-weight: 500; }
.btn { display: inline-block; text-decoration: none; }
button.primary:hover { filter: none; background: var(--brand-deep); border-color: var(--brand-deep); }
@media (prefers-color-scheme: dark) { button.primary:hover { background: var(--brand); border-color: var(--brand); } }
input:focus, select:focus, textarea:focus, button:focus-visible, .btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; border-color: var(--accent);
}
label { font-weight: 500; }

/* Cards & panels: square-ish, quiet shadows */
.panel, .kpi, .card { border-radius: 10px; box-shadow: 0 1px 2px rgba(34, 28, 39, .05), 0 1px 1px rgba(34, 28, 39, .03); }
.kpi { padding: 16px 18px; }
.kpi::before { width: 3px; background: var(--brand); }
.kpi-label { font-size: 11.5px; letter-spacing: .08em; color: var(--muted); }
.kpi-value { font-size: 23px; font-weight: 600; letter-spacing: -.01em; }
.panel-head { border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 12px; }
.panel-head h2 {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--brand-ink);
  display: flex; align-items: center; gap: 8px;
}
.panel-head h2::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--brand); }
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--brand-ink); }

/* Toolbar & calendar */
.toolbar h2 { font-weight: 600; letter-spacing: -.01em; }
.segmented { border-radius: 6px; }
.calendar { border-radius: 8px; }
.cal-head { background: var(--surface-2); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-ink); }
.cal-head small { text-transform: none; letter-spacing: 0; }
.cal-head.today { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.cal-corner { background: var(--surface-2); }
.booking { border-radius: 4px; border-left-width: 3px; box-shadow: 0 1px 2px rgba(0,0,0,.18); }
.agenda-item { border-radius: 8px; }
.chip { border-radius: 4px; }

/* Dialogs */
dialog { border-radius: 10px; }
dialog h3 { color: var(--brand-ink); padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.checks label { border-radius: 6px; }

/* Footer */
.site-footer {
  text-align: center; font-size: 12.5px; color: var(--muted); padding: 18px 16px 28px;
  border-top: 1px solid var(--border); margin-top: 8px;
}

/* Phone */
@media (max-width: 640px) {
  header.top { padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); gap: 10px; }
  .brand { gap: 10px; }
  .brand .logo { height: 28px; }
  .brand-text { padding-left: 10px; }
  .brand-text .company { font-size: 9.5px; letter-spacing: .08em; }
  .brand-text h1 { font-size: 15px; }
  main, main.dash { padding: 14px 16px calc(96px + env(safe-area-inset-bottom)); }
  dialog { border-radius: 14px 14px 0 0; }
  .site-footer { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
}

/* Calendar toolbar on desktop: title + New booking on the first row, controls underneath */
.toolbar .break { display: none; }
@media (min-width: 641px) {
  .cal-panel .toolbar h2 { order: -3; flex: 1 1 auto; margin: 0; font-size: 18px; min-width: 0; }
  .cal-panel .toolbar #newBooking { order: -2; }
  .cal-panel .toolbar .break { display: block; order: -1; flex-basis: 100%; height: 4px; }
  .cal-panel .toolbar .spacer { display: none; }
}

/* Office access code dialog */
.access-dialog { width: min(400px, calc(100vw - 32px)); border-top: 4px solid var(--brand); }
.access-dialog::backdrop { background: color-mix(in srgb, var(--brand-ink) 75%, black); }
.access-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.access-brand .logo { height: 34px; width: auto; }
.access-brand span { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); }
.access-dialog .actions button { min-width: 120px; }
@media (prefers-color-scheme: dark) { .access-brand .logo { content: url("logo-white.png"); } }
@media (max-width: 640px) { .access-dialog { margin: auto; border-radius: 12px; width: calc(100vw - 32px); } }

/* ---------- Month view ---------- */
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-width: 640px; }
.month-dow {
  padding: 8px 10px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-ink);
}
.month-dow.weekend { color: var(--muted); }
.month-cell {
  min-height: 112px; padding: 6px; display: flex; flex-direction: column; gap: 3px; cursor: copy;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0;
}
.month-cell:nth-child(7n) { border-right: 0; }
.month-cell:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.month-cell.weekend { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.month-cell.past { cursor: pointer; }
.month-cell.out .month-date { color: color-mix(in srgb, var(--muted) 60%, transparent); }
.month-date {
  align-self: flex-start; border: 0; background: none; padding: 2px 6px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; line-height: 1.4;
}
.month-date:hover { background: var(--surface-2); }
.month-cell.today .month-date { background: var(--accent); color: var(--accent-text); }
.month-item {
  display: flex; gap: 5px; align-items: baseline; width: 100%; min-width: 0; text-align: left;
  border: 0; border-left: 3px solid var(--c, var(--accent)); border-radius: 3px; padding: 2px 5px;
  background: color-mix(in srgb, var(--c, var(--accent)) 12%, var(--surface)); color: var(--text);
  font-size: 12px; font-weight: 400; cursor: pointer;
}
.month-item:hover { background: color-mix(in srgb, var(--c, var(--accent)) 22%, var(--surface)); }
.month-item.mine { outline: 1px solid var(--c, var(--accent)); }
.month-item.done { opacity: .55; }
.mi-time { font-variant-numeric: tabular-nums; color: var(--muted); flex: 0 0 auto; font-size: 11.5px; }
.mi-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.month-more { border: 0; background: none; padding: 1px 5px; font-size: 12px; color: var(--accent); text-align: left; cursor: pointer; font-weight: 600; }
.month-more:hover { text-decoration: underline; }

/* ---------- Multi-day bookings ---------- */
.inline-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); margin: -4px 0 12px; cursor: pointer; }
.inline-check input { width: auto; margin: 0; accent-color: var(--accent); }
.series-hint { margin: -4px 0 10px; color: var(--accent); font-weight: 500; }
.day-tag {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; padding: 0 6px; border-radius: 999px;
  background: rgba(255,255,255,.25); margin-left: 4px; vertical-align: 1px;
}
.month-item .day-tag, .agenda-item .day-tag, .mine-item .day-tag { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
dialog .actions .left + .left { margin-left: 0; }
@media (max-width: 640px) { #toDateWrap { min-width: 0; } }
.day-tag { white-space: nowrap; }
.month-item .day-tag { flex: 0 0 auto; margin-left: auto; padding: 0 5px; }

/* ---------- Phone Week (list by day) & Month (dots grid) ---------- */
.calendar.as-list { background: transparent; border: 0; overflow: visible; }
.pw-list { display: grid; gap: 10px; }
.pw-day {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px;
  display: grid; gap: 8px;
}
.pw-day.today { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.pw-day.past { opacity: .6; }
.pw-head {
  display: flex; align-items: baseline; gap: 6px; width: 100%; border: 0; background: none; padding: 2px 2px 0;
  text-align: left; color: var(--text); min-height: 0;
}
.pw-dow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--brand-ink); }
.pw-date { font-size: 20px; font-weight: 700; }
.pw-month { font-size: 13px; color: var(--muted); }
.pw-count { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.pw-day.today .pw-dow, .pw-day.today .pw-date { color: var(--accent); }
.pw-book {
  border: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent); background: transparent; color: var(--accent);
  border-radius: 8px; padding: 9px; font-size: 14px; font-weight: 600; width: 100%;
}
.pm-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 6px; margin-bottom: 10px;
}
.pm-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.pm-cell {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 5px; min-height: 48px;
  border: 0; border-radius: 8px; background: none; color: var(--text);
}
.pm-cell.out { color: color-mix(in srgb, var(--muted) 55%, transparent); }
.pm-cell.past .pm-num { opacity: .6; }
.pm-num { font-size: 15px; font-weight: 600; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; }
.pm-cell.today .pm-num { color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.pm-cell.selected .pm-num { background: var(--accent); color: var(--accent-text); box-shadow: none; }
.pm-dots { display: flex; gap: 3px; height: 6px; align-items: center; }
.pm-dots i { width: 6px; height: 6px; border-radius: 50%; display: block; }
.pm-dots b { font-size: 10px; line-height: 6px; color: var(--accent); }
.pm-day-head { font-weight: 700; color: var(--brand-ink); padding: 2px; }
