/* ==========================================================================
   AmrAI Institutional Portal Stylesheet
   Black (#09090B) · Metallic Gold (#D4AF37) · Crisp White (#FAFAFA)
   ========================================================================== */

:root {
  --p-bg: #09090B;
  --p-bg-elevated: #0E0E12;
  --p-surface: #121217;
  --p-surface-hover: #18181F;
  --p-surface-active: #1D1C22;
  --p-border: rgba(250, 250, 250, 0.09);
  --p-border-strong: rgba(250, 250, 250, 0.16);
  --p-gold: #D4AF37;
  --p-gold-bright: #E5C158;
  --p-gold-dim: #9E7B1C;
  --p-gold-soft: rgba(212, 175, 55, 0.12);
  --p-gold-border: rgba(212, 175, 55, 0.32);
  --p-text: #FAFAFA;
  --p-text-secondary: #B4B4BC;
  --p-text-muted: #767682;
  --p-success: #34D399;
  --p-success-soft: rgba(52, 211, 153, 0.12);
  --p-danger: #F87171;
  --p-danger-soft: rgba(248, 113, 113, 0.12);
  --p-warn: #FBBF24;
  --p-warn-soft: rgba(251, 191, 36, 0.12);
  --p-font-serif: 'Playfair Display', Georgia, serif;
  --p-font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --p-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --p-radius-sm: 4px;
  --p-radius-md: 8px;
  --p-radius-lg: 12px;
  --p-shadow: 0 18px 48px rgba(0, 0, 0, 0.65);
}

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background-color: var(--p-bg);
  color: var(--p-text);
  font-family: var(--p-font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden {
  display: none !important;
}

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

a {
  color: var(--p-gold);
  text-decoration: none;
}

a:hover {
  color: var(--p-gold-bright);
}

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

/* Custom Thin Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(250, 250, 250, 0.12);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 175, 55, 0.35);
}

/* ==========================================================================
   Buttons, Badges, Inputs & Common Controls
   ========================================================================== */
.p-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--p-radius-sm);
  border: 1px solid var(--p-border-strong);
  background: var(--p-surface);
  color: var(--p-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.p-btn:hover:not(:disabled) {
  background: var(--p-surface-hover);
  border-color: rgba(250, 250, 250, 0.28);
}

.p-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.p-btn-gold {
  background: var(--p-gold);
  border-color: var(--p-gold);
  color: #09090B;
  font-weight: 600;
}

.p-btn-gold:hover:not(:disabled) {
  background: var(--p-gold-bright);
  border-color: var(--p-gold-bright);
  color: #09090B;
}

.p-btn-outline-gold {
  background: var(--p-gold-soft);
  border-color: var(--p-gold-border);
  color: var(--p-gold-bright);
}

.p-btn-outline-gold:hover:not(:disabled) {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--p-gold);
}

.p-btn-danger {
  background: var(--p-danger-soft);
  border-color: rgba(248, 113, 113, 0.35);
  color: var(--p-danger);
}

.p-btn-danger:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.22);
  border-color: var(--p-danger);
}

.p-btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--p-text-secondary);
}

.p-btn-ghost:hover:not(:disabled) {
  background: var(--p-surface-hover);
  color: var(--p-text);
  border-color: transparent;
}

.p-btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.p-btn-xs {
  padding: 3px 8px;
  font-size: 11px;
}

.p-input,
.p-select,
.p-textarea {
  width: 100%;
  background: #0B0B0E;
  border: 1px solid var(--p-border-strong);
  border-radius: var(--p-radius-sm);
  padding: 9px 12px;
  color: var(--p-text);
  font-size: 13.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.p-input:focus,
.p-select:focus,
.p-textarea:focus {
  outline: none;
  border-color: var(--p-gold);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.15);
}

.p-input::placeholder,
.p-textarea::placeholder {
  color: var(--p-text-muted);
}

.p-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--p-text-secondary);
  margin-bottom: 6px;
}

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

.p-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 3px;
  font-family: var(--p-font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid var(--p-border);
  background: var(--p-surface);
  color: var(--p-text-secondary);
}

.p-badge-gold {
  background: var(--p-gold-soft);
  border-color: var(--p-gold-border);
  color: var(--p-gold-bright);
}

.p-badge-success {
  background: var(--p-success-soft);
  border-color: rgba(52, 211, 153, 0.3);
  color: var(--p-success);
}

.p-badge-danger {
  background: var(--p-danger-soft);
  border-color: rgba(248, 113, 113, 0.3);
  color: var(--p-danger);
}

.p-alert {
  padding: 10px 14px;
  border-radius: var(--p-radius-sm);
  font-size: 13px;
  border: 1px solid var(--p-border);
  background: var(--p-surface);
  margin-bottom: 16px;
}

.p-alert-error {
  background: var(--p-danger-soft);
  border-color: rgba(248, 113, 113, 0.4);
  color: #FCA5A5;
}

.p-alert-success {
  background: var(--p-success-soft);
  border-color: rgba(52, 211, 153, 0.4);
  color: #A7F3D0;
}

.p-alert-info {
  background: var(--p-gold-soft);
  border-color: var(--p-gold-border);
  color: var(--p-gold-bright);
}

/* ==========================================================================
   Auth / Login View
   ========================================================================== */
.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background-color: var(--p-bg);
  background-image:
    linear-gradient(to right, rgba(212, 175, 55, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(212, 175, 55, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
}

.auth-back-link {
  margin-bottom: 20px;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--p-text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.auth-back-link:hover {
  color: var(--p-gold-bright);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--p-bg-elevated);
  border: 1px solid var(--p-border-strong);
  border-top: 2px solid var(--p-gold);
  border-radius: var(--p-radius-md);
  padding: 34px 32px 28px;
  box-shadow: var(--p-shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-monogram {
  width: 36px;
  height: 36px;
  border-radius: var(--p-radius-sm);
  border: 1px solid var(--p-gold-border);
  background: var(--p-gold-soft);
  color: var(--p-gold-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--p-font-serif);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.brand-monogram-sm {
  width: 28px;
  height: 28px;
  font-size: 14px;
}

.auth-title {
  margin: 0;
  font-family: var(--p-font-serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--p-text);
}

.auth-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--p-text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.password-wrap {
  position: relative;
}

.password-wrap .p-input {
  padding-right: 64px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: var(--p-text-muted);
  font-size: 11px;
  font-family: var(--p-font-mono);
  text-transform: uppercase;
  cursor: pointer;
  padding: 4px 6px;
}

.password-toggle:hover {
  color: var(--p-gold-bright);
}

.auth-submit {
  width: 100%;
  padding: 10px 16px;
  margin-top: 4px;
}

.auth-security-foot {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--p-border);
  font-size: 11.5px;
  color: var(--p-text-muted);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.45;
}

.auth-security-foot svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--p-gold);
}

/* ==========================================================================
   Boot Loading Screen
   ========================================================================== */
.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--p-text-secondary);
  font-family: var(--p-font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.boot-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--p-border-strong);
  border-top-color: var(--p-gold);
  border-radius: 50%;
  animation: p-spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Workspace Shell & Top Navigation Bar
   ========================================================================== */
.workspace-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--p-bg);
}

.topbar {
  height: 56px;
  flex-shrink: 0;
  background: var(--p-bg-elevated);
  border-bottom: 1px solid var(--p-border);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-wordmark {
  font-family: var(--p-font-serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--p-text);
}

.topbar-wordmark span {
  color: var(--p-gold);
}

.topbar-report-link {
  font-size: 12px;
  color: var(--p-text-muted);
  border-left: 1px solid var(--p-border);
  padding-left: 14px;
  white-space: nowrap;
}

.topbar-report-link:hover {
  color: var(--p-gold-bright);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: var(--p-radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--p-text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab:hover {
  color: var(--p-text);
  background: var(--p-surface);
}

.nav-tab.active {
  color: var(--p-gold-bright);
  background: var(--p-gold-soft);
  border-color: var(--p-gold-border);
}

.nav-unread-pill {
  background: var(--p-gold);
  color: #09090B;
  font-family: var(--p-font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ws-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--p-font-mono);
  font-size: 11px;
  color: var(--p-text-secondary);
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--p-border);
  background: var(--p-surface);
}

.ws-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--p-text-muted);
}

.ws-dot.online {
  background: var(--p-success);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
}

.ws-dot.reconnecting {
  background: var(--p-warn);
}

.ws-dot.offline {
  background: var(--p-danger);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: var(--p-radius-sm);
  border: 1px solid var(--p-border);
  background: var(--p-surface);
}

.user-chip-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--p-text);
}

/* ==========================================================================
   Workspace Views Container
   ========================================================================== */
.workspace-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.view-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Encrypted Chat 3-Column Layout
   ========================================================================== */
.chat-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 296px 1fr 310px;
  overflow: hidden;
}

.chat-layout.drawer-closed {
  grid-template-columns: 296px 1fr;
}

.chat-sidebar {
  background: var(--p-bg-elevated);
  border-right: 1px solid var(--p-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-controls {
  padding: 14px;
  border-bottom: 1px solid var(--p-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px 16px;
}

.sidebar-section-label {
  padding: 8px 10px 6px;
  font-family: var(--p-font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--p-text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.room-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--p-radius-sm);
  padding: 9px 10px;
  margin-bottom: 2px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.room-item:hover {
  background: var(--p-surface);
}

.room-item.active {
  background: var(--p-surface-active);
  border-color: var(--p-gold-border);
}

.room-avatar {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: var(--p-radius-sm);
  background: var(--p-surface);
  border: 1px solid var(--p-border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--p-font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--p-gold);
  flex-shrink: 0;
}

.room-item.active .room-avatar {
  border-color: var(--p-gold-border);
  background: var(--p-gold-soft);
}

.presence-dot {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--p-bg-elevated);
  background: var(--p-text-muted);
}

.presence-dot.online {
  background: var(--p-success);
}

.presence-dot-inline {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--p-text-muted);
  flex-shrink: 0;
}

.presence-dot-inline.online {
  background: var(--p-success);
}

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

.room-meta-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.room-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--p-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-time {
  font-family: var(--p-font-mono);
  font-size: 10.5px;
  color: var(--p-text-muted);
  flex-shrink: 0;
}

.room-meta-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

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

.room-unread-badge {
  background: var(--p-gold);
  color: #09090B;
  font-family: var(--p-font-mono);
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Chat Center Feed */
.chat-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--p-bg);
  position: relative;
}

.chat-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  color: var(--p-text-secondary);
}

.chat-empty-emblem {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--p-gold-border);
  background: var(--p-gold-soft);
  color: var(--p-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.chat-empty-state h2 {
  margin: 0 0 8px;
  font-family: var(--p-font-serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--p-text);
}

.chat-empty-state p {
  margin: 0 0 20px;
  max-width: 420px;
  font-size: 13.5px;
  color: var(--p-text-muted);
}

.chat-header {
  height: 60px;
  flex-shrink: 0;
  padding: 0 20px;
  border-bottom: 1px solid var(--p-border);
  background: var(--p-bg-elevated);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chat-header-title-wrap {
  min-width: 0;
}

.chat-header-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--p-text);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-subtitle {
  font-size: 12px;
  color: var(--p-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.crypto-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--p-gold-border);
  background: var(--p-gold-soft);
  color: var(--p-gold-bright);
  font-family: var(--p-font-mono);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.crypto-status-pill:hover {
  background: rgba(212, 175, 55, 0.22);
}

.messages-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.load-older-wrap {
  display: flex;
  justify-content: center;
  padding-bottom: 12px;
}

.date-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 10px;
  color: var(--p-text-muted);
  font-family: var(--p-font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.date-divider::before,
.date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--p-border);
}

.msg-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 7px 10px;
  border-radius: var(--p-radius-sm);
  transition: background-color 0.1s ease;
  position: relative;
}

.msg-row:hover {
  background: rgba(255, 255, 255, 0.025);
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--p-radius-sm);
  background: var(--p-surface);
  border: 1px solid var(--p-border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--p-font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--p-gold);
  flex-shrink: 0;
  margin-top: 2px;
}

.msg-body {
  flex: 1;
  min-width: 0;
}

.msg-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.msg-sender {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--p-text);
}

.msg-sender.self {
  color: var(--p-gold-bright);
}

.msg-time {
  font-family: var(--p-font-mono);
  font-size: 11px;
  color: var(--p-text-muted);
}

.msg-kv-badge {
  font-family: var(--p-font-mono);
  font-size: 10px;
  color: var(--p-gold);
  border: 1px solid rgba(212, 175, 55, 0.25);
  background: rgba(212, 175, 55, 0.08);
  padding: 0 5px;
  border-radius: 3px;
}

.msg-text {
  margin-top: 3px;
  font-size: 13.8px;
  line-height: 1.52;
  color: #E4E4E7;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-text.deleted {
  font-style: italic;
  color: var(--p-text-muted);
}

.msg-text.decrypt-error {
  font-family: var(--p-font-mono);
  font-size: 12px;
  color: var(--p-danger);
}

.msg-actions {
  opacity: 0;
  transition: opacity 0.12s ease;
  flex-shrink: 0;
}

.msg-row:hover .msg-actions {
  opacity: 1;
}

.jump-bottom-btn {
  position: absolute;
  bottom: 92px;
  right: 24px;
  z-index: 10;
  box-shadow: var(--p-shadow);
}

.typing-bar {
  min-height: 22px;
  padding: 2px 22px;
  font-family: var(--p-font-mono);
  font-size: 11px;
  color: var(--p-gold-bright);
  display: flex;
  align-items: center;
}

.composer-wrap {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--p-border);
  background: var(--p-bg-elevated);
}

.composer-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: #09090B;
  border: 1px solid var(--p-border-strong);
  border-radius: var(--p-radius-md);
  padding: 8px 10px;
}

.composer-form:focus-within {
  border-color: var(--p-gold);
}

.composer-input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--p-text);
  resize: none;
  min-height: 24px;
  max-height: 140px;
  line-height: 1.45;
  padding: 4px 2px;
}

.composer-input:focus {
  outline: none;
}

.composer-hint {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--p-text-muted);
}

/* ==========================================================================
   Right Drawer: Room Info, Crypto Controls & Group Roster
   ========================================================================== */
.chat-drawer {
  background: var(--p-bg-elevated);
  border-left: 1px solid var(--p-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.drawer-section {
  padding: 16px;
  border-bottom: 1px solid var(--p-border);
}

.drawer-section-title {
  margin: 0 0 10px;
  font-family: var(--p-font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--p-text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-room-name {
  margin: 0 0 4px;
  font-family: var(--p-font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--p-text);
}

.drawer-room-desc {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--p-text-secondary);
  line-height: 1.45;
}

.drawer-btn-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.member-row:last-child {
  border-bottom: 0;
}

.member-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.member-text {
  min-width: 0;
}

.member-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--p-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-sub {
  font-size: 11px;
  color: var(--p-text-muted);
  font-family: var(--p-font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* ==========================================================================
   Super Admin & Account Views
   ========================================================================== */
.page-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px 48px;
}

.page-container {
  max-width: 1200px;
  margin: 0 auto;
}

.page-container-narrow {
  max-width: 760px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--p-border);
  flex-wrap: wrap;
}

.page-eyebrow {
  font-family: var(--p-font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--p-gold);
  margin-bottom: 4px;
}

.page-title {
  margin: 0;
  font-family: var(--p-font-serif);
  font-size: 26px;
  font-weight: 600;
  color: var(--p-text);
}

.p-card {
  background: var(--p-bg-elevated);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius-md);
  margin-bottom: 24px;
  overflow: hidden;
}

.p-card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--p-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.p-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--p-text);
}

.p-card-body {
  padding: 20px;
}

.table-wrap {
  overflow-x: auto;
}

.p-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.p-table th {
  text-align: left;
  padding: 11px 16px;
  font-family: var(--p-font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--p-text-muted);
  border-bottom: 1px solid var(--p-border);
  background: rgba(255, 255, 255, 0.015);
  white-space: nowrap;
}

.p-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--p-text-secondary);
  vertical-align: middle;
}

.p-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.p-table td.mono {
  font-family: var(--p-font-mono);
  font-size: 12px;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}

.kv-item-label {
  font-family: var(--p-font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--p-text-muted);
  margin-bottom: 4px;
}

.kv-item-val {
  font-size: 14px;
  font-weight: 500;
  color: var(--p-text);
}

/* ==========================================================================
   Modals & Toasts
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  background: var(--p-bg-elevated);
  border: 1px solid var(--p-border-strong);
  border-top: 2px solid var(--p-gold);
  border-radius: var(--p-radius-md);
  box-shadow: var(--p-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--p-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  margin: 0;
  font-family: var(--p-font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--p-text);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--p-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.checklist-box {
  max-height: 210px;
  overflow-y: auto;
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius-sm);
  background: #09090B;
  padding: 6px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--p-radius-sm);
  cursor: pointer;
}

.checklist-item:hover {
  background: var(--p-surface);
}

.fingerprint-card {
  background: #09090B;
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius-sm);
  padding: 12px;
  margin-bottom: 10px;
}

.fingerprint-code {
  font-family: var(--p-font-mono);
  font-size: 11.5px;
  color: var(--p-gold-bright);
  word-break: break-all;
  margin-top: 6px;
}

.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.toast-item {
  background: var(--p-surface);
  border: 1px solid var(--p-border-strong);
  border-left: 3px solid var(--p-gold);
  border-radius: var(--p-radius-sm);
  padding: 11px 14px;
  box-shadow: var(--p-shadow);
  font-size: 13px;
  color: var(--p-text);
}

.toast-item.error {
  border-left-color: var(--p-danger);
}

.toast-item.success {
  border-left-color: var(--p-success);
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */
.mobile-only-btn {
  display: none;
}

@media (max-width: 1120px) {
  .chat-layout {
    grid-template-columns: 260px 1fr;
  }

  .chat-drawer {
    position: fixed;
    top: 56px;
    right: 0;
    bottom: 0;
    width: 310px;
    z-index: 40;
    box-shadow: var(--p-shadow);
  }

  .chat-layout.drawer-closed .chat-drawer {
    display: none;
  }
}

@media (max-width: 780px) {
  .topbar {
    padding: 0 12px;
    gap: 8px;
  }

  .topbar-report-link,
  .ws-status-text,
  .user-chip {
    display: none;
  }

  .nav-tab {
    padding: 6px 9px;
    font-size: 12px;
  }

  .mobile-only-btn {
    display: inline-flex;
  }

  .chat-layout,
  .chat-layout.drawer-closed {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 290px;
    z-index: 45;
    box-shadow: var(--p-shadow);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .chat-sidebar.mobile-open {
    transform: translateX(0);
  }

  .page-scroll {
    padding: 18px 14px 36px;
  }
}
