/* Werkstatt 76 Plans on top of the kit (team/kit/static/css/base.css + kit.css): the calendar
   shell, the time grid, month, agenda, the event panel, Find a time and Booking pages.
   Event colours are the calendar's colour as a light tint with a solid bar on the left and
   ink text, so text keeps its contrast in light and dark (the tint mixes into the paper). */

:root {
  --gutter: 52px;
  --hour: max(48px, calc((100dvh - 230px) / 15));
  --bar-h: 64px;
  --tabs-h: 60px;
  --panel-w: 460px;
  --now: #C6372B;
  --tint: 16%;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --now: #F07B6A; --tint: 30%; } }
:root[data-theme="dark"] { --now: #F07B6A; --tint: 30%; }

/* ---- shell -------------------------------------------------------------------------- */
.shell {
  height: 100%; display: grid; grid-template-columns: var(--rail) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr); position: relative;
}
.scrim { display: none; }
.only-wide { display: inline-flex; }
.only-narrow-block { display: none; }

.rail {
  position: relative; display: flex; flex-direction: column; gap: 2px; padding: 18px 14px 12px;
  background: var(--wall); overflow-y: auto; overscroll-behavior: contain; min-height: 0;
}
.rail::after {
  content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 6px;
  background: var(--pencil-v) repeat-y 0 0 / 6px 480px; filter: var(--stroke-filter); opacity: 0.6; pointer-events: none;
}
.rail-brand { display: flex; align-items: center; padding: 0 6px 14px; min-height: 44px; }
.rail-new { margin-bottom: 14px; min-height: 44px; }
.rail-h {
  display: block; padding: 0 10px 4px; font-family: var(--font-form); font-weight: 700; font-size: 0.8125rem;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted);
}
.rail-group { padding: 12px 0 0; }
.rail-pages { margin-top: 4px; border-top: 1px solid var(--rule); padding-top: 10px; }
.rail-link, .cal-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 0 10px;
  border: 0; background: transparent; color: var(--ink); text-align: left; font-weight: 500;
}
@media (min-width: 1000px) and (pointer: fine) { .rail-link, .cal-row { min-height: 36px; } }
.rail-link:hover, .cal-row:hover { background: var(--hover); }
.rail-link.is-current { background: var(--kraft-light); font-weight: 700; }
.cal-box {
  display: inline-grid; place-items: center; width: 20px; height: 20px; flex: none;
  border: 2px solid var(--c); color: transparent; font-size: 0.8rem; background: transparent;
}
.cal-row.is-on .cal-box { background: var(--c); color: var(--on-solid); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cal-box { border-color: color-mix(in srgb, var(--c) 70%, white); } }
:root[data-theme="dark"] .cal-box { border-color: color-mix(in srgb, var(--c) 70%, white); }
.cal-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-list { display: grid; }
.rail-foot {
  position: relative; margin-top: auto; display: flex; align-items: center; gap: 4px; padding: 14px 0 0 10px;
}
.rail-foot::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px;
  background: var(--pencil-light) repeat-x 0 0 / 480px 6px; filter: var(--stroke-filter);
}
.rail-foot .account-btn { margin-left: -6px; }
.rail-address {
  flex: 1; margin: 0; font-family: var(--font-form); font-size: 0.875rem; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rail-views { padding-bottom: 6px; }

/* the app switcher at the top of the rail, as in the webmail */
.apps-rail { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 0 0 14px; border: 1.5px solid var(--ink); }
.apps-rail .apps-link {
  flex-direction: column; justify-content: center; gap: 2px; min-height: 52px; padding: 4px 0; border: 0;
  font-family: var(--font-form); font-size: 0.75rem;
}
.apps-rail .apps-link + .apps-link { border-left: 1px solid var(--rule); }
.apps-rail .apps-link .icon { font-size: 1.2rem; }
.apps-rail .apps-link.is-current { background: var(--solid); color: var(--on-solid); }

/* mini month */
.mm { padding: 4px 0 0; font-family: var(--font-form); }
.mm-head { display: flex; align-items: center; padding: 0 0 4px 10px; }
.mm-title { flex: 1; min-width: 0; font-weight: 700; font-size: 0.9375rem; font-family: var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mm-head .btn-icon.btn-small { width: 36px; }
.mm-row { display: grid; grid-template-columns: repeat(7, 1fr); }
.mm-dow { text-align: center; font-size: 0.75rem; color: var(--muted); padding: 2px 0; }
.mm-day {
  height: 28px; border: 0; padding: 0; background: transparent; color: var(--ink);
  font-family: var(--font-form); font-size: 0.875rem; font-variant-numeric: tabular-nums;
}
.mm-day:hover { background: var(--hover); }
.mm-day.is-out { color: var(--muted); opacity: 0.7; }
.mm-day.is-sel { background: var(--kraft-light); }
.mm-day.is-today { background: var(--solid); color: var(--on-solid); font-weight: 700; }

/* ---- main column ------------------------------------------------------------------- */
.main {
  min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--sheet);
  box-shadow: -8px 0 24px -16px rgba(54, 40, 26, 0.35);
}
.bar {
  position: relative; display: flex; align-items: center; gap: 6px; min-height: var(--bar-h);
  padding: 10px 16px 10px 22px; z-index: 3;
}
.bar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 6px;
  background: var(--pencil) repeat-x 0 0 / 480px 6px; filter: var(--stroke-filter); opacity: 0.7; pointer-events: none;
}
.bar-title {
  margin: 0 8px 0 0; font-size: var(--step-2); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.title-short { display: none; }
.bar-arrows { display: inline-flex; }
.bar-today { margin-left: 4px; }
.bar-busy { width: 18px; height: 3px; background: transparent; }
.bar-busy.is-on { background: linear-gradient(90deg, transparent, var(--kraft), transparent) 0 0 / 200% 100%;
                  animation: sheen 1s linear infinite; }
.view-switch { margin-left: 8px; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.view > * { flex: 1; min-height: 0; }

/* segmented choice: printed boxes side by side */
.seg { display: inline-flex; border: 1.5px solid var(--ink); }
.seg-btn {
  min-height: 36px; padding: 0 14px; border: 0; background: transparent; color: var(--ink);
  font-weight: 600; font-size: var(--step--1); white-space: nowrap;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--rule); }
.seg-btn:hover { background: var(--hover); }
.seg-btn.is-on { background: var(--solid); color: var(--on-solid); }
.seg-wide { display: grid; grid-template-columns: repeat(3, 1fr); }
.seg-wrap { flex-wrap: wrap; }
.field > .seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.field > .seg .seg-btn { padding: 0 6px; }
.seg-cal { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.field-pair.dt-pair { grid-template-columns: minmax(0, 1fr); gap: 14px; }
.dt > .field-input { flex: 1 1 0; }
.time-wrap { flex: 0 0 132px; }

/* ---- time grid ---------------------------------------------------------------------- */
.tg-scroll { overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; position: relative; }
.tg-switch { min-height: 100%; }
.tg { --n: 7; }
.tg-row { display: grid; grid-template-columns: var(--gutter) repeat(var(--n), minmax(0, 1fr)); }
.tg-top { position: sticky; top: 0; z-index: 4; background: var(--sheet); box-shadow: 0 1px 0 var(--rule); }
.tg-head { min-height: 56px; }
.tg-head-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  min-width: 0; padding: 6px 2px; border: 0; background: transparent; color: var(--ink);
}
button.tg-head-cell:hover { background: var(--hover); }
.tg-dow { font-family: var(--font-form); font-size: 0.8125rem; color: var(--muted); letter-spacing: 0.03em; }
.tg-dom {
  display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 4px;
  font-family: var(--font-form); font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.tg-head-cell.is-today .tg-dow { color: var(--ink); font-weight: 700; }
.tg-head-cell.is-today .tg-dom { background: var(--solid); color: var(--on-solid); }
.tg-head-person { flex-direction: row; gap: 8px; }
.tg-person { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tg-gutter-label {
  display: flex; align-items: center; justify-content: flex-end; padding-right: 8px;
  font-family: var(--font-form); font-size: 0.75rem; color: var(--muted);
}
.tg-allday { border-top: 1px solid var(--rule); padding: 4px 0; }
.tg-allday-cell { display: grid; gap: 2px; padding: 0 2px; min-width: 0; align-content: start; }
.tg-note {
  padding: 8px 12px 8px calc(var(--gutter) + 8px); border-top: 1px solid var(--rule);
  color: var(--muted); font-size: var(--step--1);
}
.tg-body { position: relative; height: calc(24 * var(--hour)); }
.tg-gutter { position: relative; }
.tg-hour {
  position: absolute; right: 8px; transform: translateY(-50%); font-family: var(--font-form);
  font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1;
}
.tg-col {
  position: relative; min-width: 0; border-left: 1px solid var(--rule); cursor: cell;
  background-image:
    linear-gradient(to bottom, var(--rule) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--rule) 45%, transparent) 1px, transparent 1px);
  background-size: 100% var(--hour), 100% var(--hour);
  background-position: 0 0, 0 calc(var(--hour) / 2);
  touch-action: pan-y;
}
.tg-col.is-today { background-color: color-mix(in srgb, var(--kraft-light) 22%, transparent); }
.tg-body.is-loading .tg-col::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(170, 130, 90, 0.12), transparent) 0 0 / 100% 200%;
  animation: sheen-v 1.4s linear infinite;
}
@keyframes sheen-v { to { background-position: 0 -200%; } }
@keyframes sheen { to { background-position: -200% 0; } }
.tg-ghost {
  position: absolute; left: 2px; right: 2px; z-index: 2; padding: 2px 6px; pointer-events: none;
  background: color-mix(in srgb, var(--green) 22%, var(--sheet)); box-shadow: inset 4px 0 0 var(--green);
  font-family: var(--font-form); font-size: 0.8125rem; font-weight: 700; color: var(--ink);
}
.tg-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--now); z-index: 3; pointer-events: none; }
.tg-body > .tg-now { left: var(--gutter); }
.tg-now-dot { position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--now); }

/* an event block: tint, solid bar, ink text */
.ev {
  position: absolute; z-index: 1; display: flex; flex-direction: column; align-items: stretch; gap: 0;
  overflow: hidden; padding: 3px 6px 3px 8px; border: 0; text-align: left;
  background: color-mix(in srgb, var(--c) var(--tint), var(--sheet));
  box-shadow: inset 4px 0 0 var(--c), 0 0 0 1px var(--sheet);
  color: var(--ink); font-size: 0.8125rem; line-height: 1.25; cursor: pointer;
}
.ev:hover { background: color-mix(in srgb, var(--c) calc(var(--tint) + 10%), var(--sheet)); z-index: 2; }
.ev-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
            -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.ev-time { font-family: var(--font-form); font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ev.is-short { flex-direction: row; align-items: baseline; gap: 6px; padding-top: 1px; padding-bottom: 1px; }
.ev.is-short .ev-title { flex: 0 1 auto; -webkit-line-clamp: 1; min-width: 0; white-space: nowrap; display: block; }
.ev.is-short .badges { display: none; }
.ev > * { flex: none; }
.ev .badges { margin-top: 2px; }
.ev.is-short.is-narrow .ev-time { display: none; }
.ev.is-free { background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--c) 10%, var(--sheet)) 0 6px, var(--sheet) 6px 12px); }
.ev.is-pending { box-shadow: inset 4px 0 0 var(--c), inset 0 0 0 1.5px color-mix(in srgb, var(--c) 70%, var(--ink)); }
.ev.is-declined .ev-title, .chip-ev.is-declined .chip-ev-title, .ag-item.is-declined .ag-title { text-decoration: line-through; opacity: 0.75; }
.badges { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.badge {
  display: inline-flex; align-items: center; gap: 3px; padding: 0 5px; border: 1.25px solid var(--ink);
  font-family: var(--font-form); font-size: 0.6875rem; font-weight: 700; line-height: 1.35; letter-spacing: 0.02em;
  white-space: nowrap; color: var(--ink);
}
.badge-booked { background: var(--solid); color: var(--on-solid); border-color: var(--solid); }
.badge-icon { border: 0; padding: 0; }

/* a one-line event chip: all-day row, month cells */
.chip-ev {
  display: flex; align-items: baseline; gap: 5px; min-width: 0; width: 100%; min-height: 22px; padding: 1px 6px 1px 8px;
  border: 0; text-align: left; background: color-mix(in srgb, var(--c) var(--tint), var(--sheet));
  box-shadow: inset 3px 0 0 var(--c); color: var(--ink); font-size: 0.8125rem; line-height: 1.4;
}
.chip-ev:hover { background: color-mix(in srgb, var(--c) calc(var(--tint) + 10%), var(--sheet)); }
.chip-ev-time { font-family: var(--font-form); font-size: 0.75rem; color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
.chip-ev-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ev.is-booked .ev-title::before, .chip-ev.is-booked .chip-ev-title::before { content: "Booked: "; font-family: var(--font-form); font-size: 0.6875rem; font-weight: 700; }

/* ---- month -------------------------------------------------------------------------- */
.month-wrap { display: flex; flex-direction: column; }
.month { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.m-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--rule); }
.m-dow { padding: 8px 8px 6px; font-family: var(--font-form); font-size: 0.8125rem; color: var(--muted); letter-spacing: 0.03em; }
.m-grid { flex: 1; min-height: 0; display: grid; grid-template-rows: repeat(var(--rows), minmax(0, 1fr)); }
.m-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--rule); min-height: 0; }
.m-cell {
  position: relative; min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column;
  gap: 2px; padding: 2px 4px 4px; border-left: 1px solid var(--rule); cursor: pointer;
}
.m-cell:first-child { border-left: 0; }
.m-cell:hover { background: var(--hover); }
.m-cell.is-out { background: color-mix(in srgb, var(--wall) 55%, transparent); }
.m-cell.is-out .m-num { color: var(--muted); }
.m-day {
  align-self: flex-start; display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 4px;
  border: 0; background: transparent; color: var(--ink); flex: none;
}
.m-num { font-family: var(--font-form); font-weight: 700; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.m-cell.is-today .m-day { background: var(--solid); color: var(--on-solid); }
.m-cell.is-today .m-num { color: var(--on-solid); }
.m-evs { display: grid; gap: 2px; min-width: 0; }
.m-ev { min-height: 20px; font-size: 0.75rem; }
.m-more { font-family: var(--font-form); font-size: 0.75rem; color: var(--muted); padding-left: 6px; }
.m-dots { display: none; }
.m-grid.is-loading { opacity: 0.6; }

/* ---- agenda ------------------------------------------------------------------------- */
.agenda-wrap { overflow-y: auto; overscroll-behavior: contain; }
.agenda { max-width: 820px; padding: 8px 22px 40px; }
.ag-group { padding: 6px 0 10px; }
.ag-day {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: baseline; gap: 10px; margin: 0;
  padding: 14px 0 8px; background: var(--sheet); font-size: var(--step-1); font-weight: 700; letter-spacing: -0.02em;
}
.ag-date { font-family: var(--font-form); font-weight: 400; color: var(--muted); font-size: 0.9375rem; }
.ag-date.is-main { font-family: var(--font); font-weight: 700; color: var(--ink); font-size: var(--step-1); }
.ag-item {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; width: 100%; min-height: 56px;
  padding: 10px 12px 10px 14px; margin: 0 0 6px; border: 0; text-align: left; color: var(--ink);
  background: color-mix(in srgb, var(--c) calc(var(--tint) - 6%), var(--sheet)); box-shadow: inset 4px 0 0 var(--c);
}
.ag-item:hover { background: color-mix(in srgb, var(--c) calc(var(--tint) + 6%), var(--sheet)); }
.ag-when { display: grid; align-content: start; font-family: var(--font-form); font-variant-numeric: tabular-nums; }
.ag-start { font-weight: 700; }
.ag-end { color: var(--muted); font-size: 0.875rem; }
.ag-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; min-width: 0; }
.ag-title { font-weight: 700; overflow-wrap: anywhere; }
.ag-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 2px; color: var(--muted); font-size: var(--step--1); }
.ag-meta-bit { display: inline-flex; align-items: center; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.ag-none { margin: 0; padding: 6px 0 4px; color: var(--muted); }
.ag-item.is-free { background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--c) 8%, var(--sheet)) 0 6px, var(--sheet) 6px 12px); }

/* ---- empty states, skeletons -------------------------------------------------------- */
.empty {
  display: grid; justify-items: center; align-content: center; gap: 6px; padding: 48px 24px; text-align: center;
  min-height: 50%;
}
.empty-inline { min-height: 0; padding: 28px 16px; border: 1.5px dashed var(--rule); }
.empty-icon { width: 36px; height: 36px; color: var(--kraft); }
.empty-title { margin: 6px 0 0; font-weight: 700; font-size: var(--step-1); }
.empty-text { margin: 0 0 10px; color: var(--muted); max-width: 40ch; }
.skeleton { display: grid; gap: 8px; padding: 4px 0; }
.skeleton-row {
  height: 44px; background: linear-gradient(90deg, transparent, rgba(170, 130, 90, 0.18), transparent) 0 0 / 200% 100%,
    color-mix(in srgb, var(--wall) 60%, transparent);
  animation: sheen 1.4s linear infinite;
}
.skeleton-tall { height: 64px; }
.skeleton-card { height: 140px; }

/* ---- the event panel ---------------------------------------------------------------- */
.panel-layer { position: fixed; inset: 0; z-index: 40; display: block; }
.panel-scrim { position: absolute; inset: 0; background: rgba(26, 23, 20, 0.22); }
.panel-slot { position: absolute; top: 0; right: 0; bottom: 0; width: min(var(--panel-w), 100vw); }
.panel {
  height: 100%; display: flex; flex-direction: column; background: var(--sheet); box-shadow: var(--lift);
  animation: panel-in 0.2s var(--ease);
}
@keyframes panel-in { from { transform: translateX(24px); opacity: 0; } }
.panel-tools {
  position: relative; display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 8px; min-height: 60px;
}
.panel-tools::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 6px;
  background: var(--pencil-light) repeat-x 0 0 / 480px 6px; filter: var(--stroke-filter); pointer-events: none;
}
.panel-heading { margin: 0; font-size: var(--step-1); font-weight: 700; letter-spacing: -0.02em; }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 22px 40px; }
.panel-title-row { display: flex; gap: 12px; align-items: stretch; margin-bottom: 14px; }
.panel-bar { width: 6px; flex: none; background: var(--c); }
.panel-title {
  margin: 0; font-size: var(--step-2); font-weight: 700; letter-spacing: -0.03em; line-height: 1.15;
  overflow-wrap: anywhere; outline: none;
}
.detail-row { display: flex; gap: 12px; padding: 6px 0; align-items: flex-start; }
.detail-icon { font-size: 1.15rem; margin-top: 2px; color: var(--muted); }
.detail-text { display: grid; min-width: 0; overflow-wrap: anywhere; }
.detail-strong { font-weight: 600; }
.detail-sub { color: var(--muted); font-size: var(--step--1); }
.cal-line { display: inline-flex; align-items: center; gap: 8px; }
.cal-dot { width: 12px; height: 12px; background: var(--c); flex: none; }
.link { color: var(--ink); text-decoration: underline; text-decoration-color: var(--kraft); text-underline-offset: 4px;
        text-decoration-thickness: 1.5px; overflow-wrap: anywhere; }
.link:hover { text-decoration-color: var(--ink); }
.panel-section { position: relative; padding: 16px 0 6px; margin-top: 10px; }
.panel-section::before {
  content: ""; position: absolute; left: 0; right: 0; top: -3px; height: 6px;
  background: var(--pencil-light) repeat-x 0 0 / 480px 6px; filter: var(--stroke-filter);
}
.panel-h { margin: 0 0 10px; font-size: var(--step-0); font-weight: 700; letter-spacing: -0.01em; }
.panel-h-row { display: flex; align-items: center; gap: 10px; }
.panel-h-row .panel-h { flex: 1; }
.panel-count { font-family: var(--font-form); color: var(--muted); font-size: 0.875rem; margin-bottom: 10px; }
.panel-muted { margin: 0; color: var(--muted); font-size: var(--step--1); }
.notes { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.who-list { display: grid; gap: 4px; }
.who { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.who-text { flex: 1; min-width: 0; display: grid; }
.who-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-sub { color: var(--muted); font-size: var(--step--1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-status { font-family: var(--font-form); font-size: 0.875rem; color: var(--muted); white-space: nowrap; }
.who-status.is-accepted { color: var(--green); font-weight: 700; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .who-status.is-accepted { color: var(--focus); } }
:root[data-theme="dark"] .who-status.is-accepted { color: var(--focus); }
.who-status.is-declined { color: var(--error); }
.avatar-guest { background: var(--floor); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--rule); }
.booking-box { display: grid; gap: 2px; padding: 12px 14px; background: var(--wall); }
.booking-note { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-style: italic; }
.panel-h .badge { margin-right: 6px; }
.rsvp .seg { width: 100%; }
.rsvp .seg-btn { min-height: 44px; font-size: var(--step-0); }

/* action items */
.act-list { display: grid; }
.act { display: flex; align-items: flex-start; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--rule); }
.act-check {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border: 0; background: transparent;
  color: var(--ink); font-size: 1.35rem;
}
.act-check.is-done { color: var(--green); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .act-check.is-done { color: var(--focus); } }
:root[data-theme="dark"] .act-check.is-done { color: var(--focus); }
.act-body { flex: 1; min-width: 0; display: grid; gap: 6px; padding-top: 8px; }
.act-text { overflow-wrap: anywhere; }
.act.is-done .act-text { text-decoration: line-through; color: var(--muted); }
.act-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.act-owner { width: auto; min-height: 32px; padding: 0 34px 0 10px; font-size: var(--step--1); background-position: right 8px center; }
.act-card { text-decoration: none; }
.act-card.is-on { background: var(--solid); color: var(--on-solid); border-color: var(--solid); }
.act-del { margin-top: 4px; color: var(--muted); }
.act-add { display: flex; gap: 8px; margin-top: 10px; }
.act-add .field-input { flex: 1; min-width: 0; }
.panel-danger { margin-top: 26px; }
.btn-danger { background: var(--error); border-color: var(--error); color: #FFF8F2; }
.btn-danger:hover { background: color-mix(in srgb, var(--error) 85%, black); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-danger { color: #1A1714; } }
:root[data-theme="dark"] .btn-danger { color: #1A1714; }
.btn-danger-quiet { border-color: var(--error); color: var(--error); }
.confirm { padding: 14px; border: 1.5px solid var(--error); display: grid; gap: 12px; }
.confirm-text { margin: 0; font-weight: 600; }
.confirm-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* the editor */
.ev-form { display: grid; gap: 16px; align-content: start; }
.btn-save { min-width: 96px; }
.dt { display: flex; gap: 8px; }
.dt .field-input { min-width: 0; }
.time-wrap { display: flex; min-width: 0; }
.time-wrap .field-input { width: 100%; }
.form-error { margin: 0; color: var(--error); font-weight: 600; font-size: var(--step--1); }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 4px; }
.form-actions .btn-primary { min-width: 150px; }
.people { display: flex; flex-wrap: wrap; gap: 6px 4px; }
.person {
  display: inline-flex; flex-direction: column; align-items: center; gap: 4px; min-width: 64px; padding: 6px 4px;
  border: 0; background: transparent; color: var(--ink);
}
.person:hover { background: var(--hover); }
.person-face { position: relative; display: inline-grid; border-radius: 50%; }
.person .avatar { opacity: 0.45; filter: grayscale(0.6); transition: opacity 0.15s var(--ease); }
.person.is-on .avatar { opacity: 1; filter: none; box-shadow: 0 0 0 2px var(--sheet), 0 0 0 4px var(--ink); }
.person-tick {
  position: absolute; right: -4px; bottom: -4px; display: none; place-items: center; width: 20px; height: 20px;
  border-radius: 50%; background: var(--green); color: #F3EDE1; font-size: 0.75rem; box-shadow: 0 0 0 2px var(--sheet);
}
.person.is-on .person-tick { display: inline-grid; }
.person-name { font-size: var(--step--1); font-weight: 600; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person:not(.is-on) .person-name { color: var(--muted); font-weight: 500; }
.guest-add { display: flex; gap: 8px; }
.guest-add .field-input { flex: 1; min-width: 0; }
.guests > div:not(.guest-add) { display: flex; flex-wrap: wrap; gap: 6px; }
.guests > div:empty { display: none; }
.gchip {
  display: inline-flex; align-items: center; gap: 2px; max-width: 100%; padding-left: 10px; min-height: 34px;
  border: 1.5px solid var(--ink); font-size: var(--step--1);
}
.gchip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.gchip-x { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; background: transparent; color: var(--ink); }
.gchip-x:hover { background: var(--hover); }

/* on/off switch */
.toggle {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 0; border: 0;
  background: transparent; color: var(--ink); text-align: left; font-weight: 600;
}
.toggle-label { flex: 1; }
.toggle-track {
  position: relative; width: 46px; height: 26px; flex: none; border: 1.5px solid var(--ink); background: transparent;
  transition: background 0.15s var(--ease);
}
.toggle-knob { position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; background: var(--ink); transition: transform 0.15s var(--ease); }
.toggle.is-on .toggle-track { background: var(--green); border-color: var(--green); }
.toggle.is-on .toggle-knob { transform: translateX(20px); background: #F3EDE1; }

/* ---- pages: Find a time, Booking pages ---------------------------------------------- */
.page { overflow-y: auto; overscroll-behavior: contain; }
.page-inner { max-width: 860px; padding: 22px 26px 64px; display: grid; gap: 18px; align-content: start; }
.page-title { margin: 0; font-size: var(--step-3); font-weight: 700; letter-spacing: -0.035em; line-height: 1.1; }
.page-lede { margin: -8px 0 4px; color: var(--muted); max-width: 62ch; }
.find-opts { display: flex; flex-wrap: wrap; gap: 18px 28px; }
.find-h { margin: 8px 0 0; font-size: var(--step-1); font-weight: 700; letter-spacing: -0.02em; }
.slots { display: grid; gap: 14px; }
.slot-group { display: grid; gap: 8px; }
.slot-day { margin: 0; display: flex; gap: 10px; align-items: baseline; font-size: var(--step-0); font-weight: 700; }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.slot {
  min-height: 52px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  font-family: var(--font-form); font-weight: 700; font-size: 1.0625rem; font-variant-numeric: tabular-nums;
}
.slot:hover { background: var(--green); border-color: var(--green); color: var(--on-dark); }
.find-strips { display: grid; gap: 10px; }
.dpicks { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.dpick {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 52px; min-height: 52px;
  border: 1.5px solid var(--rule); background: transparent; color: var(--ink); font-family: var(--font-form); flex: none;
}
.dpick.is-on { background: var(--solid); color: var(--on-solid); border-color: var(--solid); }
.dpick-dow { font-size: 0.75rem; }
.dpick-dom { font-weight: 700; font-size: 1.0625rem; }
.strip-rows { display: grid; gap: 8px; }
.strip-row { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; align-items: center; }
.strip-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.strip-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip {
  position: relative; height: 28px; background: color-mix(in srgb, var(--green) 14%, var(--sheet));
  box-shadow: inset 0 0 0 1px var(--rule);
}
.strip-busy { position: absolute; top: 0; bottom: 0; background: var(--kraft-deep); }
.strip-ticks { position: relative; height: 16px; }
.strip-tick { position: absolute; transform: translateX(-50%); font-family: var(--font-form); font-size: 0.75rem; color: var(--muted); }
.strip-tick:first-child { transform: none; }
.strip-tick:last-child { transform: translateX(-100%); }
.strip-key { margin: 0; color: var(--muted); font-size: var(--step--1); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.strip-key-busy, .strip-key-free { display: inline-block; width: 14px; height: 14px; }
.strip-key-busy { background: var(--kraft-deep); }
.strip-key-free { background: color-mix(in srgb, var(--green) 14%, var(--sheet)); box-shadow: inset 0 0 0 1px var(--rule); }

.bt-list { display: grid; gap: 16px; }
.bt { padding: 18px 20px; background: var(--wall); display: grid; gap: 14px; }
.bt.is-mine { box-shadow: inset 4px 0 0 var(--green); }
.bt-head { display: flex; gap: 14px; align-items: flex-start; }
.bt-faces { display: flex; flex: none; }
.bt-faces .avatar + .avatar { margin-left: -8px; box-shadow: 0 0 0 2px var(--wall); }
.bt-head-text { flex: 1; min-width: 0; display: grid; }
.bt-owner { font-family: var(--font-form); font-size: 0.875rem; color: var(--muted); }
.bt-title { margin: 0; font-size: var(--step-1); font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.bt-facts { margin: 2px 0 0; color: var(--muted); font-size: var(--step--1); }
.bt-state { font-family: var(--font-form); font-weight: 700; font-size: 0.8125rem; padding: 2px 8px; border: 1.5px solid var(--muted); color: var(--muted); }
.bt-state.is-on { border-color: var(--green); background: var(--green); color: var(--on-dark); }
.bt-body { display: grid; gap: 8px; }
.bt-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bt-link { flex: 1 1 240px; min-width: 0; font-family: var(--font-form); background: var(--sheet); }
.bt-actions a.btn { text-decoration: none; }
.bt-edit { justify-self: start; }
.bt-form { display: grid; gap: 16px; padding-top: 4px; }
.hours { display: grid; border-top: 1px solid var(--rule); }
.hours-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.hours-day {
  display: grid; justify-items: start; min-height: 44px; padding: 4px 10px; border: 1.5px solid var(--rule);
  background: transparent; color: var(--muted); text-align: left;
}
.hours-day.is-on { border-color: var(--ink); color: var(--ink); background: var(--sheet); }
.hours-day-name { font-weight: 700; }
.hours-day-state { font-family: var(--font-form); font-size: 0.75rem; }
.hours-ranges { display: grid; gap: 6px; justify-items: start; min-width: 0; }
.hours-range { display: flex; align-items: center; gap: 6px; }
.hours-time { width: 104px; min-width: 0; background-color: var(--sheet); }
.hours-to { color: var(--muted); font-size: var(--step--1); }
.hours-off { color: var(--muted); font-size: var(--step--1); padding-top: 10px; }
.hours-add { text-decoration: none; padding: 0 8px; }

/* ---- touch -------------------------------------------------------------------------- */
@media (pointer: coarse) {
  .field-input { font-size: 16px; }
  .seg-btn, .rail-link, .cal-row, .gchip { min-height: 44px; }
  .mm-day { height: 40px; }
  .act-check { width: 44px; height: 44px; }
  .act-owner { min-height: 44px; }
  .gchip-x { width: 44px; height: 44px; }
  .tg-col { cursor: default; }
  .tg-allday .chip-ev { min-height: 28px; }
  .seg-btn:active, .rail-link:active, .cal-row:active, .slot:active, .ag-item:active, .tab:active { background: var(--hover); }
}

/* ---- narrow: phones and tablets in portrait --------------------------------------- */
.tabs, .fab { display: none; }
@media (max-width: 999.98px) {
  :root { --bar-h: 56px; }
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .only-narrow { display: inline-grid; }
  .only-wide { display: none !important; }
  .only-narrow-block { display: grid; }
  .rail-link, .cal-row { min-height: 44px; }
  .rail {
    position: fixed; inset: 0 auto 0 0; z-index: 35; width: min(320px, 86vw);
    transform: translateX(-102%); transition: transform 0.24s var(--ease); box-shadow: var(--lift);
    padding-top: calc(12px + env(safe-area-inset-top)); padding-left: calc(14px + env(safe-area-inset-left));
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .rail.is-open { transform: none; }
  .rail-brand { padding-bottom: 12px; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 34; background: rgba(36, 32, 28, 0.4); }
  .main { box-shadow: none; grid-row: 1; }
  .bar { gap: 2px; padding: calc(4px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) 4px
         calc(4px + env(safe-area-inset-left)); }
  .bar-title { font-size: var(--step-1); margin: 0 4px; flex: 1; }
  .bar .grow { display: none; }
  .bar-arrows .btn-icon { width: 40px; }
  .bar-today { margin-left: 0; padding: 0 10px; }
  .tabs {
    display: grid; grid-template-columns: repeat(4, 1fr); grid-row: 2; z-index: 5;
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: var(--sheet); border-top: 1.5px solid var(--ink);
  }
  .tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: var(--tabs-h); border: 0; background: transparent; color: var(--ink);
    font-family: var(--font-form); font-size: 0.8125rem;
  }
  .tab .icon { font-size: 1.4rem; }
  .tab.is-on { background: var(--solid); color: var(--on-solid); font-weight: 700; }
  .fab {
    display: inline-flex; position: fixed; z-index: 20; right: calc(16px + env(safe-area-inset-right));
    bottom: calc(var(--tabs-h) + 16px + env(safe-area-inset-bottom)); min-height: 52px; padding: 0 20px 0 16px;
    box-shadow: var(--lift); font-size: var(--step-0);
  }
  .fab .icon { font-size: 1.25rem; }
  .shell.panel-open .fab { display: none; }
  .agenda, .page-inner { padding-bottom: 104px; }
  .tg-body { margin-bottom: 84px; }
  .toast { bottom: calc(var(--tabs-h) + 16px + env(safe-area-inset-bottom)); }
  .panel-tools { padding-top: calc(10px + env(safe-area-inset-top)); }
}
/* a wide bar that is still tight (tablet landscape, small laptops) */
@media (min-width: 1000px) and (max-width: 1240px) {
  :root { --rail: 220px; }
  .bar { padding-left: 16px; }
  .bar-title { font-size: var(--step-1); }
  .seg-btn { padding: 0 10px; }
}

/* panel as a full-screen sheet on a phone */
@media (max-width: 699.98px) {
  .panel-slot { width: 100vw; left: 0; }
  .panel-scrim { display: none; }
  .panel { animation: sheet-up 0.22s var(--ease); padding-bottom: env(safe-area-inset-bottom); }
  .panel-body { padding: 16px 16px 48px; }
}

/* phones */
@media (max-width: 599.98px) {
  :root { --gutter: 40px; --hour: 52px; }
  .title-long { display: none; }
  .title-short { display: inline; }
  .tg-hour { right: 4px; font-size: 0.6875rem; }
  .tg-gutter-label { padding-right: 4px; font-size: 0.625rem; text-align: right; line-height: 1.1; }
  .tg-week .tg-dow { font-size: 0.6875rem; }
  .tg-week .tg-dom { font-size: 1rem; min-width: 26px; height: 26px; }
  .tg-week .ev { padding: 2px 3px 2px 6px; font-size: 0.6875rem; box-shadow: inset 3px 0 0 var(--c), 0 0 0 1px var(--sheet); }
  .tg-week .ev-time, .tg-week .badges { display: none; }
  .tg-week .ev-title { -webkit-line-clamp: 4; font-weight: 600; }
  .tg-week .chip-ev { padding: 1px 3px 1px 5px; font-size: 0.6875rem; }
  .tg-team .tg-head-person { flex-direction: column; gap: 2px; }
  .tg-team .tg-person { font-size: 0.75rem; }
  .tg-team .ev { padding: 2px 4px 2px 7px; font-size: 0.75rem; }
  .tg-team .ev.is-short .ev-time { display: none; }
  .ev.is-narrow .ev-time { display: none; }
  .tg-note { padding-left: 12px; }
  .m-dow { padding: 6px 2px; text-align: center; font-size: 0.75rem; }
  .m-cell { align-items: center; padding: 2px 1px; }
  .m-day { align-self: center; }
  .m-evs { display: none; }
  .m-dots { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
  .m-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
  .agenda { padding-left: 12px; padding-right: 12px; }
  .ag-item { grid-template-columns: 52px minmax(0, 1fr); gap: 10px; padding-left: 12px; }
  .page-inner { padding: 16px 14px 104px; }
  .page-title { font-size: var(--step-2); }
  .strip-row { grid-template-columns: 76px minmax(0, 1fr); gap: 8px; }
  .strip-who .avatar { display: none; }
  .slot-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .bt { padding: 14px; }
  .hours-row { grid-template-columns: 1fr; gap: 6px; }
  .hours-day { grid-template-columns: auto 1fr; gap: 10px; align-items: center; width: 100%; }
  .seg-btn { padding: 0 10px; }
  .find-opts { gap: 14px; }
  .person { min-width: 58px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
