/* ==========================================================================
   Rosta - design tokens, app shell (side menu / tab bar) and base components.
   Follows the device's light/dark mode, unless Light or Dark is chosen in the menu.
   ========================================================================== */
:root {
  color-scheme: light dark;
  --font: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --brand: #17775f;
  --brand-dark: #0f5a47;
  --brand-soft: #e7f4ef;
  --on-brand: #ffffff;

  --bg: #f4f6f5;
  --card: #ffffff;
  --card-2: #f8faf9;
  --input-bg: #ffffff;
  --hover: #f2f6f4;
  --border: #e4e9e6;
  --border-strong: #cfd8d3;
  --text: #15201b;
  --muted: #5e6e67;

  --danger: #b3261e;
  --danger-solid: #b3261e;
  --danger-dark: #8f1e18;
  --danger-bg: #fbe9e7;
  --warn: #8a5a00;
  --warn-bg: #fdf1d6;
  --ok: #1d6f3d;
  --ok-solid: #1d6f3d;
  --ok-dark: #17582f;
  --ok-bg: #e3f4ea;

  --grid-soft: #edf1ee;
  --grid-hour: #bdc9c3; /* the hour lines: strongest */
  --grid-band: #e6f3ed; /* the green rows */
  --grid-half: #d1dad5; /* the :30 lines: a bit bolder than the quarter lines */
  --slot-bg: #c4e8d8;
  --slot-border: #7dbfa6;
  --slot-hover: #b2dfcc;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 32, 26, .05), 0 1px 3px rgba(16, 32, 26, .04);
  --shadow-md: 0 10px 30px rgba(16, 32, 26, .12);
  --ring: 0 0 0 3px rgba(23, 119, 95, .22);
  --overlay: rgba(10, 20, 16, .42);
  --sidebar-w: 256px;
}

/* Dark colours: used when the device is in dark mode (unless Light was chosen in the menu) or when Dark was chosen. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #3fcaa0;
    --brand-dark: #62d8b6;
    --brand-soft: #17302a;
    --on-brand: #04241b;

    --bg: #0e1412;
    --card: #161e1b;
    --card-2: #1a2420;
    --input-bg: #1a2420;
    --hover: #1c2824;
    --border: #26322d;
    --border-strong: #35453e;
    --text: #e9f0ed;
    --muted: #94a69e;

    --danger: #ff8f86;
    --danger-solid: #d9483e;
    --danger-dark: #bd3b32;
    --danger-bg: #3a1e1c;
    --warn: #f3c969;
    --warn-bg: #332a10;
    --ok: #6fdc97;
    --ok-solid: #2c9a58;
    --ok-dark: #238049;
    --ok-bg: #153020;

    --grid-soft: #1c2622;
    --grid-hour: #465850;
    --grid-band: #15302a;
    --grid-half: #34443d;
    --slot-bg: #1f5646;
    --slot-border: #34836a;
    --slot-hover: #266553;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, .5);
    --ring: 0 0 0 3px rgba(63, 202, 160, .28);
    --overlay: rgba(0, 0, 0, .62);
  }
}
:root[data-theme="dark"] {
  --brand: #3fcaa0;
  --brand-dark: #62d8b6;
  --brand-soft: #17302a;
  --on-brand: #04241b;

  --bg: #0e1412;
  --card: #161e1b;
  --card-2: #1a2420;
  --input-bg: #1a2420;
  --hover: #1c2824;
  --border: #26322d;
  --border-strong: #35453e;
  --text: #e9f0ed;
  --muted: #94a69e;

  --danger: #ff8f86;
  --danger-solid: #d9483e;
  --danger-dark: #bd3b32;
  --danger-bg: #3a1e1c;
  --warn: #f3c969;
  --warn-bg: #332a10;
  --ok: #6fdc97;
  --ok-solid: #2c9a58;
  --ok-dark: #238049;
  --ok-bg: #153020;

  --grid-soft: #1c2622;
  --grid-hour: #465850;
  --grid-band: #15302a;
  --grid-half: #34443d;
  --slot-bg: #1f5646;
  --slot-border: #34836a;
  --slot-hover: #266553;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, .5);
  --ring: 0 0 0 3px rgba(63, 202, 160, .28);
  --overlay: rgba(0, 0, 0, .62);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::selection { background: var(--brand-soft); }

h1 { font-size: 28px; line-height: 1.2; letter-spacing: -.02em; font-weight: 700; margin: 0 0 20px; }
h2 { font-size: 19px; line-height: 1.3; letter-spacing: -.01em; font-weight: 650; }
h3 { letter-spacing: -.005em; }

.icon { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex: none; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.main-area { flex: 1; min-width: 0; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  position: sticky;
  top: 0;
  height: 100vh;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  background: var(--card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 10px;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 17px;
  font-weight: 700;
}
.brand-sub { font-weight: 500; font-size: 13px; color: var(--muted); letter-spacing: 0; }

.org-name {
  margin: 16px 4px 18px;
  padding: 10px 12px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.side-link[hidden] { display: none; }
.side-link:hover { background: var(--hover); color: var(--text); }
.side-link.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.side-link .icon { width: 20px; height: 20px; vertical-align: 0; }
.side-label { flex: 1; min-width: 0; }

.side-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-foot form, .more-account form { margin: 0; }
.side-lang { display: flex; align-items: center; gap: 12px; padding: 4px 12px; color: var(--muted); }
.side-lang .icon { width: 20px; height: 20px; vertical-align: 0; }
.side-lang form { flex: 1; margin: 0; }
.side-lang select { padding: 7px 10px; font-size: 14px; border-radius: 8px; }

.nav-count {
  display: inline-block;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 36px 36px 80px;
  animation: page-in .28s ease-out;
}
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }

.topbar, .tabbar, .more-sheet, .more-backdrop { display: none; }

/* Phone and small tablet: slim title bar on top, tab bar at the bottom. */
@media (max-width: 899px) {
  .sidebar { display: none; }
  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 50;
    padding: max(12px, env(safe-area-inset-top)) 18px 12px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
  }
  .topbar .brand { padding: 0; font-size: 19px; }
  .topbar-org {
    max-width: 52%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
  }
  .container { padding: 22px 16px calc(100px + env(safe-area-inset-bottom)); }
  h1 { font-size: 24px; }

  .tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: var(--card);
    border-top: 1px solid var(--border);
  }
  .tab {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 2px;
    border: none;
    border-radius: 12px;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
  }
  .tab-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 52px;
    height: 30px;
    border-radius: 15px;
    transition: background .15s;
  }
  .tab .icon { width: 22px; height: 22px; vertical-align: 0; }
  .tab.active { color: var(--brand); }
  .tab.active .tab-icon { background: var(--brand-soft); }
  .tab .nav-count { position: absolute; top: -3px; right: 2px; box-shadow: 0 0 0 2px var(--card); }
  .tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .more-backdrop { display: block; position: fixed; inset: 0; z-index: 70; background: var(--overlay); }
  .more-backdrop[hidden] { display: none; }
  .more-sheet {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    max-height: 85vh;
    overflow-y: auto;
    padding: 10px 14px calc(18px + env(safe-area-inset-bottom));
    background: var(--card);
    border-radius: 22px 22px 0 0;
    box-shadow: var(--shadow-md);
    transform: translateY(105%);
    visibility: hidden;
    transition: transform .25s ease, visibility 0s linear .25s;
  }
  .more-sheet.open { transform: none; visibility: visible; transition: transform .25s ease; }
  .more-grabber { width: 40px; height: 4px; margin: 0 auto 10px; border-radius: 4px; background: var(--border-strong); }
  .more-org { padding: 4px 12px 10px; font-weight: 700; }
  .more-account { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
}

/* Pages shown inside the Calendar's slide-in booking panel (an iframe) have no menus. */
html.embedded .sidebar, html.embedded .topbar, html.embedded .tabbar,
html.embedded .more-sheet, html.embedded .more-backdrop { display: none !important; }
html.embedded .app { display: block; min-height: 0; }
html.embedded .container { padding: 18px 18px 32px; max-width: none; animation: none; }

/* Signed-out pages (login, password reset, invite links) have no menu. */
.kind-anon .container { max-width: none; padding: 0; }

.impersonation-bar { position: relative; z-index: 90; }

/* ---------- Install prompt ---------- */
.install-modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
}
/* Without this, the backdrop's own `display: flex` above beats the
   browser's default `[hidden] { display: none }` rule (same selector
   specificity, and this stylesheet loads after it) - leaving it visually
   invisible but still covering the page and swallowing every click. */
.install-modal-backdrop[hidden] { display: none; }
.install-modal {
  background: var(--card);
  border-radius: 20px;
  padding: 24px;
  max-width: 360px;
  width: 100%;
  box-shadow: var(--shadow-md);
}
.install-modal p { margin: 0 0 18px; font-size: 15px; line-height: 1.5; color: var(--text); }

/* ---------- Components ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--brand);
  color: var(--on-brand);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: scale(.98); }
.btn .icon { width: 18px; height: 18px; vertical-align: 0; }
.btn.secondary {
  background: var(--card);
  color: var(--brand);
  border-color: var(--border-strong);
  box-shadow: none;
}
.btn.secondary:hover { background: var(--brand-soft); border-color: var(--brand); }
.btn.danger { background: var(--danger-solid); color: #fff; }
.btn.danger:hover { background: var(--danger-dark); }

.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}

input[type=text], input[type=email], input[type=password], input[type=date], input[type=tel],
input[type=search], input[type=number], input[type=time], select, textarea {
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 16px;
  width: 100%;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
::placeholder { color: var(--muted); opacity: .7; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); }

form .field { margin-bottom: 16px; }
form label { display: block; font-weight: 600; font-size: 14.5px; margin-bottom: 6px; }
form .help { color: var(--muted); font-size: 14px; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--border); }
th {
  background: var(--card-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}
tbody tr:last-child td { border-bottom: none; }
@media (hover: hover) { tr:hover td { background: var(--hover); } }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
}
.badge.paid { background: var(--ok-bg); color: var(--ok); }
.badge.due { background: var(--warn-bg); color: var(--warn); }
.badge.overdue { background: var(--danger-bg); color: var(--danger); }

.messages { list-style: none; padding: 0; margin: 0 0 20px; }
.messages li {
  padding: 13px 16px;
  border-radius: 12px;
  margin-bottom: 10px;
  font-size: 15px;
  background: var(--brand-soft);
  color: var(--text);
  animation: page-in .25s ease-out;
}
.messages li.success { background: var(--ok-bg); color: var(--ok); }
.messages li.warning { background: var(--warn-bg); color: var(--warn); }
.messages li.error { background: var(--danger-bg); color: var(--danger); }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: radial-gradient(900px 420px at 50% -8%, var(--brand-soft), transparent 70%), var(--bg);
}
.login-card { width: 100%; max-width: 400px; box-shadow: var(--shadow-md); }
.login-card h1 { text-align: center; color: var(--text); }

.actions-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

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

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

.calendar-wrap { overflow-x: auto; }
.calendar-day-nav {
  display: none; /* shown only at phone widths, see the media query below */
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.calendar-time-grid {
  display: flex;
  gap: 6px;
  /* Set as a custom property (not a plain inline min-width) specifically
     so the phone-width media query below can still override it — an
     inline style always beats a stylesheet rule regardless of media
     query, so the override has to live in the min-width declaration
     itself, not in the value feeding it. */
  min-width: var(--cal-grid-min-width, 760px);
}
.calendar-axis { width: 52px; flex-shrink: 0; }
.calendar-axis-spacer { height: 44px; }
.calendar-axis-lane-spacer { height: 22px; }
.calendar-axis-body { position: relative; }
.calendar-hour-label {
  position: absolute;
  left: 0;
  right: 6px;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}
.calendar-day-col {
  flex: 1;
  min-width: var(--cal-day-min-width, 100px); /* see .calendar-time-grid's comment above */
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.calendar-day-col.today { border-color: var(--brand); border-width: 2px; }
.calendar-day-header {
  box-sizing: border-box;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom: 1px solid var(--border);
}
.calendar-day-col.today .calendar-day-header { color: var(--brand); }
.calendar-day-date { font-weight: 400; text-transform: none; letter-spacing: 0; }
.calendar-day-add {
  margin-left: auto;
  color: var(--brand);
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  line-height: 1;
}
.calendar-day-add:hover { color: var(--brand-dark); }
.calendar-day-body {
  position: relative;
  cursor: pointer;
  /* Three line strengths (48px = CALENDAR_ROW_HEIGHT in views.py): the hour is
     the strongest, the half hour medium, and the 15-minute quarters lightest. */
  background-image:
    repeating-linear-gradient(
      to bottom, var(--grid-hour) 0, var(--grid-hour) 1px, transparent 1px, transparent 48px
    ),
    repeating-linear-gradient(
      to bottom, var(--grid-half) 0, var(--grid-half) 1px, transparent 1px, transparent 24px
    ),
    repeating-linear-gradient(
      to bottom, var(--grid-soft) 0, var(--grid-soft) 1px, transparent 1px, transparent 12px
    ),
    /* every second 15-minute row (:15-:30 and :45-:00) is tinted green */
    repeating-linear-gradient(
      to bottom, transparent 0, transparent 12px, var(--grid-band) 12px, var(--grid-band) 24px
    );
}
/* With 2+ staff, the day body is split into one lane per staff member
   (plus "Unassigned" when needed) instead of drawing the gridlines and
   holding appointments itself — each lane draws its own copy of both. */
.calendar-day-body.has-lanes { display: flex; background-image: none; cursor: default; }
.calendar-staff-lane {
  position: relative;
  flex: 1;
  min-width: 70px;
  cursor: pointer;
  border-left: 1px solid var(--border);
  background-image:
    repeating-linear-gradient(
      to bottom, var(--grid-hour) 0, var(--grid-hour) 1px, transparent 1px, transparent 48px
    ),
    repeating-linear-gradient(
      to bottom, var(--grid-half) 0, var(--grid-half) 1px, transparent 1px, transparent 24px
    ),
    repeating-linear-gradient(
      to bottom, var(--grid-soft) 0, var(--grid-soft) 1px, transparent 1px, transparent 12px
    ),
    /* every second 15-minute row (:15-:30 and :45-:00) is tinted green */
    repeating-linear-gradient(
      to bottom, transparent 0, transparent 12px, var(--grid-band) 12px, var(--grid-band) 24px
    );
}
.calendar-staff-lane:first-child { border-left: none; }
.calendar-staff-labels {
  display: flex;
  height: 22px;
  border-bottom: 1px solid var(--border);
}
.calendar-staff-label {
  flex: 1;
  min-width: 70px;
  box-sizing: border-box;
  padding: 3px 6px 0;
  border-left: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calendar-staff-label:first-child { border-left: none; }
.calendar-slot-highlight {
  position: absolute;
  left: 3px;
  right: 3px;
  background: color-mix(in srgb, var(--brand) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand) 45%, transparent);
  border-radius: 4px;
  pointer-events: none;
}
.calendar-slot {
  position: absolute;
  left: 3px;
  right: 3px;
  background: var(--slot-bg);
  color: var(--text);
  border: 1px solid var(--slot-border);
  border-radius: 6px;
  padding: 3px 6px;
  overflow: hidden;
  text-decoration: none;
  font-size: 12px;
  line-height: 1.3;
}
.calendar-slot:hover { background: var(--slot-hover); }
.calendar-slot-time { display: block; font-weight: 700; color: var(--brand-dark); }
.calendar-slot-member { display: block; }

.member-picker { position: relative; }
.member-search-results {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  margin-top: 4px;
  max-height: 220px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
}
.member-search-result {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 15px;
}
.member-search-result:hover { background: var(--brand-soft); }
.member-search-add-new {
  display: block;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  color: var(--brand);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.member-search-add-new:hover { background: var(--brand-soft); }
.member-search-empty {
  padding: 10px 14px;
  color: var(--muted);
  font-size: 14px;
}
/* Booking / visit forms: one button per service, and the panel that slides
   in with that service's Pricing Sheet options. */
.service-pick-btn {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  font: inherit;
  color: var(--text);
  cursor: pointer;
}
.service-pick-btn:hover { background: var(--brand-soft); }
.service-pick-btn.has-choice { border-color: var(--brand); background: var(--brand-soft); }
.spb-name { font-weight: 600; }
.spb-arrow { color: var(--muted); font-size: 20px; line-height: 1; }
.spb-chosen { grid-column: 1 / -1; font-size: 14px; color: var(--muted); }
.spb-chosen:empty { display: none; }
.spb-chosen div { margin-top: 3px; }

.service-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .25);
  z-index: 1100;
}
.service-sheet-backdrop[hidden] { display: none; }
.service-sheet {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: var(--card);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0, 0, 0, .12);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform .22s ease, visibility 0s linear .22s;
  z-index: 1101;
}
.service-sheet.open { transform: translateX(0); visibility: visible; transition: transform .22s ease; }
.service-sheet-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex: none;
}
.service-sheet-header h2 { margin: 0; font-size: 17px; }
.service-sheet-body { flex: 1; overflow-y: auto; padding: 14px 18px; }
.service-sheet-footer {
  flex: none;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}
.svc-section { margin: 4px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.svc-note { margin-bottom: 18px; }
.svc-note textarea { width: 100%; min-height: 64px; resize: vertical; font-family: inherit; }
.svc-note .help { margin-top: 4px; }
.spb-note { font-style: italic; color: var(--muted); }
.svc-history { margin-bottom: 18px; }
.svc-history-list { list-style: none; margin: 0; padding: 0; }
.svc-history-list li { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.svc-history-list li:last-child { border-bottom: none; }
.svc-history-note { margin: 0; font-size: 14px; }
.svc-history-note:empty { display: none; }
.svc-history-more { margin-top: 6px; font-size: 14px; background: none; border: none; padding: 0; color: var(--brand); text-decoration: underline; cursor: pointer; font-family: inherit; }
.svc-option {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.svc-option:last-child { border-bottom: none; }
.svc-opt-label { display: flex; align-items: flex-start; gap: 10px; flex: 1; min-width: 150px; margin: 0; font-weight: normal; cursor: pointer; }
.svc-opt-label input { margin-top: 4px; width: auto; }
.svc-opt-main { display: flex; flex-direction: column; gap: 2px; }
.svc-opt-price { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.svc-opt-price input { width: 100px; }
/* Inside the Calendar's slide-in booking panel the options cover the whole panel. */
html.embedded .service-sheet { width: 100%; height: 100%; border-left: none; box-shadow: none; }
@media (max-width: 640px) {
  .service-sheet {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100vw;
    height: 75vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
  .service-sheet.open { transform: translateY(0); }
  html.embedded .service-sheet { height: 100%; border-radius: 0; }
}

.upload-box {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  margin-bottom: 20px;
}

/* ---- Small-screen (phone) adjustments ---- */
@media (max-width: 640px) {
  /* Members list: each row becomes its own card instead of a table row,
     since a 4-5 column table doesn't fit a phone width. */
  .member-table-wrap {
    border: none;
    background: transparent;
    overflow-x: visible;
  }
  .responsive-table thead { display: none; }
  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td {
    display: block;
    width: 100%;
  }
  .responsive-table tr {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 12px;
  }
  .responsive-table td {
    border: none;
    padding: 5px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }
  .responsive-table td:first-child {
    font-size: 17px;
    font-weight: 600;
    padding-top: 0;
  }
  .responsive-table td:last-child { padding-bottom: 0; }
  .responsive-table td[data-label]::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
  }

  /* Calendar: show one day at a time with Prev/Next-day controls, instead
     of a 7-day strip that only works by scrolling sideways. */
  .calendar-day-nav { display: flex; gap: 8px; }
  /* The week buttons are for the computer; on a phone the day buttons above do the job. */
  .toolbar .calendar-week-nav { display: none; }
  .calendar-day-nav .btn { flex: 1 1 0; min-width: 0; padding-left: 8px; padding-right: 8px; font-size: 14px; white-space: nowrap; justify-content: center; }
  .calendar-day-nav #cal-today { flex: 0 0 auto; padding-left: 14px; padding-right: 14px; }
  /* No scroll box of its own here: an overflow-x:auto wrapper swallowed the first
     finger-swipe up/down on a phone. The lanes shrink to fit instead. */
  .calendar-wrap { overflow: visible; overflow-x: clip; }
  .calendar-time-grid { min-width: 0; }
  .calendar-staff-label { min-width: 0; }
  .calendar-day-col { display: none; min-width: 0; }
  .calendar-day-col.mobile-visible { display: block; }
  .calendar-staff-lane { min-width: 0; }

}

/* "Now" line in today's column. */
.calendar-now-line {
  position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--danger);
  pointer-events: none; z-index: 3;
}
.calendar-now-line::before {
  content: ""; position: absolute; left: -1px; top: -5px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--danger);
}

/* A page showing inside the Calendar's slide-in booking panel (see
   .booking-panel below): hide the normal navbar and shrink the page
   padding, since the panel itself is already a distinct area of the
   screen and doesn't need its own full app header. */

/* The Calendar's slide-in booking panel. Fixed to the right edge, on top
   of everything, so the rest of the Calendar stays visible and untouched
   underneath while it's open — booking without losing sight of which
   hours are free. */
.booking-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(440px, 100vw);
  height: 100vh;
  background: var(--card);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0, 0, 0, .12);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .22s ease;
  z-index: 1000;
}

.booking-panel.open { transform: translateX(0); }

.booking-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.booking-panel-header h2 {
  margin: 0;
  font-size: 17px;
}

.booking-panel-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 6px;
}

.booking-panel-close:hover { background: var(--bg); color: var(--text); }

.booking-panel iframe {
  flex: 1;
  width: 100%;
  border: 0;
}

/* On a phone there's no room to keep the Calendar visible next to a side
   panel, so it becomes a bottom sheet instead: full width, but only the
   bottom half of the screen, sliding up rather than in from the side —
   leaving the top half of the Calendar visible behind it. Placed after
   the .booking-panel rules above (rather than in the shared small-screen
   media query further up the file) so it actually wins the cascade: same
   selector specificity, so without this ordering the later, unconditional
   desktop rule would override it even while this media query matches. */
@media (max-width: 640px) {
  .booking-panel {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100vw;
    height: 50vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, .12);
    transform: translateY(100%);
  }
  .booking-panel.open { transform: translateY(0); }
}

/* The Today page: a row of stat tiles, then short lists underneath. */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  color: var(--text);
  text-decoration: none;
}

a.stat-tile:hover { border-color: var(--brand); }
.stat-number { font-size: 30px; font-weight: 700; line-height: 1.1; color: var(--brand); }
.stat-label { font-size: 14px; color: var(--muted); }
.stat-tile.stat-alert .stat-number { color: var(--danger); }

.today-heading { margin: 28px 0 12px; }

.today-list { list-style: none; margin: 0; padding: 0; }

.today-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

.today-row:last-child { border-bottom: none; }
.today-row.past { opacity: .55; }
.today-time { flex: none; min-width: 96px; font-weight: 600; font-variant-numeric: tabular-nums; }
.today-main { flex: 1; min-width: 0; }
.today-more { margin: -12px 0 24px; }
.staff-badge { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }

@media (max-width: 640px) {
  .today-row { gap: 10px; padding: 12px 14px; }
  .today-time { min-width: 80px; font-size: 14px; }
}

/* Calendar: choose between everyone side by side and one person's own view. */
.staff-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.staff-switcher-label { font-size: 14px; margin-right: 2px; }
.staff-switcher .btn { padding: 8px 16px; }

/* Staff invite links on the Staff page. */
.invite-card { max-width: 640px; }
.invite-row { display: flex; gap: 10px; flex-wrap: wrap; }
.invite-url { flex: 1; min-width: 220px; font-family: ui-monospace, monospace; font-size: 13px; }

/* Gym class timetable. */
.toolbar.class-toolbar { justify-content: space-between; }
.class-week-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 0 0 16px;
}
.class-day-heading { margin: 24px 0 10px; font-size: 18px; }
.class-day-heading .muted { font-weight: 400; font-size: 15px; margin: 0 4px; }
.class-day-heading.is-today { color: var(--brand); }
.class-no-classes { margin: -4px 0 0; font-size: 14px; }
.class-edit-link { font-size: 14px; flex: none; }
.today-row.cancelled .today-main strong { text-decoration: line-through; }
.class-session-meta { margin-top: -8px; }
.weekday-field > div:not(.help) { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.weekday-field label { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; }
.weekday-field input[type=checkbox] { width: auto; }

@media (max-width: 640px) {
  .class-week-nav .btn { padding: 8px 12px; font-size: 14px; }
}

.check-row { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; margin: 0 0 6px; }
.check-row input[type=checkbox] { width: auto; margin-top: 4px; }
.class-spots { font-size: 14px; }

.class-actions { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }
.class-actions form { margin: 0; }
@media (max-width: 640px) {
  .class-row { flex-wrap: wrap; row-gap: 8px; }
  .class-row .today-main { flex: 1 1 150px; }
  .class-row .class-actions { flex: 1 1 100%; justify-content: flex-end; margin-left: 0; }
  .class-row .class-actions .btn { padding: 8px 18px; }
}

/* Exercise programs. */
.plan-row { align-items: flex-start; }
.plan-notes { font-size: 14px; margin-top: 4px; }
.plan-row.is-done .today-main > strong { text-decoration: line-through; opacity: .7; }
.btn.done-btn { background: var(--ok-solid); color: #fff; }
.btn.done-btn:hover { background: var(--ok-dark); }
.video-details { margin-top: 8px; }
.video-details summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 14px; }
.video-frame { position: relative; width: 100%; max-width: 560px; aspect-ratio: 16 / 9; margin-top: 8px; background: #000; border-radius: 8px; overflow: hidden; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@media (max-width: 640px) {
  .plan-row { flex-wrap: wrap; row-gap: 8px; }
  .plan-row .today-main { flex: 1 1 100%; }
  .plan-row .class-actions { flex: 1 1 100%; justify-content: flex-end; margin-left: 0; flex-wrap: wrap; }
}

/* Personal training: trainer hours page and member slot picker. */
.hours-card { max-width: 640px; margin-bottom: 20px; }
.hours-length { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 14px; }
.hours-length label { margin: 0; }
.hours-list { margin: 0 0 8px; }
.hours-day { min-width: 100px; }
/* One row per day: that day's time blocks sit on separate lines inside it. */
.hours-day-row, .today-row.hours-day-row { align-items: flex-start; flex-wrap: nowrap; }
.hours-day-row .hours-day { padding-top: 10px; min-width: 96px; }
.hours-blocks { min-width: 0; display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; }
.hours-block { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hours-times { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin-top: 12px; }
.hours-times input { width: auto; }
.slot-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.slot-grid form { margin: 0; }
.slot-btn { min-width: 72px; text-align: center; }

/* Prices, payments and the Money report. */
.money-summary { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 16px; }
.money-summary > div:first-child { display: flex; flex-direction: column; }
.money-big { font-size: 26px; line-height: 1.2; }
.money-big.is-owed { color: var(--danger); }
.money-list { margin: 14px 0 0; }
.money-list .today-row { flex-wrap: wrap; }
.money-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; max-width: 760px; margin: 8px 0 0; }
.money-tile { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.money-up { color: var(--ok); }
.money-down { color: var(--danger); }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 190px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; min-width: 0; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.bar { width: 100%; background: var(--brand); opacity: .45; border-radius: 4px 4px 0 0; min-height: 2px; }
.bar-col.is-selected .bar { opacity: 1; }
.bar-value { font-size: 11px; color: var(--muted, #667); white-space: nowrap; }
.bar-label { font-size: 13px; }
.price-input { display: inline-flex; align-items: center; gap: 6px; }
.price-input input { width: 110px; }
input.has-error { border-color: var(--danger); }
.price-card { margin-bottom: 18px; }
@media (max-width: 640px) { .bar-value { font-size: 10px; } .bars { gap: 6px; } }

/* Rosta Admin (operator pages) and "viewing as" bar. */
.brand-sub { font-weight: 400; opacity: .75; font-size: 14px; margin-left: 4px; }
.manage-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 14px; }
.manage-filters input[type=search] { flex: 1; min-width: 200px; }
.manage-filters select { width: auto; }
.manage-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.manage-actions form { margin: 0; }
.manage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; margin-top: 8px; }
.manage-form .field { margin-bottom: 14px; }
.manage-form { max-width: 640px; }
.manage-grid .manage-form { max-width: none; }
.field-error { color: var(--danger); font-size: 14px; margin-top: 4px; }
.test-bar { position: relative; z-index: 95; background: #e8590c; color: #fff; padding: 6px 16px; text-align: center; font-size: 13px; letter-spacing: .02em; }
.test-bar strong { letter-spacing: .08em; margin-right: 6px; }
.impersonation-bar { background: #b4531a; color: #fff; padding: 8px 16px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: center; font-size: 14px; }
.impersonation-bar form { margin: 0; }
.impersonation-bar .btn { background: #fff; color: #b4531a; border-color: #fff; padding: 6px 12px; }

/* Saved programs: member picker. */
.assign-members { max-height: 240px; overflow-y: auto; margin-top: 8px; padding: 6px 4px; border: 1px solid var(--border, #dcdfe3); border-radius: 8px; }
.assign-members label[hidden] { display: none; }
.assign-members .check-row { margin: 0; padding: 6px 8px; align-items: center; }
.assign-mode { margin-top: 12px; }

/* A short slide-out when a swipe changes the day / week / month. */
body .container { transition: transform .12s ease, opacity .12s ease; }
body.swipe-next .container { transform: translateX(-28px); opacity: .35; }
body.swipe-prev .container { transform: translateX(28px); opacity: .35; }

/* Swiping sideways must change the day/week/month, not trigger the browser's own "swipe back" navigation. */
html, body { overscroll-behavior-x: none; }


/* --- Barbershop appointment requests --- */
.request-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--warn-bg);
  color: var(--warn);
  text-decoration: none;
  font-weight: 600;
}
.request-banner .stat-number { font-size: 28px; line-height: 1; }
.request-banner-go { margin-left: auto; }
.request-list { display: grid; gap: 14px; max-width: 720px; }
.request-card { margin: 0; }
.request-head { display: flex; justify-content: space-between; align-items: center; gap: 6px 10px; flex-wrap: wrap; }
.request-name { font-size: 18px; }
.request-when { font-weight: 600; margin-top: 4px; }
.request-services { margin: 2px 0 8px; }
.contact-line { display: flex; gap: 16px; flex-wrap: wrap; margin: 6px 0; }
.contact-line a, .contact-box a { font-weight: 600; text-decoration: none; }
.contact-box { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.contact-box a[hidden] { display: none; }
.request-assign { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.request-assign select { max-width: 220px; }
.request-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; margin-top: 12px; }
.request-actions .btn { text-decoration: none; }
.decline-box summary { list-style: none; cursor: pointer; }
.decline-box summary::-webkit-details-marker { display: none; }
.decline-box form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.decline-box input[type=text] { min-width: 220px; flex: 1; }
.request-hint {
  background: var(--ok-bg);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
}
.settings-hours { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.settings-hours label { min-width: 100px; margin: 0; }
.choice-list { display: grid; gap: 8px; }
.choice { display: flex; align-items: center; gap: 10px; font-weight: 400; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.choice input { width: auto; margin: 0; }
.settings-hours input[type=time] { width: 140px; flex: 0 0 auto; }
.settings-hours label { flex: 0 0 100px; }
.request-assign select { width: auto; }

/* The arrow that tucks the options panel away again (choices are kept). */
.sheet-back {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--brand);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.sheet-back:hover { background: var(--bg); }


/* ==========================================================================
   Modern refinements
   ========================================================================== */
a.stat-tile, .stat-tile { border-radius: 16px; box-shadow: var(--shadow-sm); padding: 18px 20px; transition: transform .15s, border-color .15s, box-shadow .15s; }
a.stat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-number { font-size: 32px; letter-spacing: -.02em; }
.stat-label { font-weight: 500; }

.today-heading { font-size: 17px; margin: 32px 0 12px; }
.today-row { transition: background .15s; }
@media (hover: hover) { .today-list li:hover { background: var(--hover); } }
.today-time { color: var(--text); }
.staff-badge { border-radius: 999px; }

.service-pick-btn { border-radius: 12px; transition: background .15s, border-color .15s, box-shadow .15s; }
.service-pick-btn:hover { border-color: var(--brand); }
.spb-arrow .icon { width: 18px; height: 18px; vertical-align: 0; }
.service-sheet, .booking-panel { border-radius: 20px 0 0 20px; box-shadow: var(--shadow-md); }
html.embedded .service-sheet { border-radius: 0; }
.service-sheet-backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
.service-sheet-header, .booking-panel-header { background: var(--card); }
.sheet-back, .booking-panel-close {
  display: inline-grid;
  place-items: center;
}
.sheet-back .icon, .booking-panel-close .icon { width: 20px; height: 20px; vertical-align: 0; }
.booking-panel-close { width: 36px; height: 36px; padding: 0; border-radius: 50%; }
@media (max-width: 640px) {
  .service-sheet, .booking-panel { border-radius: 20px 20px 0 0; }
  html.embedded .service-sheet { border-radius: 0; }
}

/* Calendar */
.calendar-day-col { border-radius: 16px; box-shadow: var(--shadow-sm); }
.calendar-day-col.today { border-color: var(--brand); border-width: 1px; box-shadow: 0 0 0 1px var(--brand), var(--shadow-sm); }
.calendar-day-header { background: var(--card-2); }
.calendar-day-col.today .calendar-day-header { background: var(--brand-soft); }
.calendar-slot { border-radius: 8px; border-left: 3px solid var(--brand); box-shadow: var(--shadow-sm); }
.calendar-slot-time { color: var(--brand); }

.member-search-results { border-radius: 12px; box-shadow: var(--shadow-md); }
.member-search-result:hover, .member-search-add-new:hover { background: var(--brand-soft); }

.contact-line .icon, .contact-box .icon { width: 16px; height: 16px; vertical-align: -.2em; }
.request-card { border-radius: 16px; }
.choice { border-radius: 12px; transition: border-color .15s, background .15s; }
.choice:hover { border-color: var(--brand); }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

.upload-box { border-radius: 16px; background: var(--card); }
details > summary { cursor: pointer; }
.video-details summary { color: var(--brand); }

/* Phone: tables that turn into cards, softer cards. */
@media (max-width: 640px) {
  .card { padding: 18px; border-radius: 16px; }
  .responsive-table tr { border-radius: 16px; box-shadow: var(--shadow-sm); }
  .toolbar .btn { flex: 1 1 auto; }
  .toolbar > form { width: 100%; flex: 1 1 100% !important; }
  .toolbar > form input[type=search] { max-width: none !important; flex: 1 1 100%; }
  .toolbar > form select { max-width: none !important; flex: 1 1 0; width: auto; min-width: 0; }
}

/* "< Back to ..." links */
a:has(> svg.icon:first-child):not(.btn):not(.side-link):not(.tab) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-weight: 500;
  text-decoration: none;
}
a:has(> svg.icon:first-child):not(.btn):not(.side-link):not(.tab):hover { text-decoration: underline; }


/* ---------- Waiting requests in the calendar ---------- */
.calendar-request {
  position: absolute;
  box-sizing: border-box;
  padding: 0 3px;
  pointer-events: none; /* clicks fall through to the grid, so free times can still be picked */
}
.calendar-request::before {
  content: "";
  position: absolute;
  inset: 0 3px;
  border-radius: 8px;
  border: 1.5px dashed color-mix(in srgb, var(--warn) 55%, transparent);
  background: repeating-linear-gradient(
    135deg,
    color-mix(in srgb, var(--warn-bg) 85%, transparent) 0 8px,
    color-mix(in srgb, var(--warn-bg) 45%, transparent) 8px 16px
  );
}
.calendar-request.active::before {
  border-style: solid;
  border-color: var(--warn);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 25%, transparent);
}
.calendar-request-label {
  position: relative;
  display: block;
  margin: 4px 6px 0;
  padding: 3px 7px;
  max-width: calc(100% - 12px);
  width: max-content;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
  color: var(--warn);
  font-size: 12px;
  line-height: 1.3;
  text-decoration: none;
  pointer-events: auto;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.calendar-request-label:hover { background: var(--warn-bg); }
.calendar-request-title { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-request-sub { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.confirm-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--warn-bg);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
}
.confirm-banner-hint { margin-top: 6px; font-weight: 600; color: var(--warn); }
@media (max-width: 899px) {
  .calendar-request-sub { display: none; }
  .calendar-request-label { margin: 3px 4px 0; padding: 2px 5px; font-size: 11px; }
}

/* Login: "remember my username" */
.remember-row { display: flex; align-items: center; gap: 10px; margin: 2px 0 16px; font-weight: 400; font-size: 14px; color: var(--muted); cursor: pointer; }
.remember-row input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--brand); }

/* Pricing sheet: sub category lines */
.sub-line { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.sub-line input[name=sub_name] { flex: 2; min-width: 0; }
.sub-line input[name=sub_amount] { flex: 1; min-width: 0; max-width: 120px; }
.sub-line select { flex: none; width: auto; }
.sub-line .sub-remove { flex: none; padding: 8px 12px; }
.pricing-table tr.sub-row td:first-child { padding-left: 24px; }
@media (max-width: 640px) { .sub-line { flex-wrap: wrap; } .sub-line input[name=sub_name] { flex: 1 1 100%; } }

/* Appearance switch (Auto / Light / Dark) and the version label in the menus */
.side-theme { display: flex; align-items: center; gap: 12px; padding: 4px 12px; color: var(--muted); }
.side-theme .icon { width: 20px; height: 20px; flex: none; }
.theme-switch { display: flex; flex: 1; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.theme-switch button {
  flex: 1; border: 0; background: var(--card); color: var(--muted); padding: 7px 6px; font: inherit; font-size: 14px; cursor: pointer;
}
.theme-switch button + button { border-left: 1px solid var(--border-strong); }
.theme-switch button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); font-weight: 600; }
.build-label { padding: 6px 12px 0; font-size: 12px; color: var(--muted); }
.pricing-table td.pricing-actions { text-align: right; width: 1%; min-width: 230px; }
.pricing-table td.pricing-actions .btn { margin: 2px 0 2px 4px; }
@media (max-width: 640px) { .pricing-table td.pricing-actions { min-width: 0; } }

/* Phone notifications card (client home) */
.push-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 18px; padding: 14px 18px; }
.push-card[hidden] { display: none; }
.push-card .push-text { flex: 1; min-width: 200px; }
.push-card .push-text .muted { font-size: 14px; margin-top: 2px; }
.push-card .btn .icon { width: 18px; height: 18px; }

/* The client's Important Note: always bold, always right above the confirm button */
.important-note { margin: 0 0 14px; padding: 10px 14px; font-weight: 700; border-radius: var(--radius-sm);
  background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn); overflow-wrap: anywhere; }
.important-note[hidden] { display: none; }
.svc-important { margin: 0; border-radius: 0; border-width: 1px 0 0; flex: none; }

/* Follow-up booking: what was already booked today, for reference */
.earlier-today { background: var(--card-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 18px; }
.earlier-row { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.earlier-row:last-of-type { border-bottom: none; }
.earlier-time { font-weight: 600; }
.earlier-note { font-style: italic; color: var(--muted); }

/* Pricing sheet: the categories list */
.category-list { display: grid; gap: 10px; max-width: 640px; }
.category-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; margin: 0; text-decoration: none; color: inherit; }
.category-item:hover { border-color: var(--brand); }
.category-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.category-name { font-size: 1.05rem; }
.category-meta { font-size: .9rem; }
.category-arrow { font-size: 1.6rem; line-height: 1; color: var(--muted); flex: none; }

/* Cancel booking: the client's other bookings that day */
.also-cancel { border: 1px solid var(--border); border-radius: 10px; padding: 12px 12px 4px; margin: 14px 0; }
.also-title { margin: 0 0 4px; font-weight: 600; font-size: .95rem; }
.also-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.also-row input { margin-top: 3px; flex: none; width: 18px; height: 18px; }

/* Requests with several days and time ranges */
.win-line { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px dashed var(--border); }
.win-fields { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.win-fields input[type=date] { flex: 1 1 100%; min-width: 0; }
.win-fields input[type=time] { flex: 1 1 90px; min-width: 0; }
@media (min-width: 700px) { .win-fields input[type=date] { flex: 1 1 160px; } .win-fields input[type=time] { flex: 0 1 120px; } }
.win-dash { color: var(--muted); }
.win-remove { flex: none; padding: 8px 12px; }
.win-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip { border: 1px solid var(--border-strong); background: var(--card-2); color: var(--text); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: .85rem; cursor: pointer; }
.chip:hover { background: var(--brand-soft); border-color: var(--brand); }
.request-window { display: block; font-weight: 600; }
.request-times .request-window { font-weight: 600; }
.request-times { line-height: 1.5; }

/* Pricing sheet: tick rows for mass edit / delete */
.bulk-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.bulk-all { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.bulk-bar input[type=checkbox], .bulk-cell input[type=checkbox] { width: 18px; height: 18px; }
.bulk-buttons { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.pricing-table td.bulk-cell { width: 1%; }
.bulk-list { margin: 0 0 14px; padding-left: 20px; }
@media (max-width: 640px) { .bulk-buttons { margin-left: 0; width: 100%; } .bulk-buttons .btn { flex: 1; } .pricing-table td.bulk-cell { padding-bottom: 0; } }
.win-fields input[type=time] { min-width: 118px; padding-left: 10px; padding-right: 8px; }
.win-remove { padding: 8px 10px; }

/* Round 4: days off, no-shows, reminders */
.dayoff-form { margin-top: 10px; }
.dayoff-reason input { width: 220px; max-width: 100%; }
.hours-times input[type="text"] { width: 220px; max-width: 100%; }
.no-show-form { display: inline; margin-left: 8px; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.calendar-slot.no-show { opacity: .7; border-left-color: var(--danger); }
.no-show-tag { display: inline-block; font-size: 11px; font-weight: 700; color: var(--danger); background: var(--danger-bg); border-radius: 999px; padding: 1px 7px; margin-left: 4px; }
.check-row { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.today-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.no-show-form { margin-left: 0; }
.today-row .today-side .btn.small { white-space: nowrap; }
@media (max-width: 560px) {
  .today-row { flex-wrap: wrap; }
  .today-side { flex-basis: 100%; justify-content: flex-start; padding-left: 90px; }
}
.today-row.past { opacity: 1; }
.today-row.past > .today-time, .today-row.past > .today-main { opacity: .55; }

/* Round 5: wider desktop layouts, calmer Today page */
.today-grid { display: block; }
.today-block .today-heading { margin-top: 28px; }
.now-card { padding: 14px 18px; }
.now-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.now-row:last-child { border-bottom: none; }
.now-label { flex: none; min-width: 108px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--brand); }
.now-services { flex-basis: 100%; padding-left: 118px; font-size: 13px; }
@media (max-width: 560px) { .now-services { padding-left: 0; } .now-label { flex-basis: 100%; } }
.push-card.compact { padding: 8px 14px; margin: 0 0 14px; gap: 10px; }
.push-card.compact .push-text strong { display: none; }
.push-card.compact .push-text { font-size: 13px; min-width: 160px; }
.push-card.compact .btn { padding: 6px 12px; font-size: 13px; }
@media (min-width: 1000px) {
  .today-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 0 32px; align-items: start; }
  .today-block { order: 3; }
  .today-bookings { order: 1; }
  .today-now { order: 2; }
  .hours-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; align-items: start; }
  .hours-grid .hours-card { max-width: none; }
  .category-list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 960px; }
  .request-list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: none; }
  .settings-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; align-items: start; max-width: 1060px; }
  .settings-pair .card { max-width: none !important; }
}
.day-lines { list-style: none; margin: 8px 0 0; padding: 0; }
.day-line { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.day-line:last-child { border-bottom: none; }
.day-name { flex: none; width: 104px; font-weight: 600; }
.day-blocks { display: flex; flex-wrap: wrap; gap: 6px; }
.hours-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 3px 4px 3px 12px; font-variant-numeric: tabular-nums; font-size: 14px; }
.chip-form { display: inline; margin: 0; }
.chip-x { border: none; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; }
.chip-x:hover { background: var(--danger-bg); color: var(--danger); }
.day-free { margin: 8px 0 0; font-size: 13px; }
.hours-more { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.hours-more summary { cursor: pointer; font-weight: 600; color: var(--brand); padding: 4px 0; }
.hours-more[open] summary { margin-bottom: 8px; }
.empty-inline { background: var(--bg); border-radius: 12px; padding: 12px 14px; }

/* Round 5: confirmations that fade away by themselves */
.toasts { position: fixed; z-index: 90; right: 20px; top: 20px; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow-md); font-weight: 600; animation: toast-in .25s ease; }
.toast::before { content: "\2713"; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--ok); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.toast-x { margin-left: auto; border: none; background: transparent; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; }
.toast.leaving { opacity: 0; transform: translateY(-6px); transition: opacity .3s, transform .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (max-width: 899px) { .toasts { top: auto; bottom: calc(86px + env(safe-area-inset-bottom)); right: 16px; left: 16px; width: auto; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
@media (max-width: 560px) { .day-line { flex-direction: column; align-items: flex-start; gap: 6px; } .day-name { width: auto; } }
.hours-more form > .btn, .hours-more .weekday-field + .btn { margin-top: 10px; }

/* Requests: filter chips, booking-link card */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.chip-row .chip { text-decoration: none; display: inline-block; }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.qr-box { width: 180px; max-width: 100%; background: #fff; padding: 6px; border-radius: 10px; margin: 8px 0 12px; }
.qr-box svg { display: block; width: 100%; height: auto; }

.push-card .btn[hidden] { display: none; }
/* Public booking pages (no login): centred with side gutters */
.public-wrap { max-width: 620px; margin: 0 auto; padding: 20px 16px 48px; }
.public-wrap .card { max-width: none !important; }
/* Member list: sort and filter selects share the row and never get squashed */
.toolbar .filter-select { flex: 1 1 160px; min-width: 0; max-width: 240px !important; }
@media (max-width: 700px) { .toolbar .filter-select { max-width: none !important; flex-basis: 45%; } }
.win-fields select { flex: 1 1 90px; min-width: 100px; }
@media (min-width: 700px) { .win-fields select { flex: 0 1 120px; } }
.cell-email { word-break: break-all; }
.cell-email a { color: inherit; }

/* Reminder check status */
.timer-note { margin: 8px 0 0; color: var(--muted); }
.timer-note.is-warn { color: var(--danger); }
.timer-card { margin-top: 14px; padding: 10px 14px; }
.timer-card.is-warn { border-color: var(--danger); color: var(--danger); }

.calendar-jump-text { display: none; }

/* Phone calendar polish (kept at the end so it wins over the earlier rules). */
@media (max-width: 640px) {
  /* The week range is for the computer; here the date of the chosen day is shown instead,
     and tapping it opens the date picker (the real date box sits invisibly on top of it). */
  .calendar-range { display: none; }
  .calendar-jump { position: relative; flex: 1 1 100%; margin: 0 0 8px; }
  .calendar-jump-label { display: none; }
  .calendar-jump-text {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--card); font-size: 17px; font-weight: 600; text-transform: capitalize;
  }
  .calendar-jump input[type="date"] {
    position: absolute; inset: 0; width: 100%; max-width: none; height: 100%;
    opacity: 0; font-size: 16px; cursor: pointer;
  }

  /* The staff buttons stay on one row and scroll sideways, instead of wrapping onto several. */
  .staff-switcher { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
  .staff-switcher::-webkit-scrollbar { display: none; }
  .staff-switcher .btn, .staff-switcher-label { flex: 0 0 auto; white-space: nowrap; }
}

@media (max-width: 640px) { .hours-day-row .hours-day { min-width: 84px; } }
.hours-block .today-main { flex: 0 0 auto; white-space: nowrap; }
.hours-block .btn { margin-left: auto; }
@media (max-width: 640px) { .hours-day-row .hours-day { min-width: 76px; } .hours-block .btn { padding: 8px 12px; } }
@media (max-width: 640px) { .hours-day-row .hours-day { flex: 0 0 92px; min-width: 0; } }

/* ---- Gym extras: attendance ticks, renewals, week overview, trainer day, month summary ---- */
.attend-box { display: inline-flex; align-items: center; flex: none; margin: 0; }
.attend-box input { width: 22px; height: 22px; margin: 0; }
.summary-sheet { max-width: 860px; }
.summary-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 16px; margin: 14px 0 4px; }
.summary-sheet .today-heading { margin-top: 26px; }
@media print {
  .sidebar, .topbar, .tabbar, .test-bar, .no-print, .impersonation-bar, .messages { display: none !important; }
  body, .app, .main-area, .container { background: #fff !important; display: block !important; margin: 0 !important; padding: 0 !important; max-width: none !important; }
  .card { box-shadow: none !important; break-inside: avoid; }
  .summary-sheet { max-width: none; }
}

/* Personal training: week overview (one bar per trainer per day) and copy form */
.pt-overview { max-width: 860px; padding: 14px 16px; }
.pt-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; font-size: 14px; }
.pt-key { display: inline-flex; align-items: center; gap: 6px; }
.pt-dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.pt-row { display: flex; align-items: stretch; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border); }
.pt-axis-row { border-top: none; padding: 0 0 4px; }
.pt-day-name { flex: 0 0 84px; font-weight: 600; font-size: 14px; padding-top: 2px; }
.pt-track { position: relative; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; min-height: 26px; }
.pt-axis { min-height: 16px; }
.pt-tick-label { position: absolute; top: 0; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.pt-axis .pt-tick-label:first-child { transform: none; }
.pt-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border); opacity: .6; }
.pt-lane { position: relative; height: 22px; z-index: 1; }
.pt-block { position: absolute; top: 0; bottom: 0; border-radius: 5px; color: #fff; font-size: 11px; line-height: 22px; padding: 0 5px; overflow: hidden; white-space: nowrap; text-overflow: clip; }
.pt-none { font-size: 13px; line-height: 26px; position: relative; z-index: 1; }
.pt-c0 { background: #1a7f5f; } .pt-c1 { background: #2f6fbf; } .pt-c2 { background: #c2610f; }
.pt-c3 { background: #7a4ab8; } .pt-c4 { background: #0e8a9a; } .pt-c5 { background: #b3366b; }
@media (max-width: 640px) { .pt-day-name { flex-basis: 62px; font-size: 13px; } .pt-overview { padding: 12px; } }
.day-names { font-size: 14px; margin-top: 2px; }
.day-names .missed { text-decoration: line-through; }
.day-item .today-main .btn { display: inline-flex; }

/* (i) information buttons: descriptions and help lines open in a small bubble */
html.js .info-text { display: none; }
.info-btn { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; min-height: 0; padding: 0; margin: 0 0 0 8px; vertical-align: middle; border-radius: 50%; border: 1.5px solid var(--brand); background: transparent; color: var(--brand); font: italic 700 13px/1 Georgia, "Times New Roman", serif; cursor: pointer; text-transform: none; letter-spacing: 0; box-shadow: none; }
.info-btn:hover, .info-btn[aria-expanded="true"] { background: var(--brand); color: var(--on-brand); }
.info-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
h1 .info-btn, h2 .info-btn { margin-left: 10px; }
.info-bubble { position: fixed; z-index: 1000; box-sizing: border-box; padding: 12px 14px; background: var(--card); color: var(--text); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: 0 8px 28px rgba(0, 0, 0, .18); font-size: 14px; line-height: 1.5; font-weight: 400; text-transform: none; letter-spacing: 0; }
.info-bubble::before { content: ""; position: absolute; top: -6px; left: calc(var(--arrow-x, 20px) - 6px); width: 10px; height: 10px; background: inherit; border-left: 1px solid var(--border-strong); border-top: 1px solid var(--border-strong); transform: rotate(45deg); }
.info-bubble.above::before { top: auto; bottom: -6px; transform: rotate(225deg); }
.info-bubble a { color: var(--brand); text-decoration: underline; }
@media print { .info-btn, .info-bubble { display: none !important; } html.js .info-text { display: block; } .info-text[hidden] { display: block !important; } }

/* Filter button and its panel */
.filter-btn { display: inline-flex; align-items: center; gap: 8px; }
.filter-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: var(--on-brand); font-size: 12px; font-weight: 700; line-height: 1; }
.filter-count[hidden] { display: none; }
.filter-btn.is-active { border-color: var(--brand); }
.filter-panel { position: fixed; z-index: 900; box-sizing: border-box; padding: 14px; background: var(--card); color: var(--text); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: 0 8px 28px rgba(0, 0, 0, .18); max-height: calc(100vh - 24px); overflow-y: auto; }
.filter-panel[hidden] { display: none; }
.filter-field { margin-bottom: 12px; }
.filter-field label { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.filter-panel select, .toolbar > form .filter-panel select, .manage-filters .filter-panel select { width: 100% !important; max-width: none !important; flex: none !important; }
.filter-actions { display: flex; gap: 8px; margin-top: 4px; }
.filter-actions .btn { flex: 1 1 0; }
@media print { .filter-btn, .filter-panel { display: none !important; } }
@media (min-width: 701px) {
  .toolbar > form.has-filter-button { flex: 1 1 380px !important; flex-wrap: nowrap !important; }
  form.has-filter-button input[type=search] { flex: 1 1 140px; min-width: 0; max-width: 280px; }
}

/* Phone calendar: no Previous/Next day buttons (swiping and the date picker do the job); "Today" sits inside the date box.
   The two day buttons stay in the page, out of sight, because swiping presses them. */
@media (max-width: 640px) {
  .calendar-day-nav { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .calendar-jump-text { padding-right: 76px; }
  .calendar-today-link { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); z-index: 2; padding: 6px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; line-height: 1; text-transform: none; text-decoration: none; color: var(--brand); background: var(--brand-soft); }
  .calendar-today-link.is-today { color: var(--muted); background: transparent; pointer-events: none; }
}
@media (min-width: 641px) { .calendar-today-link { display: none; } }

/* Calendar top row on a computer: with "Book a slot" gone, week buttons, date picker and "Find a booking" share one row. */
@media (min-width: 641px) {
  .toolbar:has(.calendar-week-nav) { align-items: center; gap: 10px 14px; }
}
@media (min-width: 641px) and (max-width: 1250px) {
  .calendar-jump-label { display: none; }
}
@media (min-width: 641px) and (max-width: 1250px) {
  .toolbar:has(.calendar-week-nav) { gap: 8px 10px; }
  .calendar-week-nav .btn { padding-left: 11px; padding-right: 11px; }
  .toolbar:has(.calendar-week-nav) .calendar-jump input[type="date"] { max-width: 150px; }
}

/* Phone: the Rosta title bar is only on the home page. Pages without it keep clear of the notch themselves. */
@media (max-width: 899px) {
  .container { padding-top: calc(22px + env(safe-area-inset-top)); }
  .topbar + .container { padding-top: 22px; }
}

/* Phone: buttons that have a well-known symbol show only the symbol (search, filter, clear, apply, previous/next,
   back, edit, rename, delete, remove, copy). The words stay in the page, hidden from the eye but read out by screen
   readers, and a tooltip is added by static/js/symbols.js. On a computer the words show as before. */
.btn .sym { display: none; }
@media (max-width: 640px) {
  .btn-sym { min-width: 44px; min-height: 44px; padding-left: 12px; padding-right: 12px; gap: 0; flex: 0 0 auto; }
  .btn-sym .sym { display: inline-block; width: 20px; height: 20px; }
  .btn-sym .icon { width: 20px; height: 20px; }
  .btn-sym .btn-text, .filter-btn.btn-sym .filter-label {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .btn-sym { position: relative; }
  .filter-btn.btn-sym .filter-count { margin-left: 4px; }
  .filter-panel .filter-actions .btn-sym { flex: 1 1 0; }
  .toolbar .btn-sym { flex: 0 0 auto; }
  .calendar-week-nav .btn-sym { flex: 0 0 auto; }
}
.btn .sym-done { display: none; }
@media (max-width: 640px) {
  .btn-sym .sym-done { display: none; }
  .btn-sym.is-copied .sym-copy { display: none; }
  .btn-sym.is-copied .sym-done { display: inline-block; }
}

/* Phone: the button row at the end of a card (staff, services) wraps instead of running off the card. */
@media (max-width: 640px) {
  .responsive-table td[data-label=""] { flex-wrap: wrap; justify-content: flex-start; white-space: normal !important; gap: 8px; }
  .responsive-table td[data-label=""]::before { display: none; }
}

/* Calendar: hours when somebody does not work, and whole days when they are off or the shop is closed, are greyed out.
   Clicks go straight through, so a booking can still be made there (with the usual warning). */
.calendar-off {
  position: absolute; left: 0; right: 0; z-index: 0; pointer-events: none;
  background: repeating-linear-gradient(135deg, rgba(110, 118, 130, .24) 0, rgba(110, 118, 130, .24) 6px, rgba(110, 118, 130, .13) 6px, rgba(110, 118, 130, .13) 12px);
  border-top: 1px solid rgba(110, 118, 130, .35); border-bottom: 1px solid rgba(110, 118, 130, .35);
}
.calendar-off-day { border-top: none; border-bottom: none; }
.calendar-off-label {
  position: absolute; top: 8px; left: 2px; right: 2px; z-index: 1; pointer-events: none; text-align: center;
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
}
@media print { .calendar-off { background: #e4e6ea; } }

/* Closed every week: a line between the date-range closing days and the weekly weekdays. */
.weekly-divider { border: 0; border-top: 1px solid var(--border); margin: 22px 0 14px; }
.weekly-closed-form { margin-bottom: 6px; }

/* Name tabs on pages with one card per person (see static/js/persontabs.js). */
.person-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; margin: 6px 0 4px; -webkit-overflow-scrolling: touch; }
.person-tabs .chip { flex: 0 0 auto; min-height: 40px; padding: 8px 18px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.person-tabs .chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.person-panel[hidden] { display: none !important; }
.hours-grid.has-tabs { display: block; max-width: 640px; }

/* Phone: a days-off line (dates, reason, remove button) wraps instead of cutting the reason off. */
@media (max-width: 640px) {
  .hours-list .today-row { flex-wrap: wrap; }
  .hours-list .today-row .today-time { flex: 1 1 100%; }
  .hours-list .today-row .today-main { flex: 1 1 0; }
}

/* Section tabs (static/js/sectiontabs.js): same row of name chips as the person tabs, with an optional count. */
.section-panel[hidden] { display: none !important; }
.section-panels.has-tabs .panel-title { display: none; }
.section-tabs .tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; margin-left: 8px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: var(--on-brand); font-size: 12px; font-weight: 700; line-height: 1; }
.section-tabs .chip.active .tab-count { background: var(--on-brand); color: var(--brand); }
.section-panels.has-tabs .chip-row { margin-top: 0; }

/* The "saves every tab" note on the Prices page only matters while the tabs are showing. */
.section-save-note { display: none; margin: 4px 0 0; }
.section-panels.has-tabs ~ .section-save-note { display: block; }

/* Section tabs wrap onto a second row instead of sliding sideways, so no tab is ever hidden off-screen. */
.section-tabs { flex-wrap: wrap; overflow-x: visible; }
