:root { --rail: 72px; }
html, body { height: 100%; }
body.shell { margin: 0; display: block; padding-left: var(--rail); font-family: var(--cs-font-family-text, "Google Sans Flex", system-ui, sans-serif); font-size: 14px; line-height: 1.5;
  background: var(--cs-background-surface-subtle); color: var(--cs-text-content-bold); }
.rail { position: fixed; left: 0; top: 0; bottom: 0; width: var(--rail); z-index: 25; height: auto; display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: var(--cs-gap-appnav-md); box-sizing: border-box;
  background: var(--cs-background-container-subtlest); border-right: 1px solid var(--cs-border-container-subtle); }
.rail .mark img { display: block; width: 32px; height: 32px; }
.rail .mark { width: 40px; height: 40px; display: grid; place-items: center; margin-bottom: 12px; font-weight: 800; font-size: 18px; letter-spacing: -.03em; }
.rail .grow { flex: 1; }
.rail a, .rail button.nav { position: relative; width: var(--cs-height-control-appnav-md); height: var(--cs-height-control-appnav-md); display: grid; place-items: center; border-radius: var(--cs-radius-component-rail-item); border: 0; background: none; color: var(--cs-text-content-muted); cursor: pointer; }
.rail a:hover, .rail button.nav:hover { background: var(--cs-background-control-appnav-tile-hover); color: var(--cs-foreground-control-appnav-tile-active); }
.rail a.active { background: var(--cs-background-control-appnav-tile-active); color: var(--cs-foreground-control-appnav-tile-active); }
.rail svg, .icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rail [data-tip]:hover::after, .rail [data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; left: calc(100% + 20px); top: 50%; transform: translateY(-50%); white-space: nowrap; z-index: 20;
  background: var(--cs-background-tooltip-default); color: var(--cs-foreground-tooltip-default); padding: calc(8px + var(--cs-optical-offset)) 12px calc(8px - var(--cs-optical-offset)); border-radius: var(--cs-radius-component-tooltip); font-size: 15px; font-weight: 500; line-height: 1.3; box-shadow: 0 4px 16px rgba(0,0,0,.25); pointer-events: none; }
.avatar { width: 40px; height: 40px; border-radius: var(--cs-radius-component-avatar-square); background: var(--cs-background-container-bold); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.menu { position: fixed; left: calc(var(--rail) + 8px); bottom: 12px; z-index: 30; min-width: 200px; padding: 8px; border-radius: 12px; display: none;
  background: var(--cs-background-container-subtle); border: 1px solid var(--cs-border-container-subtle); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.menu.open { display: block; }
.menu .who { padding: 8px 18px; color: var(--cs-text-content-muted); font-size: 12px; border-bottom: 1px solid var(--cs-border-container-subtle); margin: -8px -8px 4px; padding-top: 16px; }
.menu button { width: 100%; text-align: left; border: 0; background: none; color: inherit; font: inherit; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.menu button:hover { background: var(--cs-background-container-muted); }
.main { min-width: 0; display: flex; flex-direction: column; }
.page { padding: 24px; width: 100%; box-sizing: border-box; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
h1.t { font-size: 24px; line-height: 1.2; margin: 0; font-weight: 600; }
.btn { height: 36px; padding: 0 var(--cs-padding-x-control-lg); border-radius: var(--cs-radius-component-button); border: 0; font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  background: var(--cs-background-control-accent-default); color: #fff; }
.btn:hover { background: var(--cs-background-control-accent-hover); } .btn:disabled { background: var(--cs-background-control-accent-disabled); cursor: default; }
.btn.ghost { background: var(--cs-background-container-muted); color: var(--cs-text-content-bold); } .btn.ghost:hover { background: var(--cs-background-container-bold); }
.bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.field { height: 36px; padding: 0 var(--cs-padding-x-control-lg); border-radius: var(--cs-radius-component-field); font: inherit; color: inherit; box-sizing: border-box; background: var(--cs-background-field-subtle-default); border: 1px solid var(--cs-border-field-standard-default); }
.field:focus { outline: none; border-color: var(--cs-border-field-standard-focused); }
textarea.field { height: auto; padding: 8px 12px; border-radius: var(--cs-radius-component-textarea); }
.seg { display: inline-flex; gap: 2px; box-sizing: border-box; border-radius: var(--cs-radius-component-segment); padding: var(--cs-padding-x-control-segment-md); background: var(--cs-background-container-segmentbtn-subtle); border: 1px solid var(--cs-border-container-subtle); }
.seg button { height: calc(var(--cs-height-field-lg) - 2 * var(--cs-padding-x-control-segment-md) - 2px); padding: 0 14px; border: 0; border-radius: var(--cs-radius-component-segment-item); background: none; color: var(--cs-text-content-muted); font: inherit; font-weight: 600; cursor: pointer; }
.seg button:hover { background: var(--cs-background-control-segmentbtn-subtle-hover); }
.seg button.on { background: var(--cs-background-control-segmentbtn-subtle-default); color: var(--cs-text-content-bold); }
table.tbl { width: 100%; border-collapse: collapse; background: var(--cs-background-container-subtlest); border: 1px solid var(--cs-border-container-subtle); border-radius: 12px; overflow: hidden; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--cs-text-content-muted); padding: 10px 16px; border-bottom: 1px solid var(--cs-border-container-subtle); }
.tbl td { padding: 8px 16px; border-bottom: 1px solid var(--cs-border-container-subtle); height: 56px; box-sizing: border-box; }
.tbl tr:last-child td { border-bottom: 0; } .tbl tbody tr { cursor: pointer; } .tbl tbody tr:hover { background: var(--cs-background-container-muted); }
.cell { display: flex; align-items: center; gap: 12px; } .cell .sub { color: var(--cs-text-content-muted); font-size: 12px; }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--cs-radius-component-tag); font-size: 12px; font-weight: 600; border: 1px solid var(--cs-border-container-subtle); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.new { color: var(--cs-text-feedback-brand); } .badge.accepted { color: var(--cs-text-feedback-info); } .badge.active { color: var(--cs-text-feedback-success); }
.badge.paused { color: var(--cs-text-feedback-warning); } .badge.ended { color: var(--cs-text-feedback-neutral); }
.empty { text-align: center; padding: 64px 16px; color: var(--cs-text-content-muted); }
.empty h2 { color: var(--cs-text-content-bold); font-size: 18px; margin: 0 0 8px; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: none; z-index: 40; } .scrim.open { display: block; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); z-index: 50; transform: translateX(100%); transition: transform .2s; padding: 24px; box-sizing: border-box; overflow: auto;
  background: var(--cs-background-container-subtle); border-left: 1px solid var(--cs-border-container-subtle); }
.drawer.open { transform: none; }
.drawer label { display: block; font-weight: 600; margin: 16px 0 6px; } .drawer .field { width: 100%; }
.drawer .actions { display: flex; gap: 8px; margin-top: 24px; }
.err { margin-top: 16px; padding: 10px 12px; border-radius: 8px; background: var(--cs-background-feedback-error); color: var(--cs-text-feedback-error); display: none; } .err.show { display: block; }
.ws { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; } .ws > section { min-width: 0; }
.side { border-right: 1px solid var(--cs-border-container-subtle); padding: 16px; box-sizing: border-box; }
.side .back { display: inline-flex; gap: 6px; align-items: center; color: var(--cs-text-content-muted); text-decoration: none; margin-bottom: 16px; }
.side .card { padding: 12px; border-radius: 12px; background: var(--cs-background-container-subtlest); border: 1px solid var(--cs-border-container-subtle); margin-bottom: 16px; }
.side .card b { display: block; font-size: 16px; } .side .card span.g { color: var(--cs-text-content-muted); font-size: 12px; display: block; margin: 2px 0 8px; }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--cs-radius-component-nav-item); color: var(--cs-text-content-muted); text-decoration: none; font-weight: 400; }
.side nav a svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; position: relative; top: calc(var(--cs-optical-offset) * -1); }
.side nav a:hover { background: var(--cs-background-container-muted); color: var(--cs-text-content-bold); } .side nav a.on { background: var(--cs-background-selection-muted-active); color: var(--cs-text-content-bold); font-weight: 500; }
.panel { padding: 24px; } .box { padding: 16px; border-radius: 12px; background: var(--cs-background-container-subtlest); border: 1px solid var(--cs-border-container-subtle); margin-bottom: 16px; }
.box h3 { margin: 0 0 8px; font-size: 16px; } .kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; } .kv dt { color: var(--cs-text-content-muted); } .kv dd { margin: 0; }
@media (max-width: 767px) {
  body.shell { padding-left: 0; padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .rail, .menu { display: none !important; }
  .page, .panel { padding: 16px; }
  .ws { grid-template-columns: minmax(0, 1fr); } .side { min-width: 0; border-right: 0; border-bottom: 1px solid var(--cs-border-container-subtle); }
  .side nav { display: flex; overflow-x: auto; gap: 4px; } .side nav a { white-space: nowrap; }
  .tbl .hide-m { display: none; }
}
.btn { white-space: nowrap; }
.btn svg, .back svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.panel h1.t { margin-bottom: 16px; }
.field.search { border-radius: var(--cs-radius-component-search); }
.main { min-height: 100vh; }
.tablewrap { overflow-x: auto; }
.tablewrap table.tbl { min-width: 480px; }
.head { flex-wrap: wrap; }
.bar .search { flex: 1 1 240px; max-width: 360px; }
@media (max-width: 767px) { .bar .search { max-width: none; } .bar .seg { overflow-x: auto; max-width: 100%; } }
@media (max-width: 767px) { .tablewrap table.tbl { min-width: 0; } }

/* Optical alignment: Google Sans Flex is centred in its line box, so --cs-optical-offset is 0; labels would move down by it if it changes.
   Fixed-height controls get 2x top padding (centering halves it). Icons and dots stay where they are. */
.btn, .seg button, .badge, .field:not(textarea) { box-sizing: border-box; padding-top: calc(var(--cs-optical-offset) * 2); }
.btn svg, .back svg, .badge::before { position: relative; top: calc(var(--cs-optical-offset) * -1); }
.menu button { padding: calc(8px + var(--cs-optical-offset)) 10px calc(8px - var(--cs-optical-offset)); }
.side nav a { padding: calc(8px + var(--cs-optical-offset)) 12px calc(8px - var(--cs-optical-offset)); }
.side .back { padding-top: var(--cs-optical-offset); }

/* Client switcher card and client avatars */
.av { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; overflow: hidden;
  background: var(--cs-background-container-bold); color: var(--cs-text-content-bold); } .av img { width: 100%; height: 100%; object-fit: cover; } .av.sm { width: 32px; height: 32px; font-size: 12px; }
.tbl .av { width: 40px; height: 40px; font-size: 14px; }
.side .card { position: relative; padding: 0; } .side .card .sw { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 12px; }
.side .card .sw:hover { background: var(--cs-background-container-muted); } .side .card .info { flex: 1; min-width: 0; } .side .card .info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .card .info .badge { margin-top: 2px; } .side .card .sw > svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--cs-text-content-muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pick { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; display: none; padding: 8px; border-radius: 12px; background: var(--cs-background-container-subtle); border: 1px solid var(--cs-border-container-subtle); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.pick.open { display: block; } .pick .field { width: 100%; margin-bottom: 4px; } .pick ul { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow: auto; }
.pick li a { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; color: inherit; text-decoration: none; } .pick li a:hover, .pick li a.cur { background: var(--cs-background-container-muted); }
.pick li small { display: block; color: var(--cs-text-content-muted); font-size: 12px; } .pl-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; } .pl-tags .badge { height: 20px; font-size: 11px; } .pl-tags .badge.goal::before { display: none; } .pick .none { padding: 12px 8px; color: var(--cs-text-content-muted); }
.tbl .num { white-space: nowrap; } .tbl .muted { color: var(--cs-text-content-muted); }
@media (max-width: 1279px) { .tbl .hide-l { display: none; } }

/* PageHeader: sticky on scroll, border underneath. Row 1 title and tags left, buttons right. Row 2 search and filters. */
.ph { position: sticky; top: 0; z-index: 15; padding: 16px 24px; background: var(--cs-background-surface-subtle); border-bottom: 1px solid var(--cs-border-container-subtle); display: flex; flex-direction: column; gap: 12px; }
.ph-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; min-height: 36px; }
.ph-lead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; } .ph-tags { display: flex; align-items: center; gap: 8px; }
.ph-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.ph-filters { justify-content: flex-start; } .ph-filters .search { flex: 1 1 240px; max-width: 360px; }
.ph h1.t { margin: 0; }
.main > .page { padding-top: 24px; }
@media (max-width: 767px) { .ph { padding: 12px 16px; } .ph-filters .search { max-width: none; } .ph-filters .seg { overflow-x: auto; max-width: 100%; display: flex; width: 100%; } .ph-filters .seg button { flex: 1 0 auto; padding: 0 10px; } }

/* Tables and cards: white (surface) container, visible border, soft shadow. Shadow tokens widen in the design system. */
table.tbl, .box, .side .card, .le .box { background: var(--cs-background-container-subtlest); border: 1px solid var(--cs-border-container-subtle); box-shadow: var(--cs-shadow-card); }
table.tbl { border-collapse: separate; border-spacing: 0; }
.tbl th, .tbl td { border-bottom: 1px solid var(--cs-border-container-subtle); }
.tbl tr:last-child td { border-bottom: 0; }
.pick, .menu, .drawer.open { box-shadow: var(--cs-shadow-lg); }

/* Light theme: a subtle grey tile behind the active rail icon instead of the solid dark one. */
:root[data-theme="light"] .rail a.active, :root[data-theme="light"] .rail a:hover { background: var(--cs-background-selection-muted-active); color: var(--cs-text-content-bold); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .rail a.active, :root:not([data-theme]) .rail a:hover { background: var(--cs-background-selection-muted-active); color: var(--cs-text-content-bold); }
}

/* Headings: a bit lighter than bold. */
.box h3, .empty h2, .side .card b, .le .box h3 { font-weight: 500; }
.drawer h1.t { font-weight: 600; }

/* Selects: custom chevron with room on the right (the native arrow touched the edge). */
select.field { -webkit-appearance: none; appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 16px; }

/* Phones: iOS zooms into any text field under 16px when it gets focus, and double-tap zooms on buttons.
   Fields are 16px on phones and touch screens; taps don't wait for a double-tap. Pinch zoom still works. */
@media (max-width: 767px), (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]), select, textarea { font-size: 16px !important; }
}
a, button, input, select, textarea, label, summary, [role="button"], [role="tab"] { touch-action: manipulation; }

/* Phone bottom bar (replaces the icon rail under 768px): icon plus label on every item, More opens a sheet. */
.mnav, .mscrim, .msheet, .ch, .cm, .cm-scrim { display: none; }
@media (max-width: 767px) {
  .mnav { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; box-sizing: border-box;
    height: calc(64px + env(safe-area-inset-bottom, 0px)); padding: 0 4px env(safe-area-inset-bottom, 0px);
    background: var(--cs-background-container-subtlest); border-top: 1px solid var(--cs-border-container-subtle); }
  .mnav a, .mnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; padding: 6px 2px 4px; border: 0; background: none; font: inherit; cursor: pointer;
    color: var(--cs-text-content-muted); text-decoration: none; -webkit-tap-highlight-color: transparent; }
  .mnav svg, .msheet svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .mnav span { font-size: 11px; line-height: 1.2; font-weight: 500; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mnav a.on, .mnav button.on { color: var(--cs-text-content-bold); } .mnav a.on span, .mnav button.on span { font-weight: 700; }
  .mnav a.on svg, .mnav button.on svg { stroke-width: 2.4; }
  .mscrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .2s; } .mscrim.open { opacity: 1; pointer-events: auto; }
  .msheet { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; box-sizing: border-box; max-height: 80vh; overflow: auto; padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    border-radius: 16px 16px 0 0; background: var(--cs-background-container-subtle); border: 1px solid var(--cs-border-container-subtle); box-shadow: var(--cs-shadow-lg);
    transform: translateY(105%); visibility: hidden; transition: transform .2s, visibility .2s; }
  .msheet.open { transform: none; visibility: visible; }
  .msheet .grab { width: 36px; height: 4px; border-radius: 2px; margin: 0 auto 8px; background: var(--cs-border-container-subtle); }
  .msheet h2 { margin: 0 0 4px; font-size: 14px; font-weight: 500; color: var(--cs-text-content-muted); }
  .msheet a, .msheet button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 8px; box-sizing: border-box; border: 0; border-radius: 10px; background: none; font: inherit; font-size: 16px; text-align: left;
    color: var(--cs-text-content-bold); text-decoration: none; cursor: pointer; }
  .msheet a.on { background: var(--cs-background-selection-muted-active); font-weight: 600; }
  .msheet .who { margin: 8px -16px 0; padding: 12px 24px 4px; border-top: 1px solid var(--cs-border-container-subtle); color: var(--cs-text-content-muted); font-size: 12px; overflow-wrap: anywhere; }

  /* Client header on phones: sticky, full width, same look as PageHeader. Back arrow, avatar, name, status and goal, switcher at the right edge. */
  .ch { display: block; position: sticky; top: 0; z-index: 15; padding: 18px 12px 18px 4px; background: var(--cs-background-surface-subtle); border-bottom: 1px solid var(--cs-border-container-subtle); }
  .ch-row { display: flex; align-items: center; gap: 8px; }
  .ch .bk, .ch .dd { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--cs-text-content-muted); cursor: pointer; text-decoration: none; }
  .ch .dd { margin-right: -6px; } .ch .bk, .ch .dd { -webkit-tap-highlight-color: transparent; } .ch .bk:hover, .ch .dd:hover, .ch .bk:active, .ch .dd:active, .ch .dd[aria-expanded="true"], .ch .bk[aria-expanded="true"] { background: none; color: var(--cs-text-content-bold); }
  .ch .bk svg, .ch .dd svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .ch .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
  .ch .who .av { width: 44px; height: 44px; }
  .ch .nm { min-width: 0; } .ch .nm b { display: block; font-size: 16px; font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ch .ch-tags { display: flex; align-items: center; gap: 6px; margin-top: 6px; min-width: 0; }
  .ch .ch-tags .badge { flex: none; height: 20px; padding-top: 0; } .ch .ch-tags .badge.goal { flex: 0 1 auto; min-width: 0; display: block; line-height: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--cs-text-content-muted); }
  .ch .ch-tags .badge.goal::before { display: none; }
  .ch .pick { left: 8px; right: 8px; top: calc(100% + 4px); position: absolute; }
  /* Client menu (phones): the menu button at the left of the client header opens this drawer with the client's tabs and details. */
  /* Client menu and client switcher (phones): drop down from under the client header and fill the rest of the screen. */
  .cm { display: flex; flex-direction: column; gap: 16px; position: fixed; left: 0; right: 0; bottom: 0; top: 80px; z-index: 41; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); box-sizing: border-box; overflow-y: auto;
    background: var(--cs-background-surface-subtle); opacity: 0; transform: translateY(-8px); visibility: hidden; transition: opacity .18s ease, transform .18s ease, visibility .18s; }
  .cm.open { opacity: 1; transform: none; visibility: visible; }
  body.cm-lock { overflow: hidden; }
  .cm nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .cm nav { display: flex; flex-direction: column; gap: 2px; }
  .cm nav a { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border-radius: 10px; font-size: 15px; color: var(--cs-text-content-bold); text-decoration: none; }
  .cm nav a svg { color: var(--cs-text-content-muted); } .cm nav a.on { background: var(--cs-background-selection-muted-active); font-weight: 600; }
  .cm-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; } .cm-foot .side-next { margin-top: 0; }
  .ch .pick.open { position: fixed; left: 0; right: 0; bottom: 0; top: 80px; z-index: 41; display: flex; flex-direction: column; border: 0; border-radius: 0; box-shadow: none; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); background: var(--cs-background-surface-subtle); }
  .ch .pick.open ul { max-height: none; flex: 1; } .ch .pick li a { padding: 10px 8px; }
  .ch #sw2[aria-expanded="true"] svg { transform: rotate(180deg); }
  .ws > .side { display: none; }
  .ws { min-height: 0; }
}

/* Desktop client page: slim sidebar (no back link), 16px icons, details and next action at the bottom, sticky tab header. */
.rail svg { width: 16px; height: 16px; }
.side nav a svg { width: 16px; height: 16px; }
.side .card .info { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; } .side .card .info b { max-width: 100%; }
.side-info { margin: 0; padding: 0; border-radius: 12px; overflow: hidden; background: var(--cs-background-container-subtlest); border: 1px solid var(--cs-border-container-subtle); box-shadow: var(--cs-shadow-card); }
.side-info .row { padding: 10px 12px; border-bottom: 1px solid var(--cs-border-container-subtle); } .side-info .row:last-child { border-bottom: 0; }
.side-info dt { color: var(--cs-text-content-muted); font-size: 12px; line-height: 1.4; } .side-info dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-size: 14px; line-height: 1.4; }
.side-next { margin: 16px -16px 0; padding: 16px 16px 0; border-top: 1px solid var(--cs-border-container-subtle); }
.side-next .lbl { display: block; margin-bottom: 8px; color: var(--cs-text-content-muted); font-size: 12px; font-weight: 600; }
.side-next .btn { width: 100%; justify-content: space-between; text-decoration: none; }
.btn.side-back { width: 100%; justify-content: center; margin-top: 12px; text-decoration: none; } .side > .btn.side-back { margin: 0 0 12px; }
.cph { margin: 0; } .ws > section > .panel { padding-top: 24px; }
@media (min-width: 768px) {
  .side { position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
  .side-bottom { margin-top: auto; padding-top: 24px; }
  .side .card { flex: none; }
  /* The header bar carries the tab title, so the title inside the tab is hidden. */
  .ws > section .panel > h1.t, .ws > section .ov-tab > h1.t, .ws > section .tr-title h1.t { display: none; }
}
@media (max-width: 767px) { .cph, .side-bottom { display: none; } }

/* Badges: filled tinted background with matching text, no border. Default is neutral grey; the tone classes set both colours. */
.badge { border: 0; background: var(--cs-background-feedback-neutral); color: var(--cs-text-feedback-neutral); padding-left: 10px; padding-right: 10px; }
.badge.new { background: var(--cs-background-feedback-brand); color: var(--cs-text-feedback-brand); }
.badge.accepted, .badge.lv-intermediate { background: var(--cs-background-feedback-info); color: var(--cs-text-feedback-info); }
.badge.active, .badge.lv-beginner { background: var(--cs-background-feedback-success); color: var(--cs-text-feedback-success); }
.badge.paused, .badge.lv-expert { background: var(--cs-background-feedback-warning); color: var(--cs-text-feedback-warning); }
.badge.hold { background: var(--cs-background-feedback-error); color: var(--cs-text-feedback-error); }
.badge.ended, .badge.goal { background: var(--cs-background-feedback-neutral); color: var(--cs-text-feedback-neutral); }
/* Light mode: badges get a thin ring in their own colour so pale fills still read on white and grey. */
.badge { box-shadow: inset 0 0 0 1px var(--cs-border-badge, transparent); }
/* Buttons: primary and secondary both carry a small shadow; secondary also has a subtle border. */
.btn { box-shadow: var(--cs-shadow-xs); } .btn:disabled { box-shadow: none; }
.btn.ghost { border: 1px solid var(--cs-border-container-subtle); }

/* Application tab: submitted time beside the title, answers as rows (label column, then the answer) */
.ph-sub, .app-sub { color: var(--cs-text-content-muted); font-size: 14px; }
.app-title { display: flex; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; margin-bottom: 16px; } .app-title h1.t { margin: 0; }
.app-kv { display: grid; grid-template-columns: 300px minmax(0, 1fr); margin: 12px -16px -16px; }
.app-kv dt, .app-kv dd { margin: 0; padding: 14px 16px; border-top: 1px solid var(--cs-border-container-subtle); line-height: 1.5; }
.app-kv dt { color: var(--cs-text-content-muted); } .app-kv dd { min-width: 0; overflow-wrap: anywhere; }
.app-tags { display: flex; flex-wrap: wrap; gap: 6px; } .app-extra { display: block; margin-top: 4px; }
@media (min-width: 768px) { .app-title { display: none; } }
@media (max-width: 767px) {
  .app-kv { grid-template-columns: minmax(0, 1fr); }
  .app-kv dt { padding-bottom: 2px; font-size: 13px; } .app-kv dd { padding-top: 0; border-top: 0; }
}
.app-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; } .app-h h3 { margin: 0; }
.app-box .app-kv { margin-top: 16px; }
.app-ed { display: flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--cs-text-content-muted); font-size: 13px; }
.app-box.editing .app-kv { margin-bottom: 0; } .app-box.editing .app-kv dd { padding-top: 10px; padding-bottom: 10px; }
.app-box.editing .field { width: 100%; max-width: 480px; box-sizing: border-box; } .app-box.editing .app-city, .app-box.editing .app-other { margin-top: 8px; }
.app-checks { display: flex; flex-wrap: wrap; gap: 8px 16px; } .app-checks label { display: inline-flex; align-items: center; gap: 6px; }
.app-foot { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin: 0 -16px -16px; padding: 12px 16px; border-top: 1px solid var(--cs-border-container-subtle); }
.app-foot .muted { margin: 0 auto 0 0; } .app-err { margin: 0; flex-basis: 100%; color: var(--cs-text-feedback-error); }

/* Report a Bug (testers only): the rail, account menu and More sheet items show once platform_roles says so. Form in js/bug-report.js. */
body:not(.tester) .bugitem { display: none !important; }
.drawer.bug { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.drawer.bug:focus { outline: none; }
.bug-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bug-head h1.t { margin: 0; font-size: 20px; }
.bug-sub { margin: 4px 0 0; color: var(--cs-text-content-muted); }
.drawer.bug fieldset { border: 0; margin: 16px 0 0; padding: 0; min-width: 0; }
.drawer.bug legend { display: block; font-weight: 600; margin: 0 0 6px; padding: 0; float: left; width: 100%; }
.drawer.bug legend + * { clear: both; }
.drawer.bug .opt { font-weight: 400; color: var(--cs-text-content-muted); font-size: 12px; margin-left: 4px; }
.bug-x { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--cs-text-content-muted); cursor: pointer; flex: none; }
.bug-x:hover { background: var(--cs-background-container-muted); color: var(--cs-text-content-bold); }
.bug-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bug-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.bug-pill { position: relative; margin: 0 !important; font-weight: 500 !important; }
.bug-pill input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.bug-pill span { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: var(--cs-radius-component-chip); box-sizing: border-box; cursor: pointer;
  border: 1px solid var(--cs-border-field-standard-default); background: var(--cs-background-field-subtle-default); color: var(--cs-text-content-bold); }
.bug-pill span:hover { background: var(--cs-background-container-muted); }
.bug-pill input:checked + span { border-color: var(--cs-text-feedback-brand); background: var(--cs-background-feedback-brand); color: var(--cs-text-feedback-brand); font-weight: 600; }
.bug-pill input:focus-visible + span { outline: 2px solid var(--cs-border-field-standard-focused); outline-offset: 2px; }
.bug-shots { display: flex; flex-wrap: wrap; gap: 8px; }
.bug-shot { position: relative; width: 88px; height: 88px; border-radius: 8px; overflow: hidden; border: 1px solid var(--cs-border-container-subtle); }
.bug-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bug-shot .bug-x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; background: rgba(0,0,0,.6); color: #fff; }
.bug-add { position: relative; width: 88px; height: 88px; margin: 0 !important; display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 4px; box-sizing: border-box;
  border: 1px dashed var(--cs-border-field-standard-default); border-radius: 8px; font-size: 12px; font-weight: 500 !important; text-align: center; color: var(--cs-text-content-muted); cursor: pointer; }
.bug-add:hover { background: var(--cs-background-container-muted); color: var(--cs-text-content-bold); }
.bug-add svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.bug-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.bug-hint { margin: 6px 0 0; font-size: 12px; color: var(--cs-text-content-muted); }
@media (pointer: coarse) { .bug-hint { display: none; } }
.drawer.bug .bug-check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 20px 0 0; cursor: pointer; }
.bug-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--cs-text-feedback-brand); }
.bug-auto { margin-top: 16px; font-size: 13px; color: var(--cs-text-content-muted); }
.bug-auto summary { cursor: pointer; }
.bug-auto dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 8px 0 0; }
.bug-auto dt { color: var(--cs-text-content-muted); } .bug-auto dd { margin: 0; color: var(--cs-text-content-bold); overflow-wrap: anywhere; }

/* Confirm pop-up (public/js/confirm.js): one look for every "are you sure" in the app. */
.cf-wrap { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.5); animation: cf-in .12s ease-out; }
.cf-dlg { box-sizing: border-box; width: min(440px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 24px; border-radius: 16px; background: var(--cs-background-container-subtle); border: 1px solid var(--cs-border-container-subtle); box-shadow: var(--cs-shadow-xl); color: var(--cs-text-content-bold); }
.cf-dlg h2 { margin: 0 0 8px; font-size: 18px; font-weight: 600; line-height: 1.3; }
.cf-b { color: var(--cs-text-content-muted); font-size: 14px; line-height: 1.5; } .cf-b p { margin: 0 0 8px; } .cf-b p:last-child { margin-bottom: 0; }
.cf-pts { margin: 8px 0 0; padding-left: 20px; } .cf-pts li + li { margin-top: 4px; }
.cf-acts { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
@keyframes cf-in { from { opacity: 0; } }
@media (max-width: 560px) { .cf-wrap { place-items: end stretch; padding: 12px; } .cf-acts { flex-direction: column-reverse; } .cf-acts .btn { width: 100%; justify-content: center; } }
@media (prefers-reduced-motion: reduce) { .cf-wrap { animation: none; } }
.cf-b ul { margin: 8px 0; padding-left: 20px; } .cf-b li + li { margin-top: 4px; }
/* To Review count on Check-Ins */
.nbadge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9999px; background: var(--cs-background-control-accent-default); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; pointer-events: none; }
.mnav a { position: relative; } .mnav a .nbadge { top: 2px; right: calc(50% - 22px); }
.msheet a { position: relative; } .msheet a .nbadge { position: static; margin-left: auto; }
/* Tooltips on icon-only buttons (shell.js) */
.cs-tip { position: fixed; z-index: 1000; max-width: 260px; pointer-events: none; background: var(--cs-background-tooltip-default); color: var(--cs-foreground-tooltip-default); padding: 6px 10px; border-radius: var(--cs-radius-component-tooltip); font-size: 13px; font-weight: 500; line-height: 1.3; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
