/* BBK operator dashboard + beheer — "Horizon" design.
   Builds on handoff 1a (warm paper ground, sage accent, hyperlegible type,
   pill actions, red family reserved for Safe room) and professionalises it:
   a sticky app bar with brandmark, a deep-forest hero carrying live headset
   status, real multi-column layouts from tablet width up, bottom sheets on
   phones and centred dialogs on desktop.
   Phone-first; breakpoints at 720px (tablet) and 1040px (desktop).
   Hit targets >= 44px; motion limited to short colour/shadow/transform
   transitions and switched off for prefers-reduced-motion. */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* surfaces */
  --ground: #f6f2ea;
  --ground-2: #efe9de;
  --card: #fffdf9;
  --border: #e5dccf;
  --border-soft: #eee7dc;
  --tint-sage: #e3ede5;
  --tint-warm: #f1ebe2;
  --track: #ebe3d6;
  --stripe: #e3dacc;
  --card-hover: #f7f1e8;
  /* ink */
  --ink: #26231f;
  --ink-2: #625a50;
  --muted: #877e74;
  --icon-dim: #c3b9ab;
  /* brand */
  --accent: #4c7a5c;
  --accent-deep: #3c614a;
  --accent-darker: #2f4c3a;
  --forest: #1d3528;
  --forest-2: #284636;
  --on-forest: #f1f4ee;
  --on-forest-2: rgba(241, 244, 238, .68);
  --mint: #a8d1b3;
  --amber: #d6a243;
  /* safe room only */
  --danger: #b4543a;
  --danger-deep: #93432d;
  --danger-tint: #fdf0eb;
  /* type */
  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  /* depth */
  --shadow-1: 0 1px 2px rgba(38, 35, 31, .05);
  --shadow-2: 0 1px 2px rgba(38, 35, 31, .04), 0 10px 28px -14px rgba(38, 35, 31, .18);
  --shadow-3: 0 2px 6px rgba(38, 35, 31, .06), 0 28px 60px -20px rgba(29, 53, 40, .38);
  --shadow-pick: 0 1px 2px rgba(76, 122, 92, .10), 0 10px 24px -12px rgba(76, 122, 92, .35);
  --r-lg: 12px;
  --r-md: 8px;
  --r-sm: 6px;
  --gutter: 16px;
  --maxw: 1180px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --cinema: #101814;
  --tabbar-h: 64px;   /* phone tab bar; 0 from tablet width up */
  --bar-h: 68px;      /* one session bar */
  --bars: 0;          /* visible session bars, set by app.js */
}

html { -webkit-text-size-adjust: 100%; }
html, body { min-height: 100%; }
body {
  overflow-x: clip;
  padding-bottom: calc(var(--tabbar-h) + var(--bars) * (var(--bar-h) + 8px) + env(safe-area-inset-bottom));
}
body.has-bars { padding-bottom: calc(var(--tabbar-h) + var(--bars) * (var(--bar-h) + 8px) + 16px + env(safe-area-inset-bottom)); }
body {
  font-family: var(--font);
  background: var(--ground);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger-deep); font-size: 14px; font-weight: 700; }

.icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.icon.solid { fill: currentColor; stroke: none; }

button {
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease,
              color 150ms ease, box-shadow 150ms ease, transform 150ms var(--ease);
}
button:active:not(:disabled) { transform: scale(.985); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1, h2 { font-family: var(--display); font-weight: 600; letter-spacing: -.015em; font-optical-sizing: auto; }

/* ---------------- app bar ---------------- */

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(246, 242, 234, .95);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid rgba(229, 220, 207, .7);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  min-height: 60px; padding: 0 var(--gutter);
  position: relative;
}
.brandmark {
  width: 36px; height: 36px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--forest-2), var(--forest));
  color: var(--mint);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), var(--shadow-1);
}
.brandmark .icon { stroke-width: 2.2; }
.wordmark { display: none; font-weight: 700; font-size: 15px; letter-spacing: .01em; white-space: nowrap; }
.topbar-sep { display: none; width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

.loc-switch {
  margin-right: auto; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  border: none; background: none; border-radius: var(--r-sm);
  padding: 6px 8px; min-height: 44px;
  font-weight: 700; font-size: 16px; text-align: left;
}
.loc-switch .loc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loc-switch .loc-tenant {
  font-weight: 400; font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.loc-switch:disabled, .loc-switch.static { cursor: default; opacity: 1; }
.loc-switch:not(:disabled):not(.static):hover { background: var(--ground-2); }
.loc-switch .icon { color: var(--muted); }

.user-btn {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  border: 1px solid var(--border);
  background: var(--card); color: var(--ink-2); font-weight: 700; font-size: 13px; letter-spacing: .02em;
  position: relative;
}
.user-btn::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; }
.user-btn:hover { background: var(--tint-sage); color: var(--accent-deep); border-color: #cfe0d4; }

/* Popover menus (device switcher, account) */
.device-menu {
  position: absolute; z-index: 35;
  display: flex; flex-direction: column; gap: 2px; min-width: 200px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 6px; box-shadow: var(--shadow-3);
  animation: pop 150ms var(--ease);
}
#device-menu { top: 12px; right: var(--gutter); }
.device-menu button, .user-menu a {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 8px 12px; border: none; border-radius: var(--r-sm);
  background: none; font-size: 14px; font-weight: 700; text-align: left;
  color: inherit; text-decoration: none;
}
.device-menu button:hover, .user-menu a:hover { background: var(--card-hover); }
.device-menu .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.device-menu .dot.online { background: var(--accent); }
.device-menu .dot.stale { background: var(--amber); }
.device-menu .dot.offline { background: var(--icon-dim); }
.device-menu .sub { font-weight: 400; font-size: 12px; color: var(--muted); }
.user-menu { top: calc(100% - 4px); right: var(--gutter); min-width: 240px; }
.menu-who {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px;
  border-bottom: 1px solid var(--border-soft); margin-bottom: 4px; font-size: 14px;
}
.menu-who span { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }

@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------------- page frame ---------------- */

.app { max-width: var(--maxw); margin: 0 auto; position: relative; padding: 0 var(--gutter); }
.view { display: flex; flex-direction: column; padding-bottom: 8px; }

.head { display: flex; align-items: center; gap: 10px; padding: 14px 0 0; min-height: 58px; }
.brand { font-weight: 700; font-size: 13px; letter-spacing: .02em; }
.run-name {
  font-weight: 700; font-size: 17px; margin-right: auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 6px; border: none;
  background: var(--tint-sage); color: var(--accent-deep);
  font-size: 12px; font-weight: 700; white-space: nowrap;
  position: relative; cursor: default;
}
.chip .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none;
  box-shadow: 0 0 0 3px rgba(76, 122, 92, .18);
}
.chip.off { background: var(--tint-warm); color: var(--ink-2); }
.chip.off .dot { background: var(--icon-dim); box-shadow: none; }

.panel {
  background: var(--card); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); padding: 14px; box-shadow: var(--shadow-2);
}

.section-block { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.section-head { display: flex; flex-direction: column; gap: 4px; }
.section-kicker {
  padding: 0 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent-deep);
}
.section-row { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 10px 0; }
.section-head .hint, .panel-hint { padding: 0 4px; }
.top-gap { margin-top: 14px; }

/* ---------------- navigation: top tabs (tablet+) and bottom tab bar (phones) ---------------- */

.nav-top { display: none; align-items: center; gap: 2px; }
.nav-tab {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px; border: none; border-radius: var(--r-sm);
  background: none; color: var(--ink-2); font-weight: 700; font-size: 14px;
}
.nav-tab:hover { color: var(--ink); background: var(--ground-2); }
.nav-tab.active { color: var(--accent-deep); background: var(--tint-sage); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(246, 242, 234, .96);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid rgba(229, 220, 207, .8);
}
.tabbar .nav-tab {
  flex-direction: column; justify-content: center; gap: 3px; border-radius: 0;
  font-size: 11.5px; padding: 0; min-height: 0; background: none;
}
.tabbar .nav-tab .icon { padding: 3px 14px; box-sizing: content-box; border-radius: 6px; transition: background-color 150ms ease; }
.tabbar .nav-tab.active { background: none; }
.tabbar .nav-tab.active .icon { background: var(--tint-sage); }

/* ---------------- headset status chip + overview ---------------- */

.hs-chip {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  min-height: 40px; padding: 0 14px 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--card); color: var(--ink);
  font-size: 13px; font-weight: 700; white-space: nowrap; position: relative;
}
.hs-chip::after { content: ""; position: absolute; inset: -3px; border-radius: var(--r-sm); }
.hs-chip:hover { background: var(--card-hover); }
.hs-chip .icon { color: var(--ink-2); }
.hs-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(76, 122, 92, .18); }
.hs-chip.busy .dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(214, 162, 67, .22); }
.hs-chip.warn .dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(180, 84, 58, .2); }
.hs-chip.off { color: var(--ink-2); }
.hs-chip.off .dot { background: var(--icon-dim); box-shadow: none; }

.hs-list { display: flex; flex-direction: column; gap: 8px; }
.hs-tile {
  display: flex; flex-direction: column; gap: 6px; align-items: stretch; text-align: left;
  padding: 14px 16px; background: var(--card); border: 1px solid var(--border-soft); border-radius: var(--r-md);
}
.hs-tile.running { cursor: pointer; }
.hs-tile.running:hover { border-color: var(--accent); box-shadow: var(--shadow-pick); }
.hs-tile:not(.running) { cursor: default; }
.hs-tile .hs-name { display: flex; align-items: baseline; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.hs-tile .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; align-self: center; }
.hs-tile.off .dot { background: var(--icon-dim); }
.hs-tile.running .dot { background: var(--amber); animation: breathe 2.4s ease-in-out infinite; }
.hs-tile .hs-status { margin-left: auto; font-size: 13.5px; font-weight: 400; letter-spacing: 0; color: var(--ink-2); text-align: right; }
.hs-tile .hs-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hs-tile .hs-open { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; font-weight: 700; color: var(--accent-deep); }
.bat { width: 26px; height: 11px; border-radius: 3px; border: 1.5px solid currentColor; padding: 1px;
  position: relative; display: inline-block; }
.bat::after { content: ""; position: absolute; right: -4px; top: 2px; width: 2px; height: 4px; border-radius: 0 1px 1px 0; background: currentColor; }
.bat i { display: block; height: 100%; border-radius: 1px; background: var(--accent); }
.bat.low i { background: var(--danger); }
@keyframes breathe { 50% { box-shadow: 0 0 0 6px rgba(214, 162, 67, 0); } 0%, 100% { box-shadow: 0 0 0 0 rgba(214, 162, 67, .45); } }

/* ---------------- session bars: every screen, Safe room one tap away ---------------- */

.session-bars {
  position: fixed; z-index: 29; left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px);
  display: flex; flex-direction: column-reverse; gap: 8px;
  max-width: 820px; margin: 0 auto; padding: 0 10px; pointer-events: none;
}
.sbar {
  pointer-events: auto; position: relative; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 6px;
  min-height: var(--bar-h); padding: 8px 8px 8px 8px; border-radius: var(--r-lg);
  background: rgba(20, 30, 24, .94); color: var(--on-forest);
  -webkit-backdrop-filter: blur(16px) saturate(1.3); backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: 0 14px 34px -14px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(255, 255, 255, .06);
  animation: rise 220ms var(--ease);
}
.sbar-main {
  display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 48px;
  border: none; background: none; color: inherit; text-align: left; padding: 0 4px 0 0; border-radius: var(--r-sm);
}
.sbar-thumb { width: 64px !important; flex: none; border-radius: 4px !important; box-shadow: none !important; }
.sbar-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sbar-title { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sbar-sub { font-size: 12.5px; color: var(--on-forest-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sbar-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(241, 244, 238, .1); }
.sbar-progress i { display: block; height: 100%; width: 0; background: var(--mint); transition: width 900ms linear; }
.sbar-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-width: 48px; min-height: 48px; border-radius: var(--r-sm); border: none;
  background: rgba(241, 244, 238, .1); color: var(--on-forest); font-weight: 700; font-size: 14px;
}
.sbar-btn:hover:not(:disabled) { background: rgba(241, 244, 238, .18); }
.sbar-btn:disabled { opacity: .35; cursor: default; }
.sbar-pause .icon { fill: currentColor; stroke: none; }
.sbar-safe { padding: 0 14px; background: var(--danger-tint); color: var(--danger-deep); box-shadow: inset 0 0 0 2px var(--danger); }
.sbar-safe:hover:not(:disabled) { background: #f9e1d6; }
.sbar.safe { box-shadow: 0 14px 34px -14px rgba(0, 0, 0, .55), inset 0 0 0 2px var(--danger); }
.sbar.lost .sbar-sub::after { content: " · verbinding kwijt"; color: #f0a58e; }

/* ---------------- 1 · cliënten ---------------- */

.home-grid { display: grid; gap: 0; margin-top: 18px; }
.home-main { display: flex; flex-direction: column; min-width: 0; }
.home-side { min-width: 0; }

.wearer-list { display: flex; flex-direction: column; gap: 8px; }

.wearer {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 12px 12px 12px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--r-md);
  text-align: left; font-size: inherit; min-height: 70px;
}
.panel .wearer { border-color: var(--border-soft); background: var(--card); }
.wearer:hover, .wearer:focus-visible {
  border-color: var(--accent); background: #fff;
  box-shadow: inset 0 0 0 1px var(--accent), var(--shadow-pick);
}
.wearer:focus-visible { outline: none; }
.wearer .avatar {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--av-bg, var(--tint-warm)); color: var(--av-ink, var(--ink-2));
  font-weight: 700; font-size: 15px; letter-spacing: .02em;
  transition: background-color 150ms ease, color 150ms ease;
}
/* A quiet, stable variety of avatar tones so a long list stays scannable. */
.wearer:nth-child(5n+1) { --av-bg: #f1e6d8; --av-ink: #7a5a3a; }
.wearer:nth-child(5n+2) { --av-bg: #e3ede5; --av-ink: #3c614a; }
.wearer:nth-child(5n+3) { --av-bg: #e6e9ef; --av-ink: #4a5670; }
.wearer:nth-child(5n+4) { --av-bg: #f3e3df; --av-ink: #8a4a3c; }
.wearer:nth-child(5n+5) { --av-bg: #ece7d6; --av-ink: #6b6033; }
.wearer:hover .avatar, .wearer:focus-visible .avatar { background: var(--accent); color: #fff; }
.wearer .who { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.wearer .name { font-weight: 700; font-size: 16.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wearer .meta { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.wearer .icon { color: var(--icon-dim); transition: color 150ms ease, transform 150ms var(--ease); }
.wearer:hover .icon, .wearer:focus-visible .icon { color: var(--accent); transform: translateX(2px); }

.foot-note {
  padding: 14px 4px 2px;
  display: flex; gap: 8px; align-items: center;
  color: var(--muted); font-size: 13px;
}
.foot-note a { color: var(--accent-deep); font-weight: 700; text-decoration: none; }
.foot-note a:hover { color: var(--accent-darker); }

.add-tile {
  min-height: 56px; border: 1.5px dashed var(--icon-dim); border-radius: var(--r-md);
  background: transparent; color: var(--ink-2);
  font-weight: 700; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.add-tile:hover { background: var(--tint-sage); border-color: var(--accent); color: var(--accent-deep); }

/* ---------------- poster art (library, title page, now playing) ----------------
   Titles without a pushed cover (ADR 0013 listing) get a generated "title card": a tone
   from a small earthy palette, horizon rings, a low sun for games, film grain
   and a scrim so the title stays legible. The same tone follows a title from
   its library tile to the start sheet, the curated pick and the running view. */

[data-tone="0"] { --t1: #4f7d5f; --t2: #12261b; }
[data-tone="1"] { --t1: #3f7683; --t2: #0e242b; }
[data-tone="2"] { --t1: #b57a3c; --t2: #3a200e; }
[data-tone="3"] { --t1: #a85c46; --t2: #371711; }
[data-tone="4"] { --t1: #6c6a9c; --t2: #1a1936; }
[data-tone="5"] { --t1: #848f4e; --t2: #242a11; }

.lib-poster, .title-hero, .nowplaying[data-tone] {
  background:
    radial-gradient(150% 130% at 74% 140%, transparent 0 30%, rgba(255, 255, 255, .15) 30.3% 30.8%, transparent 31.1% 42%,
      rgba(255, 255, 255, .1) 42.3% 42.8%, transparent 43.1% 54%, rgba(255, 255, 255, .06) 54.3% 54.8%, transparent 55.1%),
    radial-gradient(80% 90% at 74% 72%, color-mix(in srgb, var(--t1, #4f7d5f) 70%, #fff 30%) 0, transparent 55%),
    radial-gradient(90% 80% at 0% 0%, rgba(255, 255, 255, .12), transparent 55%),
    linear-gradient(160deg, var(--t1, #4f7d5f) 0%, var(--t2, #12261b) 78%);
}
/* grain */
.lib-poster::before, .title-hero::before, .nowplaying[data-tone]::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); opacity: .13; mix-blend-mode: overlay;
}
/* the low sun: games and experiences (videos get the play badge instead) */
[data-kind="module"] .lib-poster::after, .lib-poster[data-kind="module"]::after, .title-hero[data-kind="module"]::after {
  content: ""; position: absolute; left: 74%; top: 62%; width: 11%; aspect-ratio: 1; z-index: 0;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, #fffaf0 0 55%, rgba(255, 250, 240, 0) 72%);
  box-shadow: 0 0 40px 12px rgba(255, 244, 220, .28);
}

/* ---------------- Ontdekken: the whole page is the dark room ---------------- */

.dark-view { position: relative; color: var(--on-forest); padding: 18px 0 34px; min-height: calc(100dvh - 60px); }
.dark-view::before { /* full-bleed backdrop behind the centred column */
  content: ""; position: absolute; z-index: -1; inset: 0 calc(50% - 50vw);
  background:
    radial-gradient(60% 60% at 10% 0%, rgba(79, 125, 95, .26), transparent 60%),
    radial-gradient(50% 50% at 100% 40%, rgba(108, 106, 156, .14), transparent 60%),
    var(--cinema);
}
.dark-view .hint { color: var(--on-forest-2); }
.search-row.dark {
  background: rgba(241, 244, 238, .06); border-color: rgba(241, 244, 238, .14); color: var(--on-forest-2);
  border-radius: var(--r-md); padding: 0 18px;
}
.search-row.dark input { color: var(--on-forest); }
.search-row.dark input::placeholder { color: rgba(241, 244, 238, .5); }
.search-row.dark:focus-within { outline-color: var(--mint); }
.search-row input::-webkit-search-cancel-button { filter: invert(1) opacity(.6); }

/* Home hero: the title card at full size, inside the column */
.title-hero.spot {
  margin: 16px 0 6px; min-height: 380px; border-radius: var(--r-lg);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .8), inset 0 0 0 1px rgba(255, 255, 255, .05);
}
.title-hero.spot > .title-hero-inner { margin: 0; max-width: none; padding: 22px 22px 24px; }
.title-hero.spot > .title-hero-inner::before { inset: 0; }

.lib-rails { display: flex; flex-direction: column; gap: 8px; }
.lib-rails > .hint { padding: 10px 0; }
.rail { position: relative; container-type: inline-size; }
.rail-head { display: flex; align-items: center; gap: 10px; padding: 16px 0 2px; }
.rail-head h4 { font-family: var(--display); font-weight: 600; font-size: 19px; letter-spacing: -.005em; }
.rail-count {
  font-size: 11.5px; font-weight: 700; color: var(--on-forest-2);
  padding: 2px 8px; border-radius: 4px; background: rgba(241, 244, 238, .08);
}
.rail-nav { margin-left: auto; display: none; gap: 6px; }
.rail-btn {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid rgba(241, 244, 238, .16); background: rgba(241, 244, 238, .06); color: var(--on-forest);
}
.rail-btn:hover:not(:disabled) { background: rgba(241, 244, 238, .16); }
.rail-btn:disabled { opacity: .3; cursor: default; }

.rail-track {
  display: grid; grid-auto-flow: column; gap: 12px;
  grid-auto-columns: calc((100cqw - 12px) / 1.55);
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  /* bleed to the screen edges, so the next title peeks in (cqw = the row's
     width; a % here would be the scroller's own width in scroll-padding) */
  margin: 0 calc(50cqw - 50vw); padding: 12px calc(50vw - 50cqw) 14px; scroll-padding-inline: calc(50vw - 50cqw);
  scrollbar-width: none;
}
.rail-track::-webkit-scrollbar { display: none; }

.lib-tile {
  scroll-snap-align: start; position: relative; min-width: 0;
  display: flex; flex-direction: column; gap: 8px; align-items: stretch;
  padding: 0; border: none; background: none; text-align: left; color: var(--on-forest);
}
.lib-poster {
  position: relative; overflow: hidden; isolation: isolate; display: block;
  aspect-ratio: 16 / 9; border-radius: var(--r-md);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 14px 30px -18px rgba(0, 0, 0, .8);
  transition: transform 220ms var(--ease), box-shadow 220ms var(--ease);
}
.lib-poster .lib-title {
  position: absolute; left: 12px; right: 12px; bottom: 10px; z-index: 2;
  font-family: var(--display); font-weight: 600; font-size: 20px; line-height: 1.05; letter-spacing: -.01em;
  color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, .45);
  overflow-wrap: anywhere;
}
.lib-poster .lib-title::before { /* bottom scrim behind the title */
  content: ""; position: absolute; z-index: -1; left: -12px; right: -12px; bottom: -10px; height: 220%;
  background: linear-gradient(to top, rgba(0, 0, 0, .55), transparent);
}
.lib-badge {
  position: absolute; left: 10px; top: 10px; z-index: 2;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #fff;
  padding: 5px 8px; border-radius: 4px; background: rgba(0, 0, 0, .28);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.lib-badge .icon { fill: currentColor; stroke: none; }
.lib-info { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 2px; min-height: 20px; }
.lib-meta { font-size: 12px; color: var(--on-forest-2); }
.lib-cta {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; color: var(--mint);
}
.lib-cta .icon { fill: currentColor; stroke: none; }
.lib-tile:focus-visible { outline: none; }
.lib-tile:focus-visible .lib-poster { box-shadow: 0 0 0 3px var(--mint), 0 18px 36px -16px rgba(0, 0, 0, .9); }
.lib-tile.off .lib-poster { filter: grayscale(.9) brightness(.8); }
.lib-tile.off .lib-cta { display: none; }

@media (hover: hover) {
  .lib-cta { opacity: 0; transform: translateX(-4px); transition: opacity 180ms ease, transform 180ms var(--ease); }
  .lib-tile:hover .lib-poster { transform: translateY(-4px) scale(1.035); box-shadow: 0 0 0 2px rgba(168, 209, 179, .7), 0 24px 40px -18px rgba(0, 0, 0, .9); }
  .lib-tile:hover .lib-cta, .lib-tile:focus-visible .lib-cta { opacity: 1; transform: none; }
  .rail.scrolls .rail-nav { display: flex; }
}

/* Start sheet: the title card as a header */
.sheet-poster { aspect-ratio: 21 / 8; border-radius: var(--r-md); margin-bottom: 2px; }
.sheet-poster .lib-title { font-family: var(--font); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }

/* ---------------- Activiteit + cliënt history ---------------- */

.card-list {
  background: var(--card); border: 1px solid var(--border-soft); border-radius: var(--r-lg);
  padding: 4px 16px; box-shadow: var(--shadow-1);
}
.ins-list { display: flex; flex-direction: column; }
.ins-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--border-soft); font-size: 14px;
}
.ins-row:last-child { border-bottom: none; }
.ins-row .k { min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-row .v { color: var(--ink-2); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.ins-row .v .icon { vertical-align: -2px; color: var(--accent-deep); }
.ins-row.warn .k, .ins-row.warn .v { color: var(--danger-deep); }
.ins-row.warn .v .icon { color: var(--danger-deep); }

.activity-list {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border-soft); border-radius: var(--r-lg);
  padding: 4px 14px; box-shadow: var(--shadow-1);
}
.activity-list > .hint { padding: 14px 2px; }
.act-row {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border-soft);
}
.act-row:last-child { border-bottom: none; }
.act-thumb { width: 64px; border-radius: 4px !important; box-shadow: none !important; }
.act-thumb::after { display: none; }
.act-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.act-title { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.act-time { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.act-live {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 4px; background: #f6ead2; color: #7a5a1c;
}
.rated { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; }
.rated.up { background: var(--tint-sage); color: var(--accent-deep); }
.rated.down { background: var(--tint-warm); color: var(--ink-2); }
.activity-list.compact { padding: 0 12px; box-shadow: none; }

/* ---------------- 2 · curated pick ---------------- */

.back {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--card); color: var(--accent-deep);
  font-weight: 700; font-size: 14px; line-height: 1; border-radius: var(--r-sm);
  padding: 0 14px 0 10px; min-height: 40px; min-width: 44px; justify-content: center;
  position: relative;
}
.back::after { content: ""; position: absolute; inset: -3px; }
.back:hover { color: var(--accent-darker); background: var(--card-hover); }
#btn-run-back { padding: 0; width: 40px; }

/* Title page: a full-bleed poster with the pick's name, why and Start on it. */
.title-hero {
  position: relative; overflow: hidden; isolation: isolate;
  margin: 0 calc(50% - 50vw); min-height: min(78vh, 560px);
  display: flex; color: var(--on-forest);
}
.title-hero > .title-hero-inner {
  position: relative; z-index: 2; flex: 1;
  display: flex; flex-direction: column; justify-content: space-between; gap: 28px;
  max-width: var(--maxw); margin: 0 auto; padding: 14px var(--gutter) 28px;
}
.title-hero > .title-hero-inner::before { /* scrim: bottom + left, so text reads on any tone */
  content: ""; position: absolute; z-index: -1; inset: 0 calc(50% - 50vw);
  background:
    linear-gradient(to top, rgba(8, 12, 10, .82) 0%, rgba(8, 12, 10, .35) 45%, transparent 70%),
    linear-gradient(to right, rgba(8, 12, 10, .55), transparent 60%);
}
.title-hero .media-caption { display: none; }
.title-hero[data-kind="module"]::after { top: 30%; left: 76%; width: clamp(56px, 9vw, 128px); }
.curated-head { margin-top: auto; }
.kicker {
  font-size: 11.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent-deep);
}
.title-hero .kicker { color: var(--mint); }
.curated-head h2 { margin-top: 10px; font-size: 42px; line-height: 1.02; text-wrap: balance; text-shadow: 0 4px 24px rgba(0, 0, 0, .35); }
.curated-head .sub { margin-top: 10px; font-size: 15px; color: rgba(241, 244, 238, .8); }
.title-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn-primary.btn-play {
  flex: 1 1 220px; min-height: 58px; padding: 0 28px;
  background: #fbf8f2; color: var(--forest);
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .7);
}
.btn-play .icon { fill: currentColor; stroke: none; }
.btn-primary.btn-play:hover:not(:disabled) { background: #fff; }
.btn-primary.btn-play:hover:not(:disabled) .icon { transform: scale(1.1); }

.why-card {
  padding: 16px 18px; border-radius: var(--r-lg);
  background: var(--tint-sage); border: 1px solid #d3e3d8;
}
.why-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; color: var(--accent-deep); margin-bottom: 10px; }
.why-lines { display: flex; flex-direction: column; gap: 9px; font-size: 14.5px; color: var(--ink); }
.why-lines .line { display: flex; gap: 10px; align-items: center; }
.why-lines .line .icon {
  color: var(--accent); width: 28px; height: 28px; padding: 6px; border-radius: 6px;
  background: rgba(255, 255, 255, .7);
}

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat {
  padding: 12px 14px; background: var(--card);
  border: 1px solid var(--border-soft); border-radius: var(--r-md); box-shadow: var(--shadow-1);
}
.stat-label { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; color: var(--muted); }
.stat-value { margin-top: 2px; font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }

.foot { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
/* Phones: the primary action of a view stays under the thumb. */
#view-running .foot {
  position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 5;
  margin: 0 calc(-1 * var(--gutter)); padding: 14px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(246, 242, 234, 0), var(--ground) 22px);
}

.btn-primary {
  min-height: 60px; border: none; border-radius: var(--r-md);
  background: linear-gradient(180deg, #568667, var(--accent));
  color: #fff;
  font-weight: 700; font-size: 17.5px; line-height: 1;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 10px 22px -10px rgba(60, 97, 74, .7);
}
.btn-primary .icon { transition: transform 150ms var(--ease); }
.btn-primary:hover:not(:disabled) { background: var(--accent-deep); }
.btn-primary:hover:not(:disabled) .icon { transform: translateX(3px); }
.btn-primary:disabled { opacity: .45; cursor: default; box-shadow: none; }

.btn-ghost-text {
  min-height: 44px; border: none; background: none; border-radius: var(--r-sm); padding: 0 12px;
  color: var(--muted); font-weight: 700; font-size: 14px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-ghost-text:hover { color: var(--ink-2); background: var(--ground-2); }
.btn-ghost-text.small { min-height: 36px; font-size: 13px; color: var(--accent-deep); }

/* ---------------- 3 · session running ---------------- */

.banner {
  margin-top: 12px; padding: 13px 16px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 700;
}
.banner.safe { background: var(--danger-tint); color: var(--danger-deep); border: 1.5px solid var(--danger); }
.banner.info { background: var(--tint-warm); color: var(--ink-2); border: 1px solid var(--border); }

.take {
  margin-top: 12px; min-height: 48px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--card); color: var(--ink-2);
  font-weight: 700; font-size: 14px;
}
.take:hover { background: var(--card-hover); }

.run-layout { display: grid; gap: 14px; margin-top: 14px; }
.run-main, .run-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.nowplaying {
  position: relative; overflow: hidden; isolation: isolate;
  padding: 18px 18px 20px; border-radius: var(--r-lg); color: var(--on-forest);
  background:
    radial-gradient(100% 100% at 100% 0%, rgba(168, 209, 179, .18), transparent 55%),
    linear-gradient(165deg, var(--forest-2), var(--forest));
  box-shadow: var(--shadow-3);
}
.nowplaying[data-tone] { box-shadow: 0 2px 6px rgba(38, 35, 31, .08), 0 28px 60px -22px rgba(0, 0, 0, .55); }
.nowplaying[data-tone]::after { z-index: -1; }
.nowplaying::before {
  content: ""; position: absolute; z-index: -1;
  width: 420px; height: 420px; right: -170px; bottom: -280px; border-radius: 50%;
  background: repeating-radial-gradient(circle at center, transparent 0 30px, rgba(241, 244, 238, .07) 30px 31px);
}
.nowplaying[data-tone]::before {
  inset: 0; width: auto; height: auto; border-radius: 0;
  background: linear-gradient(to right, rgba(8, 12, 10, .6), rgba(8, 12, 10, .1));
}
.np-kicker {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--mint);
}
.np-kicker::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); animation: breathe-mint 2.4s ease-in-out infinite; }
@keyframes breathe-mint { 0%, 100% { box-shadow: 0 0 0 0 rgba(168, 209, 179, .5); } 50% { box-shadow: 0 0 0 6px rgba(168, 209, 179, 0); } }
.np-title { margin-top: 10px; font-family: var(--display); font-weight: 600; font-size: 28px; line-height: 1.1; letter-spacing: -.01em; }
.np-meta { margin-top: 6px; font-size: 13px; color: var(--on-forest-2); font-variant-numeric: tabular-nums; }
.progress { margin-top: 16px; height: 8px; border-radius: 999px; background: rgba(241, 244, 238, .14); overflow: hidden; }
.progress-fill {
  width: 0; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #7fb38f, var(--mint));
  box-shadow: 0 0 12px rgba(168, 209, 179, .55);
  transition: width 900ms linear;
}

.rate-card {
  padding: 16px; background: var(--card);
  border: 1px solid var(--border-soft); border-radius: var(--r-lg); box-shadow: var(--shadow-2);
}
.rate-head { font-family: var(--display); font-weight: 600; font-size: 19px; margin-bottom: 12px; }
.rate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rate-btn {
  min-height: 84px; border-radius: var(--r-md);
  font-weight: 700; font-size: 15px; line-height: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
}
.rate-btn.up { border: none; background: linear-gradient(180deg, #568667, var(--accent)); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14); }
.rate-btn.up:hover { background: var(--accent-deep); }
.rate-btn.down { border: 2px solid var(--border); background: var(--ground); color: var(--ink-2); }
.rate-btn.down:hover { background: var(--card-hover); }
.rate-btn.selected { box-shadow: 0 0 0 3px var(--card), 0 0 0 5.5px var(--accent-deep); }
.rate-note { margin-top: 12px; font-size: 12.5px; color: var(--muted); }

.run-panel { display: flex; flex-direction: column; gap: 12px; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ctl {
  min-height: 54px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--card); color: var(--ink);
  font-weight: 700; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.ctl .icon { color: var(--accent-deep); }
.ctl:hover:not(:disabled) { background: var(--card-hover); border-color: var(--icon-dim); }
.ctl:disabled { opacity: .45; cursor: default; }
.ctl.on { background: var(--tint-sage); border-color: var(--accent); color: var(--accent-deep); }

.sliders { display: flex; flex-direction: column; gap: 4px; padding: 2px 2px 0; }
.sliders label {
  display: grid; grid-template-columns: 86px 1fr 44px; align-items: center; gap: 10px;
  min-height: 44px; font-size: 13px; font-weight: 700; color: var(--ink-2);
}
.slider-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent;
  accent-color: var(--accent); cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: var(--track); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--track); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent); box-shadow: 0 2px 6px rgba(38, 35, 31, .18);
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent); box-shadow: 0 2px 6px rgba(38, 35, 31, .18);
}

.btn-end {
  min-height: 48px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--card); color: var(--ink-2);
  font-weight: 700; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-end:hover:not(:disabled) { background: var(--card-hover); }
.btn-end:disabled { opacity: .45; cursor: default; }

.btn-safe {
  min-height: 58px; border: 2px solid var(--danger); border-radius: var(--r-md);
  background: var(--danger-tint); color: var(--danger-deep);
  font-weight: 700; font-size: 16.5px; line-height: 1;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 10px 22px -14px rgba(180, 84, 58, .8);
}
.btn-safe:hover { background: #f9e1d6; }

/* Ack feedback on any command button */
.flash-ok { box-shadow: 0 0 0 3px var(--accent) !important; }
.flash-err { box-shadow: 0 0 0 3px var(--danger) !important; }

/* ---------------- meekijken (remote watch-along) ---------------- */

.preview {
  background: #14110f; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-3);
}
.preview-frame {
  position: relative; aspect-ratio: 16 / 9; background: #14110f;
  display: flex; align-items: center; justify-content: center;
}
.preview-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }
.preview-frame img:not([src]) { visibility: hidden; }
.preview-frame:fullscreen { aspect-ratio: auto; }
.preview-status {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  max-width: calc(100% - 24px);
  background: rgba(20, 17, 15, .78); color: #fff;
  font-size: 13px; font-weight: 700; padding: 7px 13px; border-radius: 6px;
  text-align: center;
}
.preview-bar {
  display: flex; align-items: center; gap: 4px; padding: 6px 8px 6px 16px; color: #f1ede6;
}
.preview-label {
  flex: 1; display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #e0674a; box-shadow: 0 0 0 3px rgba(224, 103, 74, .25); }
.preview-bar .btn-ghost-text { color: rgba(241, 237, 230, .75); }
.preview-bar .btn-ghost-text:hover { color: #fff; background: rgba(255, 255, 255, .08); }

/* ---------------- sheets: bottom sheet on phones, dialog on desktop ---------------- */

.sheet {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(24, 22, 19, .42);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade 150ms ease;
}
.sheet-card {
  width: 100%; max-width: 560px; max-height: calc(100dvh - 24px); overflow-y: auto;
  background: var(--ground); border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 26px 18px calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow-3);
  position: relative;
  animation: rise 220ms var(--ease);
}
.sheet-card::before {
  content: ""; position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
  width: 40px; height: 4px; border-radius: 999px; background: var(--icon-dim);
}
.sheet-head { font-family: var(--display); font-weight: 600; font-size: 22px; padding: 0 2px 4px; letter-spacing: -.01em; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: .6; } }

select {
  min-height: 48px; width: 100%;
  border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--card) 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='%23877e74' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center;
  -webkit-appearance: none; appearance: none;
  color: var(--ink); font-family: inherit; font-size: 15px; padding: 0 40px 0 14px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
select:hover:not(:disabled) { border-color: var(--icon-dim); }
select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76, 122, 92, .2); }
select:disabled { opacity: .45; }
.sheet .btn-primary { min-height: 56px; font-size: 16px; margin-top: 4px; }

.field-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.icon-btn {
  width: 48px; height: 48px; display: grid; place-items: center; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--card); color: var(--accent-deep);
}
.icon-btn:hover { background: var(--tint-sage); border-color: #cfe0d4; }
#lib-patient { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76, 122, 92, .1); }
.device-line {
  display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px;
  border-radius: var(--r-sm); background: var(--card); border: 1px solid var(--border-soft);
  font-size: 15px; font-weight: 700; color: var(--ink);
}
.device-line .muted { font-weight: 400; }
.device-line .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }
.device-line.off { color: var(--ink-2); font-weight: 400; }
.device-line.off .dot { background: var(--icon-dim); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-opt {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 48px; padding: 8px 14px; border-radius: var(--r-sm); text-align: left;
  border: 1.5px solid var(--border); background: var(--card); color: var(--ink);
  font-size: 14px; font-weight: 700;
}
.chip-opt .chip-sub { font-size: 12px; font-weight: 400; color: var(--muted); }
.chip-opt:hover { border-color: var(--icon-dim); }
.chip-opt.on { border-color: var(--accent); background: var(--tint-sage); color: var(--accent-deep); box-shadow: 0 0 0 1px var(--accent); }
.chip-opt.on .chip-sub { color: var(--accent-deep); }

/* Confirm / alert / prompt (BBK.confirm & co. in auth.js) — above any open window */
.dialog-sheet { z-index: 46; }
.dialog-card { max-width: 460px; gap: 10px; }
.dialog-message { font-size: 15px; line-height: 1.45; color: var(--ink-2); padding: 0 2px; }
.dialog-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.dialog-actions .btn-primary, .dialog-actions .btn-danger { min-height: 52px; font-size: 16px; padding: 0 22px; }

.client-head { display: flex; align-items: center; gap: 14px; }
.client-head .avatar {
  width: 58px; height: 58px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--tint-sage); color: var(--accent-deep); font-weight: 700; font-size: 19px;
}
.client-head-text { min-width: 0; }
.client-head .sheet-head { padding: 0; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.field input[type="text"], .field input[type="email"], .field input[type="password"] {
  min-height: 48px; border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--card); color: var(--ink);
  font-family: inherit; font-size: 16px; font-weight: 400; padding: 0 14px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.field input:hover:not(:disabled) { border-color: var(--icon-dim); }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76, 122, 92, .2); }
.field input:disabled { background: var(--ground-2); color: var(--ink-2); }
.field input::placeholder { color: #aaa093; }

.check-row {
  display: flex; align-items: center; gap: 12px; min-height: 48px;
  padding: 8px 12px; border-radius: var(--r-sm); background: var(--card); border: 1px solid var(--border-soft);
  font-size: 14px; color: var(--ink); cursor: pointer;
}
.check-row input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.check-row.sub { min-height: 44px; background: none; border: none; padding: 4px 6px; }
.role-list { display: flex; flex-direction: column; gap: 0; }
.check-group-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-deep); margin-top: 10px; padding: 0 6px; }

.token-box {
  font: 13px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--forest); color: var(--mint); border-radius: var(--r-sm); padding: 14px 16px;
  word-break: break-all; user-select: all;
}
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.sheet-error { font-size: 13px; font-weight: 700; color: var(--danger-deep); }

.btn-danger {
  min-height: 48px; border: 1.5px solid var(--danger); border-radius: var(--r-md);
  background: var(--danger-tint); color: var(--danger-deep);
  font-weight: 700; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-danger:hover:not(:disabled) { background: #f9e1d6; }
.btn-danger:disabled { opacity: .45; cursor: default; }

/* ---------------- events drawer (below the fold) ---------------- */

.events { margin-top: 26px; padding-bottom: calc(28px + env(safe-area-inset-bottom)); color: var(--muted); }
.events summary {
  cursor: pointer; font-size: 13px; font-weight: 700; list-style: none;
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--border);
}
.events summary::-webkit-details-marker { display: none; }
.events summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 150ms ease; }
.events[open] summary::before { transform: rotate(45deg); }
.events summary:hover { color: var(--ink-2); background: var(--card); }
.feed {
  list-style: none; max-height: 320px; overflow-y: auto; margin-top: 10px;
  background: var(--card); border: 1px solid var(--border-soft); border-radius: var(--r-md); padding: 4px 14px;
}
.feed:empty { display: none; }
.feed li {
  padding: 8px 2px; border-bottom: 1px solid var(--border-soft);
  font-size: 13px; display: flex; gap: 12px; color: var(--ink-2);
}
.feed li:last-child { border-bottom: none; }
.feed .t { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.feed li.warn { color: #8a6a2a; }
.feed li.bad { color: var(--danger-deep); }
.feed li.good { color: var(--accent-deep); }
.events .drawer-link {
  display: inline-block; padding: 10px 0; margin-right: 16px;
  color: var(--accent-deep); font-weight: 700; font-size: 13px; text-decoration: none;
}

/* ---------------- beheer (admin) ---------------- */

.title-block { padding: 26px 2px 16px; }
.title-block h2 { margin-top: 6px; font-size: 34px; line-height: 1.08; text-wrap: balance; }
.title-block .sub { margin-top: 8px; font-size: 14.5px; color: var(--muted); max-width: 60ch; }
.loc-edit { min-height: 38px; padding: 0 10px; margin: 6px 0 0 -10px; color: var(--accent-deep); }

/* Tabs: a segmented track that scrolls sideways on narrow phones. */
.tabs {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 6px;
  background: var(--ground-2); border: 1px solid var(--border-soft); border-radius: var(--r-md);
  overflow-x: auto; scrollbar-width: none; align-self: flex-start; max-width: 100%;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; min-height: 40px; padding: 0 16px; border-radius: 6px;
  border: none; background: none; color: var(--ink-2);
  font-weight: 700; font-size: 14px; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { background: var(--card); color: var(--accent-deep); box-shadow: var(--shadow-2); }

.view > .section-block { margin-top: 12px; }
.page-head { display: flex; flex-direction: column; gap: 16px; }
.btn-primary.btn-compact { min-height: 48px; padding: 0 20px; font-size: 15px; align-self: flex-start; }
.client-grid { padding-bottom: 8px; }
.wearer .meta.last { color: var(--accent-deep); font-size: 12.5px; }
.wearer-list.unpadded { padding: 0; }
#tenant-switch { width: auto; max-width: 280px; margin-left: auto; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.search-row {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; min-height: 48px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--muted);
}
.search-row input {
  flex: 1; min-height: 46px; border: none; background: none;
  font-family: inherit; font-size: 15px; color: var(--ink); outline: none;
}
.search-row:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Inzichten: één-serie staafgrafieken + lijstkaarten (dataviz specs:
   dunne staven, ronde koppen op de basislijn, terughoudende as,
   selectieve labels, hover per staaf). */
[data-tpanel="insights"] { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }
.ins-toolbar { display: flex; }
.ins-toolbar select { max-width: 320px; }
.chart-card {
  background: var(--card); border: 1px solid var(--border-soft);
  border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow-1); min-width: 0;
}
.chart-title { font-weight: 700; font-size: 14.5px; margin-bottom: 10px; }
.chart-unit { font-weight: 400; font-size: 12px; color: var(--muted); }
.chart { display: block; width: 100%; height: auto; }
.chart .axis { stroke: var(--border); stroke-width: 1; }
.chart .bar-fill { fill: var(--accent); transition: fill 150ms ease; }
.chart .bar-hit { fill: transparent; }
.chart .bar-val {
  font: 700 11px var(--font);
  fill: var(--ink-2); opacity: 0; transition: opacity 150ms ease;
}
.chart .bar.always .bar-val, .chart .bar:hover .bar-val { opacity: 1; }
.chart .bar:hover .bar-fill { fill: var(--accent-deep); }
.chart .bar-lab { font: 10px var(--font); fill: var(--muted); }
.chart-card .hint { margin-top: 10px; }

.w-stats {
  background: var(--tint-sage); border-radius: var(--r-sm); padding: 10px 12px;
  font-size: 13px; color: var(--ink);
  display: flex; flex-direction: column; gap: 3px;
}

/* Content scoren: één sliderrij per eigenschap (aanbevelingsprofiel) */
#c-dims { display: flex; flex-direction: column; gap: 2px; background: var(--card); border: 1px solid var(--border-soft); border-radius: var(--r-md); padding: 6px 14px; }
.dim-row {
  display: grid; grid-template-columns: 128px 1fr 26px;
  align-items: center; gap: 12px;
  min-height: 44px; font-size: 13px; font-weight: 700; color: var(--ink-2);
}
.dim-row .dim-val { text-align: right; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------------- login gate + full-screen pickers ---------------- */

.login {
  position: fixed; inset: 0; z-index: 50; overflow-y: auto;
  display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  isolation: isolate;
  background:
    radial-gradient(80% 60% at 85% 0%, rgba(168, 209, 179, .2), transparent 60%),
    linear-gradient(165deg, var(--forest-2), #14271d 80%);
}
.login::before {
  content: ""; position: absolute; z-index: -1;
  width: 1100px; height: 1100px; left: 50%; bottom: -760px; transform: translateX(-50%); border-radius: 50%;
  background: repeating-radial-gradient(circle at center, transparent 0 46px, rgba(241, 244, 238, .07) 46px 47px);
  -webkit-mask-image: radial-gradient(circle at center, #000 35%, transparent 72%);
  mask-image: radial-gradient(circle at center, #000 35%, transparent 72%);
}
.login::after {
  content: ""; position: absolute; z-index: -1; left: 50%; bottom: 0; transform: translate(-50%, 50%);
  width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(241, 244, 238, .55), rgba(168, 209, 179, .12) 45%, transparent 70%);
}
.login-card {
  background: var(--card); border-radius: var(--r-lg);
  padding: 34px 26px 26px; width: min(420px, 100%);
  display: flex; flex-direction: column; gap: 14px; text-align: center;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .04);
  animation: rise 260ms var(--ease);
}
.login-card h1 { font-size: 27px; }
.login-card > .muted { margin-top: -6px; font-size: 14px; }
.login-card input {
  font-size: 26px; text-align: center; letter-spacing: .4em;
  padding: .7rem; border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--ground); color: var(--ink); font-family: inherit;
}
.login-card .btn-primary { min-height: 56px; font-size: 16px; margin-top: 4px; }
.login-card .error { text-align: center; }
/* Brandmark above the sign-in card title */
.login-card[data-step="login"]::before {
  content: ""; align-self: center; width: 52px; height: 52px; border-radius: 10px; margin-bottom: 2px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 32 32' fill='none' stroke='%23a8d1b3' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 23a11 11 0 0 1 22 0'/%3E%3Cpath d='M10 23a6 6 0 0 1 12 0'/%3E%3Cpath d='M3 27h26'/%3E%3Cpath d='M16 5v3'/%3E%3Cpath d='m7.5 8.5 2 2'/%3E%3Cpath d='m24.5 8.5-2 2'/%3E%3C/svg%3E") no-repeat center,
    linear-gradient(160deg, var(--forest-2), var(--forest));
}

/* Account forms reuse the login card, but with normal text inputs (the
   card's own input style is the old big-digit PIN field). */
.account-card { text-align: left; gap: 14px; }
.account-card h1, .account-card > .muted { text-align: center; }
.account-card .field input {
  font-size: 16px; letter-spacing: normal; text-align: left;
  min-height: 50px; padding: 0 14px; background: var(--card);
}
.account-card .wearer-list { max-height: 60vh; overflow: auto; padding: 2px; }

/* Below desktop the running view is one column: flatten the side column so
   the Safe room bar can stick to the viewport for the whole view, not just
   while the controls are on screen. */
@media (max-width: 1039px) {
  .run-side { display: contents; }
}

/* Tablet portrait: icons only in the top tabs and headset chip, so the bar fits. */
@media (min-width: 720px) and (max-width: 919px) {
  .nav-top .nav-tab { padding: 0 12px; font-size: 0; gap: 0; }
  .hs-chip .hs-chip-text { display: none; }
}

/* ---------------- tablet ---------------- */

@media (min-width: 720px) {
  :root { --gutter: 28px; }
  :root { --tabbar-h: 0px; }
  .topbar-sep { display: block; }
  .topbar-inner { min-height: 68px; }
  .nav-top { display: flex; }
  .tabbar { display: none; }
  .session-bars { padding: 0 var(--gutter); }

  .panel { padding: 18px; }
  .rail-track { grid-auto-columns: calc((100cqw - 2 * 14px) / 2.6); gap: 14px; }
  .rail.grid .rail-track { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

  .title-hero.spot { min-height: 440px; margin-top: 20px; }
  .title-hero.spot > .title-hero-inner { padding: 34px 36px 36px; }
  .curated-head h2 { font-size: 54px; }
  .title-actions { flex-wrap: nowrap; }
  .btn-primary.btn-play { flex: 0 0 auto; min-width: 240px; }
  .page-head { flex-direction: row; align-items: flex-end; justify-content: space-between; }
  .page-head .btn-compact { align-self: auto; }
  .client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
  .title-block { padding-top: 34px; }
  .title-block h2 { font-size: 42px; }

  /* Sheets become centred dialogs */
  .sheet { align-items: center; padding: 24px; }
  .sheet-card { border-radius: var(--r-lg); padding: 26px 24px 22px; max-height: calc(100dvh - 48px); }
  .sheet-card::before { display: none; }
  .dialog-actions { flex-direction: row-reverse; justify-content: flex-start; align-items: center; }
  .dialog-actions .btn-primary, .dialog-actions .btn-danger { min-width: 150px; }

  .view > .section-block > .wearer-list.unpadded {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px;
  }
  [data-tpanel="insights"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  [data-tpanel="insights"] .ins-toolbar, [data-tpanel="insights"] #cmp-card { grid-column: 1 / -1; }
}

/* ---------------- desktop ---------------- */

@media (min-width: 1040px) {
  :root { --gutter: 36px; }

  .wordmark { display: inline; }
  .rail-track { grid-auto-columns: calc((100cqw - 4 * 16px) / 4.35); gap: 16px; }
  .lib-poster .lib-title { font-size: 22px; }

  .title-hero.spot { min-height: 500px; }
  .title-hero.spot > .title-hero-inner { padding: 44px 48px 48px; }
  .curated-head h2 { font-size: 72px; max-width: 14ch; }
  .curated-head .sub { font-size: 17px; }

  .run-layout { grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 28px; margin-top: 18px; align-items: start; }
  .run-side { position: sticky; top: 92px; }
  .nowplaying { padding: 28px 28px 30px; }
  .np-title { font-size: 38px; }

  #view-running .foot { position: static; margin: 0; padding: 4px 0 0; background: none; }

  .view > .section-block > .wearer-list.unpadded { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
/* Content packages (ADR 0012): versie-acties in het pakket-sheet, status op tegels */
.ver-row { flex-wrap: wrap; }
.ver-row .acts { display: flex; gap: 12px; width: 100%; justify-content: flex-end; }
.ver-row .acts .btn-ghost-text { min-height: 36px; }
.hs-tile .hs-content { font-size: 12.5px; color: var(--accent-deep); font-weight: 700; }
.hs-tile .hs-content.warn { color: var(--danger-deep); }

/* ---------------- package listings (ADR 0013): covers, description, previews ---------------- */

/* A pushed cover replaces the generated title card wherever a title shows
   (applyPoster sets --cover); the title scrim stays, the low sun goes. */
.lib-poster[data-cover], [data-cover] > .lib-poster, .title-hero[data-cover], .nowplaying[data-cover] {
  background: var(--cover) center / cover no-repeat, var(--t2, #12261b);
}
.lib-poster[data-cover]::after, [data-cover] > .lib-poster::after, .title-hero[data-cover]::after { display: none; }

/* Start window: description + a row of thumbnails (preview clip first) */
.lib-desc { font-size: 14.5px; line-height: 1.45; color: var(--ink-2); padding: 0 2px; margin: -6px 0 0; }
.lib-shots { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: thin; }
.lib-shot {
  position: relative; flex: none; width: 116px; aspect-ratio: 16 / 9; padding: 0; border: 0;
  border-radius: var(--r-sm); overflow: hidden; background: var(--track); cursor: zoom-in;
}
.lib-shot img, .lib-shot-blank { display: block; width: 100%; height: 100%; object-fit: cover; }
.lib-shot:hover, .lib-shot:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lib-shot.is-video { cursor: pointer; }
.lib-shot-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; background: linear-gradient(to top, rgba(0, 0, 0, .35), rgba(0, 0, 0, .1));
}
.lib-shot-play .icon {
  fill: currentColor; stroke: none; padding: 7px; border-radius: 50%;
  background: rgba(0, 0, 0, .5); box-sizing: content-box;
}

/* Enlarged screenshot / preview clip, above the start window */
.sheet.lightbox { z-index: 45; align-items: center; padding: 16px; background: rgba(12, 14, 12, .86); }
.lightbox figure { margin: 0; width: min(100%, 1100px); animation: rise 220ms var(--ease); }
.lightbox img, .lightbox video {
  display: block; width: 100%; max-height: 82dvh; object-fit: contain;
  border-radius: var(--r-md); background: #000;
}
.lightbox figcaption { margin-top: 10px; color: #fff; font-size: 15px; text-align: center; }

/* Beheer: the package's listing, read-only */
.lib-media { display: flex; flex-direction: column; gap: 10px; }
.lib-hero { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-md); background: var(--track); }
#p-shots .lib-shot {
  width: 132px; aspect-ratio: auto; overflow: visible; background: none; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); text-decoration: none;
}
#p-shots .lib-shot img { aspect-ratio: 16 / 9; height: auto; border-radius: var(--r-sm); border: 1px solid var(--border); }
#p-shots .lib-shot:hover, #p-shots .lib-shot:focus-visible { outline: none; }
#p-shots .lib-shot:hover img { border-color: var(--accent); }
