/**
 * TruBible quick panel (TINL-1357): styles for /hub/tb-hub.js.
 *
 * "Daylight" rules (docs/design.md): paper and ink, hairlines, ONE accent (the main button, the app
 * you are in, the focus ring), no gradients; a soft shadow only because the panel floats.
 * It reads the page's tokens (tokens.css) and has its own fallbacks for pages that do not load them
 * (the meeting room): Light by default, Dark with data-hub-theme="dark" or the page's data-theme.
 *
 * Computers and tablets: a centred sheet near the top, like a desktop launcher.
 * Phones: a bottom sheet with a grab handle, app tiles three across.
 */
.tbh {
  --h-bg: var(--bg-card, #ffffff);
  --h-soft: var(--bg-subtle, #f4f4f2);
  --h-hover: var(--bg-hover, #ececea);
  --h-ink: var(--text, #111113);
  --h-muted: var(--text-secondary, #55585f);
  --h-line: var(--border, #e4e4e1);
  --h-brand: var(--brand, #0369a1);
  --h-brand-soft: var(--brand-soft, #e3f1fa);
  --h-on-brand: var(--on-brand, #ffffff);
  --h-danger: var(--danger, #b42318);
  --h-ease: var(--ease-out, cubic-bezier(.2, .8, .2, 1));
  --h-font: var(--font-body, Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  position: fixed; inset: 0; z-index: 2147483000;
  display: flex; justify-content: center; align-items: flex-start;
  padding: min(12vh, 110px) 16px 16px;
  background: rgba(15, 15, 18, .38);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .18s var(--h-ease), visibility 0s linear .18s;
  font-family: var(--h-font);
  color: var(--h-ink); -webkit-tap-highlight-color: transparent;
}
.tbh[data-hub-theme="dark"], [data-theme="dark"] .tbh:not([data-hub-theme="light"]) {
  --h-bg: var(--bg-card, #1b1c1f); --h-soft: var(--bg-subtle, #242529); --h-hover: var(--bg-hover, #2e2f34);
  --h-ink: var(--text, #f3f3f1); --h-muted: var(--text-secondary, #b3b6bd); --h-line: var(--border, #34353a);
  --h-brand: var(--brand, #7cc7ee); --h-brand-soft: var(--brand-soft, #173243); --h-on-brand: var(--on-brand, #0b1a24);
  --h-danger: var(--danger, #ff8a80);
}
/* Forced dark (the meeting room has no tokens; the Worship presenter is dark on a light page): spelled out. */
.tbh[data-hub-theme="dark"] { --h-bg: #1b1c1f; --h-soft: #242529; --h-hover: #2e2f34; --h-ink: #f3f3f1; --h-muted: #b3b6bd; --h-line: #34353a; --h-brand: #7cc7ee; --h-brand-soft: #173243; --h-on-brand: #0b1a24; --h-danger: #ff8a80; }
.tbh.open { opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
html.tbh-lock { overflow: hidden; }

.tbh-panel {
  position: relative; width: min(680px, 100%); max-height: min(76vh, 720px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--h-bg); border: 1px solid var(--h-line); border-radius: 20px;
  box-shadow: 0 24px 70px rgba(10, 10, 14, .28), 0 2px 8px rgba(10, 10, 14, .1);
  transform: translateY(10px) scale(.97); opacity: 0;
  transition: transform .26s cubic-bezier(.2, .9, .25, 1.12), opacity .18s var(--h-ease);
}
.tbh.open .tbh-panel { transform: none; opacity: 1; }
.tbh-grab { display: none; }

.tbh i[data-lucide], .tbh svg { width: 18px; height: 18px; flex: none; stroke-width: 2; }
.tbh button { font: inherit; color: inherit; cursor: pointer; }
.tbh :focus-visible { outline: 2px solid var(--h-brand); outline-offset: 2px; border-radius: 10px; }
.tbh .tbh-input:focus-visible, .tbh .tbh-body:focus-visible { outline: 0; }
.tbh h2, .tbh h3 { font-family: var(--h-font); }
.tbh kbd { font: 600 11px/1 var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); padding: 4px 6px; border-radius: 6px; background: var(--h-soft); border: 1px solid var(--h-line); color: var(--h-muted); }

/* ---- The field ---- */
.tbh-search { display: flex; align-items: center; gap: 12px; padding: 6px 10px 6px 18px; border-bottom: 1px solid var(--h-line); }
.tbh-search > svg, .tbh-search > i { color: var(--h-muted); width: 20px; height: 20px; }
.tbh-input { flex: 1; min-width: 0; height: 52px; border: 0; outline: 0; background: transparent; color: var(--h-ink); font: 500 17px/1.3 var(--h-font); }
.tbh-input::placeholder { color: var(--h-muted); opacity: .85; }
.tbh-x { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 999px; background: transparent; color: var(--h-muted); }
.tbh-x:hover { background: var(--h-hover); color: var(--h-ink); }

/* ---- The list ---- */
.tbh-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px 10px 12px; outline: 0; }
.tbh-sec { padding: 6px 0 2px; }
.tbh-sec h3 { margin: 8px 10px 6px; font: 600 11px/1 var(--h-font); letter-spacing: .08em; text-transform: uppercase; color: var(--h-muted); }

.tbh-apps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 2px; }   /* four across: the apps sit in even rows as the list grows */
.tbh-app { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 4px 10px; border: 0; border-radius: 14px; background: transparent; text-align: center; min-width: 0; transition: background .14s, transform .14s; }
.tbh-app:hover { background: var(--h-soft); }
.tbh-app:active { transform: scale(.96); }
.tbh-app b { font: 600 12.5px/1.25 var(--h-font); max-width: 100%; overflow-wrap: anywhere; }
.tbh-app small { display: none; }
.tbh-app-ic { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px; background: var(--h-soft); border: 1px solid var(--h-line); transition: transform .22s cubic-bezier(.2, .9, .25, 1.3); }
.tbh-app-ic svg, .tbh-app-ic i { width: 24px; height: 24px; }
.tbh-app:hover .tbh-app-ic { transform: translateY(-3px); }
.tbh-app.here .tbh-app-ic { background: var(--h-brand-soft); border-color: transparent; color: var(--h-brand); }
.tbh-app.here b { color: var(--h-brand); }
/* While searching, apps become ordinary rows (their one-line purpose shows). */
.tbh-apps.list { display: block; padding: 0; }
.tbh-apps.list .tbh-app { flex-direction: row; width: 100%; text-align: start; gap: 12px; padding: 8px 10px; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 0; align-items: center; }
.tbh-apps.list .tbh-app-ic { width: 36px; height: 36px; border-radius: 10px; grid-row: span 2; }
.tbh-apps.list .tbh-app-ic svg, .tbh-apps.list .tbh-app-ic i { width: 18px; height: 18px; }
.tbh-apps.list .tbh-app b { font-size: 14.5px; align-self: end; }
.tbh-apps.list .tbh-app small { display: block; color: var(--h-muted); font-size: 12.5px; align-self: start; }
.tbh-apps.list .tbh-app:hover .tbh-app-ic { transform: none; }

.tbh-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 7px 10px; border: 0; border-radius: 12px; background: transparent; text-align: start; transition: background .12s; }
.tbh-row:hover, .tbh-row:focus-visible, .tbh-app:focus-visible { background: var(--h-soft); }
.tbh-ic { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--h-soft); border: 1px solid var(--h-line); }
.tbh-row:hover .tbh-ic { background: var(--h-bg); }
.tbh-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tbh-txt b { font: 600 14.5px/1.3 var(--h-font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbh-txt small { font-size: 12.5px; color: var(--h-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbh-tag { font: 700 10px/1 var(--h-font); letter-spacing: .06em; padding: 4px 7px; border-radius: 999px; border: 1px solid var(--h-line); color: var(--h-muted); }
.tbh-none { margin: 22px 12px; color: var(--h-muted); font-size: 14.5px; text-align: center; }

/* ---- A verse ---- */
.tbh-verse blockquote { margin: 0 10px; padding: 2px 0 2px 14px; border-inline-start: 3px solid var(--h-ink); font: italic 500 18px/1.55 var(--font-accent, Fraunces, Georgia, serif); max-height: 34vh; overflow: auto; }
.tbh-verse sup { font: 600 10px/1 var(--font-body, Inter, sans-serif); font-style: normal; color: var(--h-muted); margin-inline-end: 3px; }
.tbh-ref { margin: 8px 10px 0; font: 600 12px/1.3 var(--h-font); letter-spacing: .06em; text-transform: uppercase; color: var(--h-muted); }
.tbh-uses { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 10px 6px; }
.tbh-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--h-line); background: var(--h-bg); font: 600 14px/1 var(--h-font); transition: background .14s, transform .12s; }
.tbh-btn:hover { background: var(--h-soft); }
.tbh-btn:active { transform: scale(.97); }
.tbh-btn.primary { background: var(--h-brand); border-color: var(--h-brand); color: var(--h-on-brand); }
.tbh-btn.primary:hover { filter: brightness(.94); background: var(--h-brand); }
.tbh-btn:disabled { opacity: .55; cursor: default; }
.tbh-btn svg, .tbh-btn i { width: 16px; height: 16px; }

/* ---- A helper task, the demo ---- */
.tbh-task { padding: 4px 6px 8px; }
.tbh-back { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px 0 6px; margin: 2px 4px 6px; border: 0; border-radius: 999px; background: transparent; color: var(--h-muted); font: 600 13px/1 var(--h-font); }
.tbh-back:hover { background: var(--h-soft); color: var(--h-ink); }
.tbh-task h2 { display: flex; align-items: center; gap: 10px; margin: 2px 10px 4px; font: 700 20px/1.25 var(--h-font); letter-spacing: -.02em; }
.tbh-muted { margin: 0 10px 12px; color: var(--h-muted); font-size: 14.5px; line-height: 1.5; }
.tbh-label { display: block; margin: 6px 10px; font: 600 13px/1.3 var(--h-font); }
.tbh-task textarea { display: block; width: calc(100% - 20px); margin: 0 10px; padding: 12px 14px; border: 1px solid var(--h-line); border-radius: 14px; background: var(--h-bg); color: var(--h-ink); font: 400 16px/1.5 var(--h-font); resize: vertical; min-height: 104px; }
.tbh-task textarea:focus { outline: 2px solid var(--h-brand); outline-offset: 1px; border-color: transparent; }
.tbh-draft { margin: 4px 10px 0; padding: 14px 16px 6px; border: 1px solid var(--h-line); border-radius: 16px; background: var(--h-soft); animation: tbh-rise .32s var(--h-ease) both; }
.tbh-draft pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 400 15px/1.6 var(--h-font); max-height: 38vh; overflow: auto; }
.tbh-ai-note { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; color: var(--h-muted); font-size: 12.5px; }
.tbh-ai-note svg, .tbh-ai-note i { width: 14px; height: 14px; }
.tbh-draft .tbh-uses { margin: 10px 0 8px; }
.tbh-err { margin: 10px; color: var(--h-danger); font-size: 14.5px; }
.tbh-wait { display: flex; align-items: center; gap: 6px; margin: 14px 12px; color: var(--h-muted); font-size: 14px; }
.tbh-wait span { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: tbh-dot 1s infinite ease-in-out; }
.tbh-wait span:nth-child(2) { animation-delay: .15s; } .tbh-wait span:nth-child(3) { animation-delay: .3s; }
.tbh-wait em { font-style: normal; margin-inline-start: 6px; }
.tbh-video { display: block; width: calc(100% - 20px); margin: 4px 10px 6px; aspect-ratio: 16 / 9; border-radius: 14px; background: #000; }
/* The demo film gets a wider panel on computers and tablets: it is a picture of the app, so size is clarity. */
.tbh[data-hub-view="demo"] .tbh-panel { width: min(1040px, 100%); max-height: min(92vh, 900px); transition: transform .26s cubic-bezier(.2, .9, .25, 1.12), opacity .18s var(--h-ease), width .28s var(--h-ease); }

.tbh-foot { display: flex; gap: 16px; padding: 9px 18px; border-top: 1px solid var(--h-line); color: var(--h-muted); font-size: 12px; }
.tbh-foot span { display: inline-flex; align-items: center; gap: 5px; }
.tbh-flash { position: absolute; left: 50%; bottom: 52px; transform: translate(-50%, 8px); padding: 9px 16px; border-radius: 999px; background: var(--h-ink); color: var(--h-bg); font: 600 13px/1 var(--h-font); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; }
.tbh-flash.on { opacity: 1; transform: translate(-50%, 0); }

/* Rows arrive one after another the first time the panel opens (a short, quiet cascade). */
.tbh.open .tbh-sec { animation: tbh-rise .34s var(--h-ease) both; }
.tbh.open .tbh-sec:nth-of-type(2) { animation-delay: .04s; } .tbh.open .tbh-sec:nth-of-type(3) { animation-delay: .08s; }
@keyframes tbh-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes tbh-dot { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }

/* ---- The one button in an app's bar ---- */
.tbh-door { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px 0 12px; border-radius: 999px; border: 1px solid var(--border, #e4e4e1); background: var(--bg-card, #fff); color: var(--text-secondary, #55585f); font: 500 14px/1 var(--font-body, Inter, system-ui, sans-serif); cursor: pointer; transition: background .14s, border-color .14s, color .14s; min-width: 0; }
.tbh-door:hover { background: var(--bg-hover, #ececea); color: var(--text, #111113); }
.tbh-door span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbh-door svg, .tbh-door i { width: 16px; height: 16px; flex: none; }
.tbh-door kbd { margin-inline-start: 6px; font: 600 11px/1 var(--font-mono, ui-monospace, Menlo, monospace); padding: 4px 6px; border-radius: 6px; background: var(--bg-subtle, #f4f4f2); border: 1px solid var(--border, #e4e4e1); color: var(--text-secondary, #55585f); white-space: nowrap; }
.tbh-door:focus-visible { outline: 2px solid var(--brand, #0369a1); outline-offset: 2px; }
.tbh-door.icon-only { width: 44px; height: 44px; padding: 0; justify-content: center; }
.tbh-door.icon-only span, .tbh-door.icon-only kbd { display: none; }

/* ---- Touch: bigger targets, no keyboard hints ---- */
@media (pointer: coarse) {
  .tbh-foot, .tbh-door kbd { display: none; }
  .tbh-row { min-height: 52px; }
  .tbh-btn { min-height: 44px; }
  .tbh-x { width: 44px; height: 44px; }
  .tbh-back { min-height: 44px; }
}

/* ---- Phones: a bottom sheet ---- */
@media (max-width: 640px) {
  .tbh { align-items: flex-end; padding: 0; }
  .tbh-panel { width: 100%; max-height: 88dvh; border-radius: 22px 22px 0 0; border-width: 1px 0 0; transform: translateY(100%); opacity: 1; transition: transform .32s cubic-bezier(.2, .9, .25, 1); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .tbh-grab { display: block; width: 40px; height: 4px; margin: 8px auto 0; border-radius: 4px; background: var(--h-line); }
  .tbh-apps { gap: 6px; }
  .tbh-app-ic { width: 56px; height: 56px; }
  .tbh-input { font-size: 16px; }
  .tbh-verse blockquote { font-size: 17px; }
  .tbh-flash { bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  .tbh, .tbh-panel, .tbh-app-ic, .tbh-flash { transition: none; }
  .tbh.open .tbh-sec, .tbh-draft { animation: none; }
}

/* ---- trubible.com's top bar (app.js renderNav): the door sits before the theme switch ---- */
.navbar .nav-door { width: 36px; height: 36px; flex: none; margin-inline-start: 4px; background: transparent; }
@media (max-width: 980px) {
  .navbar.nav-user .nav-door { margin-left: auto; }
  .navbar.nav-user .nav-door + .theme-btn { margin-left: 4px; }
}
@media (pointer: coarse) { .navbar .nav-door { width: 44px; height: 44px; } }
