/* ==========================================================================
   Brophy Family HQ · Flagship Mobile UI System
   Obsidian & Warm Brushed-Titanium Aesthetic · Box 0 Air-Gapped PWA
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg-deep: #080A0F;
  --bg-elevated: #0E121B;
  --surface-1: rgba(18, 23, 34, 0.84);
  --surface-2: rgba(25, 32, 46, 0.92);
  --surface-3: rgba(34, 43, 62, 0.95);
  --border-subtle: rgba(255, 255, 255, 0.075);
  --border-strong: rgba(214, 184, 124, 0.34);
  --border-cyan: rgba(56, 189, 248, 0.38);

  --text-primary: #F3F1EC;
  --text-secondary: #9CA5B8;
  --text-muted: #687389;

  --titanium: #D6B87C;
  --titanium-bright: #EFE0BE;
  --titanium-dim: rgba(214, 184, 124, 0.14);

  --cyan: #38BDF8;
  --cyan-bright: #7DD3FC;
  --cyan-dim: rgba(56, 189, 248, 0.14);

  --emerald: #34D399;
  --emerald-dim: rgba(52, 211, 153, 0.14);
  --amber: #FBBF24;
  --amber-dim: rgba(251, 191, 36, 0.14);
  --crimson: #F87171;
  --crimson-dim: rgba(248, 113, 113, 0.14);

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-height: 64px;
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body {
  background-image:
    radial-gradient(ellipse 80% 45% at 20% -5%, rgba(214, 184, 124, 0.085), transparent 65%),
    radial-gradient(ellipse 70% 40% at 85% 0%, rgba(56, 189, 248, 0.075), transparent 60%);
  background-attachment: fixed;
}

[hidden] {
  display: none !important;
}

button, input, textarea, select {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  user-select: none;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Prevent iOS WebKit auto-zoom on focus by keeping inputs >= 16px */
input, textarea {
  font-size: 16px;
}

/* ==========================================================================
   1. AUTH LOCK SCREEN
   ========================================================================== */

.auth-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) 20px calc(28px + var(--safe-bottom));
}

.auth-card {
  width: 100%;
  max-width: 410px;
  background: linear-gradient(180deg, rgba(22, 28, 41, 0.92) 0%, rgba(13, 17, 25, 0.96) 100%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow:
    0 28px 60px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  border-radius: 26px;
  padding: 32px 26px 28px;
  text-align: center;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.auth-crest-wrap {
  position: relative;
  width: 76px;
  height: 76px;
  margin: 0 auto 18px;
}

.auth-crest {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 26px rgba(56, 189, 248, 0.16);
}

.auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--titanium-dim);
  border: 1px solid rgba(214, 184, 124, 0.28);
  color: var(--titanium-bright);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.auth-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

.auth-spinner-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 14px 0 8px;
}

.orbital-spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid rgba(214, 184, 124, 0.18);
  border-top-color: var(--titanium);
  border-right-color: var(--cyan);
  animation: spin 0.85s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.auth-spinner-text {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.google-signin-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 15px 18px;
  border-radius: 14px;
  background: linear-gradient(180deg, #F8F7F4 0%, #E7E4DC 100%);
  color: #0B0E14;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 #FFFFFF;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}

.google-signin-btn:active {
  transform: scale(0.985);
}

.auth-trust-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.trust-pill {
  font-size: 11.5px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: 999px;
}

.auth-restricted-box {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.32);
  border-radius: 16px;
  padding: 16px;
  text-align: left;
  margin-bottom: 16px;
}

.auth-restricted-box h3 {
  font-size: 14px;
  font-weight: 700;
  color: #FCA5A5;
  margin-bottom: 6px;
}

.auth-restricted-box p {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.auth-error-banner {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--crimson-dim);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #FECACA;
  font-size: 12.5px;
  text-align: left;
}

/* ==========================================================================
   2. APP SHELL, SAFARI BANNER & TOP FROSTED HEADER
   ========================================================================== */

.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 780px;
  margin: 0 auto;
  position: relative;
}

.safari-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: calc(8px + var(--safe-top)) 14px 0;
  padding: 10px 13px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(214, 184, 124, 0.18), rgba(56, 189, 248, 0.12));
  border: 1px solid var(--border-strong);
  font-size: 12.5px;
}

.safari-banner a {
  color: var(--titanium-bright);
  font-weight: 700;
  text-decoration: none;
}

.safari-banner-close {
  color: var(--text-secondary);
  padding: 4px 6px;
  font-size: 14px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: rgba(8, 10, 15, 0.82);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.header-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.header-titles {
  min-width: 0;
}

.header-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.header-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.relay-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.relay-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.relay-pill.online {
  color: #6EE7B7;
}

.relay-pill.online .relay-dot {
  background: var(--emerald);
  box-shadow: 0 0 9px rgba(52, 211, 153, 0.75);
  animation: pulseDot 2.4s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.88); }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.wa-header-link {
  width: 35px;
  height: 35px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: #4ADE80;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.wa-header-link:hover {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.35);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 5px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
  font-weight: 700;
}

.user-avatar {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--titanium), #9A7B42);
  color: #090B10;
  font-size: 12px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.user-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 245px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(18, 23, 35, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.65);
  z-index: 60;
  display: grid;
  gap: 10px;
}

.popover-email {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-secondary);
  word-break: break-all;
}

.popover-tier {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--titanium-bright);
  background: var(--titanium-dim);
  padding: 3px 8px;
  border-radius: 6px;
  width: fit-content;
}

.signout-btn {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.28);
  color: #FCA5A5;
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
}

/* ==========================================================================
   3. TAB VIEWS & JARVIS CONVERSATION STUDIO
   ========================================================================== */

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 14px calc(var(--nav-height) + var(--safe-bottom) + 18px);
}

.tab-view {
  display: none;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.tab-view.active {
  display: flex;
}

/* Jarvis Studio Segmented Controls */
.studio-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-radius: 15px;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.seg-group {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(6, 8, 13, 0.65);
  padding: 3px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.045);
}

.seg-group.gears {
  flex: 1 1 230px;
}

.seg-group.voices {
  flex: 1 1 150px;
}

.seg-btn {
  flex: 1;
  padding: 7px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: center;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.seg-btn.active {
  background: linear-gradient(180deg, rgba(214, 184, 124, 0.24), rgba(214, 184, 124, 0.13));
  color: var(--titanium-bright);
  border: 1px solid rgba(214, 184, 124, 0.38);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}

.seg-group.voices .seg-btn.active {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.22), rgba(56, 189, 248, 0.11));
  color: var(--cyan-bright);
  border: 1px solid rgba(56, 189, 248, 0.38);
}

/* Conversation Thread */
.chat-feed {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 240px;
  padding-bottom: 6px;
}

.welcome-hero {
  background: linear-gradient(145deg, rgba(21, 27, 40, 0.88), rgba(13, 17, 26, 0.92));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: grid;
  gap: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.welcome-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.welcome-greeting {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.welcome-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.prompt-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.prompt-pill {
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.085);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 600;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.prompt-pill:active {
  transform: scale(0.97);
  border-color: var(--titanium);
  background: var(--titanium-dim);
}

/* Chat Bubbles */
.msg-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: fadeSlideUp 0.2s ease-out;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-row.user {
  align-items: flex-end;
}

.msg-row.jarvis {
  align-items: flex-start;
}

.msg-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  padding: 0 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.msg-bubble {
  max-width: 90%;
  padding: 12px 15px;
  border-radius: 17px;
  font-size: 14.25px;
  line-height: 1.55;
  word-wrap: break-word;
}

.msg-row.user .msg-bubble {
  background: linear-gradient(145deg, rgba(214, 184, 124, 0.22), rgba(168, 137, 79, 0.15));
  border: 1px solid rgba(214, 184, 124, 0.34);
  color: #FAF6EE;
  border-bottom-right-radius: 5px;
}

.msg-row.jarvis .msg-bubble {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-bottom-left-radius: 5px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.msg-body p + p {
  margin-top: 8px;
}

.msg-body ul {
  margin: 6px 0 6px 18px;
}

.msg-body li + li {
  margin-top: 4px;
}

.msg-body code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: rgba(0, 0, 0, 0.38);
  padding: 2px 5px;
  border-radius: 5px;
  color: var(--titanium-bright);
}

.thinking-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--cyan-bright);
  font-size: 13.5px;
  font-weight: 600;
}

.thinking-dots {
  display: inline-flex;
  gap: 4px;
}

.thinking-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  animation: dotBounce 1.2s infinite ease-in-out;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.16s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.32s; }

@keyframes dotBounce {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); }
}

/* Custom Inline Audio Player inside Jarvis Bubble */
.voice-player {
  margin-top: 11px;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(8, 10, 16, 0.65);
  border: 1px solid rgba(56, 189, 248, 0.24);
  display: flex;
  align-items: center;
  gap: 10px;
}

.vp-play-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), #0284C7);
  color: #06121D;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(56, 189, 248, 0.3);
}

.vp-bars {
  flex: 1;
  height: 24px;
  display: flex;
  align-items: center;
  gap: 2.5px;
  cursor: pointer;
}

.vp-bar {
  flex: 1;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
  transition: background 0.12s ease;
}

.vp-bar.played {
  background: var(--cyan-bright);
}

.vp-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.vp-speed-btn {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

/* ==========================================================================
   4. DOCKED VOICE STUDIO & COMPOSER
   ========================================================================== */

.composer-dock {
  position: sticky;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 8px);
  z-index: 30;
  margin-top: auto;
  background: rgba(14, 18, 28, 0.94);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 10px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.composer-idle {
  display: grid;
  gap: 8px;
}

.tap-speak-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(214, 184, 124, 0.14));
  border: 1px solid rgba(56, 189, 248, 0.42);
  color: var(--text-primary);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.1s ease, border-color 0.15s ease;
}

.tap-speak-btn:active {
  transform: scale(0.985);
}

.tap-speak-mic-ring {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.22);
  color: var(--cyan-bright);
  display: grid;
  place-items: center;
}

.composer-text-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.chat-input {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  padding: 10px 13px;
  border-radius: 13px;
  background: rgba(6, 8, 13, 0.72);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  resize: none;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.15s ease;
}

.chat-input:focus {
  border-color: rgba(214, 184, 124, 0.45);
}

.send-text-btn {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--titanium-bright), var(--titanium));
  color: #090B10;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(214, 184, 124, 0.28);
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.send-text-btn:active:not(:disabled) {
  transform: scale(0.95);
}

/* Active 24-Bar Live Voice Studio */
.voice-studio {
  display: grid;
  gap: 11px;
  padding: 4px 2px 2px;
}

.vs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px;
}

.vs-status-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

.vs-rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--crimson);
  box-shadow: 0 0 10px rgba(248, 113, 113, 0.85);
  animation: pulseDot 1.1s ease-in-out infinite;
}

.vs-status-wrap.hearing {
  color: #6EE7B7;
}

.vs-status-wrap.hearing .vs-rec-dot {
  background: var(--emerald);
  box-shadow: 0 0 12px rgba(52, 211, 153, 0.9);
}

.vs-timer {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--titanium-bright);
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 9px;
  border-radius: 8px;
}

.waveform-stage {
  height: 58px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(5, 7, 12, 0.82);
  border: 1px solid rgba(56, 189, 248, 0.22);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.wf-bar {
  flex: 1;
  height: 14%;
  min-height: 5px;
  max-height: 100%;
  border-radius: 99px;
  background: linear-gradient(180deg, var(--cyan-bright), var(--titanium));
  opacity: 0.45;
  transition: height 0.055s ease-out, opacity 0.08s ease-out;
}

.vs-preview {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 0 4px;
  min-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vs-actions {
  display: grid;
  grid-template-columns: 1fr 1.45fr;
  gap: 9px;
}

.vs-cancel-btn {
  padding: 14px 12px;
  border-radius: 13px;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: #FCA5A5;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.vs-send-btn {
  padding: 14px 14px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--titanium-bright), var(--titanium));
  color: #090B10;
  font-size: 14.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 6px 20px rgba(214, 184, 124, 0.3);
}

/* ==========================================================================
   5. CARDS, HOME INTERCOM, VAULT PINS & SYSTEMS
   ========================================================================== */

.glass-card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: grid;
  gap: 13px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--text-primary);
}

.card-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--titanium-dim);
  color: var(--titanium-bright);
  border: 1px solid rgba(214, 184, 124, 0.25);
}

.card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: -6px;
}

/* Room Intercom Grid */
.room-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}

.room-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 12px 13px;
  border-radius: 14px;
  background: rgba(11, 15, 23, 0.72);
  border: 1px solid var(--border-subtle);
  text-align: left;
  transition: all 0.15s ease;
}

.room-card.wide {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.room-card.selected {
  background: linear-gradient(145deg, rgba(214, 184, 124, 0.18), rgba(214, 184, 124, 0.07));
  border-color: var(--titanium);
  box-shadow: 0 4px 16px rgba(214, 184, 124, 0.15);
}

.room-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.room-card.selected .room-name {
  color: var(--titanium-bright);
}

.room-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

.intercom-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 13px;
  background: rgba(6, 8, 13, 0.75);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  outline: none;
}

.intercom-input:focus {
  border-color: var(--titanium);
}

.primary-gold-btn {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--titanium-bright), var(--titanium));
  color: #090B10;
  font-size: 14.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(214, 184, 124, 0.25);
  transition: transform 0.1s ease;
}

.primary-gold-btn:active:not(:disabled) {
  transform: scale(0.985);
}

.secondary-outline-btn {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
}

.live-telemetry-box {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(6, 8, 13, 0.72);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 9px;
}

.live-telemetry-box.success {
  border-color: rgba(52, 211, 153, 0.35);
  color: #A7F3D0;
}

/* Vault Security PIN Cards */
.pin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.pin-card {
  padding: 14px;
  border-radius: 15px;
  background: linear-gradient(155deg, rgba(24, 31, 45, 0.92), rgba(11, 14, 22, 0.96));
  border: 1px solid rgba(214, 184, 124, 0.24);
  display: grid;
  gap: 10px;
}

.pin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pin-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--titanium-bright);
}

.pin-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

.pin-display-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  background: rgba(5, 7, 11, 0.85);
  border: 1px solid var(--border-subtle);
}

.pin-digits {
  font-family: var(--font-mono);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--text-primary);
}

.pin-digits.revealed {
  color: var(--emerald);
}

.pin-btns {
  display: flex;
  gap: 6px;
}

.mini-btn {
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.mini-btn:active {
  background: var(--titanium-dim);
  border-color: var(--titanium);
}

/* Vault & Systems Launch Cards */
.launch-list {
  display: grid;
  gap: 8px;
}

.launch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 14px;
  background: rgba(11, 15, 23, 0.72);
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.launch-item:active {
  transform: scale(0.99);
  border-color: var(--titanium);
}

.launch-info {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.launch-title {
  font-size: 13.75px;
  font-weight: 700;
  color: var(--text-primary);
}

.launch-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.launch-arrow {
  color: var(--titanium);
  font-size: 15px;
  flex-shrink: 0;
}

.silo-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--emerald-dim);
  color: #6EE7B7;
  border: 1px solid rgba(52, 211, 153, 0.28);
  flex-shrink: 0;
}

/* Clinical / DNS Key-Value Rows */
.kv-stack {
  display: grid;
  gap: 7px;
}

.kv-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(6, 8, 13, 0.72);
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
}

.kv-line code {
  font-family: var(--font-mono);
  color: var(--titanium-bright);
  font-weight: 600;
}

.clinical-notes {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.55;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 11px;
  background: rgba(6, 8, 13, 0.55);
  border: 1px solid var(--border-subtle);
}

.safety-pill {
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.28);
  color: #FCA5A5;
  font-size: 12px;
  font-weight: 600;
}

details.dns-drawer {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}

details.dns-drawer summary {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

details.dns-drawer summary::-webkit-details-marker {
  display: none;
}

details.dns-drawer[open] summary {
  color: var(--titanium-bright);
  margin-bottom: 12px;
}

/* ==========================================================================
   6. NATIVE FROSTED BOTTOM TAB BAR & TOAST
   ========================================================================== */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: rgba(9, 12, 18, 0.88);
  backdrop-filter: blur(26px) saturate(190%);
  -webkit-backdrop-filter: blur(26px) saturate(190%);
  border-top: 1px solid rgba(255, 255, 255, 0.085);
  padding: 6px 12px calc(6px + var(--safe-bottom));
}

.bottom-nav-inner {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 6px;
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  transition: color 0.16s ease, background 0.16s ease;
}

.nav-tab svg {
  width: 21px;
  height: 21px;
  stroke-width: 1.9;
}

.nav-tab.active {
  color: var(--titanium-bright);
  background: rgba(214, 184, 124, 0.1);
}

.app-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 18px);
  transform: translateX(-50%);
  z-index: 80;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(20, 26, 39, 0.96);
  border: 1px solid var(--border-strong);
  color: var(--titanium-bright);
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

@media (max-width: 420px) {
  .seg-group.gears, .seg-group.voices {
    flex: 1 1 100%;
  }
  .msg-bubble {
    max-width: 94%;
  }
}
