@font-face { font-family: 'Campione Neue Sans'; font-weight: 900; font-style: normal; font-display: swap; src: url('/fonts/CampioneNeueSans-Black.ttf') format('truetype'); }
@font-face { font-family: 'Campione Neue Sans'; font-weight: 500; font-style: normal; font-display: swap; src: url('/fonts/CampioneNeueSans-Medium.otf') format('opentype'); }
@font-face { font-family: 'Campione Neue Sans'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/CampioneNeueSans-Regular.otf') format('opentype'); }
/* === Brand type: Choplin (Rene Bieder) — the TEXT voice paired under Campione === */
@font-face { font-family: 'Choplin'; font-weight: 600; font-style: normal; font-display: swap; src: url('/fonts/rene-bieder-choplin-semibold.otf') format('opentype'); }
@font-face { font-family: 'Choplin'; font-weight: 500; font-style: normal; font-display: swap; src: url('/fonts/rene-bieder-choplin-medium.otf') format('opentype'); }
@font-face { font-family: 'Choplin'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/rene-bieder-choplin-book.otf') format('opentype'); }
/* === Brand type: DM Mono — the TELEMETRY voice (paths, times, counts). Self-hosted
   under the SIL OFL (see /fonts/DMMono-OFL.txt); sourced from google/fonts
   ofl/dmmono @ bfb7c046, converted TTF→woff2 with fontTools 4.61.1. === */
@font-face { font-family: 'DM Mono'; font-weight: 500; font-style: normal; font-display: swap; src: url('/fonts/DMMono-Medium.woff2') format('woff2'); }
@font-face { font-family: 'DM Mono'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/DMMono-Regular.woff2') format('woff2'); }
/* === CSS Variables === */
:root {
  --bg-primary: #2e1a1a;
  --bg-secondary: #3e1616;
  --accent-red: #ff6b6b;
  --accent-yellow: #feca57;
  --text-primary: #ffffff;
  --text-secondary: #ccc;
  --text-muted: #bbb;
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-hover: rgba(255, 255, 255, 0.15);
  --nav-height: 56px;
  /* Measured by syncNavHeight(): how far the layout viewport stops short of
     the true screen (100vh - innerHeight). 0 everywhere except the mis-sized
     iOS standalone webview (62px on Jase's phone), where the band below
     innerHeight is unpaintable letterbox and env(safe-area-inset-bottom)
     describes an indicator that lies OUTSIDE the webview. */
  --viewport-bottom-gap: 0px;
  --header-height: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* Fleet design-system tokens — SHARED source (the FLEET board and the
     Scoreboard both consume these; do not fork per-view). Status color language:
     green on-target, amber needs-attention, cool gray quiet, red dead. */
  --fleet-working: #2ed573;
  --fleet-your-move: #feca57;
  --fleet-waiting: #8f8a93;
  --fleet-resting: #6e6a74;
  --fleet-dead: #ff6b6b;
  --fleet-none: rgba(255,255,255,0.16);
  --fleet-hair: rgba(255,255,255,0.08);
  /* shared panel surfaces — single source; .sb-wrap/--sb-* and .dm-sidebar/--pw-*
     alias onto these (tokens PR 2026-07-11, value-preserving promotion) */
  --fleet-panel: rgba(255,255,255,0.05);
  --fleet-panel-2: rgba(255,255,255,0.015);
  --fleet-ink: 'Campione Neue Sans', 'Helvetica Neue', Arial, sans-serif;
  --fleet-text: 'Choplin', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  /* telemetry voice — DM Mono (self-hosted, OFL) with the system mono stack it
     replaces as fallback; every var(--fleet-mono, ...) consumer upgrades here */
  --fleet-mono: 'DM Mono', 'SF Mono', 'Menlo', ui-monospace, monospace;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #140a0a;
  color: var(--text-primary);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* === Login Screen === */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 300;
  background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
}

.login-screen.hidden { display: none; }

.login-card {
  text-align: center;
  width: 100%;
  max-width: 320px;
}

.login-logo {
  height: 60px;
  width: auto;
  margin-bottom: 16px;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
  background: linear-gradient(45deg, var(--accent-red), var(--accent-yellow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.login-screen input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: 'SF Mono', 'Menlo', monospace;
  margin-bottom: 12px;
  outline: none;
  text-align: center;
  letter-spacing: 2px;
}

.login-screen input:focus {
  border-color: var(--accent-red);
}

.login-btn {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
}

.login-error {
  margin-top: 12px;
  font-size: 0.8rem;
  color: #ff4757;
}

/* === Header === */
.app-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  padding-top: calc(var(--safe-top) + 8px);
  height: calc(var(--header-height) + var(--safe-top));
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--glass-border);
  z-index: 100;
  position: relative;
}

.header-logo { height: 28px; width: auto; }

.app-header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(45deg, var(--accent-red), var(--accent-yellow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === Main Content === */
main {
  flex: 1;
  overflow: hidden;
  transition: margin-right 0.25s ease;
  background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
}

.view { display: none; height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.view.active { display: flex; flex-direction: column; }
.view-header { display: flex; justify-content: space-between; align-items: center; padding: 16px; flex-shrink: 0; }
.view-header h2 { font-size: 1.3rem; font-weight: 700; }

/* === Terminal View === */
#view-terminal { overflow: hidden; }
.tmux-tabs { display: flex; gap: 2px; padding: 4px 8px; background: rgba(0, 0, 0, 0.3); overflow-x: auto; flex-shrink: 0; scrollbar-width: none; }
.tmux-tabs::-webkit-scrollbar { display: none; }
.tmux-tab { padding: 6px 14px; min-height: 36px; border-radius: 6px; font-size: 0.8rem; font-weight: 500; white-space: nowrap; background: var(--glass-bg); border: 1px solid transparent; color: var(--text-muted); cursor: pointer; transition: all 0.15s; flex-shrink: 0; }
.tmux-tab.active { background: rgba(255, 107, 107, 0.2); border-color: rgba(255, 107, 107, 0.3); color: var(--accent-red); }
.tmux-tab:active { transform: scale(0.95); }
.tmux-tab-add { background: rgba(46, 213, 115, 0.2); color: #2ed573; border-color: rgba(46, 213, 115, 0.3); font-size: 1rem; font-weight: 700; padding: 6px 12px; }
.tmux-tab-clear { background: rgba(254, 202, 87, 0.18); color: #feca57; border-color: rgba(254, 202, 87, 0.35); font-size: 0.75rem; font-weight: 600; padding: 6px 12px; }
.tmux-tab-clear:hover { background: rgba(254, 202, 87, 0.3); }
.tmux-tab-bar { display: inline-block; margin-left: 8px; padding: 1px 6px; border-radius: 4px; font-size: 0.65rem; font-weight: 700; vertical-align: middle; border: 1px solid rgba(255,255,255,0.1); }
.tmux-tab-bar-ok { background: rgba(46, 213, 115, 0.2); border-color: rgba(46, 213, 115, 0.3); color: #2ed573; }
.tmux-tab-bar-warn { background: rgba(254, 202, 87, 0.3); border-color: rgba(254, 202, 87, 0.5); color: #feca57; }
.tmux-tab-bar-critical { background: rgba(255, 107, 107, 0.35); border-color: rgba(255, 107, 107, 0.6); color: #ff6b6b; }
/* Pane traffic lights (Comms pilot) — small vertical 3-lamp light beside the
   token badge. Palette: green working · solid amber mid-thread · pulsing amber
   your-move · deep amber done/resting · red dead · all-dim unknown. */
.pane-light { display: inline-flex; flex-direction: column; gap: 1px; margin-left: 6px; padding: 2px; border-radius: 3px; background: rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.12); vertical-align: middle; }
.pane-lamp { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,0.12); }
.pane-light-working .pane-lamp-g { background: #2ed573; box-shadow: 0 0 4px rgba(46, 213, 115, 0.8); }
.pane-light-waiting .pane-lamp-a { background: #feca57; box-shadow: 0 0 3px rgba(254, 202, 87, 0.6); }
.pane-light-your-move .pane-lamp-a { background: #feca57; box-shadow: 0 0 5px rgba(254, 202, 87, 0.9); animation: pane-lamp-pulse 1.2s ease-in-out infinite; }
.pane-light-resting .pane-lamp-a { background: #b8860b; box-shadow: 0 0 2px rgba(184, 134, 11, 0.5); }
.pane-light-dead .pane-lamp-r { background: #ff6b6b; box-shadow: 0 0 4px rgba(255, 107, 107, 0.8); }
/* unknown: no lamp lit — all stay dim; the light frame itself signals "probed, no answer" */
@keyframes pane-lamp-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
/* Human-presence lamp (Comms pilot) — beside the room name in the DM header.
   Lit = typing-now, dim = recently-active, invisible otherwise. */
.presence-lamp { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 8px; vertical-align: middle; background: transparent; transition: background 0.3s, box-shadow 0.3s; }
.presence-lamp-on { background: #2ed573; box-shadow: 0 0 6px rgba(46, 213, 115, 0.8); }
.presence-lamp-dim { background: rgba(46, 213, 115, 0.35); box-shadow: none; }
/* Tab context menu */
.tab-context-menu { position: fixed; z-index: 9999; background: var(--glass-bg, rgba(30, 30, 50, 0.95)); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 8px; padding: 4px; min-width: 160px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5); }
.tab-menu-item { display: block; width: 100%; padding: 10px 14px; border: none; background: none; color: var(--text-primary, #e0e0e0); font-size: 0.85rem; font-weight: 500; text-align: left; cursor: pointer; border-radius: 6px; transition: background 0.1s; }
.tab-menu-item:hover { background: rgba(255, 255, 255, 0.1); }
.tab-menu-item:disabled { opacity: 0.35; cursor: not-allowed; }
.tab-menu-item:disabled:hover { background: none; }
.tab-menu-item.tab-menu-danger { color: var(--accent-red, #ff6b6b); }
.tab-menu-item.tab-menu-danger:hover:not(:disabled) { background: rgba(255, 107, 107, 0.15); }

/* Message ⋯ menu — Preview / Open / Forward (attachments) + Delete (admin). */
.tab-menu-sep { height: 1px; background: rgba(255, 255, 255, 0.1); margin: 4px 6px; }
/* Forward destination list (second level of the attachment menu). */
.dm-forward-head { display: flex; align-items: center; gap: 4px; padding: 4px 8px 6px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.dm-forward-back { background: none; border: none; color: var(--text-secondary); font-size: 1.15rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.dm-forward-list { max-height: 240px; overflow-y: auto; }
.dm-forward-row { display: flex; align-items: center; gap: 6px; }
.dm-forward-icon { display: inline-block; width: 1em; text-align: center; color: var(--text-muted); flex-shrink: 0; }
.dm-forward-empty { padding: 8px 14px; font-size: 0.8rem; color: var(--text-muted); }
#terminal-container { flex: 1; padding: 2px; overflow: hidden; position: relative; transition: border-color 0.15s; border: 2px solid transparent; border-radius: 4px; }
#terminal-container.drop-active { border-color: var(--accent-yellow, #feca57); background: rgba(254, 202, 87, 0.05); }
#terminal-container .xterm { height: 100%; }
/* === Special Keys Toolbar === */
.special-keys { display: flex; gap: 4px; padding: 4px 8px; background: rgba(0, 0, 0, 0.5); overflow-x: auto; flex-shrink: 0; scrollbar-width: none; }
.special-keys::-webkit-scrollbar { display: none; }
.skey { padding: 6px 12px; min-width: 40px; min-height: 32px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; font-family: 'SF Mono', 'Menlo', monospace; white-space: nowrap; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.15); color: var(--text-secondary); cursor: pointer; flex-shrink: 0; transition: all 0.1s; -webkit-user-select: none; user-select: none; }
.skey:active { transform: scale(0.92); background: rgba(255, 255, 255, 0.2); }
.skey-toggle.active { background: rgba(255, 107, 107, 0.3); border-color: rgba(255, 107, 107, 0.5); color: var(--accent-red); }

/* === Chat Bar === */
.chat-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.45);
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.chat-bar textarea {
  flex: 1;
  padding: 8px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 100px;
  line-height: 1.4;
  transition: border-color 0.15s;
}
.chat-bar textarea:focus { border-color: rgba(255, 255, 255, 0.3); }
.chat-bar textarea::placeholder { color: rgba(255, 255, 255, 0.35); }
.chat-bar textarea.chat-bar-error { border-color: var(--accent-red); }
.chat-bar textarea.chat-bar-error::placeholder { color: var(--accent-red); }
.chat-bar-send, .chat-bar-mic {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 50%;
  transition: color 0.15s, background 0.15s;
}
.chat-bar-send:hover, .chat-bar-mic:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.08); }
.chat-bar-send:active, .chat-bar-mic:active { opacity: 0.6; }
.chat-bar-mic.recording { color: var(--accent-red); animation: mic-pulse 1s ease-in-out infinite; }
.chat-bar-mic.transcribing { color: var(--accent-yellow); }
.chat-bar-mic-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: var(--accent-yellow);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.terminal-status { display: flex; align-items: center; gap: 8px; padding: 2px 12px; background: rgba(0, 0, 0, 0.4); font-size: 0.7rem; color: var(--text-muted); flex-shrink: 0; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #ff4757; }
.status-dot.connected { background: #2ed573; }

/* === Cards === */
.card-list { display: flex; flex-direction: column; gap: 10px; padding: 0 16px 16px; overflow-y: auto; }
.card { background: var(--glass-bg); backdrop-filter: blur(10px); border-radius: 12px; padding: 16px; border: 1px solid var(--glass-border); transition: all 0.2s; }
.card:active { transform: scale(0.98); background: var(--glass-hover); }
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.card-subtitle { font-size: 0.8rem; color: var(--text-muted); }

/* === Session Cards === */
.session-card { display: flex; flex-direction: column; gap: 12px; cursor: pointer; }
.session-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.session-name { font-size: 1.05rem; font-weight: 700; word-break: break-all; line-height: 1.3; }
.session-badges { display: flex; flex-wrap: wrap; gap: 5px; flex-shrink: 0; }
.badge { font-size: 0.65rem; padding: 3px 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.badge.attached { background: rgba(46, 213, 115, 0.15); color: #2ed573; }
.badge.protected { background: rgba(255, 202, 87, 0.15); color: var(--accent-yellow); }
.session-actions { display: flex; gap: 8px; }
.session-btn { flex: 1; padding: 8px 0; border-radius: 8px; font-size: 0.8rem; font-weight: 600; font-family: inherit; cursor: pointer; text-align: center; border: none; min-height: 36px; }
.session-btn-connect { background: rgba(46, 213, 115, 0.15); color: #2ed573; }
.session-btn-connect:active { background: rgba(46, 213, 115, 0.3); }
.session-btn-restart { background: rgba(255, 202, 87, 0.15); color: var(--accent-yellow); }
.session-btn-restart:active { background: rgba(255, 202, 87, 0.3); }
.session-btn-kill { background: rgba(255, 71, 87, 0.15); color: #ff4757; }
.session-btn-kill:active { background: rgba(255, 71, 87, 0.3); }

/* === Actions Grid === */
.actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px 16px; }
.action-btn { background: var(--glass-bg); backdrop-filter: blur(10px); border: 1px solid var(--glass-border); border-radius: 12px; padding: 20px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; transition: all 0.2s; color: var(--text-primary); font-family: inherit; }
.action-btn:active { transform: scale(0.95); background: var(--glass-hover); }
.action-icon { font-size: 1.8rem; }
.action-label { font-size: 0.8rem; font-weight: 500; }

/* === Action Output === */
.action-output { margin: 0 16px 16px; background: rgba(0, 0, 0, 0.6); border-radius: 12px; border: 1px solid var(--glass-border); overflow: hidden; }
.action-output.hidden { display: none; }
.action-output-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: rgba(0, 0, 0, 0.3); font-size: 0.8rem; font-weight: 600; }
.action-output pre { padding: 12px 14px; font-size: 0.75rem; font-family: 'SF Mono', 'Menlo', monospace; color: var(--text-secondary); white-space: pre-wrap; word-break: break-all; max-height: 300px; overflow-y: auto; -webkit-user-select: text; user-select: text; }

/* === System Dashboard === */
.stat-card { display: flex; flex-direction: column; gap: 8px; }
.stat-header { display: flex; justify-content: space-between; align-items: baseline; }
.stat-label { font-size: 0.85rem; color: var(--text-muted); }
.stat-value { font-size: 1.2rem; font-weight: 700; }
.stat-bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent-red), var(--accent-yellow)); transition: width 0.5s ease; }
.stat-detail { font-size: 0.75rem; color: var(--text-muted); }
.stat-na { color: var(--text-muted); opacity: 0.6; }

/* Threshold coloring. Reuses the health-dot palette (green #4caf50 /
   yellow #ffb84d / red #ff5b6e) for one visual system, applied to both
   .stat-value and .stat-bar-fill. TWO classes (see dashboard.js render):
   - WATCHER-MATCHED (red ≈ a page): pressure free% <15, swap >=85, sessions >cap.
   - UI USAGE CAUTION (NOT a watcher line): RAM used >90 — stricter than the
     watcher's <500MB (~98%) backstop; red here is a heads-up, not page-imminent. */
.stat-value.sev-green  { color: #4caf50; }
.stat-value.sev-yellow { color: #ffb84d; }
.stat-value.sev-red    { color: #ff5b6e; }
.stat-bar-fill.sev-green  { background: #4caf50; }
.stat-bar-fill.sev-yellow { background: #ffb84d; }
.stat-bar-fill.sev-red    { background: #ff5b6e; }

/* === System Health Card (Module 7 #5) === */
.health-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.health-title { font-size: 1rem; font-weight: 600; }
.health-meta { margin-left: auto; font-size: 0.7rem; color: var(--text-muted); }
.health-rows { display: flex; flex-direction: column; gap: 4px; }
.health-row { border-radius: 8px; }
.health-row-head { display: flex; align-items: center; gap: 8px; padding: 6px 4px; cursor: pointer; min-height: 32px; }
.health-row.open .health-row-head { background: rgba(255, 255, 255, 0.04); }
.health-name { font-size: 0.85rem; font-weight: 500; min-width: 70px; }
.health-summary { font-size: 0.75rem; color: var(--text-muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health-caret { font-size: 0.7rem; color: var(--text-muted); }
.health-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.health-green { background: #4caf50; box-shadow: 0 0 6px rgba(76, 175, 80, 0.4); }
.health-yellow { background: #ffb84d; box-shadow: 0 0 6px rgba(255, 184, 77, 0.4); }
.health-red { background: #ff5b6e; box-shadow: 0 0 6px rgba(255, 91, 110, 0.5); }
.health-unknown { background: #555; }
.health-signals { padding: 6px 4px 8px 22px; display: flex; flex-direction: column; gap: 4px; }
.health-signals.empty { color: var(--text-muted); font-size: 0.75rem; }
.health-signal { display: flex; gap: 8px; font-size: 0.72rem; line-height: 1.4; }
.health-signal-time { color: var(--text-muted); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.health-signal-summary { color: #ddd; }
.health-signal.sev-red .health-signal-summary { color: #ffb1b8; }
.health-signal.sev-yellow .health-signal-summary { color: #ffd9a3; }
.health-error { font-size: 0.75rem; color: #ff5b6e; margin-top: 8px; }

/* === Buttons === */
.btn-accent { background: linear-gradient(135deg, var(--accent-red), var(--accent-yellow)); border: none; color: #fff; font-weight: 600; padding: 8px 16px; border-radius: 8px; font-size: 0.85rem; cursor: pointer; font-family: inherit; }
.btn-accent:active { opacity: 0.8; }
.btn-icon { position: relative; background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; padding: 10px; min-height: 44px; min-width: 44px; }

/* === Bottom Navigation === */
/* padding-bottom: only the part of the home-indicator inset that actually
   falls INSIDE the webview. When the webview stops short of the screen
   (--viewport-bottom-gap > 0, the mis-sized iOS standalone case) the
   indicator sits in the letterbox below the paintable area and the env()
   value is bogus — the max() collapses the padding to its base 6px instead
   of wasting a 34px band above the letterbox. Gap 0 → unchanged. */
.bottom-nav { display: flex; justify-content: space-around; align-items: center; padding: 6px 0; padding-bottom: max(6px, calc(env(safe-area-inset-bottom, 0px) + 6px - var(--viewport-bottom-gap))); background: #0a0a14; border-top: 1px solid var(--glass-border); position: relative; z-index: 100; flex-shrink: 0; }
.nav-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: none; color: var(--text-muted); font-size: 0.6rem; cursor: pointer; padding: 4px 10px; min-height: 44px; min-width: 44px; transition: color 0.15s; font-family: inherit; }
.nav-btn.active { color: var(--accent-red); }
.nav-btn svg { width: 26px; height: 26px; }

/* === Modal === */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px; }
.modal { background: var(--bg-secondary); border-radius: 16px; padding: 24px; width: 100%; max-width: 340px; border: 1px solid var(--glass-border); }
.modal h3 { font-size: 1.1rem; margin-bottom: 16px; }
.modal input { width: 100%; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--glass-border); background: var(--glass-bg); color: var(--text-primary); font-size: 1rem; font-family: inherit; margin-bottom: 16px; outline: none; }
.modal input:focus { border-color: var(--accent-red); }
.modal-buttons { display: flex; gap: 10px; justify-content: flex-end; }
.btn-cancel { background: var(--glass-bg); border: 1px solid var(--glass-border); color: var(--text-secondary); padding: 8px 16px; border-radius: 8px; font-size: 0.85rem; cursor: pointer; font-family: inherit; }

/* === Utilities === */
.hidden { display: none !important; }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

/* === Terminal touch handling === */
#terminal-container .xterm {
  -webkit-user-select: text;
  user-select: text;
}
#terminal-container .xterm-screen {
  touch-action: none;
}

/* === App container === */
/* Anchored to the layout viewport (no explicit height) ON PURPOSE — final
   state of the round-2/3/4 saga. On the mis-sized iOS standalone webview the
   layout viewport (innerHeight, 812pt on an 874pt screen) IS the entire
   paintable surface: #484 sized this 100vh (874) on the theory that vh
   reaches the true screen, but the screenshots showed paint hard-stops at
   812 — the vh overhang just pushed the nav's label row below the paint edge
   (labels vanished), and the bottom 62pt stayed black letterbox no CSS can
   touch. So: fill the box we can paint (top:0 + bottom:0), and let
   --viewport-bottom-gap (measured 100vh - innerHeight) neutralize the bogus
   env(safe-area-inset-bottom) that describes an indicator outside the
   webview. Evidence: IMG_1244 vs IMG_1246/1247 readouts, Jase's iPhone,
   2026-07-28 (tasks e7740aa8 → cfb71950). */
#app-container { display: flex; flex-direction: column; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: #0a0a14; }
#app-container.hidden { display: none !important; }

