/* BullsnBears companion shell — Desk · Study · Journal
   Tokens from the 11 Sep 2026 mobile guide. Reuses uf-design-tokens.css. */

:root {
  --app-desk: #E8B86D;
  --app-study: #7BA3C9;
  --app-journal: #8FBF9F;
  --app-bg: #0B0E14;
  --app-surface: #12161E;
  --app-surface-hi: #181D27;
  --app-border: rgba(255, 255, 255, 0.08);
  --app-text: #E8EAED;
  --app-muted: #9AA3AD;
  --app-faint: #6B7380;
  --app-tab-h: 60px;
  --app-back-h: 48px;
  --app-safe-b: env(safe-area-inset-bottom, 0px);
  --app-safe-t: env(safe-area-inset-top, 0px);
}

html.app-shell,
body.app-shell {
  margin: 0;
  min-height: 100%;
  background: var(--bnb-bg, var(--app-bg));
  color: var(--bnb-text, var(--app-text));
  font-family: var(--bnb-font-body, Inter, ui-sans-serif, system-ui, sans-serif);
}

html[data-uf-theme] {
  --app-bg: var(--bnb-bg);
  --app-surface: var(--bnb-surface);
  --app-surface-hi: var(--bnb-surface-hi);
  --app-border: var(--bnb-border);
  --app-text: var(--bnb-text);
  --app-muted: var(--bnb-text-muted);
  --app-faint: var(--bnb-text-faint);
}

.app-root {
  min-height: 100dvh;
  padding: calc(12px + var(--app-safe-t)) 16px calc(var(--app-tab-h) + var(--app-safe-b) + 16px);
  box-sizing: border-box;
}

.app-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.app-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--app-desk);
}

.app-title {
  margin: 2px 0 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.app-asof {
  font-size: 12px;
  color: var(--app-muted);
  text-align: right;
}

.app-lead {
  margin: 0 0 16px;
  color: var(--app-muted);
  font-size: 14px;
  line-height: 1.45;
}

.app-board {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-extras {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.app-extra {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--app-border);
  background: var(--app-surface);
  color: var(--app-muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app-section {
  margin-top: 16px;
}

.app-section:first-child {
  margin-top: 0;
}

.app-section-title {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--app-desk);
}

.app-section-note {
  margin: 4px 0 10px;
  font-size: 12px;
  color: var(--app-faint);
}

.app-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (min-width: 720px) {
  .app-cards { grid-template-columns: repeat(3, 1fr); }
}

.app-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--app-border);
  background: var(--app-surface);
  color: var(--app-text);
  text-decoration: none;
  box-sizing: border-box;
}

.app-card:active {
  background: var(--app-surface-hi);
}

.app-card-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.app-card-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--app-muted);
  line-height: 1.35;
}

.app-card.is-placeholder {
  border-style: dashed;
}

.app-panel {
  margin-top: 8px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--app-border);
  background: var(--app-surface);
}

.app-panel h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.app-panel p {
  margin: 0 0 12px;
  color: var(--app-muted);
  font-size: 14px;
  line-height: 1.45;
}

.app-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 8px;
  box-sizing: border-box;
  color: var(--app-desk);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

.app-card,
.app-panel,
.app-wx,
.app-analog-card,
.app-auth,
.app-seat,
.app-study-card,
.app-extra {
  background: var(--app-surface);
  color: var(--app-text);
  border-color: var(--app-border);
}

.app-backbar,
#app-backbar {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  min-height: calc(var(--app-back-h) + var(--app-safe-t));
  padding: var(--app-safe-t) 8px 0;
  box-sizing: border-box;
  background: color-mix(in srgb, var(--bnb-bg, #0B0E14) 88%, transparent);
  border-bottom: 1px solid var(--app-border);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  flex-shrink: 0;
}

.app-backbar[data-foyer="study"] .app-back { color: var(--app-study); }
.app-backbar[data-foyer="journal"] .app-back { color: var(--app-journal); }
.app-backbar[data-foyer="desk"] .app-back { color: var(--app-desk); }

/* Tool pages (Size / Hunt / File / Wave / Lab / Journal deep links). Foyer shells stay clean. */
html.app-back-host,
body.app-back-host {
  padding-top: calc(var(--app-back-h) + var(--app-safe-t));
}

/* Companion Back replaces the textbook STUDY hop on Command Center. */
html.app-back-host .uf-back-link {
  display: none;
}

html.uf-embedded .app-backbar,
html.uf-embedded #app-backbar {
  display: none !important;
}

.app-study-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-study-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--app-border);
  background: var(--app-surface);
  color: var(--app-text);
  text-decoration: none;
}

.app-study-card strong {
  display: block;
  font-size: 15px;
}

.app-study-card span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--app-muted);
}

.app-tabbar,
#app-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 120;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  height: calc(var(--app-tab-h) + var(--app-safe-b));
  padding: 0 8px var(--app-safe-b);
  box-sizing: border-box;
  background: color-mix(in srgb, var(--bnb-bg, #0B0E14) 88%, transparent);
  border-top: 1px solid var(--app-border);
  backdrop-filter: saturate(140%) blur(12px);
}

/* Distinct from chassis `.site-tab-bar` — uf-chassis.js / cc-mobile must not hide these. */
html.uf-embedded .app-tabbar,
html.uf-embedded #app-tabbar {
  display: flex !important;
  visibility: visible !important;
  z-index: 120;
}

/* PIN overlay owns the door. Rooms stay visible after one successful PIN. */
html.uf-lead-blocking .app-tabbar,
html.uf-lead-blocking #app-tabbar,
html.uf-lead-blocking .app-backbar,
html.uf-lead-blocking #app-backbar {
  visibility: hidden;
  pointer-events: none;
}

/* Distinct from chassis `.site-tab-bar` — uf-chassis.js must not see these. */
.app-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  min-width: 44px;
  padding: 6px 4px;
  border: 0;
  background: transparent;
  color: var(--app-faint);
  text-decoration: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.app-tab svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-tab[data-room="desk"].is-active { color: var(--app-desk); }
.app-tab[data-room="study"].is-active { color: var(--app-study); }
.app-tab[data-room="journal"].is-active { color: var(--app-journal); }

.app-note {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--app-faint);
}

@media (max-width: 390px) {
  .app-cards { gap: 8px; }
  .app-card { min-height: 68px; padding: 10px; }
}

html.app-tabs-host,
body.app-tabs-host {
  padding-bottom: calc(var(--app-tab-h) + var(--app-safe-b));
}

.app-wx {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--app-border);
  background: var(--app-surface-hi);
  color: var(--app-text);
  font-size: 13px;
  line-height: 1.4;
}

.app-analog-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.app-analog-card {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--app-border);
  background: var(--app-surface);
}

.app-stat {
  margin: 8px 0 6px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 390px) {
  .app-analog-row { grid-template-columns: 1fr; }
}

@media (hover: none) and (pointer: coarse) {
  .app-card,
  .app-tab,
  .app-back,
  .app-study-card,
  .app-auth-btn {
    min-height: 44px;
  }
}

.app-auth,
.app-seat {
  margin: 0 0 16px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--app-border);
  background: var(--app-surface);
}

.app-auth-label,
.app-seat-ack {
  display: block;
  margin: 8px 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--app-muted);
}

.app-auth-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--app-border);
  background: var(--app-surface-hi);
  color: var(--app-text);
  font: inherit;
}

.app-auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 14px;
  margin: 0 8px 8px 0;
  border: 0;
  border-radius: 8px;
  background: var(--app-journal);
  color: #0B0E14;
  font-weight: 800;
  cursor: pointer;
}

.app-auth-btn-ghost {
  background: transparent;
  color: var(--app-muted);
  border: 1px solid var(--app-border);
}

.app-auth-msg {
  min-height: 1.2em;
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--app-muted);
}

.app-auth-msg.is-err { color: #F26674; }
.app-auth-msg.is-ok { color: var(--app-journal); }

.app-auth-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--app-faint);
  line-height: 1.4;
}

.app-seat-copy {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--app-text);
}

.app-seat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.app-seat-row .app-auth-input {
  flex: 1 1 180px;
  margin: 0;
}

.app-seat-ack input {
  margin-right: 8px;
}
