/* Moved verbatim from templates/_partials/therapy_bottom_nav.html (inline <style>) so it can be
   cached. Keep in sync with that template; cascade position = the
   <link> that replaced the <style> block. */
  /* ============ Design tokens ============
     Night slate, same as the Menu sheet (therapy-menu.css) and the site
     header: Sam, 9 Nov 2026 picked dark for every sheet. Teal is the only
     accent; no orange, no warm cream. */
  #tsbbRoot{
    --tsbb-bg: #0E1115;
    --tsbb-surface: #13161B;
    --tsbb-raise: #1A1E24;
    --tsbb-cream: #F2F1EE;
    --tsbb-cream-dim: rgba(242,241,238,0.72);
    --tsbb-muted: rgba(242,241,238,0.58);
    --tsbb-faint: rgba(242,241,238,0.40);
    --tsbb-teal: #1F8C8C;
    --tsbb-teal-d: #1B7F7F;
    --tsbb-teal-bright: #6FAFAE;
    --tsbb-border: rgba(242,241,238,0.10);
    --tsbb-border-strong: rgba(242,241,238,0.16);
    --tsbb-font: 'Hanken Grotesk', system-ui, sans-serif;
    --tsbb-display: 'Sora', 'Hanken Grotesk', system-ui, sans-serif;
  }
  #tsbbRoot, #tsbbRoot *{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }

  /* Content must clear the bar (64px) + the FAB crest (22px above the
     bar's bottom edge → FAB top ≈86px) + breathing room. */
  body{ padding-bottom:calc(96px + env(safe-area-inset-bottom, 0px)); }

  /* ============ Sticky bottom bar + Events FAB ============ */
  .tsbb-bar{
    position:fixed; left:0; right:0; bottom:0; z-index:700;
    max-width:430px; margin:0 auto;
    display:flex; align-items:flex-end;
    height:calc(64px + env(safe-area-inset-bottom));
    padding:8px 8px calc(8px + env(safe-area-inset-bottom));
    background:color-mix(in srgb, var(--tsbb-surface) 94%, transparent);
    backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
    border-top:1px solid var(--tsbb-border);
  }
  /* color-mix fallback for older WebKit */
  @supports not (background: color-mix(in srgb, #000 94%, transparent)){
    .tsbb-bar{ background:rgba(19,22,27,0.94); }
  }
  .tsbb-tab{
    flex:1; display:flex; flex-direction:column; align-items:center; gap:4px;
    padding:0 0 2px; color:var(--tsbb-muted); text-decoration:none;
    background:none; border:none; cursor:pointer;
    font-family:var(--tsbb-font);
    transition:color .12s, transform .08s;
  }
  .tsbb-tab:active{ transform:scale(.92); }
  .tsbb-tab svg{ width:21px; height:21px; }
  .tsbb-tab span{ font-size:8.5px; font-weight:800; letter-spacing:0.1em; text-transform:uppercase; }
  .tsbb-tab.on{ color:var(--tsbb-teal-bright); }
  .tsbb-gap{ width:76px; flex-shrink:0; }
  /* Centre Events button (Sam, 10 Nov 2026): a teal circle with a
     calendar icon and "Events", no T badge, sitting nearly level with the
     bar (its top is ~6px above the bar's edge). */
  .tsbb-fab{
    position:absolute; left:50%; bottom:calc(env(safe-area-inset-bottom) + 12px);
    transform:translateX(-50%);
    width:58px; height:58px; border-radius:50%;
    background:var(--tsbb-teal); color:#FFFFFF; border:none; cursor:pointer;
    font-family:var(--tsbb-font); padding:0;
    display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px;
    box-shadow:0 8px 18px -8px rgba(31,140,140,.8), 0 0 0 4px var(--tsbb-surface);
    transition:background .2s, transform .2s;
  }
  .tsbb-fab:active{ transform:translateX(-50%) scale(.94); background:var(--tsbb-teal-d); }
  .tsbb-fab:focus-visible{ outline:2px solid var(--tsbb-teal-bright); outline-offset:3px; }
  .tsbb-fab-ic{ width:22px; height:22px; }
  .tsbb-fab-tx{ font-size:8px; font-weight:800; letter-spacing:.12em; text-transform:uppercase; line-height:1; }
  body.tsbb-ev-open .tsbb-fab{ background:var(--tsbb-teal-d); }
  @media (hover:hover){
    .tsbb-fab:hover{ background:var(--tsbb-teal-d); }
  }
  .tsbb-fab-x{ display:none; }

  /* ============ Sheet shell ============ */
  .tsbb-scrim{
    position:fixed; inset:0; z-index:698;
    background:rgba(6,8,10,0.6);
    opacity:0; pointer-events:none; transition:opacity .28s;
  }
  body.tsbb-ev-open .tsbb-scrim, body.tsbb-mn-open .tsbb-scrim, body.tsbb-ct-open .tsbb-scrim, body.tsbb-ar-open .tsbb-scrim{ opacity:1; pointer-events:auto; }

  .tsbb-sheet{
    position:fixed; left:0; right:0; z-index:699;
    max-width:430px; margin:0 auto;
    bottom:calc(64px + env(safe-area-inset-bottom));
    background:var(--tsbb-surface);
    border-top:2px solid var(--tsbb-teal);
    border-radius:20px 20px 0 0;
    box-shadow:0 -18px 50px -22px rgba(0,0,0,0.8);
    display:flex; flex-direction:column;
    transform:translateY(calc(100% + 80px + env(safe-area-inset-bottom)));
    transition:transform .34s cubic-bezier(.32,.72,.28,1);
    font-family:var(--tsbb-font); color:var(--tsbb-cream);
  }
  #tsbbEvSheet{ height:auto; max-height:min(68vh, 560px); }
  #tsbbMnSheet{ height:min(54vh, 445px); }
  #tsbbCtSheet{ height:auto; max-height:min(80vh, 640px); }
  #tsbbArSheet{ height:auto; max-height:min(76vh, 620px); }
  body.tsbb-ev-open #tsbbEvSheet, body.tsbb-mn-open #tsbbMnSheet, body.tsbb-ct-open #tsbbCtSheet, body.tsbb-ar-open #tsbbArSheet{ transform:translateY(0); }

  /* ── Scroll lock — the page behind must not scroll while a sheet is
     open (mirrors locksmith-callbar.css "Scroll lock"). Sheet interiors
     keep scrolling; overscroll-behavior stops the scroll chain; the
     scrim's touchmove preventDefault (JS below) kills iOS rubber-band. */
  body.tsbb-ev-open, body.tsbb-mn-open, body.tsbb-ct-open, body.tsbb-ar-open{ overflow:hidden; }
  .tsbb-ev-list, .tsbb-mn-list, .tsbb-ct-body, .tsbb-ar-body{ overscroll-behavior:contain; -webkit-overflow-scrolling:touch; }

  .tsbb-handle{ display:none; }
  /* Head: a small teal label over the title (the venue's or the page's
     name). Sheet titles are not headings (they'd add Events/Artists/Menu/
     Contact to every page's outline). */
  .tsbb-head{ display:flex; align-items:center; gap:8px; padding:16px 16px 10px; }
  .tsbb-hd{ flex:1; min-width:0; display:flex; flex-direction:column; gap:5px; }
  .tsbb-count{ font-size:10.5px; font-weight:700; letter-spacing:0.16em; text-transform:uppercase; color:var(--tsbb-teal-bright); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .tsbb-count em{ font-style:normal; color:var(--tsbb-faint); letter-spacing:0.12em; }
  .tsbb-head .tsbb-title{ margin:0; font-family:var(--tsbb-display); font-size:21px; font-weight:700; letter-spacing:-0.02em; line-height:1.1; color:var(--tsbb-cream); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  #tsbbMnSheet .tsbb-head{ padding-bottom:0; }
  .tsbb-head-btn{ flex-shrink:0; display:inline-flex; align-items:center; gap:6px; height:32px; padding:0 11px; border-radius:8px; background:var(--tsbb-teal); color:#FFFFFF; font-family:var(--tsbb-font); font-size:12px; font-weight:700; text-decoration:none; white-space:nowrap; }
  .tsbb-head-btn:active{ background:var(--tsbb-teal-d); }
  .tsbb-close{ margin-left:auto; width:32px; height:32px; border-radius:8px; border:1px solid var(--tsbb-border-strong); background:transparent; cursor:pointer; display:grid; place-items:center; color:var(--tsbb-cream); flex-shrink:0; padding:0; }
  .tsbb-close svg{ width:15px; height:15px; }

  /* ============ Events + Artists sheets: one sideways row ============
     Sam, 9 Nov 2026: one horizontal row of portrait flyer cards (about
     two and a half showing), no up-and-down scrolling, a small dark date
     chip on each photo, the name on one line and "time · place" under it.
     Buttons only on special events. */
  .tsbb-ev-list, .tsbb-ar-body{
    display:flex; gap:10px; overflow-x:auto; overflow-y:hidden;
    scroll-snap-type:x proximity; scroll-padding-left:16px;
    padding:2px 16px 4px; scrollbar-width:none; -ms-overflow-style:none;
    overscroll-behavior-x:contain; -webkit-overflow-scrolling:touch;
  }
  .tsbb-ev-list::-webkit-scrollbar, .tsbb-ar-body::-webkit-scrollbar{ display:none; }
  .tsbb-ev-status, .tsbb-ar-status{ flex:1 0 100%; padding:30px 4px 34px; font-size:10.5px; font-weight:700; letter-spacing:0.14em; text-transform:uppercase; color:var(--tsbb-faint); text-align:center; }

  .tsbb-cd{
    flex:0 0 38%; scroll-snap-align:start; min-width:0;
    display:flex; flex-direction:column;
    background:var(--tsbb-raise); border:1px solid var(--tsbb-border);
    border-radius:10px; overflow:hidden; text-decoration:none; color:var(--tsbb-cream);
    font-family:var(--tsbb-font);
  }
  a.tsbb-cd:active{ transform:scale(.97); }
  .tsbb-cd-ph{
    position:relative; aspect-ratio:4/5; overflow:hidden;
    background:repeating-linear-gradient(45deg, #1C2027 0 10px, #171A20 10px 20px);
    display:grid; place-items:center;
  }
  .tsbb-cd-ph img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
  .tsbb-cd-ph > i{ font-style:normal; font-family:var(--tsbb-display); font-size:22px; font-weight:700; color:var(--tsbb-faint); }
  .tsbb-chip{
    position:absolute; left:7px; top:7px; z-index:1;
    background:rgba(19,22,27,0.84); color:#FFFFFF; border-radius:6px; padding:4px 6px;
    font-size:9px; font-weight:700; letter-spacing:0.12em; text-transform:uppercase; line-height:1; white-space:nowrap;
  }
  .tsbb-cd-tx{ display:flex; flex-direction:column; gap:2px; padding:8px 9px 9px; min-width:0; }
  .tsbb-cd-tx b{ font-family:var(--tsbb-display); font-size:13.5px; font-weight:700; letter-spacing:-0.01em; line-height:1.2; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .tsbb-cd-tx > span:not(.tsbb-cd-btn){ font-size:11.5px; font-weight:500; color:var(--tsbb-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .tsbb-cd-btn{ align-self:flex-start; margin-top:6px; background:var(--tsbb-teal); color:#FFFFFF; border-radius:8px; padding:6px 9px; font-size:11.5px; font-weight:700; text-decoration:none; white-space:nowrap; }
  .tsbb-cd-btn:active{ background:var(--tsbb-teal-d); }

  /* Foot: a small button bottom left, an optional quiet link bottom right.
     The round badge may overlap them a little (Sam: that's fine). */
  .tsbb-ev-foot, .tsbb-ar-foot{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 16px 12px; }
  .tsbb-btn-all{
    display:inline-flex; align-items:center; gap:6px;
    background:transparent; color:var(--tsbb-teal-bright);
    border:1.5px solid rgba(111,175,174,0.6); border-radius:8px;
    padding:8px 11px; font-family:var(--tsbb-font); font-size:12.5px; font-weight:700;
    text-decoration:none; cursor:pointer; white-space:nowrap;
  }
  .tsbb-btn-all:active{ background:rgba(111,175,174,0.12); }
  .tsbb-btn-all svg{ width:13px; height:13px; }
  .tsbb-foot-link{ font-size:10.5px; font-weight:600; color:rgba(255,255,255,0.72); text-decoration:none; white-space:nowrap; }

  /* ============ Menu sheet ============ */
  .tsbb-mn-list{ flex:1; overflow-y:auto; padding:2px 16px 18px; display:flex; flex-direction:column; gap:7px; }
  .tsbb-mn-row{ display:flex; align-items:center; gap:12px; background:var(--tsbb-raise); border:1px solid var(--tsbb-border); border-radius:13px; padding:14px; cursor:pointer; text-align:left; font-family:var(--tsbb-font); color:var(--tsbb-cream); text-decoration:none; width:100%; }
  .tsbb-mn-row:active{ background:#22272F; }
  .tsbb-mn-row .mi{ width:34px; height:34px; border-radius:9px; background:rgba(111,175,174,0.1); display:grid; place-items:center; color:var(--tsbb-teal-bright); flex-shrink:0; }
  .tsbb-mn-row .mi svg{ width:16px; height:16px; }
  .tsbb-mn-row .mi i{ font-size:16px; line-height:1; }
  .tsbb-mn-row b{ flex:1; min-width:0; font-size:13px; font-weight:800; letter-spacing:0.06em; text-transform:uppercase; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .tsbb-mn-row b small{ display:block; font-size:9px; font-weight:700; letter-spacing:0.14em; color:var(--tsbb-muted); margin-top:3px; }
  .tsbb-mn-row .mchev{ color:var(--tsbb-faint); flex-shrink:0; }
  .tsbb-mn-row .mchev svg{ width:15px; height:15px; transition:transform .2s; }

  /* Collapsible groups in the Menu sheet — the signed-in account
     dropdown (My account / Edit profile / Sign out) and the
     masteradmin Admin group share one treatment. */
  .tsbb-admin-toggle, .tsbb-acct-toggle{ background:var(--tsbb-raise); border:1px solid var(--tsbb-border-strong); }
  .tsbb-admin-toggle[aria-expanded="true"] .mchev svg,
  .tsbb-acct-toggle[aria-expanded="true"] .mchev svg{ transform:rotate(90deg); }
  .tsbb-admin-links, .tsbb-acct-links{ display:flex; flex-direction:column; gap:5px; padding:2px 0 0 12px; }
  .tsbb-admin-links[hidden], .tsbb-acct-links[hidden]{ display:none; }
  .tsbb-admin-links a, .tsbb-acct-links a{
    display:flex; align-items:center; gap:10px;
    background:rgba(242,241,238,0.03); border:1px solid var(--tsbb-border);
    border-radius:11px; padding:11px 13px; color:var(--tsbb-cream-dim);
    text-decoration:none; font-size:11.5px; font-weight:700; letter-spacing:0.08em; text-transform:uppercase;
  }
  .tsbb-admin-links a:active, .tsbb-acct-links a:active{ background:#22272F; }

  /* ============ Contact sheet ============ */
  .tsbb-ct-body{ flex:1; overflow-y:auto; padding:2px 16px 8px; display:flex; flex-direction:column; gap:12px; }
  .tsbb-ct-mail{
    display:flex; align-items:center; gap:12px;
    background:var(--tsbb-raise); border:1px solid var(--tsbb-border-strong);
    border-radius:13px; padding:14px; text-decoration:none; color:var(--tsbb-cream);
    font-family:var(--tsbb-font);
  }
  .tsbb-ct-mail:active{ background:#22272F; }
  .tsbb-ct-mail .mi{ width:34px; height:34px; border-radius:9px; background:rgba(111,175,174,0.1); display:grid; place-items:center; color:var(--tsbb-teal-bright); flex-shrink:0; }
  .tsbb-ct-mail .mi svg{ width:16px; height:16px; }
  .tsbb-ct-mail b{
    flex:1; min-width:0; font-size:14.5px; font-weight:800; letter-spacing:0.01em;
    color:var(--tsbb-teal-bright); overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  }
  .tsbb-ct-mail b small{ display:block; font-size:9px; font-weight:700; letter-spacing:0.14em; text-transform:uppercase; color:var(--tsbb-muted); margin-top:3px; }
  .tsbb-ct-form{ display:flex; flex-direction:column; gap:10px; }
  .tsbb-ct-form label{
    display:flex; flex-direction:column; gap:5px;
    font-size:9px; font-weight:800; letter-spacing:0.14em; text-transform:uppercase;
    color:var(--tsbb-muted); font-family:var(--tsbb-font);
  }
  .tsbb-ct-form input, .tsbb-ct-form select, .tsbb-ct-form textarea{
    width:100%; background:var(--tsbb-bg); color:var(--tsbb-cream);
    border:1px solid var(--tsbb-border-strong); border-radius:11px;
    padding:12px 13px; font-family:var(--tsbb-font); font-size:14px; font-weight:600;
  }
  .tsbb-ct-form input::placeholder, .tsbb-ct-form textarea::placeholder{ color:var(--tsbb-faint); font-weight:500; }
  .tsbb-ct-form input:focus, .tsbb-ct-form select:focus, .tsbb-ct-form textarea:focus{
    outline:none; border-color:var(--tsbb-teal-bright);
  }
  .tsbb-ct-form select{
    appearance:none; -webkit-appearance:none; cursor:pointer;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23948C7C' stroke-width='2.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 12px center; background-size:15px;
    padding-right:36px;
  }
  .tsbb-ct-form textarea{ min-height:96px; resize:vertical; }
  /* Honeypot — visually removed, still in the form for bots to fill. */
  .tsbb-hp{ position:absolute; left:-9999px; top:auto; width:1px; height:1px; opacity:0; pointer-events:none; }
  .tsbb-ct-send{
    display:flex; align-items:center; justify-content:center; gap:8px;
    width:100%; background:var(--tsbb-teal); color:#FFFFFF; border:none; border-radius:999px;
    padding:15px 14px; margin-top:2px; font-family:var(--tsbb-font); font-size:12px; font-weight:800;
    letter-spacing:0.16em; text-transform:uppercase; cursor:pointer; transition:transform .08s;
  }
  .tsbb-ct-send:active{ transform:scale(.97); background:var(--tsbb-teal-d); }
  .tsbb-ct-send[disabled]{ opacity:.55; cursor:default; }
  .tsbb-ct-send svg{ width:15px; height:15px; }
  /* Pending-state spinner — swapped in by JS while the contact POST is in flight. */
  .tsbb-ct-send .tsbb-ct-spin{ width:16px; height:16px; animation:tsbb-spin .7s linear infinite; }
  @keyframes tsbb-spin{ to{ transform:rotate(360deg); } }
  @keyframes tsbb-pulse{ 0%, 100%{ opacity:1; } 50%{ opacity:.45; } }

  /* Mobile-only — portal_topbar / header nav takes over from 768px. */
  @media (min-width: 768px){
    .tsbb-bar, .tsbb-sheet, .tsbb-scrim{ display:none !important; }
    body{ padding-bottom:0; }
  }

  @media (prefers-reduced-motion: reduce){
    .tsbb-sheet, .tsbb-fab, .tsbb-fab-x, .tsbb-scrim, .tsbb-tab{ transition:none; }
    /* No rotation — pulse opacity instead so pending state stays perceivable. */
    .tsbb-ct-send .tsbb-ct-spin{ animation:tsbb-pulse 1.2s ease-in-out infinite; }
  }


  /* ============ Venue bar (therapy_bottom_nav_venue.html) ============
     Sam, 9 Nov 2026: on a venue page the bar is the venue's own. Same
     shell; these rules add the venue-only pieces. Teal is the accent. */
  /* Contact */
  .tsbb-vn-addr{ display:flex; align-items:center; gap:12px; background:var(--tsbb-raise); border:1px solid var(--tsbb-border); border-radius:13px; padding:14px; color:var(--tsbb-cream); }
  .tsbb-vn-addr .mi, .tsbb-ct-mail .mi i{ display:grid; place-items:center; }
  .tsbb-vn-addr .mi{ width:34px; height:34px; border-radius:9px; background:rgba(111,175,174,0.1); color:var(--tsbb-teal-bright); flex-shrink:0; }
  .tsbb-vn-addr b{ flex:1; min-width:0; font-size:13.5px; font-weight:700; line-height:1.3; }
  .tsbb-vn-addr b small, .tsbb-ct-mail b small{ display:block; font-size:9px; font-weight:700; letter-spacing:0.14em; text-transform:uppercase; color:var(--tsbb-muted); margin-top:3px; }
  .tsbb-vn-dir, #tsbbVnSend{ border-radius:8px; text-decoration:none; }
  .tsbb-vn-more{ display:flex; flex-direction:column; gap:8px; margin-top:4px; }
  .tsbb-vn-done{ display:flex; flex-direction:column; gap:6px; padding:18px 16px; background:var(--tsbb-raise); border:1px solid var(--tsbb-teal); border-radius:12px; }
  .tsbb-vn-done[hidden]{ display:none; }
  .tsbb-vn-done b{ font-size:17px; font-weight:800; color:var(--tsbb-cream); }
  .tsbb-vn-done span{ font-size:13px; font-weight:600; color:var(--tsbb-cream-dim); }

  /* Menu: the line back to Therapy Sound */
  #tsbbVnForm[hidden]{ display:none; }
  /* Venue pages: the page's end clears the bar, the Events button and the
     venue-name chip above it (chip top ≈ 92px + 22px). */
  body:has(.tsbb-vn-bar){ padding-bottom:calc(128px + env(safe-area-inset-bottom, 0px)); }
  @media (min-width: 768px){ body:has(.tsbb-vn-bar){ padding-bottom:0; } }
  /* Therapy favourites (a venue with no events of its own) and "More
     artists" fill into the same row as the cards before them. */
  #tsbbVnFavs, #tsbbVnFavsList, #tsbbArMoreGrid{ display:contents; }
