:root {
  /* ── CYPH.27 AAA APPLE TOKENS (2026-08-20) ── */
  --bg: #020406;
  --surface: #0A0F18;
  --surface2: #121C2A;
  --surface3: #1E2E42;
  --surface-vibrancy: rgba(10, 16, 26, 0.84);
  --surface-vibrancy-strong: rgba(14, 22, 36, 0.96);
  --border: 1px solid rgba(255, 255, 255, 0.07);
  --border-strong: 1px solid rgba(255, 255, 255, 0.11);
  --border-cyan: rgba(10, 207, 255, 0.22);
  --border-violet: rgba(154, 92, 255, 0.28);
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.11);
  --text: #F5F3F7;
  --text2: rgba(245, 243, 247, 0.68);
  --text3: rgba(245, 243, 247, 0.38);
  --muted: rgba(245, 243, 247, 0.44);
  --green: #30D158;
  --green-hover: #40E068;
  --yellow: #FFD60A;
  --amber: #FF9F0A;
  --grey: #8E8E93;
  --blue: #0A84FF;
  --purple: #9A5CFF;
  --violet: #9A5CFF;
  --violet-hover: #B07AFF;
  --cyan: #0ACFFF;
  --cyan-hover: #33DAFF;
  --red: #FF453A;
  --r: 12px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 22px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --glow-cyan: rgba(10, 207, 255, 0.09);
  --glow-violet: rgba(154, 92, 255, 0.10);
  --purple-glow: rgba(154, 92, 255, 0.14);
  --green-glow: rgba(48, 209, 88, 0.14);
  --mono: 'SF Mono','Space Mono',ui-monospace,SFMono-Regular,Menlo,monospace;
  --display: 'SF Pro Display','Syne',system-ui,-apple-system,sans-serif;
  --font: 'SF Pro Text','Syne',system-ui,-apple-system,sans-serif;
  --font-text: 'SF Pro Text',system-ui,-apple-system,sans-serif;
  --font-mono: 'SF Mono','Space Mono',ui-monospace,monospace;
  --ease: cubic-bezier(0.2,0,0,1);
  --spring: cubic-bezier(0.16,1,0.3,1);
  --transition: border-color 180ms var(--ease), background 180ms var(--ease), color 180ms var(--ease), opacity 180ms var(--ease), transform 280ms var(--spring), box-shadow 280ms var(--ease);
  --secure-ease: cubic-bezier(0.16,1,0.3,1);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.32), 0 8px 24px rgba(0,0,0,0.30);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.42), 0 1px 0 rgba(255,255,255,0.06) inset;
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.52), 0 1px 0 rgba(255,255,255,0.06) inset;
  --secure-surface: var(--surface-vibrancy);
  --secure-surface-strong: var(--surface-vibrancy-strong);
  --secure-line: var(--line);
  --secure-line-bright: var(--line-strong);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color-scheme: dark;
  scrollbar-gutter: stable;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'ss01' 1, 'case' 1;
  letter-spacing: -0.011em;
  font-synthesis: none;
}

a { color: var(--cyan); text-decoration: none; transition: color 180ms var(--ease); }
a:hover { color: var(--cyan-hover); }
a:focus-visible { outline: 2px solid rgba(10,207,255,0.72); outline-offset: 2px; border-radius: 4px; }

/* ── AAA Scrollbars ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.14);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.14) transparent; }

/* ── Auth — AAA Apple Glass ── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background:
    radial-gradient(ellipse 68% 42% at 50% -6%, rgba(10,207,255,0.08), transparent 62%),
    radial-gradient(ellipse 44% 32% at 92% 18%, rgba(154,92,255,0.09), transparent 58%),
    #020406;
}

.auth-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 8px;
}

.cyph-logo {
  width: 72px;
  height: 72px;
  display: block;
  margin-bottom: 16px;
  filter: drop-shadow(0 8px 24px rgba(154,92,255,0.28)) drop-shadow(0 0 32px rgba(10,207,255,0.14));
}

.auth-logo {
  font-family: var(--display);
  letter-spacing: 0.12em;
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--text);
  text-rendering: optimizeLegibility;
}

.auth-brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 8px;
}

.auth-brand-name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 28px;
  letter-spacing: 0.12em;
  color: var(--text);
}

.auth-logo--sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--text3);
  margin-bottom: 32px;
  text-transform: uppercase;
  font-weight: 500;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(180deg, rgba(18,24,36,0.92), rgba(10,16,26,0.96));
  backdrop-filter: blur(24px) saturate(1.15);
  -webkit-backdrop-filter: blur(24px) saturate(1.15);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  padding: 32px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.03) inset;
}

.auth-card::before {
  content: '';
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--cyan) 0%, var(--violet) 52%, transparent 88%);
  opacity: 0.9;
}

.auth-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255,255,255,0.045), transparent 60%);
  pointer-events: none;
}

.auth-tabs {
  display: flex;
  gap: 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 0;
}

.auth-tab {
  background: none;
  border: none;
  color: var(--text3);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  font-weight: 600;
  cursor: pointer;
  padding: 0 2px 10px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 180ms var(--ease), border-color 180ms var(--ease);
}

.auth-tab.active {
  color: var(--text);
  border-bottom-color: var(--cyan);
  text-shadow: 0 0 12px rgba(10,207,255,0.28);
}

.auth-tab:hover { color: var(--text2); }

.auth-field {
  margin-bottom: 16px;
}

.auth-field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  font-weight: 600;
  color: var(--text3);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.auth-field input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease), background 180ms var(--ease);
}

.auth-field input::placeholder { color: var(--text3); }

.auth-field input:focus {
  border-color: rgba(10,207,255,0.42);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 3px rgba(10,207,255,0.10);
}

.auth-field input:hover { border-color: rgba(255,255,255,0.12); }

.auth-btn {
  width: 100%;
  margin-top: 8px;
  padding: 13px 20px;
  background: linear-gradient(135deg, #9A5CFF 0%, #7A3DFF 100%);
  border: 1px solid rgba(154,92,255,0.32);
  border-radius: var(--r-md);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 180ms var(--spring), box-shadow 180ms var(--ease), background 180ms var(--ease), border-color 180ms var(--ease);
  box-shadow: 0 8px 20px rgba(154,92,255,0.22), 0 1px 0 rgba(255,255,255,0.12) inset;
}

.auth-btn:hover {
  background: linear-gradient(135deg, #B07AFF 0%, #8A4FFF 100%);
  border-color: rgba(154,92,255,0.48);
  box-shadow: 0 12px 28px rgba(154,92,255,0.28), 0 1px 0 rgba(255,255,255,0.14) inset;
  transform: translateY(-1px);
}
.auth-btn:active { transform: translateY(0) scale(0.98); }
.auth-btn:focus-visible { outline: 2px solid rgba(10,207,255,0.72); outline-offset: 2px; }

.auth-btn.nucleus-btn,
.nucleus-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
}

.auth-btn.nucleus-btn:hover,
.nucleus-btn:hover {
  color: var(--text);
  border-color: rgba(10,207,255,0.28);
  background: rgba(10,207,255,0.08);
  box-shadow: 0 4px 16px rgba(10,207,255,0.10);
}

.auth-error {
  color: #ff6b8a;
  font-size: 11px;
  margin-top: 12px;
  min-height: 16px;
}

.auth-divider {
  text-align: center;
  margin: 20px 0 12px;
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--muted);
}

.google-wrap { display: flex; justify-content: center; }

.auth-reset { text-align: center; margin-top: 16px; }

.auth-reset-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.08em;
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.15s ease-in-out;
}

.auth-reset-btn:hover { color: var(--cyan); }

.cyph-app-error {
  margin: 12px 16px 0;
  padding: 12px 14px;
  border: 1px solid rgba(255, 107, 138, 0.45);
  background: rgba(255, 107, 138, 0.08);
  border-radius: 6px;
  color: #ff8fa8;
  font-size: 11px;
}

.cyph-app-error--warn {
  border-color: rgba(245, 197, 66, 0.45);
  background: rgba(245, 197, 66, 0.08);
  color: #f5c542;
}

.cyph-app-error-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.cyph-app-error-body {
  flex: 1;
  min-width: 0;
}

.cyph-app-error-link-text {
  margin-top: 6px;
  font-size: 10px;
  word-break: break-all;
  color: var(--text);
  opacity: 0.9;
}

.cyph-app-error-close {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface3);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 180ms var(--ease), background 180ms var(--ease), color 0.15s ease-in-out;
}

.cyph-app-error-close:hover {
  border-color: var(--yellow);
  color: var(--yellow);
}

.cyph-app-error-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.cyph-app-error-btn {
  background: var(--surface3);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color 180ms var(--ease), background 180ms var(--ease);
}

.cyph-app-error-btn:hover { border-color: var(--cyan); }

.cyph-app-error-link {
  background: none;
  border: none;
  color: var(--cyan);
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.06em;
  cursor: pointer;
  text-decoration: underline;
}

/* ── App Shell — AAA Apple Vibrancy ── */
.app-shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: transparent;
  gap: 16px;
  padding: 16px;
  position: relative;
}

.left-sidebar {
  width: 248px;
  min-width: 200px;
  max-width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar {
  background: var(--surface-vibrancy);
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
  box-shadow: var(--shadow-md);
}

.main-chat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-vibrancy);
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  position: relative;
}

.right-panel {
  width: 320px;
  min-width: 280px;
  max-width: 420px;
  flex-shrink: 0;
  background: var(--surface-vibrancy);
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  z-index: 2;
  pointer-events: auto;
  box-shadow: var(--shadow-md);
  transition: width 280ms var(--spring), min-width 280ms var(--spring), border-color 180ms var(--ease), transform 280ms var(--spring);
}

/* Collapsible Right Panel */
.app-shell.right-collapsed .right-panel {
  width: 0px !important;
  min-width: 0px !important;
  max-width: 0px !important;
  border-left: 1px solid transparent !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

.app-shell.right-collapsed .resizer-right {
  display: none !important;
}

#toggle-right-panel-btn {
  transition: opacity 0.2s, color 0.2s, border-color 0.2s;
  position: relative;
  z-index: 5;
  pointer-events: auto;
}

#toggle-right-panel-btn.collapsed {
  opacity: 0.45;
}

#toggle-right-panel-btn.collapsed:hover {
  opacity: 1;
}

.resizer {
  width: 8px;
  margin: 0 -2px;
  background: transparent;
  cursor: col-resize;
  flex-shrink: 0;
  transition: background 180ms var(--ease);
  position: relative;
  z-index: 10;
}
.resizer::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 12%;
  bottom: 12%;
  width: 2px;
  border-radius: 999px;
  background: transparent;
  transition: background 180ms var(--ease);
}
.resizer:hover::after,
.resizer:active::after {
  background: rgba(154,92,255,0.42);
}

/* Pop-out removed 8/23/26 — unified shell */

.right-panel-placeholder {
  padding: 16px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

/* ── Right Panel Sections ── */
.rp-section { padding: 16px; border-bottom: 1px solid var(--line); }
.rp-section:last-child { border-bottom: none; }
#rp-room-info,
#rp-dm-info {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.rp-header {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: var(--text3);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
}
.rp-badge {
  background: rgba(57, 217, 138, 0.1);
  color: var(--green);
  font-size: 8px;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid rgba(57, 217, 138, 0.2);
}
.rp-room-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.rp-room-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}
.rp-divider {
  height: 1px;
  background: var(--line);
  margin: 12px 16px;
}
.rp-members {
  max-height: 120px;
  overflow-y: auto;
}
.rp-member {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  font-size: 11px;
  color: var(--text);
}
.rp-member-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rp-member-dot.online { background: var(--green); }
.rp-member-dot.offline { background: var(--muted); }
.rp-empty { font-size: 10px; color: var(--muted); }

/* ── Encryption Key Block ── */
.rp-encryption-key {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(48,209,88,0.06);
  border: 1px solid rgba(48,209,88,0.14);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin-top: 6px;
}
.rp-enc-icon {
  font-size: 14px;
  flex-shrink: 0;
}
.rp-enc-hash {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--green);
  letter-spacing: 0.04em;
  word-break: break-all;
  background: none;
}

/* ── DM Profile Section ── */
.rp-dm-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 8px;
}
.rp-dm-avatar {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface2);
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--surface3);
}
.rp-dm-avatar svg {
  display: block;
}
.rp-dm-details {
  flex: 1;
  min-width: 0;
}
.rp-dm-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.rp-dm-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--muted);
}

/* ── PGP Fingerprint Block ── */
.rp-pgp-fingerprint {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin-top: 6px;
}
.rp-pgp-hash {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--cyan);
  letter-spacing: 0.06em;
  word-break: break-all;
  background: none;
}

/* ── Member List Improvements ── */
.rp-member-dot.away { background: var(--yellow); }
.rp-member-name {
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── AI Terminal in Right Panel ── */
#rp-ai-terminal {
  flex: 0 0 auto;
  margin-top: auto;
  position: relative;
  z-index: 2;
  pointer-events: auto;
  background: linear-gradient(180deg, rgba(10,16,26,0.92), rgba(8,12,20,0.98));
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 4px 0;
}

.rp-terminal-log {
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 8px;
  font-size: 11px;
  line-height: 1.6;
}
.rp-terminal-msg {
  padding: 2px 0;
  word-break: break-word;
}
.rp-terminal-msg.rp-system { color: var(--muted); font-style: italic; }
.rp-terminal-msg.rp-user { color: var(--green); }
.rp-terminal-msg.rp-ai { color: var(--purple); }
.rp-terminal-msg.rp-error { color: var(--red); }
.rp-terminal-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 10px;
  pointer-events: auto;
  position: relative;
  z-index: 2;
}
.rp-terminal-prompt {
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.rp-terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  caret-color: var(--green);
  pointer-events: auto;
  position: relative;
  z-index: 2;
}
.rp-terminal-input::placeholder { color: var(--muted); }

.sidebar-header {
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(154,92,255,0.06), transparent 72%);
}

.sidebar-logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cyph-logo--sm {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.sidebar-logo {
  font-family: var(--display);
  letter-spacing: 0.10em;
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.sidebar-network {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--text3);
  margin-top: 2px;
  font-weight: 600;
}

.self-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.02));
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar--clickable {
  cursor: pointer;
  transition: box-shadow 0.15s ease-in-out, transform 0.15s ease-in-out;
}

.avatar--clickable:hover {
  box-shadow: 0 0 0 2px rgba(10,207,255,0.42);
  transform: scale(1.02);
}

.avatar.small { width: 26px; height: 26px; font-size: 9px; }

.self-info { flex: 1; min-width: 0; }

.self-name { font-family: var(--font-text); font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }

.self-status {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.02em;
}

.buddy-section { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; }

.section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--text3);
  padding: 14px 16px 8px;
  font-weight: 600;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.buddy-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  transition: background 180ms var(--ease), border-color 180ms var(--ease), transform 180ms var(--ease);
  position: relative;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
}

.buddy-item:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.06);
  transform: translateX(1px);
}

.buddy-item.active {
  background: linear-gradient(90deg, rgba(154,92,255,0.14), rgba(154,92,255,0.04));
  border-color: rgba(154,92,255,0.22);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 180ms var(--ease);
}

.status-dot.online { background: var(--green); box-shadow: 0 0 8px rgba(48,209,88,0.5); }
.status-dot.away { background: var(--yellow); }
.status-dot.busy { background: #e74c3c; }
.status-dot.offline { background: var(--grey); }

.self-profile--clickable {
  cursor: pointer;
  transition: background 180ms var(--ease);
}

.self-profile--clickable:hover {
  background: var(--surface2);
}

.self-edit-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  transition: color 0.15s ease-in-out;
}

.self-edit-btn:hover { color: var(--cyan); transform: scale(1.08); }

.buddy-menu-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0;
  transition: opacity 180ms var(--ease);
  line-height: 1;
}

.buddy-item:hover .buddy-menu-btn,
.buddy-item.active .buddy-menu-btn {
  opacity: 1;
}

.buddy-menu-btn:hover { color: var(--text); }

.cyph-context-menu {
  position: fixed;
  z-index: 9000;
  min-width: 140px;
  background: var(--surface);
  border: var(--border);
  border-radius: 6px;
  padding: 4px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
}

.cyph-context-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 180ms var(--ease);
}

.cyph-context-menu button:hover {
  background: var(--surface2);
}

.cyph-context-menu button.danger {
  color: #ff6b8a;
}

.chat-header-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.chat-action-btn {
  background: var(--surface2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: color 180ms var(--ease), border-color 180ms var(--ease);
}

.chat-action-btn:hover {
  color: var(--text);
  border-color: rgba(0, 255, 255, 0.45);
}

.chat-action-btn.danger:hover {
  color: #ff6b8a;
  border-color: rgba(255, 107, 138, 0.45);
}

.cyph-modal {
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: rgba(2,6,12,0.68);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cyph-modal[hidden] {
  display: none;
}

.cyph-modal-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, rgba(18,24,36,0.96), rgba(10,16,26,0.98));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.cyph-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: var(--border);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.cyph-modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.15s ease-in-out;
}

.cyph-modal-close:hover { color: var(--cyan); }

.cyph-modal-body {
  padding: 16px;
}

.profile-avatar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.profile-avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 14px;
}

.profile-avatar-hint {
  font-size: 9px;
  color: var(--muted);
  line-height: 1.4;
  flex: 1;
}

.profile-field {
  display: block;
  margin-bottom: 12px;
}

.profile-field span {
  display: block;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.profile-field input,
.profile-field select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 9px 10px;
  outline: none;
  transition: border-color 180ms var(--ease), background 180ms var(--ease);
}

.profile-field input:focus,
.profile-field select:focus {
  border-color: rgba(0, 255, 255, 0.5);
}

.profile-readonly {
  font-size: 10px;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.8;
}

.profile-readonly-label {
  display: inline-block;
  width: 64px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 9px;
}

.profile-error {
  color: #ff6b8a;
  font-size: 10px;
  min-height: 14px;
  margin-top: 8px;
}

.cyph-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: var(--border);
  background: var(--surface2);
}

.cyph-modal-footer-right {
  display: flex;
  gap: 8px;
}

.profile-btn {
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--line);
  transition: background 180ms var(--ease), color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.profile-btn--ghost {
  background: transparent;
  color: var(--muted);
}

.profile-btn--ghost:hover { color: var(--text); }

.profile-btn--primary {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #000;
  font-weight: 700;
}

.profile-btn--primary:hover { background: #33FFFF; }

.buddy-meta { flex: 1; min-width: 0; }

.buddy-name { font-size: 11px; font-weight: 700; }

.buddy-node {
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rooms-section {
  border-top: 1px solid var(--line);
  max-height: 160px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.room-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  transition: background 180ms var(--ease), border-color 180ms var(--ease);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
}

.room-item:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.06);
}

.room-item.active {
  background: linear-gradient(90deg, rgba(154,92,255,0.14), rgba(154,92,255,0.05));
  border-color: rgba(154,92,255,0.22);
}

.room-delete-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  padding: 2px 4px;
  line-height: 1;
}

.room-item:hover .room-delete-btn { opacity: 0.6; }
.room-delete-btn:hover { opacity: 1 !important; color: var(--red); }

.room-hash {
  font-size: 11px;
  font-weight: 700;
  color: var(--purple);
  width: 12px;
  flex-shrink: 0;
}

.room-meta { flex: 1; min-width: 0; }

.room-name { font-size: 11px; font-weight: 700; }

.room-slug {
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.add-room-bar {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  background: rgba(255,255,255,0.015);
}

.add-room-bar.join-room-bar {
  border-top: none;
  padding-top: 0;
}

.room-empty {
  font-size: 9px;
  color: var(--muted);
  padding: 4px 0 8px;
  line-height: 1.4;
}

.add-room-bar input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  font-family: inherit;
  font-size: 10px;
  padding: 6px 8px;
  transition: border-color 180ms var(--ease), background 180ms var(--ease);
}

.add-room-bar input:focus { border-color: rgba(0, 255, 255, 0.5); }

.add-room-bar button {
  background: var(--surface3);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: inherit;
  font-size: 9px;
  padding: 6px 8px;
  cursor: pointer;
  transition: border-color 180ms var(--ease), background 180ms var(--ease);
}

.add-room-bar button:hover { border-color: var(--cyan); }

.radio-bar {
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  background: rgba(255,255,255,0.02);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.radio-label {
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-bottom: 6px;
}

.radio-track { font-size: 11px; font-weight: 700; }

.radio-artist { font-size: 10px; color: var(--muted); }

.radio-meta {
  font-size: 9px;
  color: var(--muted);
  margin-top: 4px;
}

.radio-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.radio-transport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.radio-btn {
  width: 24px;
  height: 24px;
  background: var(--surface3);
  border: 1px solid var(--surface3);
  color: var(--muted);
  font-family: inherit;
  font-size: 9px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: border-color 180ms var(--ease), background 180ms var(--ease), color 0.15s ease-in-out;
}

.radio-btn:hover {
  border-color: var(--green);
  color: var(--green);
}

.radio-btn:active {
  background: var(--surface);
}

.radio-progress-wrap {
  width: 100%;
}

.radio-progress {
  position: relative;
  flex: 1;
  height: 4px;
  background: var(--surface3);
  border-radius: 999px;
  overflow: hidden;
  cursor: pointer;
}

.radio-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #09f27a 0%, #39D98A 55%, #7dffbf 100%);
  width: 0%;
  box-shadow: 0 0 8px rgba(57, 217, 138, 0.45);
  transition: width 80ms linear;
}

.radio-time {
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.radio-options {
  display: flex;
  align-items: center;
  gap: 6px;
}

.radio-btn.radio-mode {
  width: 22px;
  height: 22px;
  font-size: 10px;
}

.radio-btn.radio-mode.active {
  border-color: var(--green);
  color: var(--green);
  background: rgba(57, 217, 138, 0.08);
}

.radio-volume {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.radio-vol-icon {
  font-size: 10px;
  flex-shrink: 0;
}

.radio-vol-slider {
  flex: 1;
  min-width: 0;
  height: 4px;
  accent-color: var(--green);
  cursor: pointer;
}

/* --- Chat --- */
.chat-pane {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
  min-height: 0;
  flex: 1;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(10,16,26,0.86);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
}

.chat-header > div:first-child {
  flex: 1;
  min-width: 0;
}

.chat-peer-name { font-family: var(--font-text); font-size: 16px; font-weight: 600; letter-spacing: -0.015em; }

.chat-peer-status { font-family: var(--font-mono); font-size: 11px; color: var(--text3); margin-top: 2px; letter-spacing: 0.02em; }

.chat-window-controls { display: flex; gap: 6px; }

.win-btn {
  width: 14px;
  height: 14px;
  background: var(--surface3);
  border: 1px solid var(--line);
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: radial-gradient(ellipse 60% 30% at 50% 0%, rgba(154,92,255,0.04), transparent 70%);
}

/* Terminal-style messages — no bubbles */
.msg-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  max-width: 100%;
  animation: msgFadeIn 220ms var(--spring);
}

.msg-row.outgoing { align-self: flex-end; align-items: flex-end; flex-direction: row-reverse; }
.msg-row.incoming { align-self: flex-start; }

.msg-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  overflow: hidden;
  color: var(--text);
}
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.msg-avatar--clickable { cursor: pointer; transition: border-color 0.15s ease, transform 0.15s ease; }
.msg-avatar--clickable:hover { border-color: var(--cyan); transform: scale(1.08); }
.msg-sender--clickable { cursor: pointer; border-bottom: 1px dotted rgba(255, 255, 255, 0.25); }
.msg-sender--clickable:hover { border-bottom-color: var(--cyan); }

.msg-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 82%;
}

.msg-bubble {
  padding: 12px 16px;
  font-family: var(--font-text);
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  max-width: 560px;
}

.msg-sender {
  font-family: var(--font-text);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
  color: var(--text2);
}

.msg-row.outgoing .msg-sender { color: var(--cyan); }

.msg-row.incoming .msg-bubble {
  color: var(--text);
}

.msg-row.outgoing .msg-bubble {
  color: var(--cyan);
}

.msg-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  margin-top: 6px;
  letter-spacing: 0.04em;
}

.msg-system {
  align-self: center;
  font-size: 10px;
  color: var(--muted);
  background: var(--surface2);
  padding: 4px 12px;
  border-radius: 12px;
  border: var(--border);
}

/* Chat composer */
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: rgba(10,16,26,0.92);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  margin: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.chat-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: var(--font-text);
  font-size: 15px;
  padding: 13px 16px;
  outline: none;
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease), background 180ms var(--ease);
}

.chat-input::placeholder {
  color: var(--text3);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.chat-input:focus {
  border-color: var(--border-cyan);
  box-shadow: 0 0 0 1px var(--glow-cyan);
}

.chat-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.chat-send {
  background: linear-gradient(135deg, #9A5CFF 0%, #7A3DFF 100%);
  border: 1px solid rgba(154,92,255,0.28);
  border-radius: var(--r-md);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 13px 18px;
  transition: transform 180ms var(--spring), box-shadow 180ms var(--ease), background 180ms var(--ease);
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(154,92,255,0.18);
}

.chat-send:hover {
  background: linear-gradient(135deg, #B07AFF 0%, #8A4FFF 100%);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(154,92,255,0.24);
}
.chat-send:active { transform: translateY(0) scale(0.98); }

.chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.add-buddy-bar {
  padding: 5px 12px;
  border-top: 1px solid var(--surface3);
  display: flex;
  gap: 6px;
}

.add-buddy-bar input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  font-family: inherit;
  font-size: 10px;
  padding: 6px 8px;
  transition: border-color 180ms var(--ease), background 180ms var(--ease);
}

.add-buddy-bar input:focus { border-color: rgba(0, 255, 255, 0.5); }

.add-buddy-bar button {
  background: var(--surface3);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: inherit;
  font-size: 9px;
  padding: 6px 8px;
  cursor: pointer;
  transition: border-color 180ms var(--ease), background 180ms var(--ease);
}

.add-buddy-bar button:hover { border-color: var(--cyan); }

.empty-chat {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--text3);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  text-align: center;
  user-select: none;
  padding: 40px;
}

.empty-chat::before {
  content: '';
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px dashed rgba(10,207,255,0.22);
  background: radial-gradient(circle, rgba(154,92,255,0.09) 0%, transparent 68%);
  box-shadow: 0 0 24px rgba(154,92,255,0.10);
}

.app-error {
  margin: 12px 16px 0;
  padding: 12px 14px;
  border: 1px solid rgba(255, 107, 138, 0.45);
  background: rgba(255, 107, 138, 0.08);
  border-radius: 6px;
  color: #ff8fa8;
  font-size: 11px;
}

.app-error-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.app-error-btn {
  background: var(--surface3);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: inherit;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color 180ms var(--ease), background 180ms var(--ease);
}

.app-error-btn:hover { border-color: var(--cyan); }

.app-error-link {
  color: var(--cyan);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.app-shell--error .chat-pane,
.app-shell--error .buddy-section {
  opacity: 0.35;
  pointer-events: none;
}

@media (max-width: 900px) {
  .app-shell { gap: 0; padding: 0; }
  .left-sidebar { display: none; }
  .right-panel { display: none; }
  .resizer { display: none; }
  .main-chat { border-radius: 0; border-left: none; border-right: none; }
}
@media (max-width: 640px) {
  .auth-card { margin: 0 12px; padding: 24px; }
  .chat-tab-bar { padding: 0 4px; min-height: 40px; }
  .messages { padding: 16px; }
  .chat-input-bar { padding: 12px 16px; }
}

.buddy-unread {
  background: var(--purple);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 10px;
  padding: 2px 6px;
  line-height: 1;
  flex-shrink: 0;
  margin-right: 4px;
  box-shadow: 0 0 8px rgba(176, 38, 255, 0.4);
}

.buddy-item.buddy-new-msg {
  animation: buddy-flash 1.0s ease-out;
}

@keyframes buddy-flash {
  0% {
    background-color: rgba(176, 38, 255, 0.3);
  }
  100% {
    background-color: transparent;
  }
}

/* ── Chat Tab Bar ── */
.chat-tab-bar {
  display: flex;
  align-items: stretch;
  background: rgba(10,16,26,0.86);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  border-bottom: 1px solid var(--line);
  height: auto;
  min-height: 44px;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
  -ms-overflow-style: none;
  user-select: none;
  gap: 2px;
  padding: 0 8px;
}

.chat-tab-bar::-webkit-scrollbar {
  display: none;
}

.chat-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  height: auto;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  margin: 4px 0;
  cursor: pointer;
  transition: background 180ms var(--ease), border-color 180ms var(--ease), color 180ms var(--ease);
  position: relative;
  flex-shrink: 0;
  max-width: 180px;
  min-width: 0;
}

.chat-tab:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.06);
}

.chat-tab.active {
  background: rgba(255,255,255,0.08);
  border-color: rgba(154,92,255,0.22);
  box-shadow: 0 1px 0 rgba(255,255,255,0.05) inset;
}

.chat-tab.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--purple);
}

.chat-tab.has-unread .chat-tab-label {
  color: #39d98a;
}

.chat-tab-icon {
  font-size: 8px;
  color: var(--muted);
  flex-shrink: 0;
  line-height: 1;
}

.chat-tab.active .chat-tab-icon {
  color: var(--cyan);
}

.chat-tab-label {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.chat-tab.active .chat-tab-label {
  color: var(--text);
}

.chat-tab-badge {
  font-size: 9px;
  font-family: var(--mono);
  font-weight: 700;
  background: var(--purple);
  color: #fff;
  border-radius: 8px;
  padding: 0 5px;
  line-height: 16px;
  min-width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.chat-tab-close {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 4px;
  margin: 0;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.35;
  position: relative;
  z-index: 2;
  pointer-events: auto;
  transition: opacity 0.1s ease-in-out, color 0.1s ease-in-out;
}

.chat-tab:hover .chat-tab-close,
.chat-tab.active .chat-tab-close {
  opacity: 0.7;
}

.chat-tab-close:hover {
  opacity: 1 !important;
  color: #ff6b8a;
}

.chat-tab-add {
  font-size: 14px;
  color: var(--muted);
  justify-content: center;
  padding: 0 12px;
  min-width: 32px;
  flex-shrink: 0;
}

.chat-tab-add:hover {
  color: var(--cyan);
}

.chat-tab.dragging {
  opacity: 0.4;
}

/* ── Split View ── */
.main-chat {
  position: relative;
}

.main-chat.split-mode {
  display: flex;
  flex-direction: row;
  overflow: visible;
}

.main-chat.split-mode > .chat-pane {
  flex: 1;
  min-width: 0;
  border-right: 1px solid #1A1A1A;
}

.main-chat.split-mode > .chat-pane-split-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.split-collapse-btn {
  position: absolute;
  top: 32px;
  right: 8px;
  z-index: 50;
}

.split-collapse-button {
  font-size: 14px;
  width: 28px;
  height: 28px;
}

.main-chat.split-drop-right,
.main-chat.split-drop-left {
  outline: 2px dashed var(--purple);
  outline-offset: -2px;
}

.main-chat.split-drop-right::after,
.main-chat.split-drop-left::after {
  content: 'Drop here for split view';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--purple);
  letter-spacing: 0.08em;
  pointer-events: none;
}

.main-chat.split-drop-right::after {
  right: 10%;
}

.main-chat.split-drop-left::after {
  left: 10%;
}

/* ── Split mode responsive ── */
@media (max-width: 768px) {
  .chat-tab-bar {
    display: none;
  }
  .main-chat.split-mode {
    flex-direction: column;
  }
  .main-chat.split-mode > .chat-pane-split-right {
    border-left: none;
    border-top: 1px solid #1A1A1A;
  }
}

@keyframes msgFadeIn {
  0% {
    opacity: 0;
    transform: translateY(-8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Command Palette */
#command-palette {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(2,6,12,0.72);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 18vh;
}

#command-palette[hidden] {
  display: none;
}

.command-palette-card {
  width: 100%;
  max-width: 600px;
  background: linear-gradient(180deg, rgba(18,24,36,0.96), rgba(10,16,26,0.98));
  backdrop-filter: blur(24px) saturate(1.15);
  -webkit-backdrop-filter: blur(24px) saturate(1.15);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.command-palette-input-wrap {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: var(--border);
  gap: 10px;
}

.command-palette-input-wrap .prompt {
  color: var(--cyan);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

#command-palette-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
  letter-spacing: 0.02em;
}

#command-palette-input::placeholder {
  color: var(--muted);
}

.command-palette-results {
  max-height: 320px;
  overflow-y: auto;
}

.command-palette-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.1s ease-in-out;
  border-left: 3px solid transparent;
}

.command-palette-result:hover,
.command-palette-result.active {
  background: var(--surface2);
  border-left-color: var(--cyan);
}

.command-palette-result .icon {
  width: 20px;
  text-align: center;
  color: var(--muted);
  flex-shrink: 0;
}

.command-palette-result .label {
  flex: 1;
  font-size: 12px;
}

.command-palette-result .meta {
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.command-palette-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  border-top: var(--border);
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.command-palette-footer kbd {
  background: var(--surface3);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text);
}

/* Username color classes for hashed colors */
.msg-sender.c0 { color: #FF6B6B; }
.msg-sender.c1 { color: #FECA57; }
.msg-sender.c2 { color: #48DBFB; }
.msg-sender.c3 { color: #FF9FF3; }
.msg-sender.c4 { color: #54A0FF; }
.msg-sender.c5 { color: #5F27CD; }
.msg-sender.c6 { color: #01A3A4; }
.msg-sender.c7 { color: #F368E0; }
.msg-sender.c8 { color: #FF9F43; }
.msg-sender.c9 { color: #EE5A24; }
.msg-sender.c10 { color: #00D2D3; }
.msg-sender.c11 { color: #C8D6E5; }

/* ── Enclave Explorer ── */
.enclave-section {
  border-bottom: var(--border);
  max-height: 200px;
  overflow-y: auto;
  padding-bottom: 4px;
}

.enclave-item {
  position: relative;
}

.enclave-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 180ms var(--ease), border-color 180ms var(--ease);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  margin: 2px 8px;
}

.enclave-header:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.06);
}

.enclave-icon {
  color: var(--purple);
  flex-shrink: 0;
}

.enclave-name {
  font-size: 11px;
  font-weight: 700;
  flex: 1;
}

.enclave-count {
  font-size: 9px;
  color: var(--muted);
}

.enclave-relays {
  padding-left: 20px;
}

.enclave-partition {
  margin-bottom: 4px;
}

.partition-label {
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding: 4px 8px 2px;
  text-transform: uppercase;
}

.relay-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 180ms var(--ease), border-color 180ms var(--ease);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  margin: 2px 8px;
}

.relay-item:hover {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.06);
}

.relay-item.active {
  background: linear-gradient(90deg, rgba(154,92,255,0.14), rgba(154,92,255,0.05));
  border-color: rgba(154,92,255,0.22);
}

.relay-prefix {
  font-size: 11px;
  font-weight: 700;
  width: 14px;
  flex-shrink: 0;
}

.relay-prefix.relay {
  color: var(--purple);
}

.relay-prefix.uplink {
  color: var(--green);
}

.relay-name {
  font-size: 11px;
  font-family: var(--mono);
  flex: 1;
}

.relay-ephemeral {
  font-size: 9px;
  color: var(--green);
  padding: 1px 4px;
  background: rgba(57, 217, 138, 0.1);
  border-radius: 3px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.enclave-empty {
  font-size: 9px;
  color: var(--muted);
  padding: 4px 0 8px;
  line-height: 1.4;
}

.add-enclave-bar {
  padding: 6px 12px;
  border-top: var(--border);
  display: flex;
  gap: 6px;
}

.add-enclave-bar input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  font-family: inherit;
  font-size: 10px;
  padding: 6px 8px;
  transition: border-color 180ms var(--ease), background 180ms var(--ease);
}

.add-enclave-bar input:focus { border-color: rgba(176, 38, 255, 0.5); }

.add-enclave-bar button {
  background: var(--surface3);
  border: 1px solid var(--line);
  color: var(--purple);
  font-family: inherit;
  font-size: 12px;
  padding: 6px 8px;
  cursor: pointer;
  transition: border-color 180ms var(--ease), background 180ms var(--ease), color 0.15s ease-in-out;
}

.add-enclave-bar button:hover {
  border-color: var(--purple);
  color: var(--purple);
}

/* Pop-out mode removed 8/23/26 */

/* ── WebSocket Status Indicator ── */
.ws-status {
  position: fixed;
  top: 8px;
  right: 12px;
  z-index: 9000;
  font-size: 9px;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--mono);
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  pointer-events: none;
}

.ws-status.visible {
  opacity: 1;
}

.ws-status.connecting {
  background: rgba(245, 197, 66, 0.15);
  color: var(--yellow);
  border: 1px solid rgba(245, 197, 66, 0.3);
}

.ws-status.connected {
  background: rgba(57, 217, 138, 0.15);
  color: var(--green);
  border: 1px solid rgba(57, 217, 138, 0.3);
}

.ws-status.disconnected {
  background: rgba(255, 68, 68, 0.15);
  color: var(--red);
  border: 1px solid rgba(255, 68, 68, 0.3);
}

/* ── E2EE Lock Icon ── */
.e2ee-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  cursor: default;
  position: relative;
}

.e2ee-badge svg {
  display: block;
}

.e2ee-badge:hover svg {
  filter: drop-shadow(0 0 4px rgba(57, 217, 138, 0.6));
}

.e2ee-badge .e2ee-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--green);
  font-size: 9px;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms var(--ease);
}

.e2ee-badge:hover .e2ee-tooltip {
  opacity: 1;
}

/* ───────────────────────────────────────────────────────── */
/* ── NULLXRE × NUCLEUS PREMIUM CHAT POLISH ──────────────── */
/* Syne + Space Mono · restrained cyan/violet · no HUD clutter */
/* ───────────────────────────────────────────────────────── */

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}

/* Soft atmosphere — not scanlines */
body.cyph-shell::before,
.auth-wrap::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 65% 45% at 50% -8%, rgba(154, 58, 160, 0.07), transparent 58%),
    radial-gradient(ellipse 45% 35% at 80% 18%, rgba(0, 196, 235, 0.05), transparent 52%);
  opacity: 0.9;
}

.auth-wrap,
.app-shell {
  position: relative;
  z-index: 1;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.14); }

/* Sidebar brand */
.sidebar {
  background: var(--surface);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-logo {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text);
}

.sidebar-network {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--text3);
  margin-top: 2px;
}

.cyph-logo--sm {
  filter: drop-shadow(0 0 12px rgba(154, 58, 160, 0.25));
}

.section-label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.16em;
  color: var(--text3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0 14px 6px;
  margin: 14px 0 6px;
  text-transform: uppercase;
}

.left-sidebar {
  width: 280px;
  min-width: 220px;
  max-width: 450px;
}

.self-profile {
  margin: 8px 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--r);
  background: var(--surface2);
}

.buddy-item,
.room-item,
.enclave-item {
  border-bottom: none;
  border-left: 2px solid transparent;
  margin: 1px 8px;
  padding: 10px 12px;
  border-radius: var(--r);
  font-family: var(--font);
  transition: var(--transition);
}

.buddy-item:hover,
.room-item:hover,
.enclave-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.buddy-item.active,
.room-item.active,
.enclave-item.active {
  background: var(--glow-violet);
  border-left-color: var(--violet);
  color: var(--text);
}

.avatar {
  background: var(--surface2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--mono);
  color: var(--violet);
  border-radius: var(--r);
}

.buddy-item.active .avatar {
  border-color: var(--border-violet);
}

.buddy-name,
.room-name {
  font-family: var(--font);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.buddy-node,
.room-slug {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text3);
}

/* Nav tabs — clean segmented control */
.sidebar-nav-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  height: 36px;
  margin: 0 0 4px;
  padding: 0 8px;
  gap: 0;
}

.sidebar-nav-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text3);
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
  height: 100%;
}

.sidebar-nav-tab:hover {
  color: var(--text2);
  background: transparent;
}

.sidebar-nav-tab.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
  background: transparent;
  font-weight: 700;
  text-shadow: none;
}

/* Messages — quiet luxury bubbles */
.messages {
  padding: 20px 24px;
  gap: 4px;
  background:
    radial-gradient(ellipse 50% 30% at 50% 0%, rgba(154, 58, 160, 0.04), transparent 70%);
}

.msg-row {
  margin-bottom: 10px;
  max-width: 72%;
  display: flex;
  flex-direction: column;
  gap: 3px;
  animation: msgFadeIn 0.18s ease;
}

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

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

.msg-bubble {
  background: var(--surface2);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  padding: 10px 14px;
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  font-weight: 500;
}

.msg-row.outgoing .msg-bubble {
  background: rgba(154, 58, 160, 0.12);
  border-color: var(--border-violet);
  color: var(--text);
}

.msg-row.outgoing .msg-bubble,
.msg-row.incoming .msg-bubble {
  color: var(--text);
}

.msg-sender {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1px;
}

.msg-row.outgoing .msg-sender { color: var(--violet); }
.msg-row.incoming .msg-sender { color: var(--cyan); }

.msg-time {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--text3);
  margin-top: 1px;
  letter-spacing: 0.04em;
}

.msg-system {
  align-self: center;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--text3);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  padding: 5px 14px;
}

/* Chat chrome */
.chat-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(6, 6, 8, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 14px 22px;
}

.chat-peer-name {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
}

.chat-peer-status {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--text3);
}

.chat-tab-bar {
  background: var(--surface);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0 10px;
  gap: 4px;
  min-height: 36px;
}

.chat-tab {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--text3);
  padding: 0 12px;
  min-height: 36px;
  margin-right: 2px;
  border-radius: var(--r) var(--r) 0 0;
  transition: var(--transition);
}

.chat-tab:hover {
  color: var(--text2);
  background: rgba(255, 255, 255, 0.02);
}

.chat-tab.active {
  border-color: rgba(255, 255, 255, 0.08);
  background: var(--surface2);
  color: var(--cyan);
}

.chat-tab.active::before {
  background: var(--cyan);
}

/* Action buttons — don't nuke primary CTAs */
button.chat-action-btn,
button.self-edit-btn,
.chat-action-btn,
.self-edit-btn {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 10px;
  transition: var(--transition);
  background: transparent;
  color: var(--text2);
  border-radius: var(--r);
  cursor: pointer;
}

button.chat-action-btn:hover,
button.self-edit-btn:hover,
.chat-action-btn:hover,
.self-edit-btn:hover {
  border-color: var(--border-cyan);
  color: var(--cyan);
  background: var(--glow-cyan);
}

.auth-btn,
.chat-send {
  text-transform: uppercase;
}

.status-dot.online {
  background: var(--green);
  box-shadow: 0 0 6px rgba(57, 217, 138, 0.45);
}

.status-dot.away {
  background: var(--amber);
  box-shadow: 0 0 6px rgba(245, 197, 66, 0.35);
}

/* Empty state — brand-first, no protocol dump */
.empty-chat {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0;
  background:
    radial-gradient(ellipse 55% 40% at 50% 42%, rgba(154, 58, 160, 0.08), transparent 70%),
    radial-gradient(ellipse 40% 30% at 70% 60%, rgba(0, 196, 235, 0.05), transparent 65%),
    var(--bg);
  position: relative;
  padding: 48px 32px;
  overflow: hidden;
  font-size: 0;
  color: transparent;
  user-select: none;
  text-shadow: none;
}

.empty-chat::before {
  content: 'CYPH.27';
  display: block;
  font-family: var(--display);
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--text);
  margin-bottom: 12px;
  animation: emptyBrandIn 0.5s ease-out;
}

.empty-chat::after {
  content: 'End-to-end encrypted · Select a conversation';
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text3);
  text-align: center;
  max-width: 360px;
  line-height: 1.7;
  animation: emptyBrandIn 0.55s ease-out 0.05s both;
}

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

.buddy-section,
.rooms-section,
.enclave-section {
  flex: 1;
  max-height: none;
  overflow-y: auto;
}

.right-panel {
  background: var(--surface);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.rp-header {
  font-family: var(--mono);
  color: var(--text3);
}

.resizer:hover,
.resizer:active {
  background: var(--violet);
}

.add-buddy-bar input:focus,
.add-room-bar input:focus,
.add-enclave-bar input:focus {
  border-color: var(--border-cyan);
  box-shadow: none;
}

/* Composer stays primary (override any transparent button rules) */
.chat-send {
  background: var(--violet) !important;
  border-color: transparent !important;
  color: #fff !important;
}
.chat-send:hover {
  background: var(--violet-hover) !important;
}
.auth-btn:not(.nucleus-btn) {
  background: var(--violet) !important;
  border-color: transparent !important;
  color: #fff !important;
}
.auth-btn:not(.nucleus-btn):hover {
  background: var(--violet-hover) !important;
}


/* ═══ EMBEDDED TACTICAL MODE — inbox Team Chat popup ═══
   Defense-contract HUD: clipped corners, grid + scanline surfaces,
   mono stencil labels, bracketed timestamps, LED status. */
body.cyph-embed { background: #04070a; font-family: var(--mono); }
body.cyph-embed .app-shell,
body.cyph-embed .chat-pane { background: #04070a; }

body.cyph-embed .chat-header {
  background: linear-gradient(135deg, rgba(23,224,176,0.07), rgba(4,7,10,0.92));
  border-bottom: 1px solid rgba(23,224,176,0.22);
  padding: 8px 14px;
  gap: 10px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}
body.cyph-embed .chat-header::before {
  content: 'SECURE CHANNEL ▮';
  position: absolute; right: 14px; top: 22px;
  font-size: 7px; letter-spacing: 0.2em; color: rgba(23,224,176,0.35);
  font-family: var(--mono);
}
body.cyph-embed .chat-header { position: relative; }
body.cyph-embed .chat-peer-name {
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase; color: #eafff8;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body.cyph-embed .chat-peer-name::before { content: '◤ '; color: var(--green); }
body.cyph-embed .chat-peer-status {
  font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(23,224,176,0.6); font-family: var(--mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body.cyph-embed .chat-peer-status::before {
  content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 6px var(--green);
  margin-right: 7px; vertical-align: 1px;
  animation: tacLedPulse 2s ease-in-out infinite;
}
@keyframes tacLedPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

body.cyph-embed .messages {
  background:
    linear-gradient(rgba(23,224,176,0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23,224,176,0.018) 1px, transparent 1px),
    #04070a;
  background-size: 24px 24px;
  padding: 10px 12px;
}
body.cyph-embed .msg-row { gap: 8px; }
body.cyph-embed .msg-avatar {
  width: 24px; height: 24px; min-width: 24px; border-radius: 0;
  background: rgba(23,224,176,0.06); border: 1px solid rgba(23,224,176,0.28);
  font-family: var(--mono); font-size: 9px;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
}
body.cyph-embed .msg-avatar--clickable:hover { border-color: var(--green); transform: none; }
body.cyph-embed .msg-main { max-width: 88%; }
body.cyph-embed .msg-sender {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; display: inline-block;
}
body.cyph-embed .msg-sender::before { content: '['; }
body.cyph-embed .msg-sender::after { content: ']'; }
body.cyph-embed .msg-sender--clickable:hover { border-bottom-color: var(--green); }
body.cyph-embed .msg-bubble { font-family: var(--mono); font-size: 12px; line-height: 1.55; }
body.cyph-embed .msg-row.outgoing .msg-bubble { color: #9fffe6; }
body.cyph-embed .msg-row.incoming .msg-bubble { color: #dde6e2; }
body.cyph-embed .msg-time {
  font-family: var(--mono); font-size: 8px; letter-spacing: 0.1em;
  color: rgba(23,224,176,0.42);
}
body.cyph-embed .msg-time::before { content: '['; }
body.cyph-embed .msg-time::after { content: ']'; }
body.cyph-embed .msg-system {
  border-radius: 0; font-family: var(--mono); font-size: 9px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(23,224,176,0.75);
  border: 1px solid rgba(23,224,176,0.2); background: rgba(23,224,176,0.04);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
body.cyph-embed .empty-chat {
  font-family: var(--mono); letter-spacing: 0.18em; text-transform: uppercase;
  font-size: 10px; color: rgba(23,224,176,0.35);
}

body.cyph-embed .chat-input-bar {
  background: linear-gradient(180deg, rgba(6,10,14,0.96), #04070a);
  border-top: 1px solid rgba(23,224,176,0.22);
  padding: 10px 12px 12px;
  gap: 8px;
}
body.cyph-embed .chat-input {
  background: #070b10; border: 1px solid rgba(23,224,176,0.22);
  border-radius: 0; font-family: var(--mono); font-size: 12px;
  color: #d8fff2; padding: 10px 12px;
}
body.cyph-embed .chat-input::placeholder { color: rgba(23,224,176,0.35); letter-spacing: 0.2em; }
body.cyph-embed .chat-input:focus {
  border-color: rgba(23,224,176,0.55);
  box-shadow: 0 0 12px rgba(23,224,176,0.14);
}
body.cyph-embed .chat-send {
  background: rgba(23,224,176,0.12); border: 1px solid rgba(23,224,176,0.45);
  border-radius: 0; color: var(--green);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
body.cyph-embed .chat-send:hover { background: rgba(23,224,176,0.24); color: #fff; }
body.cyph-embed .chat-send:disabled { opacity: 0.3; }

body.cyph-embed .chat-tab-bar {
  background: #04070a; border-bottom: 1px solid rgba(23,224,176,0.16);
}
body.cyph-embed .chat-tab {
  border-radius: 0; font-family: var(--mono); letter-spacing: 0.1em;
  text-transform: uppercase; font-size: 9px;
}
body.cyph-embed .chat-tab.active {
  border-bottom: 2px solid var(--green); color: var(--green);
}
body.cyph-embed .e2ee-badge {
  border: 1px solid rgba(57,217,138,0.32); background: rgba(57,217,138,0.06);
  border-radius: 0;
}
body.cyph-embed .chat-action-btn { border-radius: 0; }
body.cyph-embed .right-panel {
  background: #04070a;
  border-left: 1px solid rgba(23,224,176,0.16);
}
body.cyph-embed .rp-section-title {
  font-family: var(--mono); letter-spacing: 0.16em; text-transform: uppercase;
}
body.cyph-embed ::-webkit-scrollbar { width: 6px; height: 6px; }
body.cyph-embed ::-webkit-scrollbar-thumb { background: rgba(23,224,176,0.2); border-radius: 0; }
body.cyph-embed ::-webkit-scrollbar-thumb:hover { background: rgba(23,224,176,0.4); }


/* ── AAA Focus Ring ── */
button:focus-visible, input:focus-visible, [tabindex]:focus-visible, a:focus-visible {
  outline: 2px solid rgba(10,207,255,0.72);
  outline-offset: 2px;
}


/* ── Subtle grain — Apple luxe ── */
.app-shell::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.015;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  z-index: 0;
}

/* ════════════════════════════════════════════════════════════════
   CYPH.27 — DEFENSE CONTRACT TACTICAL v2 (2026-08-23)
   Next-level cyberpunk HUD: clipped geometry, corner brackets,
   phosphor terminal, LED status, stencil mono, neon hairlines.
   Replaces the 8/23 hacker pass in full.
   ════════════════════════════════════════════════════════════════ */

:root {
  --tac-green: #30D158;
  --tac-green-hi: #7dffb0;
  --tac-cyan: #0ACFFF;
  --tac-violet: #9A5CFF;
  --tac-red: #FF453A;
  --edge-cyan: rgba(10,207,255,0.55);
  --edge-violet: rgba(154,92,255,0.55);
  --edge-green: rgba(48,209,88,0.55);
  --hair: rgba(255,255,255,0.07);
  --clip-sm: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  --clip-lg: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

::selection { background: rgba(10,207,255,0.32); color:#fff; }

/* ── Shell atmosphere: obsidian + grid + scanlines + refresh sweep ── */
body.cyph-shell {
  background:
    radial-gradient(ellipse 72% 46% at 50% -10%, rgba(10,207,255,0.08), transparent 60%),
    radial-gradient(ellipse 44% 32% at 88% 12%, rgba(154,92,255,0.07), transparent 56%),
    radial-gradient(ellipse 40% 30% at 6% 74%, rgba(48,209,88,0.04), transparent 55%),
    radial-gradient(ellipse 90% 55% at 50% 112%, rgba(0,0,0,0.9), transparent 55%),
    #010204;
}
body.cyph-shell::before {
  content:''; position:fixed; inset:0; pointer-events:none; z-index:0;
  background:
    linear-gradient(rgba(255,255,255,0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.028) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity:.5;
  mask-image: radial-gradient(ellipse 75% 62% at 50% 36%, #000 26%, transparent 80%);
}
body.cyph-shell::after {
  content:''; position:fixed; inset:0; pointer-events:none; z-index:0;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(10,207,255,0.03) 3px);
}
html::before {
  content:''; position:fixed; left:0; right:0; top:-140px; height:140px;
  pointer-events:none; z-index:1;
  background: linear-gradient(180deg, transparent, rgba(10,207,255,0.05), transparent);
  animation: tacRefreshSweep 10s linear infinite;
}
@keyframes tacRefreshSweep { to { transform: translateY(calc(100vh + 280px)); } }

/* ── Panels: squared vibrancy + clipped corners ── */
.sidebar, .main-chat, .right-panel {
  border-radius: 0 !important;
  clip-path: var(--clip-lg);
  border-color: var(--hair);
}
.main-chat { position:relative; }
.sidebar { position:relative; }

/* Corner brackets — TL/BR on sidebar+chat (right-panel scrolls, skip) */
.sidebar::before, .main-chat::before {
  content:''; position:absolute; top:0; left:0; width:20px; height:20px;
  border-top:2px solid var(--edge-cyan); border-left:2px solid var(--edge-cyan);
  pointer-events:none; z-index:6;
}
.sidebar::after, .main-chat::after {
  content:''; position:absolute; bottom:0; right:0; width:20px; height:20px;
  border-bottom:2px solid var(--edge-cyan); border-right:2px solid var(--edge-cyan);
  pointer-events:none; z-index:6;
}
.right-panel { box-shadow: var(--shadow-md), inset 1px 0 0 rgba(154,92,255,0.18); }
.app-shell::after { display:none; } /* kill soft grain — scanlines own it now */

/* ── Sidebar header: stencil + LED watermark ── */
.sidebar-header {
  background:
    linear-gradient(90deg, rgba(48,209,88,0.07), transparent 65%),
    linear-gradient(180deg, rgba(255,255,255,0.035), transparent);
  border-bottom:1px solid rgba(48,209,88,0.16);
}
.sidebar-header::after {
  content:'● SOVEREIGN ENCLAVE · E2EE';
  color: rgba(48,209,88,0.5);
  animation: tacLed 2.4s ease-in-out infinite;
}
@keyframes tacLed { 0%,100%{opacity:.45} 50%{opacity:.95} }
.sidebar-logo { letter-spacing:.16em; text-shadow:0 0 16px rgba(10,207,255,.25); }

/* Micro-labels: force stencil mono */
.section-label, .rp-header, .chat-peer-status, .self-status, .buddy-node,
.room-slug, .enclave-count, .partition-label, .ws-status, .sidebar-network,
.chat-tab-label, .msg-sender, .msg-time, .profile-readonly-label {
  font-family: var(--font-mono) !important;
  text-transform: uppercase;
}
.section-label { letter-spacing:.18em; padding-left:18px; }
.section-label::before {
  content:'◢'; left:4px; top:50%; transform:translateY(-50%);
  color: var(--tac-green); opacity:.7; font-size:8px;
}

/* Rows: squared rails */
.buddy-item, .room-item, .enclave-item, .relay-item, .rp-member {
  border-radius:0 !important;
}
.buddy-item:hover, .room-item:hover, .enclave-item:hover {
  background: rgba(10,207,255,0.05);
  border-left-color: var(--edge-cyan);
  transform:none;
}
.buddy-item.active, .room-item.active, .enclave-item.active {
  background: linear-gradient(90deg, rgba(154,92,255,0.16), rgba(10,207,255,0.05));
  border-left-color: var(--tac-violet);
  box-shadow: inset 3px 0 0 var(--tac-violet), 0 0 16px rgba(154,92,255,.12);
}
.status-dot.online { animation: tacLed 2s ease-in-out infinite; }
.status-dot.busy   { box-shadow:0 0 8px rgba(255,69,58,.6); }

/* Self profile chip */
.self-profile {
  clip-path: var(--clip-sm); border-radius:0 !important;
  border-color: rgba(48,209,88,0.16);
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.015));
}
.avatar { border-radius:0 !important; clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px)); }
.msg-avatar, .rp-dm-avatar { border-radius:0 !important; clip-path: var(--clip-sm); }

/* ── Chat header: HUD chrome ── */
.chat-header {
  background: linear-gradient(180deg, rgba(8,13,22,0.96), rgba(5,8,14,0.98));
  border-image: none;
  border-bottom:1px solid rgba(10,207,255,0.22);
  box-shadow: 0 1px 0 rgba(10,207,255,0.08) inset, 0 10px 30px rgba(0,0,0,.4);
}
.chat-peer-name {
  font-family: var(--display); letter-spacing:.06em;
  text-shadow: 0 0 18px rgba(10,207,255,.28);
}
.chat-peer-name::before { content:'◤ '; color:var(--tac-cyan); font-size:.85em; }
.chat-peer-status { letter-spacing:.16em; color:var(--text3); }
.chat-action-btn, .self-edit-btn {
  border-radius:0 !important;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
}
.chat-action-btn:hover { border-color: var(--edge-cyan); color:var(--tac-cyan); background:rgba(10,207,255,.07); box-shadow:0 0 12px rgba(10,207,255,.15); }
.e2ee-badge {
  border-radius:0 !important; clip-path: var(--clip-sm);
  border-color: rgba(48,209,88,0.35); background: rgba(48,209,88,0.07);
  padding:2px 7px;
}

/* Tabs: squared + neon underline glow */
.chat-tab { border-radius:0 !important; }
.chat-tab.active { background:rgba(10,207,255,.06); border-color:rgba(10,207,255,.25); }
.chat-tab.active::before { background:var(--tac-cyan); box-shadow:0 0 10px rgba(10,207,255,.6); height:2px; }
.chat-tab-badge { border-radius:0; clip-path:polygon(0 0,100% 0,100% 100%,3px 100%,0 calc(100% - 3px)); }

/* ── Messages: comms blocks ── */
.msg-bubble {
  border-radius:0 !important;
  clip-path: var(--clip-sm);
  font-size:13.5px;
}
.msg-row.incoming .msg-bubble {
  border-color: rgba(10,207,255,0.16);
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.02));
  box-shadow: inset 2px 0 0 rgba(10,207,255,0.35), 0 6px 18px rgba(0,0,0,.3);
}
.msg-row.outgoing .msg-bubble {
  border-color: rgba(154,92,255,0.28);
  background: linear-gradient(180deg, rgba(154,92,255,0.14), rgba(154,92,255,0.05));
  box-shadow: inset -2px 0 0 rgba(154,92,255,0.45), 0 6px 18px rgba(0,0,0,.3);
}
.msg-sender { letter-spacing:.12em; }
.msg-row.incoming .msg-sender::before { content:'['; opacity:.5; }
.msg-row.incoming .msg-sender::after  { content:']'; opacity:.5; }
.msg-row.outgoing .msg-sender { color:var(--tac-violet); text-shadow:0 0 8px rgba(154,92,255,.35); }
.msg-row.outgoing .msg-sender::before { content:'['; opacity:.5; }
.msg-row.outgoing .msg-sender::after  { content:']'; opacity:.5; }
.msg-time { letter-spacing:.1em; }
.msg-time::before { content:'['; opacity:.4; }
.msg-time::after  { content:']'; opacity:.4; }
.msg-system { border-radius:0; clip-path:polygon(0 0,calc(100% - 8px) 0,100% 8px,100% 100%,8px 100%,0 calc(100% - 8px)); border-color:rgba(48,209,88,.2); color:rgba(48,209,88,.8); background:rgba(48,209,88,.04); letter-spacing:.14em; }

/* ── Composer: transmit deck ── */
.chat-input-bar {
  background: linear-gradient(180deg, rgba(8,13,22,0.97), rgba(4,7,12,0.99));
  border-top:1px solid rgba(10,207,255,0.18);
}
.chat-input {
  border-radius:0 !important; clip-path:var(--clip-sm);
  background: rgba(255,255,255,0.035);
  font-family:var(--font-mono); font-size:13px; caret-color:var(--tac-green);
}
.chat-input:focus {
  border-color: rgba(10,207,255,0.45);
  box-shadow: 0 0 0 1px rgba(10,207,255,0.18), inset 0 0 18px rgba(10,207,255,0.06);
}
.chat-send {
  background: linear-gradient(135deg,#9A5CFF,#6A2BEF) !important;
  border-radius:0 !important;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
  box-shadow: 0 0 20px rgba(154,92,255,.28), inset 0 1px 0 rgba(255,255,255,.18) !important;
  letter-spacing:.14em;
}
.chat-send:hover { filter:brightness(1.15); transform:none; }
.add-buddy-bar input, .add-room-bar input, .add-enclave-bar input {
  border-radius:0 !important; font-family:var(--font-mono);
}
.add-buddy-bar button, .add-room-bar button, .add-enclave-bar button {
  border-radius:0 !important; clip-path:var(--clip-sm);
}

/* ── Right panel: intel + phosphor terminal ── */
.rp-section { padding:14px 16px; }
.rp-header { letter-spacing:.16em; color:rgba(237,241,249,.42); }
.rp-encryption-key, .rp-pgp-fingerprint {
  border-radius:0 !important; clip-path:var(--clip-sm);
  border-color: rgba(48,209,88,0.2); background: rgba(48,209,88,0.05);
  box-shadow: inset 0 0 14px rgba(48,209,88,0.05);
}
.rp-enc-hash { color:var(--tac-green-hi); text-shadow:0 0 8px rgba(48,209,88,.35); }
.rp-pgp-hash { color:var(--tac-cyan); }
.rp-badge {
  border-radius:0; clip-path:polygon(0 0,calc(100% - 4px) 0,100% 4px,100% 100%,4px 100%,0 calc(100% - 4px));
  border-color:rgba(48,209,88,.35); color:var(--tac-green); background:rgba(48,209,88,.08);
  letter-spacing:.12em;
}
#rp-ai-terminal {
  background: linear-gradient(180deg, rgba(6,12,9,0.97), rgba(3,6,5,0.99));
  border-top:1px solid rgba(48,209,88,0.25);
}
#rp-ai-terminal .rp-header { color:var(--tac-green); text-shadow:0 0 10px rgba(48,209,88,.3); }
.rp-terminal-log {
  background: rgba(2,6,4,0.8);
  border:1px solid rgba(48,209,88,0.14);
  clip-path:var(--clip-sm);
  padding:8px 10px;
  font-size:10.5px;
}
.rp-terminal-msg.rp-system { color:rgba(125,255,176,.55); }
.rp-terminal-msg.rp-user   { color:#c8ffe2; }
.rp-terminal-msg.rp-ai     { color:var(--tac-green-hi); text-shadow:0 0 6px rgba(48,209,88,.25); }
.rp-terminal-msg.rp-error  { color:var(--tac-red); text-shadow:0 0 6px rgba(255,69,58,.3); }
.rp-terminal-prompt { text-shadow:0 0 8px rgba(48,209,88,.5); }
.rp-terminal-input { caret-color:var(--tac-green); }
.rp-member-dot { border-radius:0; width:6px; height:6px; transform:rotate(45deg); }

/* Context menu / modals / ws chips */
.cyph-context-menu, .cyph-modal-card {
  border-radius:0 !important;
  clip-path: var(--clip-lg);
  backdrop-filter: blur(22px) saturate(1.2);
}
.cyph-modal-card { border-color: rgba(10,207,255,0.2); }
.ws-status { border-radius:0; clip-path:var(--clip-sm); letter-spacing:.14em; }

/* Empty state: target ring */
.empty-chat::before {
  text-shadow: 0 0 30px rgba(10,207,255,.35), 0 0 60px rgba(154,92,255,.2);
  letter-spacing:.22em;
}
.empty-chat::after { color:rgba(48,209,88,.55); letter-spacing:.18em; }
.empty-chat {
  background:
    radial-gradient(circle at 50% 42%, transparent 118px, rgba(10,207,255,0.05) 119px, transparent 121px),
    radial-gradient(circle at 50% 42%, transparent 148px, rgba(154,92,255,0.04) 149px, transparent 151px),
    radial-gradient(ellipse 55% 40% at 50% 42%, rgba(154,92,255,0.07), transparent 70%);
}

/* Auth card (index.html): clipped vault with scanning top line */
.auth-card {
  border-radius:0 !important;
  clip-path: var(--clip-lg);
  border-color: rgba(10,207,255,0.16);
}
.auth-card::before {
  background: linear-gradient(90deg, transparent, var(--tac-cyan), var(--tac-violet), transparent);
  height:2px; opacity:.9;
  animation: tacAuthScan 3.2s ease-in-out infinite;
}
@keyframes tacAuthScan { 0%,100%{transform:translateX(-30%)} 50%{transform:translateX(30%)} }
.auth-btn:not(.nucleus-btn) {
  border-radius:0 !important;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%) !important;
  background: linear-gradient(135deg,#9A5CFF,#6A2BEF) !important;
}
.auth-field input { border-radius:0 !important; clip-path:var(--clip-sm); font-family:var(--font-mono); }
.auth-tab.active { border-bottom-color: var(--tac-green); text-shadow:0 0 10px rgba(48,209,88,.4); }

/* Scrollbars: square cyan */
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-thumb { background:rgba(10,207,255,0.16); border-radius:0; }
::-webkit-scrollbar-thumb:hover { background:rgba(10,207,255,0.3); }

/* Focus rings stay cyan, squared */
:focus-visible { outline-offset:1px; }

@media (max-width:900px){
  html::before { display:none; }
}

/* ════════════════════════════════════════════════════════════════
   CYPH.27 — SPECTRUM v1: IRC LOG LINES + FREQUENCY SCANNER
   ════════════════════════════════════════════════════════════════ */

/* ── IRC log mode ── */
.msg-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  padding: 1px 2px;
  border-radius: 0;
  animation: msgFadeIn 0.15s ease;
}
.msg-line-time {
  color: var(--text3);
  font-size: 10px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  opacity: 0.75;
}
.msg-line-nick { flex-shrink: 0; font-weight: 700; letter-spacing: 0.02em; }
.msg-line-nick--clickable { cursor: pointer; }
.msg-line-nick--clickable:hover { text-decoration: underline; text-shadow: 0 0 8px currentColor; }
.msg-line-text { color: rgba(245,243,247,0.82); word-break: break-word; min-width: 0; }
.msg-line.outgoing .msg-line-text { color: rgba(213,196,255,0.9); }
.msg-line.outgoing .msg-line-time { color: rgba(154,92,255,0.5); }
.msg-line-action {
  color: var(--tac-green-hi);
  font-style: italic;
  opacity: 0.85;
  word-break: break-word;
  text-shadow: 0 0 8px rgba(48,209,88,0.18);
}
.msg-line-system .msg-line-sys {
  color: rgba(48,209,88,0.62);
  font-size: 11px;
  letter-spacing: 0.08em;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Nick colors inside log lines (mirror .c0-.c11 palette) */
.msg-line .c0 { color:#FF6B6B; } .msg-line .c1 { color:#FECA57; }
.msg-line .c2 { color:#48DBFB; } .msg-line .c3 { color:#FF9FF3; }
.msg-line .c4 { color:#54A0FF; } .msg-line .c5 { color:#1DD1A1; }
.msg-line .c6 { color:#F368E0; } .msg-line .c7 { color:#FF9F43; }
.msg-line .c8 { color:#00D2D3; } .msg-line .c9 { color:#C56CF0; }
.msg-line .c10 { color:#7EFFB2; } .msg-line .c11 { color:#FDA7DF; }

/* LOG / COMMS header toggle — wider than square icon buttons */
#log-mode-btn {
  width: auto !important;
  min-width: 28px;
  padding: 0 9px !important;
  font-family: var(--font-mono) !important;
  font-size: 9px !important;
  letter-spacing: 0.12em;
  font-weight: 700;
}
#log-mode-btn.log-on {
  color: var(--tac-green);
  border-color: rgba(48,209,88,0.35);
  background: rgba(48,209,88,0.07);
}
#log-mode-btn.log-on:hover { box-shadow: 0 0 12px rgba(48,209,88,0.2); }

/* Sidebar SCAN + spectrum toggle buttons */
.bar-side-btn {
  background: rgba(10,207,255,0.06);
  border: 1px solid rgba(10,207,255,0.28);
  color: var(--tac-cyan);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 6px 9px;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  transition: background 180ms var(--ease), box-shadow 180ms var(--ease), color 180ms var(--ease);
  flex-shrink: 0;
}
.bar-side-btn:hover {
  background: rgba(10,207,255,0.14);
  box-shadow: 0 0 14px rgba(10,207,255,0.22);
}
#create-room-public[aria-pressed="true"] {
  color: var(--tac-green);
  border-color: rgba(48,209,88,0.45);
  background: rgba(48,209,88,0.12);
  box-shadow: 0 0 12px rgba(48,209,88,0.2);
}

/* ── Spectrum scanner modal ── */
#spectrum-modal {
  position: fixed;
  inset: 0;
  z-index: 8500;
  background: rgba(1,3,5,0.72);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#spectrum-modal[hidden] { display: none; }

.spectrum-card {
  width: 100%;
  max-width: 520px;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(10,16,26,0.97), rgba(5,8,14,0.99));
  border: 1px solid rgba(10,207,255,0.22);
  clip-path: var(--clip-lg);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 40px rgba(10,207,255,0.07), inset 0 1px 0 rgba(255,255,255,0.05);
}
.spectrum-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(10,207,255,0.16);
  background: linear-gradient(90deg, rgba(10,207,255,0.06), transparent 70%);
}
.spectrum-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--tac-cyan);
  text-shadow: 0 0 12px rgba(10,207,255,0.35);
}
.spectrum-sub {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.16em;
  color: var(--text3);
}
.spectrum-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 16px 8px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,0.09);
  clip-path: var(--clip-sm);
  background: rgba(255,255,255,0.035);
}
.spectrum-input-wrap:focus-within {
  border-color: rgba(10,207,255,0.42);
  box-shadow: inset 0 0 16px rgba(10,207,255,0.05);
}
.spectrum-input-wrap .prompt { color: var(--tac-cyan); font-weight: 700; }
.spectrum-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  height: 38px;
}
.spectrum-results {
  overflow-y: auto;
  min-height: 180px;
  margin: 4px 16px 8px;
  position: relative;
}
.spectrum-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-left: 2px solid transparent;
  color: var(--text);
  font-family: var(--font-mono);
  padding: 9px 12px;
  cursor: pointer;
  transition: background 140ms var(--ease), border-color 140ms var(--ease);
}
.spectrum-row:hover, .spectrum-row:focus-visible {
  background: rgba(10,207,255,0.06);
  border-left-color: var(--edge-cyan);
  outline: none;
}
.spectrum-freq {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--tac-cyan);
  text-shadow: 0 0 8px rgba(10,207,255,0.25);
  white-space: nowrap;
}
.spectrum-ops {
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--text3);
  flex-shrink: 0;
}
.spectrum-topic {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spectrum-tuned {
  font-size: 8px;
  letter-spacing: 0.14em;
  color: var(--tac-green);
  border: 1px solid rgba(48,209,88,0.3);
  padding: 1px 5px;
  flex-shrink: 0;
}
.spectrum-empty {
  text-align: center;
  padding: 44px 20px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  line-height: 1.8;
  color: var(--text3);
}
.spectrum-scanline {
  position: absolute;
  left: 0; right: 0;
  height: 46px;
  top: -46px;
  background: linear-gradient(180deg, transparent, rgba(10,207,255,0.09), transparent);
  animation: specSweep 1.1s ease-in-out infinite;
  pointer-events: none;
}
@keyframes specSweep { to { transform: translateY(calc(100% + 300px)); } }
.spectrum-foot {
  display: flex;
  gap: 16px;
  justify-content: center;
  padding: 9px 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.05);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  color: var(--text3);
}
.spectrum-foot kbd {
  border: 1px solid rgba(255,255,255,0.12);
  padding: 1px 4px;
  font-family: inherit;
}

@media (max-width: 640px) {
  #spectrum-modal { padding: 10px; align-items: stretch; }
  .spectrum-card { max-height: 92vh; }
}

/* ════════════════ COMPOSER MEDIA v1 (emoji + gif) ════════════════ */
.composer-media-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text2);
  width: 34px; height: 38px;
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  transition: color 140ms var(--ease), border-color 140ms var(--ease), background 140ms var(--ease);
}
.composer-media-btn:hover {
  color: var(--tac-cyan);
  border-color: rgba(10,207,255,0.35);
  background: rgba(10,207,255,0.07);
}

/* Emoji popup — floats above composer */
.chat-input-bar { position: relative; }
#emoji-pop {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 10px;
  z-index: 8000;
  display: grid;
  grid-template-columns: repeat(12, 30px);
  gap: 2px;
  padding: 8px;
  background: linear-gradient(180deg, rgba(12,18,28,0.98), rgba(6,9,16,0.99));
  border: 1px solid rgba(10,207,255,0.2);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  box-shadow: 0 18px 44px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.05);
}
#emoji-pop[hidden] { display: none; }
.emoji-cell {
  background: transparent;
  border: none;
  font-size: 17px;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
  transition: transform 120ms var(--ease), background 120ms var(--ease);
}
.emoji-cell:hover { background: rgba(10,207,255,0.12); transform: scale(1.25); }

/* GIF modal — spectrum-card sibling */
#gif-modal {
  position: fixed; inset: 0; z-index: 8500;
  background: rgba(1,3,5,0.72);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
#gif-modal[hidden] { display: none; }
.gif-card {
  width: 100%; max-width: 560px; max-height: 80vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(10,16,26,0.97), rgba(5,8,14,0.99));
  border: 1px solid rgba(154,92,255,0.22);
  clip-path: var(--clip-lg);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 40px rgba(154,92,255,0.07), inset 0 1px 0 rgba(255,255,255,0.05);
}
.gif-head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(154,92,255,0.18);
  background: linear-gradient(90deg, rgba(154,92,255,0.07), transparent 70%);
}
.gif-title {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  letter-spacing: 0.18em; color: var(--tac-violet);
  text-shadow: 0 0 12px rgba(154,92,255,0.35);
}
.gif-sub { flex: 1; font-family: var(--font-mono); font-size: 7.5px; letter-spacing: 0.16em; color: var(--text3); }
.gif-input-wrap {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 16px 8px; padding: 0 12px;
  border: 1px solid rgba(255,255,255,0.09);
  clip-path: var(--clip-sm);
  background: rgba(255,255,255,0.035);
}
.gif-input-wrap:focus-within { border-color: rgba(154,92,255,0.42); box-shadow: inset 0 0 16px rgba(154,92,255,0.05); }
.gif-input-wrap .prompt { color: var(--tac-violet); font-weight: 700; }
.gif-input-wrap input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-family: var(--font-mono); font-size: 13px; height: 38px;
}
.gif-results {
  overflow-y: auto; min-height: 200px;
  margin: 4px 16px 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px;
  position: relative;
}
.gif-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 0; cursor: pointer; overflow: hidden;
  aspect-ratio: 16 / 10;
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease), transform 140ms var(--ease);
}
.gif-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gif-item:hover {
  border-color: rgba(154,92,255,0.45);
  box-shadow: 0 0 14px rgba(154,92,255,0.22);
  transform: translateY(-1px);
}
.gif-foot {
  display: flex; gap: 16px; justify-content: center;
  padding: 9px 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.05);
  font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 0.1em; color: var(--text3);
}
.gif-foot kbd { border: 1px solid rgba(255,255,255,0.12); padding: 1px 4px; font-family: inherit; }

/* Embedded gif/images inside messages */
.msg-line--media { flex-wrap: wrap; }
.msg-media-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tac-cyan);
  opacity: 0.75;
}
.msg-line-img, .msg-bubble-img {
  max-width: 240px;
  max-height: 180px;
  object-fit: cover;
  display: block;
  border: 1px solid rgba(10,207,255,0.22);
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  cursor: zoom-in;
  background: #04070c;
}
.msg-bubble-img { margin-top: 8px; }
@media (max-width: 640px) {
  #gif-modal { padding: 10px; align-items: stretch; }
  .gif-card { max-height: 92vh; }
  .composer-media-btn { width: 30px; }
}

/* ════════════════ N27 CUSTOM EMOJI v1 ════════════════ */
.emoji-brand-label {
  grid-column: 1 / -1;
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.2em;
  color: var(--text3);
  padding: 4px 2px 1px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 2px;
}
.emoji-cell.emoji-custom img {
  width: 20px;
  height: 20px;
  display: block;
}
.emoji-cell.emoji-custom:hover { background: rgba(154,92,255,0.14); }
.custom-emoji {
  width: 20px;
  height: 20px;
  vertical-align: -4px;
  display: inline-block;
  margin: 0 1px;
}
.msg-line .custom-emoji { width: 18px; height: 18px; vertical-align: -3px; }

/* ════════════════ COMPOSER MIRROR (live N27 emoji in send bar) ════════════════ */
.chat-input-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
}
.chat-input-mirror {
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: 13px 16px;
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  white-space: pre;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}
.chat-input {
  position: relative;
  z-index: 2;
  background: transparent !important;
  color: transparent !important;
  caret-color: var(--text);
}
.composer-emoji {
  width: 18px;
  height: 18px;
  vertical-align: -4px;
  display: inline-block;
  margin: 0 1px;
}

/* ════════════════════════════════════════════════════════════════
   CYPH.27 — AAA HACKER FINAL v1 (SEPTEMBER LAUNCH)
   Phosphor-terminal identity: green/cyan duotone on obsidian glass,
   mono-first typography, CRT scanlines, clipped panels, LED status.
   FULLY SUPERSEDES TACTICAL v2 + cyph-frontier — scoped to
   body.cyph-shell (app) + .auth-wrap (index) so cyph-embed (inbox
   Team Chat) stays untouched.
   ════════════════════════════════════════════════════════════════ */

:root {
  --hack-bg: #010302;
  --hack-phos: #33F28C;
  --hack-phos-hi: #7FFFC4;
  --hack-phos-dim: #18C56E;
  --hack-cyan: #0ACFFF;
  --hack-violet: #9A5CFF;
  --hack-red: #FF453A;
  --hack-amber: #FFD60A;
  --hack-panel: rgba(5, 10, 7, 0.88);
  --hack-panel-strong: rgba(3, 6, 4, 0.97);
  --hack-glass: rgba(7, 13, 9, 0.72);
  --hack-line: rgba(51, 242, 140, 0.10);
  --hack-line-strong: rgba(51, 242, 140, 0.20);
  --hack-line-cyan: rgba(10, 207, 255, 0.18);
  --hack-text: #E9FFF3;
  --hack-text2: rgba(233, 255, 243, 0.62);
  --hack-text3: rgba(233, 255, 243, 0.36);
  --hack-glow: 0 0 16px rgba(51, 242, 140, 0.22);
  --hack-glow-soft: 0 0 34px rgba(51, 242, 140, 0.07);
  --hack-clip-sm: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 7px 100%, 0 calc(100% - 7px));
  --hack-clip-lg: polygon(0 0, calc(100% - 13px) 0, 100% 13px, 100% 100%, 13px 100%, 0 calc(100% - 13px));
}

::selection { background: rgba(51, 242, 140, 0.30); color: #01220f; }

/* ── Atmosphere: obsidian + phosphor radial + CRT sets ── */
body.cyph-shell {
  background:
    radial-gradient(ellipse 70% 44% at 50% -10%, rgba(51, 242, 140, 0.085), transparent 60%),
    radial-gradient(ellipse 40% 30% at 90% 14%, rgba(10, 207, 255, 0.055), transparent 56%),
    radial-gradient(ellipse 36% 28% at 4% 78%, rgba(154, 92, 255, 0.035), transparent 55%),
    radial-gradient(ellipse 92% 58% at 50% 114%, rgba(0, 0, 0, 0.92), transparent 55%),
    var(--hack-bg);
  color: var(--hack-text);
}
body.cyph-shell::before {
  background:
    linear-gradient(rgba(51, 242, 140, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(51, 242, 140, 0.028) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.5;
  mask-image: radial-gradient(ellipse 75% 62% at 50% 36%, #000 26%, transparent 80%);
}
body.cyph-shell::after {
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(51, 242, 140, 0.028) 3px);
}
html::before {
  background: linear-gradient(180deg, transparent, rgba(51, 242, 140, 0.045), transparent);
  animation: tacRefreshSweep 10s linear infinite;
}
.body-cyph-wrap { min-height: 100vh; }

/* ── Panels: phosphor-black glass, clipped, hairline green ── */
body.cyph-shell .sidebar,
body.cyph-shell .main-chat,
body.cyph-shell .right-panel {
  background: var(--hack-panel);
  border: 1px solid var(--hack-line);
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(51, 242, 140, 0.06);
}
body.cyph-shell .right-panel {
  box-shadow: var(--shadow-md), inset 1px 1px 0 rgba(51, 242, 140, 0.05);
}
body.cyph-shell .sidebar::before,
body.cyph-shell .main-chat::before {
  border-top-color: var(--hack-line-strong);
  border-left-color: var(--hack-line-strong);
}
body.cyph-shell .sidebar::after,
body.cyph-shell .main-chat::after {
  border-bottom-color: var(--hack-line-strong);
  border-right-color: var(--hack-line-strong);
}

/* ── Sidebar ── */
body.cyph-shell .sidebar-header {
  background:
    linear-gradient(90deg, rgba(51, 242, 140, 0.07), transparent 65%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
  border-bottom: 1px solid rgba(51, 242, 140, 0.16);
}
body.cyph-shell .sidebar-header::after {
  content: '● SOVEREIGN ENCLAVE · E2EE';
  color: rgba(51, 242, 140, 0.55);
  animation: tacLed 2.4s ease-in-out infinite;
}
body.cyph-shell .sidebar-logo {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--hack-text);
  text-shadow: 0 0 16px rgba(51, 242, 140, 0.35);
  transition: transform 180ms var(--ease);
}
body.cyph-shell .sidebar-logo:hover {
  animation: hackGlitchHover 0.35s steps(3) 1;
}
@keyframes hackGlitchHover {
  0% { transform: translateX(0); }
  33% { transform: translateX(1px) skewX(-3deg); }
  66% { transform: translateX(-1px) skewX(2deg); }
  100% { transform: none; }
}
body.cyph-shell .sidebar-network {
  color: var(--hack-text3);
  letter-spacing: 0.2em;
}
body.cyph-shell .cyph-logo--sm {
  filter: drop-shadow(0 0 12px rgba(51, 242, 140, 0.22));
}

body.cyph-shell .self-profile {
  border-color: rgba(51, 242, 140, 0.14);
  background: linear-gradient(180deg, rgba(51, 242, 140, 0.045), rgba(255, 255, 255, 0.015));
  box-shadow: inset 0 1px 0 rgba(51, 242, 140, 0.06);
}
body.cyph-shell .self-name { font-family: var(--font-mono); font-size: 12.5px; font-weight: 700; }
body.cyph-shell .self-status { color: var(--hack-text3); letter-spacing: 0.08em; }
body.cyph-shell .self-edit-btn:hover { color: var(--hack-phos); }

body.cyph-shell .sidebar-nav-tabs {
  border-bottom: 1px solid rgba(51, 242, 140, 0.10);
}
body.cyph-shell .sidebar-nav-tab {
  color: var(--hack-text3);
}
body.cyph-shell .sidebar-nav-tab:hover { color: var(--hack-text2); }
body.cyph-shell .sidebar-nav-tab.active {
  color: var(--hack-phos);
  border-bottom-color: var(--hack-phos);
  text-shadow: 0 0 14px rgba(51, 242, 140, 0.4);
  font-weight: 700;
}

body.cyph-shell .section-label {
  color: var(--hack-text3);
  border-bottom: 1px solid rgba(51, 242, 140, 0.08);
  letter-spacing: 0.2em;
}
body.cyph-shell .section-label::before { color: var(--hack-phos); }

body.cyph-shell .buddy-item,
body.cyph-shell .room-item,
body.cyph-shell .enclave-item,
body.cyph-shell .relay-item {
  border-radius: 0;
}
body.cyph-shell .buddy-item:hover,
body.cyph-shell .room-item:hover,
body.cyph-shell .enclave-item:hover,
body.cyph-shell .relay-item:hover {
  background: rgba(51, 242, 140, 0.05);
  border-left-color: rgba(51, 242, 140, 0.32);
  transform: none;
}
body.cyph-shell .buddy-item.active,
body.cyph-shell .room-item.active,
body.cyph-shell .enclave-item.active,
body.cyph-shell .relay-item.active {
  background: linear-gradient(90deg, rgba(51, 242, 140, 0.13), rgba(10, 207, 255, 0.045));
  border-left-color: var(--hack-phos);
  box-shadow: inset 2px 0 0 rgba(51, 242, 140, 0.55), 0 0 16px rgba(51, 242, 140, 0.08);
}
body.cyph-shell .buddy-name,
body.cyph-shell .room-name { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.04em; }
body.cyph-shell .buddy-node,
body.cyph-shell .room-slug { color: var(--hack-text3); letter-spacing: 0.06em; }
body.cyph-shell .buddy-menu-btn:hover { color: var(--hack-phos); }
body.cyph-shell .room-hash { color: var(--hack-phos); text-shadow: var(--hack-glow); }
body.cyph-shell .enclave-icon { color: var(--hack-phos); }
body.cyph-shell .relay-prefix.uplink { color: var(--hack-phos); }
body.cyph-shell .relay-ephemeral {
  color: var(--hack-phos);
  background: rgba(51, 242, 140, 0.08);
}
body.cyph-shell .add-buddy-bar,
body.cyph-shell .add-room-bar,
body.cyph-shell .add-enclave-bar {
  border-color: rgba(51, 242, 140, 0.10);
}
body.cyph-shell .add-buddy-bar input,
body.cyph-shell .add-room-bar input,
body.cyph-shell .add-enclave-bar input,
body.cyph-shell .join-room-bar input {
  background: rgba(51, 242, 140, 0.035);
  border-color: var(--hack-line);
  font-family: var(--font-mono);
  font-size: 10px;
}
body.cyph-shell .add-buddy-bar input:focus,
body.cyph-shell .add-room-bar input:focus,
body.cyph-shell .add-enclave-bar input:focus,
body.cyph-shell .join-room-bar input:focus {
  border-color: rgba(51, 242, 140, 0.4);
  box-shadow: 0 0 12px rgba(51, 242, 140, 0.08);
}
body.cyph-shell .add-buddy-bar button,
body.cyph-shell .add-room-bar button,
body.cyph-shell .add-enclave-bar button {
  background: rgba(51, 242, 140, 0.06);
  border-color: var(--hack-line);
  color: var(--hack-text2);
}
body.cyph-shell .add-buddy-bar button:hover,
body.cyph-shell .add-room-bar button:hover,
body.cyph-shell .add-enclave-bar button:hover {
  color: var(--hack-phos);
  border-color: rgba(51, 242, 140, 0.4);
}

body.cyph-shell .avatar {
  background: rgba(51, 242, 140, 0.05);
  border: 1px solid var(--hack-line);
  color: var(--hack-phos);
  font-family: var(--font-mono);
}
body.cyph-shell .avatar--clickable:hover {
  box-shadow: 0 0 0 2px rgba(51, 242, 140, 0.35);
}
body.cyph-shell .status-dot.online {
  background: var(--hack-phos);
  box-shadow: 0 0 8px rgba(51, 242, 140, 0.7);
}
body.cyph-shell .status-dot.away { background: var(--hack-amber); }
body.cyph-shell .status-dot.busy { background: var(--hack-red); box-shadow: 0 0 8px rgba(255, 69, 58, 0.6); }

/* ── Chat chrome ── */
body.cyph-shell .chat-tab-bar {
  background: var(--hack-glass);
  border-bottom: 1px solid rgba(51, 242, 140, 0.12);
}
body.cyph-shell .chat-tab {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--hack-text3);
}
body.cyph-shell .chat-tab:hover {
  color: var(--hack-text2);
  background: rgba(51, 242, 140, 0.045);
}
body.cyph-shell .chat-tab.active {
  background: rgba(51, 242, 140, 0.07);
  border-color: rgba(51, 242, 140, 0.25);
  color: var(--hack-phos);
}
body.cyph-shell .chat-tab.active::before {
  background: var(--hack-phos);
  box-shadow: 0 0 10px rgba(51, 242, 140, 0.6);
}
body.cyph-shell .chat-tab.active .chat-tab-icon { color: var(--hack-phos); }
body.cyph-shell .chat-tab.has-unread .chat-tab-label { color: var(--hack-phos-hi); }
body.cyph-shell .chat-tab-badge {
  background: var(--hack-phos);
  color: #01220f;
  box-shadow: 0 0 10px rgba(51, 242, 140, 0.5);
}
body.cyph-shell .chat-tab-add:hover { color: var(--hack-phos); }
body.cyph-shell .chat-tab-close:hover { color: var(--hack-red); }
body.cyph-shell .chat-tab-label { font-family: var(--font-mono); }

body.cyph-shell .chat-header {
  background: linear-gradient(180deg, rgba(8, 14, 10, 0.96), rgba(4, 7, 5, 0.98));
  border-bottom: 1px solid rgba(51, 242, 140, 0.18);
  box-shadow: 0 1px 0 rgba(51, 242, 140, 0.06) inset, 0 10px 30px rgba(0, 0, 0, 0.4);
}
body.cyph-shell .chat-peer-name {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--hack-text);
  text-shadow: 0 0 18px rgba(51, 242, 140, 0.28);
}
body.cyph-shell .chat-peer-name::before { content: '◤ '; color: var(--hack-phos); font-size: 0.85em; }
body.cyph-shell .chat-peer-status {
  color: var(--hack-text3);
  letter-spacing: 0.16em;
}
body.cyph-shell .chat-action-btn,
body.cyph-shell .self-edit-btn {
  background: rgba(51, 242, 140, 0.025);
  border-color: var(--hack-line);
  color: var(--hack-text2);
}
body.cyph-shell .chat-action-btn:hover,
body.cyph-shell .self-edit-btn:hover {
  color: var(--hack-phos);
  border-color: rgba(51, 242, 140, 0.38);
  background: rgba(51, 242, 140, 0.07);
}
body.cyph-shell .chat-action-btn.danger:hover {
  color: var(--hack-red);
  border-color: rgba(255, 69, 58, 0.4);
}
body.cyph-shell .e2ee-badge {
  border: 1px solid rgba(51, 242, 140, 0.35);
  background: rgba(51, 242, 140, 0.06);
}

/* ── Messages: terminal log blocks ── */
body.cyph-shell .messages {
  background:
    radial-gradient(ellipse 58% 32% at 50% 0%, rgba(51, 242, 140, 0.045), transparent 70%),
    linear-gradient(rgba(51, 242, 140, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(51, 242, 140, 0.012) 1px, transparent 1px);
  background-size: auto, 40px 40px, 40px 40px;
}
body.cyph-shell .msg-main { max-width: 84%; }
body.cyph-shell .msg-sender,
body.cyph-shell .msg-time {
  font-family: var(--font-mono);
}
body.cyph-shell .msg-sender {
  font-size: 10px;
  letter-spacing: 0.12em;
}
body.cyph-shell .msg-sender--clickable:hover { border-bottom-color: var(--hack-phos); }
body.cyph-shell .msg-time {
  font-size: 9px;
  color: var(--hack-text3);
}
body.cyph-shell .msg-time::before { content: '['; opacity: 0.35; }
body.cyph-shell .msg-time::after { content: ']'; opacity: 0.35; }
body.cyph-shell .msg-bubble {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
}
body.cyph-shell .msg-row.incoming .msg-bubble {
  border-color: rgba(51, 242, 140, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.018));
  box-shadow: inset 2px 0 0 rgba(51, 242, 140, 0.35), 0 6px 18px rgba(0, 0, 0, 0.3);
  color: var(--hack-text);
}
body.cyph-shell .msg-row.outgoing .msg-bubble {
  border-color: rgba(51, 242, 140, 0.30);
  background: linear-gradient(180deg, rgba(51, 242, 140, 0.10), rgba(51, 242, 140, 0.03));
  box-shadow: inset -2px 0 0 rgba(51, 242, 140, 0.45), 0 6px 18px rgba(0, 0, 0, 0.3);
  color: var(--hack-phos-hi);
}
body.cyph-shell .msg-row.outgoing .msg-sender { color: var(--hack-phos); text-shadow: var(--hack-glow); }
body.cyph-shell .msg-row.incoming .msg-sender { color: var(--hack-cyan); }
body.cyph-shell .msg-system {
  border-color: rgba(51, 242, 140, 0.22);
  color: rgba(51, 242, 140, 0.8);
  background: rgba(51, 242, 140, 0.04);
  font-family: var(--font-mono);
  letter-spacing: 0.18em;
}
body.cyph-shell .msg-line-time { color: rgba(51, 242, 140, 0.5); }
body.cyph-shell .msg-line { font-size: 12.5px; }

/* ── Composer ── */
body.cyph-shell .chat-input-bar {
  background: linear-gradient(180deg, rgba(8, 13, 10, 0.97), rgba(3, 6, 4, 0.99));
  border-top: 1px solid rgba(51, 242, 140, 0.18);
}
body.cyph-shell .chat-input,
body.cyph-shell .chat-input-mirror {
  font-family: var(--font-mono);
  font-size: 13px;
}
body.cyph-shell .chat-input {
  background: rgba(51, 242, 140, 0.03);
  border-color: var(--hack-line);
  caret-color: var(--hack-phos);
}
body.cyph-shell .chat-input::placeholder {
  color: rgba(51, 242, 140, 0.4);
  letter-spacing: 0.22em;
}
body.cyph-shell .chat-input:focus {
  border-color: rgba(51, 242, 140, 0.42);
  box-shadow: 0 0 0 1px rgba(51, 242, 140, 0.14), inset 0 0 18px rgba(51, 242, 140, 0.05);
}
body.cyph-shell .chat-send {
  background: linear-gradient(135deg, #35F08C, #12C46C) !important;
  border-color: rgba(51, 242, 140, 0.0) !important;
  color: #01220f !important;
  font-weight: 800 !important;
  box-shadow: 0 8px 20px rgba(51, 242, 140, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
}
body.cyph-shell .chat-send:hover {
  background: linear-gradient(135deg, #4FFFA1, #17D870) !important;
  box-shadow: 0 12px 28px rgba(51, 242, 140, 0.3) !important;
  color: #01180c !important;
}
body.cyph-shell .composer-media-btn {
  border-color: var(--hack-line);
  background: rgba(51, 242, 140, 0.03);
  color: var(--hack-text2);
}
body.cyph-shell .composer-media-btn:hover {
  color: var(--hack-phos);
  border-color: rgba(51, 242, 140, 0.38);
  background: rgba(51, 242, 140, 0.07);
}

/* ── Right panel ── */
body.cyph-shell .rp-header {
  color: rgba(233, 255, 243, 0.4);
  letter-spacing: 0.18em;
}
body.cyph-shell .rp-badge {
  color: var(--hack-phos);
  background: rgba(51, 242, 140, 0.08);
  border-color: rgba(51, 242, 140, 0.35);
}
body.cyph-shell .rp-room-name {
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
body.cyph-shell .rp-encryption-key,
body.cyph-shell .rp-pgp-fingerprint {
  border-color: rgba(51, 242, 140, 0.2);
  background: rgba(51, 242, 140, 0.045);
  box-shadow: inset 0 0 14px rgba(51, 242, 140, 0.04);
}
body.cyph-shell .rp-enc-hash {
  color: var(--hack-phos-hi);
  text-shadow: 0 0 8px rgba(51, 242, 140, 0.35);
}
body.cyph-shell .rp-pgp-hash { color: var(--hack-cyan); }
body.cyph-shell .rp-member-name { font-family: var(--font-mono); }
body.cyph-shell .rp-member-dot.online { background: var(--hack-phos); box-shadow: 0 0 6px rgba(51, 242, 140, 0.6); }
body.cyph-shell .rp-member-dot.away { background: var(--hack-amber); }
body.cyph-shell .rp-member-dot.offline { background: rgba(233, 255, 243, 0.25); }

/* AI terminal = phosphor CRT */
body.cyph-shell #rp-ai-terminal {
  background: linear-gradient(180deg, rgba(4, 9, 6, 0.97), rgba(1, 4, 2, 0.99));
  border-top: 1px solid rgba(51, 242, 140, 0.28);
}
body.cyph-shell #rp-ai-terminal::before {
  content: 'MIKUOS CORE ▮ AI GATEWAY';
  position: absolute;
  top: 6px;
  right: 14px;
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.22em;
  color: rgba(51, 242, 140, 0.28);
  pointer-events: none;
}
body.cyph-shell #rp-ai-terminal .rp-header {
  color: var(--hack-phos);
  text-shadow: 0 0 10px rgba(51, 242, 140, 0.35);
}
body.cyph-shell .rp-terminal-log {
  background: rgba(1, 7, 3, 0.86);
  border: 1px solid rgba(51, 242, 140, 0.16);
  font-size: 10.5px;
}
body.cyph-shell .rp-terminal-msg.rp-system { color: rgba(127, 255, 196, 0.5); }
body.cyph-shell .rp-terminal-msg.rp-user { color: #D9FFEC; }
body.cyph-shell .rp-terminal-msg.rp-ai { color: var(--hack-phos-hi); text-shadow: 0 0 6px rgba(51, 242, 140, 0.3); }
body.cyph-shell .rp-terminal-msg.rp-error { color: var(--hack-red); text-shadow: 0 0 6px rgba(255, 69, 58, 0.3); }
body.cyph-shell .rp-terminal-prompt { text-shadow: 0 0 8px rgba(51, 242, 140, 0.6); color: var(--hack-phos); }
body.cyph-shell .rp-terminal-input { caret-color: var(--hack-phos); color: var(--hack-text); }

/* ── Modals: palette / spectrum / gif / profile ── */
body.cyph-shell .cyph-modal-card,
body.cyph-shell #command-palette .command-palette-card,
body.cyph-shell .spectrum-card,
body.cyph-shell .gif-card {
  border-color: rgba(51, 242, 140, 0.22);
  background: linear-gradient(180deg, rgba(8, 14, 10, 0.97), rgba(3, 6, 4, 0.99));
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 40px rgba(51, 242, 140, 0.06), inset 0 1px 0 rgba(51, 242, 140, 0.08);
}
body.cyph-shell .cyph-modal-header {
  border-bottom-color: rgba(51, 242, 140, 0.12);
  font-family: var(--font-mono);
  letter-spacing: 0.18em;
}
body.cyph-shell .cyph-modal-close:hover { color: var(--hack-phos); }
body.cyph-shell .cyph-modal-footer { background: rgba(51, 242, 140, 0.025); border-top-color: rgba(51, 242, 140, 0.1); }
body.cyph-shell .profile-btn--primary {
  background: linear-gradient(135deg, #35F08C, #12C46C);
  border-color: transparent;
  color: #01220f;
}
body.cyph-shell .profile-btn--primary:hover { background: linear-gradient(135deg, #4FFFA1, #17D870); }
body.cyph-shell .profile-field input:focus,
body.cyph-shell .profile-field select:focus {
  border-color: rgba(51, 242, 140, 0.45);
}
body.cyph-shell .profile-field input,
body.cyph-shell .profile-field select { font-family: var(--font-mono); }
body.cyph-shell .profile-error { color: var(--hack-red); }

body.cyph-shell .spectrum-title {
  color: var(--hack-phos);
  text-shadow: 0 0 12px rgba(51, 242, 140, 0.35);
}
body.cyph-shell .spectrum-head {
  border-bottom-color: rgba(51, 242, 140, 0.16);
  background: linear-gradient(90deg, rgba(51, 242, 140, 0.06), transparent 70%);
}
body.cyph-shell .spectrum-input-wrap {
  border-color: var(--hack-line);
  background: rgba(51, 242, 140, 0.03);
}
body.cyph-shell .spectrum-input-wrap:focus-within {
  border-color: rgba(51, 242, 140, 0.42);
}
body.cyph-shell .spectrum-input-wrap .prompt { color: var(--hack-phos); }
body.cyph-shell .spectrum-row:hover,
body.cyph-shell .spectrum-row:focus-visible {
  background: rgba(51, 242, 140, 0.06);
  border-left-color: rgba(51, 242, 140, 0.4);
}
body.cyph-shell .spectrum-freq {
  color: var(--hack-phos);
  text-shadow: 0 0 8px rgba(51, 242, 140, 0.25);
}
body.cyph-shell .spectrum-tuned {
  color: var(--hack-phos);
  border-color: rgba(51, 242, 140, 0.3);
}
body.cyph-shell .spectrum-scanline {
  background: linear-gradient(180deg, transparent, rgba(51, 242, 140, 0.1), transparent);
}
body.cyph-shell .spectrum-empty { font-family: var(--font-mono); letter-spacing: 0.16em; }

body.cyph-shell #gif-modal .gif-head {
  border-bottom-color: rgba(10, 207, 255, 0.18);
  background: linear-gradient(90deg, rgba(10, 207, 255, 0.06), transparent 70%);
}
body.cyph-shell .gif-title { color: var(--hack-cyan); text-shadow: 0 0 12px rgba(10, 207, 255, 0.3); }
body.cyph-shell .gif-input-wrap { border-color: var(--hack-line); background: rgba(51, 242, 140, 0.03); }
body.cyph-shell .gif-input-wrap:focus-within { border-color: rgba(10, 207, 255, 0.42); }
body.cyph-shell .gif-input-wrap .prompt { color: var(--hack-cyan); }
body.cyph-shell .gif-item:hover {
  border-color: rgba(51, 242, 140, 0.45);
  box-shadow: 0 0 14px rgba(51, 242, 140, 0.2);
}
body.cyph-shell .command-palette-result:hover,
body.cyph-shell .command-palette-result.active {
  background: rgba(51, 242, 140, 0.06);
  border-left-color: var(--hack-phos);
}
body.cyph-shell .command-palette-input-wrap .prompt { color: var(--hack-phos); }
body.cyph-shell #command-palette-input { font-family: var(--font-mono); }
body.cyph-shell .command-palette-footer kbd { border-color: var(--hack-line); }

body.cyph-shell .cyph-context-menu {
  background: var(--hack-panel-strong);
  border-color: var(--hack-line-strong);
}
body.cyph-shell .cyph-context-menu button:hover { background: rgba(51, 242, 140, 0.08); }
body.cyph-shell .cyph-context-menu button.danger { color: var(--hack-red); }

/* ── Empty state: boot block ── */
body.cyph-shell .empty-chat {
  background:
    radial-gradient(circle at 50% 42%, transparent 118px, rgba(51, 242, 140, 0.05) 119px, transparent 121px),
    radial-gradient(circle at 50% 42%, transparent 148px, rgba(10, 207, 255, 0.035) 149px, transparent 151px),
    radial-gradient(ellipse 55% 40% at 50% 42%, rgba(51, 242, 140, 0.06), transparent 70%);
  font-family: var(--font-mono);
}
body.cyph-shell .empty-chat::before {
  content: 'CYPH.27▮';
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.28em;
  text-shadow: 0 0 30px rgba(51, 242, 140, 0.4), 0 0 60px rgba(10, 207, 255, 0.15);
  animation: emptyBrandIn 0.5s ease-out, hackCaret 1.2s steps(2) infinite;
}
body.cyph-shell .empty-chat::after {
  content: '> E2EE CHANNEL ARMED · SELECT A CONVERSATION';
  color: rgba(51, 242, 140, 0.55);
  letter-spacing: 0.22em;
}
@keyframes hackCaret {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(0.55); }
}

/* ── Auth / index ── */
.auth-wrap {
  background:
    radial-gradient(ellipse 68% 42% at 50% -6%, rgba(51, 242, 140, 0.07), transparent 62%),
    radial-gradient(ellipse 44% 32% at 92% 18%, rgba(10, 207, 255, 0.06), transparent 58%),
    #010302;
}
.auth-wrap::before {
  background:
    radial-gradient(ellipse 65% 45% at 50% -8%, rgba(51, 242, 140, 0.09), transparent 58%),
    radial-gradient(ellipse 45% 35% at 80% 18%, rgba(10, 207, 255, 0.05), transparent 52%);
}
.auth-card {
  background: linear-gradient(180deg, rgba(8, 14, 10, 0.95), rgba(3, 6, 4, 0.98));
  border-color: rgba(51, 242, 140, 0.2);
  clip-path: var(--hack-clip-lg);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55), 0 0 40px rgba(51, 242, 140, 0.06), inset 0 1px 0 rgba(51, 242, 140, 0.1);
}
.auth-card::before {
  background: linear-gradient(90deg, transparent, var(--hack-phos), var(--hack-cyan), transparent);
  height: 2px;
  opacity: 0.85;
  animation: tacAuthScan 3.2s ease-in-out infinite;
}
.auth-brand-name {
  font-family: var(--font-mono);
  font-weight: 700;
  text-shadow: 0 0 18px rgba(51, 242, 140, 0.3);
}
.auth-sub { color: rgba(233, 255, 243, 0.4); letter-spacing: 0.24em; }
.auth-tab {
  color: rgba(233, 255, 243, 0.4);
  font-family: var(--font-mono);
  letter-spacing: 0.16em;
}
.auth-tab.active {
  color: var(--hack-phos);
  border-bottom-color: var(--hack-phos);
  text-shadow: 0 0 12px rgba(51, 242, 140, 0.4);
}
.auth-field label {
  letter-spacing: 0.16em;
  color: rgba(233, 255, 243, 0.45);
}
.auth-field input {
  background: rgba(51, 242, 140, 0.03);
  border-color: var(--hack-line);
  font-family: var(--font-mono);
  clip-path: var(--hack-clip-sm);
}
.auth-field input:focus {
  border-color: rgba(51, 242, 140, 0.45);
  box-shadow: 0 0 14px rgba(51, 242, 140, 0.1);
}
.auth-btn:not(.nucleus-btn),
.auth-btn.nucleus-btn {
  font-family: var(--font-mono);
  letter-spacing: 0.16em;
}
.auth-btn:not(.nucleus-btn) {
  background: linear-gradient(135deg, #35F08C, #12C46C) !important;
  border-color: transparent !important;
  color: #01220f !important;
  font-weight: 800 !important;
  clip-path: var(--hack-clip-sm);
  box-shadow: 0 8px 20px rgba(51, 242, 140, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.auth-btn:not(.nucleus-btn):hover {
  background: linear-gradient(135deg, #4FFFA1, #17D870) !important;
  box-shadow: 0 12px 28px rgba(51, 242, 140, 0.3);
}
.auth-btn.nucleus-btn {
  background: rgba(10, 207, 255, 0.08) !important;
  border: 1px solid rgba(10, 207, 255, 0.3) !important;
  color: var(--hack-cyan) !important;
  clip-path: var(--hack-clip-sm);
}
.auth-btn.nucleus-btn:hover {
  background: rgba(10, 207, 255, 0.14) !important;
  box-shadow: 0 0 14px rgba(10, 207, 255, 0.2);
}
.auth-reset-btn { color: rgba(233, 255, 243, 0.4); font-family: var(--font-mono); letter-spacing: 0.12em; }
.auth-error { color: var(--hack-red); font-family: var(--font-mono); }
.auth-divider { border-color: var(--hack-line); color: rgba(233, 255, 243, 0.35); font-family: var(--font-mono); letter-spacing: 0.18em; }

/* ── System chrome: scrollbars, focus, resizer, ws ── */
::-webkit-scrollbar-thumb {
  background: rgba(51, 242, 140, 0.16);
  border-radius: 0;
}
::-webkit-scrollbar-thumb:hover { background: rgba(51, 242, 140, 0.3); }
button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(51, 242, 140, 0.6);
  outline-offset: 1px;
}
body.cyph-shell .resizer:hover::after,
body.cyph-shell .resizer:active::after {
  background: rgba(51, 242, 140, 0.5);
}
.ws-status.connected {
  background: rgba(51, 242, 140, 0.12);
  color: var(--hack-phos);
  border-color: rgba(51, 242, 140, 0.32);
  clip-path: var(--hack-clip-sm);
}
.ws-status.connecting {
  background: rgba(255, 214, 10, 0.1);
  color: var(--hack-amber);
  border-color: rgba(255, 214, 10, 0.3);
}
.ws-status.disconnected {
  background: rgba(255, 69, 58, 0.1);
  color: var(--hack-red);
  border-color: rgba(255, 69, 58, 0.3);
}
#log-mode-btn.log-on {
  color: var(--hack-phos);
  border-color: rgba(51, 242, 140, 0.35);
  background: rgba(51, 242, 140, 0.07);
}
.bar-side-btn {
  background: rgba(10, 207, 255, 0.05);
  border: 1px solid rgba(10, 207, 255, 0.25);
  color: var(--hack-cyan);
}
.bar-side-btn:hover {
  background: rgba(10, 207, 255, 0.12);
  box-shadow: 0 0 14px rgba(10, 207, 255, 0.18);
}
#create-room-public[aria-pressed="true"] {
  color: var(--hack-phos);
  border-color: rgba(51, 242, 140, 0.45);
  background: rgba(51, 242, 140, 0.12);
  box-shadow: 0 0 12px rgba(51, 242, 140, 0.2);
}
#emoji-pop {
  border-color: rgba(51, 242, 140, 0.22);
  background: linear-gradient(180deg, rgba(10, 16, 12, 0.98), rgba(3, 6, 4, 0.99));
}
.emoji-cell:hover { background: rgba(51, 242, 140, 0.14); }
.emoji-cell.emoji-custom:hover { background: rgba(10, 207, 255, 0.14); }
.emoji-brand-label { color: rgba(233, 255, 243, 0.35); }
.msg-media-tag { color: var(--hack-phos); }
.msg-line-img, .msg-bubble-img {
  border-color: rgba(51, 242, 140, 0.22);
}
.radio-btn:hover { border-color: var(--hack-phos); color: var(--hack-phos); }
.radio-btn.radio-mode.active { border-color: var(--hack-phos); color: var(--hack-phos); background: rgba(51, 242, 140, 0.08); }
.radio-progress-fill {
  background: linear-gradient(90deg, #18C56E 0%, #33F28C 55%, #7FFFC4 100%);
  box-shadow: 0 0 8px rgba(51, 242, 140, 0.45);
}
.radio-vol-slider { accent-color: var(--hack-phos); }

@media (max-width: 900px) {
  html::before { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  body.cyph-shell .sidebar-logo,
  body.cyph-shell .sidebar-header::after,
  body.cyph-shell .empty-chat::before,
  .auth-card::before {
    animation: none !important;
  }
}
