/**
 * shadcn-flavoured theme layer.
 *
 * Loaded after styles.css so it wins on equal specificity, and kept separate so
 * the original styling stays intact and this can be dropped by removing one
 * <link>. Bootstrap comes from a CDN earlier in the head, so overriding .btn and
 * form controls here needs no !important.
 *
 * What is borrowed from shadcn is the *structure*, not the palette:
 *   - 1px borders do the work; shadows are almost absent
 *   - one 8px radius instead of three competing ones
 *   - 2px focus ring with a 2px offset, on every interactive element
 *   - 14px base text, 500 weight for labels, muted foreground for secondary
 *   - generous, consistent padding on a 4px scale
 *
 * The warm Mindset palette is kept — only desaturated slightly, because the
 * cream/terracotta combination was fighting itself at full saturation.
 */

/* Tokens live in styles.css. They used to be declared in both files with
   different values for the same names, which is why radii and shadows were
   inconsistent across views — whichever rule won the cascade decided the
   scale. This file now only styles components. */

/* ------------------------------------------------------------------- base */

body {
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  letter-spacing: -0.014em;
  font-weight: 600;
}

/* One visible focus treatment everywhere, and never the removed-outline
   anti-pattern: this app is used one-handed on a phone and with a keyboard. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:where(a, button, input, select, textarea):focus:not(:focus-visible) {
  outline: none;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-border: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: none;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn-sm {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-primary {
  --btn-bg: var(--accent);
  --btn-fg: #fff;
  --btn-border: var(--accent);
}
.btn-primary:hover {
  --btn-bg: var(--accent-hover);
  --btn-border: var(--accent-hover);
  color: #fff;
}

.btn-outline-primary {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-border: var(--border);
}
.btn-outline-primary:hover {
  --btn-bg: var(--subtle);
  --btn-fg: var(--ink);
  --btn-border: var(--subtle-3);
}

.btn-light {
  --btn-bg: transparent;
  --btn-fg: var(--muted);
  --btn-border: transparent;
}
.btn-light:hover {
  --btn-bg: var(--subtle);
  --btn-fg: var(--ink);
}

.btn-danger,
.btn-outline-danger {
  --btn-fg: var(--red);
  --btn-border: var(--border);
  --btn-bg: var(--surface);
}
.btn-danger:hover,
.btn-outline-danger:hover {
  --btn-bg: rgba(184, 66, 51, 0.08);
  --btn-fg: var(--red);
}

/* ------------------------------------------------------------ form fields */

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea,
.form-select,
.form-control {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  box-shadow: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus,
.form-select:focus,
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  outline: none;
}

/* Labels wrapping their own input, which is the pattern used throughout. */
label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

/* --------------------------------------------------------------- surfaces */

.panel,
.sectionCard,
.cards > article {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: none;
}

.cards > article {
  padding: 16px;
}

.cardLabel,
.sectionLabel {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ------------------------------------------------------------------- nav */

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}

.nav:hover {
  background: var(--subtle);
  color: var(--ink);
}

/* Active state is a filled block, as in shadcn's sidebar, rather than a
   coloured pill that competes with the accent buttons.
   Scoped to .navGroup and using longhands: styles.css paints the active item
   with the accent colour via a shorthand, and matching its specificity alone
   proved unreliable in the cascade. */
.navGroup .nav.active {
  background-color: var(--subtle-2);
  background-image: none;
  border-color: var(--border);
  color: var(--ink);
  font-weight: 600;
}

.navGroup .nav.active i {
  color: var(--accent);
}

:root[data-theme="dark"] .navGroup .nav.active {
  background-color: var(--subtle-3);
  border-color: var(--subtle-3);
}

/* ----------------------------------------------------------------- tables */

table {
  font-size: 13.5px;
}

th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

td, th {
  border-color: var(--border-soft);
}

/* --------------------------------------------------------------- consents */

.consentRow {
  border-radius: var(--radius);
  background: var(--surface);
  transition: background var(--transition), border-color var(--transition);
}

/* Lifting on hover made the list feel unstable while scrolling a queue. */
.consentRow:hover {
  transform: none;
  border-color: var(--subtle-3);
  background: var(--subtle);
}

.consentPill,
.consentTag {
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 3px 8px;
}

/* Muted status colours: a queue of amber pills is noise, not information. */
.consentPill-awaiting_clinician {
  background: rgba(196, 138, 42, 0.12);
  color: #8a5f14;
  border: 1px solid rgba(196, 138, 42, 0.25);
}
.consentPill-signed {
  background: rgba(90, 138, 106, 0.12);
  color: #3d6b4d;
  border: 1px solid rgba(90, 138, 106, 0.25);
}
.consentPill-rejected {
  background: rgba(184, 66, 51, 0.1);
  color: #8f3325;
  border: 1px solid rgba(184, 66, 51, 0.22);
}

:root[data-theme="dark"] .consentPill-awaiting_clinician { color: #e0b45f; }
:root[data-theme="dark"] .consentPill-signed { color: #7fc79a; }
:root[data-theme="dark"] .consentPill-rejected { color: #e08476; }

.consentStatus {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--subtle);
}

.consentField {
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 6px;
}

.consentCanvas {
  border: 1px dashed var(--subtle-3);
  border-radius: var(--radius);
}

.consentSigCard {
  border-radius: var(--radius);
  box-shadow: none;
}

/* ---------------------------------------------------------------- chrome */

.consentBadge {
  border-radius: var(--radius-sm);
  min-width: 18px;
  height: 18px;
  font-size: 10.5px;
  font-weight: 700;
}

.pwaToast,
.pwaOfflinePill {
  border-radius: var(--radius);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
}

.pwaToastBtn {
  border-radius: var(--radius-sm);
  font-weight: 600;
}

/* Thin, unobtrusive scrollbars, matching the surface rather than the OS. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--subtle-3) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--subtle-3);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--muted); background-clip: content-box; }

/* Respect a user's reduced-motion preference; several views animate. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------- sidebar */

/* Two stacked words, uppercase — the product name is the workspace, and the
   old "Task Manager" subtitle stopped being true once cabins, bookings and
   forms moved in. */
.sidebar .wordmark {
  margin: 0;
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brandLine {
  padding-bottom: 16px;
}

/* Full-bleed band rather than a rounded card: hairlines across the whole
   sidebar separate identity from navigation more quietly than a box does. */
.profileCard {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 -16px;
  padding: 14px 16px;
  border: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}

.profileAvatar {
  flex-shrink: 0;
}

.profileText {
  min-width: 0;
}

.profileText .cardLabel {
  margin-bottom: 1px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: none;
}

.profileCard h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

/* Role and address are still worth carrying, but they are reference detail —
   one truncated line, with the full value on hover. */
#userMeta {
  margin: 2px 0 0;
  font-size: 11.5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* The active row's filled tray and accent icon are set with the rest of the
   nav states further up this file. Only the resting icon needed work: it
   inherited the label's colour, so the column of glyphs read as heavy as the
   text beside it. */
.nav {
  font-weight: 500;
}

.nav i {
  font-size: 16px;
  color: var(--muted);
  transition: color var(--transition);
}

.nav:hover i {
  color: var(--accent);
}

.sidebarCard {
  border-radius: var(--radius-lg);
}

.sidebarCardTitle {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
}

.miniMetric {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 6px;
  font-size: 12.5px;
}

.miniMetric i {
  color: var(--accent);
  font-size: 13px;
}

/* Overdue is the one number in here that is a problem, so it carries the
   colour rather than being one of two identical rows. */
.miniMetric-alert,
.miniMetric-alert i,
.miniMetric-alert strong {
  color: var(--red);
}

/* ------------------------------------------------------------- sign-in */

/* A neutral-chrome button, deliberately not tinted with the brand accent:
   Google's own guidance is that the mark sits on white or a plain surface. */
.btn-google {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-border: var(--border);
  min-height: 44px;
  gap: 10px;
  font-weight: 500;
}
.btn-google:hover {
  --btn-bg: var(--subtle);
  --btn-border: var(--subtle-3);
}

.googleMark {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.authDivider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 13px;
}
.authDivider::before,
.authDivider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border);
}

/* Trailing button inside a text field. The input keeps its own padding so the
   ring still traces the field, not the button. */
.inputWithAction {
  position: relative;
  display: block;
}
/* The field is a level deeper than the form's own `label > input` rule, so it
   restates the full width it would otherwise inherit. */
.inputWithAction input {
  width: 100%;
  padding-right: 44px;
}
.inputAction {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--transition);
}
.inputAction:hover {
  color: var(--ink);
}

/* ----------------------------------------------------------- task board */

.viewHead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.viewHead .pageTitle {
  margin-bottom: 4px;
}

.viewHeadSub {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
}

/* Progress on the left, the four counts on the right, one hairline between:
   a single row that answers "where does the work stand" in one glance. */
.statsBar {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 22px 26px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
}

.statsProgress {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
  padding-right: 32px;
  border-right: 1px solid var(--border);
}

.progressTitle {
  margin: 0 0 2px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.progressSub {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

/* The percentage moves inside the ring, which is what the ring is for. */
.statsProgress .progressRing {
  position: relative;
  width: 76px;
  height: 76px;
  flex-shrink: 0;
}

.statsProgress .progressRing svg {
  width: 100%;
  height: 100%;
}

/* Accent, not the completion green: at this size the ring is the panel's one
   piece of colour, and green here fought the accent everywhere else. */
.statsProgress .progressRing .ringFill {
  stroke: var(--accent);
}

.progressRingValue {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
}

.statsFigures {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  flex: 1;
  min-width: 0;
}

.statFigure span {
  display: block;
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.statFigure strong {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* Overdue is the only count that is bad news, so it is the only coloured one. */
.statFigure-alert strong {
  color: var(--red);
}

/* Panels whose header and rows carry their own padding, so the card itself
   has none and the hairlines can run edge to edge. */
.panelFlush {
  padding: 0;
  overflow: hidden;
}

.panelFlush .panelHead {
  margin: 0;
  padding: 20px 24px;
}

.panelHead-divided {
  border-bottom: 1px solid var(--border);
}

.panelHead-stacked {
  display: block;
}

.panelHeadIcon {
  margin-right: 2px;
  color: var(--red);
}

.panelHeadSub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.panelCount {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Hairlines instead of gaps: the queue is one list, not a stack of cards. */
.taskList-divided {
  display: block;
  gap: 0;
}

.taskList-divided .taskRow {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  border-radius: 0;
}

.taskList-divided .taskRow:first-child {
  border-top: 0;
}

/* The red wash is dropped in these two panels. Every row in the priority
   queue is overdue, so tinting them all removed the signal and left a slab
   of red — the dateChip pill carries it instead. */
.taskList-divided .taskRow.isOverdue {
  background: transparent;
}

.taskList-divided .taskRow:hover,
.taskList-divided .taskRow.isOverdue:hover {
  background: var(--subtle);
}

.taskList-divided .emptyState {
  padding: 44px 24px;
}

/* Now that the row itself is untinted, the due chip carries the status on its
   own — a bordered pill so it holds at 11px against a plain row. */
.taskList-divided .dateChip {
  padding: 4px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.taskList-divided .dateChip.overdue {
  border-color: var(--edge-red);
}

.taskList-divided .dateChip.today {
  border-color: var(--edge-amber);
}

/* The full list now lives inside a panel, so it drops the card border and
   the 1px grid gaps it used when it stood alone. */
.allTasksPanel .taskGrid {
  border: 0;
  border-radius: 0;
  background: transparent;
  gap: 0;
}

/* -------------------------------------------------------------- dashboard */

/* The view's own title, above the cards rather than in the action bar — the
   overview is the one screen with no toolbar controls of its own. */
.pageTitle {
  margin: 0 0 24px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Greeting and the metric tiles read as one block, so they share a card
   rather than floating as two unrelated rows above the panels. */
.welcomePanel {
  padding: 32px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
}

.welcomePanel h2 {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.welcomeSub {
  margin: 0 0 28px;
  font-size: 15px;
  color: var(--muted);
}

.welcomePanel .dashboardStrip {
  margin-bottom: 0;
}

/* ------------------------------------------------------- upcoming sessions */

/* Title and its one action, with no eyebrow label: the panel sits under a page
   title that already says where you are. */
/* Roomier than the default panel; the session rows need the breathing space
   the tighter list panels elsewhere do not. */
.panelWide {
  padding: 28px;
  border-radius: var(--radius-xl);
}

.panelHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.panelHead h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

/* A text action, not a button: it navigates, it does not change anything. */
.linkAction {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}
.linkAction:hover {
  text-decoration: underline;
}

.sessionList {
  display: grid;
  gap: 16px;
}

/* Inset on the panel rather than outlined against the page, so the rows read
   as contents of the card and not as four more cards. */
.sessionRow {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface-raised);
  transition: border-color var(--transition);
}

.sessionRow:hover {
  border-color: var(--subtle-3);
}

.sessionAvatar {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--subtle-2);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sessionMain {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  flex: 1;
}

.sessionMain strong {
  font-size: 15px;
  font-weight: 600;
}

.sessionMeta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
}

/* Quiet until the row is hovered, then it becomes the obvious next click. */
.sessionAction {
  flex-shrink: 0;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.sessionRow:hover .sessionAction {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Two across, so each tile has room for the icon chip and a full-size number.
   Auto-fit at four across squeezed both into an unreadable strip. */
.dashboardStrip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.dashboardStrip:empty {
  display: none;
}

.dashCard {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface-raised);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.dashCard:hover {
  border-color: var(--subtle-3);
  background: var(--subtle);
}

/* Tinted square, not a coloured circle: circles here would compete with the
   session avatars directly below, which do mean "a person". */
.dashCardIcon {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  background: var(--accent-light);
  color: var(--accent);
  font-size: 22px;
}

.dashCardBody {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.dashCardLabel {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.dashCardValue {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* Cards with no server-backed number (Cabins) leave this slot empty rather than
   filling it with a word that would read as a statistic. */
.dashCardValue:empty { display: none; }

.dashCardHint {
  font-size: 12.5px;
  color: var(--muted);
}

/* Tone is a tint plus a same-hue edge — the one status mechanism used across
   task rows and cabin cells too. A left rule read as a different treatment
   again, and the app had three of those.

   Now that each tile carries an icon chip, the tint moves onto the chip: a
   full-card wash at this size read as "selected" rather than "needs you". */
.dashCard-attention { border-color: var(--edge-amber); }
.dashCard-danger { border-color: var(--edge-red); }

.dashCard-attention .dashCardIcon {
  background: var(--tint-amber);
  color: var(--amber);
}

.dashCard-danger .dashCardIcon {
  background: var(--tint-red);
  color: var(--red);
}

.dashCard-attention:hover { border-color: var(--amber); }
.dashCard-danger:hover { border-color: var(--red); }

/* ---------------------------------------------------------- form dialog */

.consentDialog {
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.consentDialog::backdrop {
  background: rgba(20, 18, 14, 0.55);
  backdrop-filter: blur(2px);
}

.consentDialogInner {
  max-height: calc(100dvh - 48px);
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Full screen on phones: a centred card with margins wastes the space where
   the signature pad has to live. */
@media (max-width: 640px) {
  .consentDialog {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .consentDialogInner {
    max-height: 100dvh;
    padding: 16px calc(16px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  }
}

/* The dialog header stays reachable while reading a long form. */
.consentDialogInner > .sectionHead {
  position: sticky;
  top: -20px;
  z-index: 2;
  margin: -20px -20px 12px;
  padding: 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
}

/* ============================================================ phone format */

/*
 * iOS zooms the page whenever a focused input renders below 16px, and it does
 * not zoom back out afterwards — which is what happens on the login screen.
 * The fix is the font size, not user-scalable=no: disabling pinch zoom would
 * break the page for anyone who needs to magnify it.
 */
@media (max-width: 1024px), (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea,
  .form-select,
  .form-control {
    font-size: 16px;
  }

  /* 44px is the smallest reliably hittable target with a thumb. Several
     controls sat at 32–38px, which is comfortable with a mouse and a
     coin-toss on a phone — and this app is used one-handed at a front desk. */
  .btn,
  .nav,
  .bd-btn,
  .bd-tab,
  .bd-mode,
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  .form-select,
  .form-control {
    min-height: 44px;
  }

  .btn-sm,
  .bd-btn-sm {
    min-height: 40px;
  }

  /* Checkboxes and the task-row circle need the same treatment, but growing
     the box would break the row rhythm — grow the hit area instead. */
  .taskRow-check {
    position: relative;
  }
  .taskRow-check::after {
    content: "";
    position: absolute;
    inset: -11px;
  }
}

@media (max-width: 640px) {
  /* Header actions vary per view now, so a fixed 3-column grid left gaps and
     stretched a lone button across the screen. Let them size to content. */
  .actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  .actions .btn {
    flex: 0 1 auto;
    min-height: 40px;
    padding: 8px 14px;
    font-size: 13px;
  }

  /* Icons stay: at this size they identify a button faster than its label. */
  .actions .btn i {
    display: inline-block;
  }

  .menuToggle {
    flex: 0 0 auto;
  }

  /* Typography: the desktop scale reads oversized on a 390px screen. */
  body { font-size: 14px; }
  h1 { font-size: 20px; }
  h2 { font-size: 17px; }
  h3 { font-size: 16px; }
  .sectionHead h3 { font-size: 16px; }
  .cardLabel, .sectionLabel { font-size: 10px; }
  .sectionNote { font-size: 12px; }

  /* One tile per row: the icon chip plus a 30px number will not fit two across
     at 390px without dropping one of the two, and both carry meaning. */
  .dashboardStrip {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .dashCard { padding: 14px; gap: 14px; }
  .dashCardIcon { width: 42px; height: 42px; font-size: 18px; }
  .dashCardValue { font-size: 24px; }
  .dashCardHint { font-size: 11.5px; }

  .pageTitle { margin-bottom: 16px; font-size: 21px; }

  .welcomePanel { padding: 18px; margin-bottom: 16px; }
  .welcomePanel h2 { font-size: 21px; }
  .welcomeSub { margin-bottom: 18px; font-size: 13.5px; }

  .panelWide { padding: 16px; }
  .panelHead { margin-bottom: 16px; }
  .panelHead h3 { font-size: 16px; }

  /* The action drops below the row instead of squeezing the name column. */
  .sessionList { gap: 10px; }
  .sessionRow {
    flex-wrap: wrap;
    padding: 14px;
    gap: 12px;
  }
  .sessionAvatar { width: 40px; height: 40px; font-size: 13px; }
  .sessionAction { width: 100%; }

  .cards > article { padding: 12px; }
  .cards > article strong { font-size: 20px; }

  /* Forms queue: stack the row so a long client name is not squeezed by the
     status pill. */
  .consentRow {
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
  }

  .consentRowTags {
    flex-shrink: 0;
  }

  /* One column of detail fields reads better than two cramped ones. */
  .consentAnswers {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .consentField {
    font-size: 13px;
  }

  .consentSignatures {
    gap: 10px;
  }

  .consentSigCard img {
    width: 140px;
  }

  /* Actions in the form dialog: full width and thumb-sized. */
  .consentActions .btn {
    flex: 1 1 140px;
    min-height: 44px;
  }

  .consentCanvas {
    max-width: 100%;
    height: 160px;
  }

  .panel { padding: 14px; }
}

/* Nothing should ever push the page sideways on a phone. */
@media (max-width: 640px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .mainPanel { min-width: 0; }
}

/* --------------------------------------------------------------- settings */

/* Two columns of stacked cards. Availability is the tall one, so it sits with
   the short Appearance and Notifications cards rather than beside them. */
.settingsGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: start;
}

.settingsColumn {
  display: grid;
  gap: 24px;
}

.settingsCard {
  padding: 24px;
  border-radius: var(--radius-xl);
}

.settingsCardHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* The card's own kicker: uppercase and muted, so the h3s inside it read as the
   settings and this reads as the drawer they sit in. */
.settingsCardLabel {
  margin: 0 0 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.settingsCardHead .settingsCardLabel { margin-bottom: 0; }
.settingsCardHead { margin-bottom: 20px; }

.settingsHeading {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.settingRow .settingsHeading,
.settingsSub + .btn { margin-bottom: 0; }

.settingsSub {
  margin: 4px 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.settingsSub-tight { margin-bottom: 0; }

.settingsRule {
  margin: 20px 0;
  border: 0;
  border-top: 1px solid var(--border);
  opacity: 1;
}

.settingRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.settingRow .settingsSub { margin-bottom: 0; }

/* Says plainly that a control is scenery. Better than a live-looking switch
   that silently forgets, which is what an un-backed toggle actually is. */
.soonPill {
  flex: none;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--subtle);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* Everything inside a preview card is disabled, so it is dimmed as a block
   rather than each control fighting its own opacity. */
.settingsCard.isPreview .scheduleRows,
.settingsCard.isPreview .settingRow,
.settingsCard.isPreview .blockedList,
.settingsCard.isPreview .btn[disabled] {
  opacity: 0.72;
}

/* ── switches ── */

.switch {
  position: relative;
  flex: none;
  display: inline-flex;
  margin: 0;
}

.switch input {
  position: absolute;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: not-allowed;
}

.switchTrack {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--subtle-3);
  transition: background var(--transition);
}

.switchTrack::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
}

.switch input:checked + .switchTrack { background: var(--accent); }
.switch input:checked + .switchTrack::after { transform: translateX(18px); }

/* ── weekly schedule ── */

.scheduleRows {
  display: grid;
  gap: 10px;
}

.scheduleRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.scheduleDay {
  font-size: 13px;
  color: var(--ink);
}

.scheduleControls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.timeRange {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.timeDash { color: var(--muted); }

.timeInput {
  width: 76px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--subtle);
  color: var(--ink);
  font-size: 12px;
  text-align: center;
}

.scheduleOff {
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
}

/* ── blocked dates ── */

.blockedList {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.blockedDate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--subtle);
}

.blockedMain {
  display: grid;
  gap: 2px;
}

.blockedMain strong { font-size: 13px; }
.blockedMain .settingsSub { margin: 0; }

.iconBtn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 4px;
  line-height: 1;
  cursor: pointer;
}

.iconBtn:hover:not([disabled]) { color: var(--red); }

.hiddenTime { visibility: hidden; pointer-events: none; }

.availSaveRow { margin-top: 10px; text-align: right; }

.blockedDateItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--subtle);
  margin-bottom: 6px;
}
.blockedDateItem strong { font-size: 13px; }

.blockedDateForm { display: grid; gap: 8px; margin-top: 10px; }
.blockedDateForm.hidden { display: none; }
.blockedDateRow { display: flex; align-items: center; gap: 6px; }
.blockedDateRow .formInput { flex: 1; }
.blockedDateActions { display: flex; gap: 6px; }
.blockedDeleteBtn { padding: 4px 8px; }

.settingsSaveStatus { font-size: 12px; color: var(--muted); margin-left: 8px; }
.settingsSaveStatus.ok { color: var(--green, #22c55e); }

@media (max-width: 900px) {
  .settingsGrid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .settingsCard { padding: 16px; }
  .settingsCardHead { margin-bottom: 14px; }
  .settingsHeading { font-size: 14px; margin-bottom: 10px; }
  .settingsRule { margin: 14px 0; }
  .scheduleRow { gap: 10px; }
  .scheduleControls { gap: 10px; }
  .timeInput { width: 68px; padding: 4px 6px; font-size: 11px; }
  .blockedDateRow { flex-wrap: wrap; }
}

/* ------------------------------------------------------------ task form */

/*
 * The Stitch "Mindset Task Edit" layout: header band, scrollable body of
 * labelled sections, footer band. The base `dialog form` rule pads the whole
 * form; here the padding moves into the three bands so the borders can run
 * edge to edge.
 */
.taskDialog { width: min(704px, calc(100vw - 32px)); }

.taskDialog form {
  gap: 0;
  padding: 0;
  overflow: hidden;
  max-height: calc(100dvh - 48px);
  /* Head and foot take their natural height; the body takes the rest. Without
     the explicit minmax(0,1fr) the body row is `auto`, whose automatic minimum
     is its content height, so it refused to shrink and `overflow: hidden` just
     clipped the tail of the form — Notes and the Save button ended up below the
     bottom of the dialog with nothing to scroll. */
  grid-template-rows: auto minmax(0, 1fr) auto;
}

/* On a phone the two task filters split the row 50/50, which left "All
   priorities" reading "All pric...". Give them a real minimum and let them wrap
   onto their own lines when that minimum does not fit, rather than shrinking
   until the label is unreadable. */
@media (max-width: 640px) {
  .filters { flex-wrap: wrap; }
  .filters select { flex: 1 1 168px; width: auto; min-width: 168px; }

  .statsBar {
    flex-direction: column;
    gap: 16px;
    padding: 16px;
  }
  .statsProgress {
    padding-right: 0;
    border-right: none;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    width: 100%;
    justify-content: center;
  }
  .statsFigures {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

.formHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
}

.formHead h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.formClose {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  transition: var(--transition);
}

.formClose:hover { background: var(--subtle); color: var(--ink); }

.formBody {
  display: grid;
  gap: 24px;
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;   /* pairs with the grid row above so overflow-y can engage */
}

/* Assignee, priority, status, sharing and recurrence belong together: they are
   the "who and how" of a task, as opposed to its title, dates and notes. */
.formGroup {
  padding: 20px;
  background: var(--subtle);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
}

.formField { display: grid; gap: 8px; align-content: start; }
.formField-wide { grid-column: 1 / -1; }

.fieldLabel {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* The base stylesheet styles inputs nested in a <label>; these fields put the
   label alongside the control instead, so the sizing is restated here. */
.formBody input:not([type="hidden"]),
.formBody select,
.formBody textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.formBody textarea { resize: vertical; }

.formBody input:not([type="hidden"]):focus,
.formBody select:focus,
.formBody textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.formBody input:disabled,
.formBody select:disabled { opacity: 0.6; cursor: not-allowed; }

/* A chevron the browser will not restyle, so the selects match the inputs. */
.selectField { position: relative; display: block; }
.selectField select { appearance: none; padding-right: 36px; cursor: pointer; }
.selectField > i {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
}

/* Status pills. The value lives in the hidden #status input; these only draw
   it, which is why nothing else in the app had to learn about them. */
.statusPills { display: flex; flex-wrap: wrap; gap: 8px; }

.statusPill {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.statusPill:hover { border-color: var(--subtle-3); background: var(--subtle); }

.statusPill.isActive {
  border-color: var(--accent);
  background: var(--tint-accent);
  color: var(--accent);
  font-weight: 600;
}

.formFoot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 24px;
  background: var(--surface-raised);
  border-top: 1px solid var(--border);
}

.formFootSpacer { flex: 1; }

@media (max-width: 640px) {
  .formGroup { padding: 16px; }
  .formBody, .formHead, .formFoot { padding-left: 16px; padding-right: 16px; }
  /* Delete stays visible but stops sitting beside the primary action. */
  .formFoot { flex-wrap: wrap; }
  .formFootSpacer { display: none; }
  .formFoot .btn { flex: 1 1 auto; }
}

/* ------------------------------------------------------------ cabins */

/*
 * The Stitch "Mindset Cabin Booking Calendar": filter pills in the header, a
 * toolbar, a week/day time grid, and a booking drawer down the right.
 */
.cabinsHead { align-items: flex-start; gap: 16px; flex-wrap: wrap; }

.roomFilters {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.roomPill {
  padding: 7px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.roomPill:hover { color: var(--ink); }

/* Each room keeps one colour across the pill, its events and the day list, so
   the filter and the grid can be read against each other. */
.roomPill.isActive { background: var(--surface); box-shadow: var(--shadow-sm); }
.roomPill.room-0.isActive { color: var(--accent); }
.roomPill.room-1.isActive { color: var(--mint); }

.calToolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.calToolbarGroup { display: flex; align-items: center; gap: 10px; }

.calStep {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.calStep button {
  padding: 6px 10px;
  border: 0;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: var(--transition);
}

.calStep button:hover { background: var(--subtle); color: var(--ink); }
.calStep button + button { border-left: 1px solid var(--border); }

.calPeriod { margin: 0; font-size: 17px; font-weight: 700; }

.calShell { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.calShell:has(.bookDrawer.hidden) { grid-template-columns: minmax(0, 1fr); }

.calMain {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.calDayHeader {
  display: grid;
  grid-template-columns: 64px repeat(var(--calCols, 7), minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
  background: var(--surface-raised);
}

.calDay {
  display: grid;
  gap: 2px;
  justify-items: center;
  padding: 10px 4px;
  border: 0;
  border-left: 1px solid var(--border-soft);
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
}

.calDay:hover { background: var(--subtle); }
.calDay.isSelected { background: var(--tint-accent); }

.calDayName {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.calDayNum { font-size: 15px; font-weight: 600; color: var(--ink); }

/* Today gets the filled marker; the selected day gets the tinted column. They
   are different things and are shown differently. */
.calDayNum.isToday {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}

.calBody {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  max-height: 560px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.calTimeCol { border-right: 1px solid var(--border-soft); }

.calHour {
  position: relative;
  height: var(--calHour, 56px);
  padding-right: 8px;
  text-align: right;
}

/* The label straddles the line it names rather than sitting inside the hour. */
.calHour span {
  position: relative;
  top: -7px;
  font-size: 11px;
  color: var(--muted);
}

.calGrid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--calCols, 7), minmax(0, 1fr));
}

.calLines { position: absolute; inset: 0; display: grid; grid-auto-rows: 1fr; }
.calLines > div { border-top: 1px solid var(--border-soft); }

.calCol { position: relative; border-left: 1px solid var(--border-soft); }
.calCol.isSelected { background: var(--tint-accent); }

.calEvent {
  position: absolute;
  overflow: hidden;
  display: grid;
  align-content: start;
  gap: 1px;
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 11px;
  line-height: 1.25;
  cursor: default;
}

.calEvent strong {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calEvent span { color: var(--muted); font-size: 10px; }
/* Under ~45 minutes there is no room for two lines; the title wins. */
.calEvent.isShort span { display: none; }

.calEvent.room-0 { border-color: var(--edge-accent); background: var(--tint-accent); color: var(--accent); }
.calEvent.room-1 { border-color: var(--edge-mint); background: var(--tint-mint); color: var(--mint); }

.calNow { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); }
.calNow::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--red);
}

/* ---- booking drawer */

.bookDrawer {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.drawerHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
}

.drawerHead h3 { margin: 0; font-size: 16px; font-weight: 700; }

.drawerBody {
  display: grid;
  gap: 16px;
  padding: 18px;
  /* Was a flat 620px, which made the drawer taller than a 720px viewport and
     pushed its own submit button below the fold. Track the viewport instead. */
  max-height: min(620px, calc(100vh - 260px));
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Keeps "Book now" on screen while any part of the form is. */
.drawerFoot {
  position: sticky;
  bottom: -18px;
  display: grid;
  gap: 8px;
  margin: 4px -18px -18px;
  padding: 12px 18px 18px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.drawerFoot .formMessage:empty { display: none; }

.drawerForm { display: grid; gap: 14px; }

/* Same field treatment as the task form; the base stylesheet only styles
   inputs nested inside a <label>. */
.drawerForm input,
.drawerForm select,
.drawerForm textarea {
  width: 100%;
  padding: 10px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.drawerForm textarea { resize: vertical; }

.drawerForm input:focus,
.drawerForm select:focus,
.drawerForm textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.drawerCard {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--subtle);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
}

.drawerCardTitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.statusRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.statusValue { font-weight: 600; color: var(--ink); }

@media (max-width: 1100px) {
  .calShell { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .calToolbar { align-items: stretch; }
  .calToolbarGroup { flex-wrap: wrap; }
  .calBody { grid-template-columns: 48px minmax(0, 1fr); }
  .calMain { overflow-x: auto; }
}

/* Views with no header controls (Overview, Cabins, Booking Desk, Forms,
   Activity, Settings) collapse the bar rather than showing an empty strip
   with a border. Mobile keeps it — the menu toggle lives there. */
.topbar.topbarBare {
  display: none;
}
/* Matches the breakpoint where .menuToggle becomes visible in styles.css. */
@media (max-width: 1100px) {
  .topbar.topbarBare {
    display: flex;
    border-bottom: 0;
  }
}

/* ── Contrast: text on accent fills ────────────────────────────────
   The dark theme's accent (#d4875a) is a light orange. White text on it
   measured 2.83:1 — below the 4.5:1 minimum — on primary buttons, the
   booking-desk step numbers and today's date in the cabin calendar.
   Light theme's accent (#9A5533) is dark and keeps white. */
:root { --on-accent: #ffffff; }
:root[data-theme="dark"] { --on-accent: #24160e; }

:root[data-theme="dark"] .btn-primary,
:root[data-theme="dark"] .bd-btn-primary,
:root[data-theme="dark"] .bd-step-num,
:root[data-theme="dark"] .calDayNum.isToday {
  color: var(--on-accent);
}

/* "New task" now lives in the All tasks panel header, pushed to the right
   so the count stays beside the title. */
.panelHead-divided .panelHeadAction { margin-left: auto; }

/* ── Booking desk: Availability tab ──────────────────────────────── */
.bd-avail-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.bd-avail-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
  flex: 1 1 160px;
}
/* Availability answers "when is she next free?", so it groups by day and
   leads with a count instead of laying 40 equal cards on a 3-up grid where
   the same date repeats on every one. Stacked, not gridded. */
#availSlots {
  display: block;
}
.bd-avail-summary {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary, #6b7280);
  margin-bottom: 12px;
}
.bd-avail-day {
  border-top: 1px solid var(--border);
  padding: 12px 0;
}
.bd-avail-day:first-of-type { border-top: none; padding-top: 0; }
.bd-avail-daylabel {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}
.bd-avail-daylabel span {
  font-weight: 500;
  color: var(--text-secondary, #6b7280);
}
.bd-avail-times {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
/* Clickable now: whoever just found the slot is usually the one who has to
   book it, and retyping therapist/duration/date by hand is where the
   mistakes came from. It carries the choice into the flow, it does not book. */
.bd-avail-time {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}
.bd-avail-time:hover,
.bd-avail-time:focus-visible {
  border-color: var(--primary, #2563eb);
  color: var(--primary, #2563eb);
}

/* The fourth tab (Availability) overflowed the row on a 390px screen:
   "New booking" wrapped to two lines and "Payments" was cut off at the
   edge. Scroll the row horizontally instead of wrapping or clipping. */
.bd-tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.bd-tabs::-webkit-scrollbar { display: none; }
.bd-tab {
  white-space: nowrap;
  flex: 0 0 auto;
}
@media (max-width: 560px) {
  .bd-tab { padding-left: 12px; padding-right: 12px; }
}
