:root {
  --bg: #12161d;
  --panel: #1d2330;
  --panel-soft: #2a3242;
  --primary: #7c4dff;
  --primary-strong: #5c2de2;
  --text: #edf2ff;
  --muted: #aab2c5;
  --success: #37c67b;
  --danger: #ff5d73;
  --border: rgba(255, 255, 255, 0.09);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f141b, #171f2a 50%, #0f141b);
  color: var(--text);
  font-family: Arial, sans-serif;
}

button, input {
  font: inherit;
}

.app-shell {
  max-width: 380px;
  margin: 40px auto;
  padding: 16px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
}

.brand {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.auth-logo {
  display: block;
  width: 84px;
  height: 84px;
  margin: 0 auto 20px;
  border-radius: 50%;
}

.panel {
  background: rgba(17, 25, 35, 0.85);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 12px 12px;
  padding: 16px;
}

.auth-card {
  max-width: 440px;
  margin: 0 auto;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  background: var(--panel-soft);
  color: var(--text);
  border: 1px solid transparent;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.tab.active {
  background: var(--primary);
  border-color: var(--primary);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
}

.auth-form input {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 12px 14px;
}

.primary, .secondary {
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  transition: 0.2s ease;
}

.primary {
  background: var(--primary);
  color: white;
  font-weight: 700;
}

.primary:hover { background: var(--primary-strong); }

.secondary {
  background: var(--panel-soft);
  color: var(--text);
}

.hidden { display: none !important; }

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.user-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}

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

.section-header h2 {
  margin: 0;
}

.small {
  padding: 8px 10px;
  font-size: 0.85rem;
}

.call-panel {
  background: rgba(124, 77, 255, 0.08);
  border: 1px solid rgba(124, 77, 255, 0.5);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.call-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.call-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.translation-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.translation-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
}

.translation-toggle input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.translation-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(124, 77, 255, 0.16);
  border: 1px solid rgba(124, 77, 255, 0.5);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
}

.translation-badge:empty {
  display: none;
}

.success {
  background: var(--success);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
}

.danger {
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
}

.end-call-button {
  font-size: 2em;
  font-weight: 700;
  padding: 20px 28px;
  border-radius: 12px;
}

.connection-loader {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

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

.call-diagnostics {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
  font-family: "Courier New", monospace;
  line-height: 1.5;
}

.audio-meters {
  display: flex;
  gap: 32px;
  padding-top: 16px;
  margin-top: 12px;
  border-top: 1px solid var(--border);
}

.meter-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.meter-label {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.meter-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 140px;
}

.vertical-slider {
  writing-mode: vertical-lr;
  direction: rtl;
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  width: 22px;
  height: 140px;
  accent-color: var(--primary);
  cursor: pointer;
}

.meter-track {
  width: 16px;
  height: 140px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.meter-fill {
  width: 100%;
  height: 0%;
  border-radius: 6px 6px 0 0;
}

.meter-fill.outgoing {
  background: linear-gradient(180deg, var(--danger), var(--primary) 45%, var(--success));
}

.meter-fill.incoming {
  background: linear-gradient(180deg, var(--danger), var(--primary) 45%, var(--success));
}

.user-list {
  display: grid;
  gap: 8px;
}

.user-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  background: #dff3e1;
  border-radius: 12px;
  padding: 8px 10px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.1s ease;
}

.user-item:hover {
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.24);
}

.user-item:active {
  transform: translateY(1px);
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #ffffff;
  border: 1px solid #cccccc;
}

.user-avatar-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #ffffff;
  border: 1px solid #cccccc;
  color: #999999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 700;
}

.user-center {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #000000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-activity-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: #3d3d3d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-activity-row:empty {
  display: none;
}

.user-activity-call-icon {
  flex-shrink: 0;
  font-size: 0.85rem;
  line-height: 1;
}

.user-activity-call-icon.incoming {
  color: #2e7d32;
}

.user-activity-call-icon.outgoing {
  color: #555555;
}

.user-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}

.user-lastseen {
  font-size: 0.7rem;
  color: #000000;
  white-space: nowrap;
}

.user-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.user-status-dot.online {
  background: #2e7d32;
}

.user-status-dot.offline {
  background: #c62828;
}

.user-dot-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.user-attention-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.user-attention-dot.missed-call {
  background: #00e676;
}

.user-attention-dot.unread {
  background: #43a047;
}

.user-language-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  padding: 3px 9px 3px 3px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #333;
}

.user-language-flag {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
}

.account-language-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-language-row select {
  flex: 1;
}

.account-language-row .user-language-flag {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

#callPeerLanguageTag {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  margin-bottom: 10px;
}

.user-email {
  color: #3f3f3f;
  font-size: 0.92rem;
}

/* Compact contact-detail header inside the chat modal: back / avatar /
   name+last-seen on the left, call + language flag in the middle, a
   hamburger menu on the right (mirrors the Android contact detail screen). */
/* Header controls are sized 15% larger than the base UI (per explicit
   request); the call button gets an extra bump on top (20% over base). */
.chat-header-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: -4px -4px 12px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--border);
}

.chat-back-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  flex-shrink: 0;
}

.chat-peer-avatar-sm {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #ffffff;
  border: 1px solid #cccccc;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.chat-peer-avatar-placeholder-sm {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #ffffff;
  border: 1px solid #cccccc;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  color: #999999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
}

.chat-peer-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.chat-peer-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-peer-lastseen {
  font-size: 0.83rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-call-btn {
  width: 41px;
  height: 41px;
  border-radius: 50%;
  border: none;
  background: var(--success);
  color: white;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.chat-call-btn:hover {
  filter: brightness(1.08);
}

.chat-language-flag-sm {
  width: 23px;
  height: 23px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.chat-menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.chat-menu-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
}

.chat-overflow-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #23293a;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  z-index: 10;
  min-width: 150px;
  overflow: hidden;
}

.chat-overflow-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  padding: 10px 14px;
  font-size: 0.85rem;
  cursor: pointer;
}

.chat-overflow-menu button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.incoming-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 14, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.incoming-modal-card {
  width: min(380px, 100%);
  background: linear-gradient(180deg, rgba(35, 42, 59, 0.98), rgba(23, 28, 39, 0.98));
  border: 1px solid rgba(124, 77, 255, 0.45);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
  text-align: center;
}

.incoming-modal-eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  margin-bottom: 10px;
}

.incoming-modal-card h2 {
  margin: 0;
  font-size: 1.65rem;
}

.incoming-modal-avatar-wrap {
  width: 96px;
  height: 96px;
  margin: 4px auto 0;
  position: relative;
}

.incoming-modal-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(124, 77, 255, 0.55);
  display: block;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.incoming-modal-avatar-placeholder {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 3px solid rgba(124, 77, 255, 0.55);
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.call-avatar-wrap {
  width: 96px;
  height: 96px;
  margin: 4px auto 12px;
  position: relative;
}

.call-peer-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(124, 77, 255, 0.55);
  display: block;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.call-peer-avatar-placeholder {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 3px solid rgba(124, 77, 255, 0.55);
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.call-timer {
  text-align: center;
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.call-subtitle {
  margin: 4px 0 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(124, 77, 255, 0.12);
  color: var(--text);
  font-style: italic;
  font-size: 0.95rem;
  text-align: center;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.incoming-modal-caller {
  margin: 14px 0 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.incoming-modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.incoming-modal-actions.single {
  grid-template-columns: 1fr;
}

.history-modal-card {
  width: min(380px, 100%);
  text-align: left;
}

.history-modal-card h2 {
  text-align: center;
}

.call-history-totals {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 4px;
}

.call-history-list {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

.call-history-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
}

.call-history-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.call-history-date {
  color: var(--text);
  font-weight: 600;
}

.call-history-details {
  color: var(--muted);
  font-size: 0.82rem;
}

.call-history-protocol {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.call-history-protocol.direct {
  color: var(--success);
  background: rgba(55, 198, 123, 0.12);
}

.call-history-protocol.relay {
  color: var(--danger);
  background: rgba(255, 93, 115, 0.12);
}

.call-history-protocol.unknown {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
}

.call-history-empty {
  color: var(--muted);
  text-align: center;
  padding: 20px 0;
}

.chat-modal-card {
  width: min(380px, 100%);
  text-align: left;
  display: flex;
  flex-direction: column;
}

.chat-modal-card h2 {
  text-align: center;
}

.chat-message-list {
  height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  padding: 10px;
  border-radius: 10px;
  background-color: #d7f0d1;
  background-image:
    radial-gradient(circle at 15% 25%, rgba(255, 255, 255, 0.55) 0, rgba(255, 255, 255, 0.55) 3px, transparent 3px),
    radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.4) 0, rgba(255, 255, 255, 0.4) 2px, transparent 2px),
    radial-gradient(circle at 45% 85%, rgba(255, 255, 255, 0.45) 0, rgba(255, 255, 255, 0.45) 2.5px, transparent 2.5px),
    radial-gradient(circle at 88% 15%, rgba(255, 255, 255, 0.35) 0, rgba(255, 255, 255, 0.35) 2px, transparent 2px),
    radial-gradient(circle at 30% 55%, rgba(46, 125, 50, 0.12) 0, rgba(46, 125, 50, 0.12) 4px, transparent 4px);
  background-size: 70px 70px, 90px 90px, 60px 60px, 100px 100px, 120px 120px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.15);
}

.chat-bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
  word-wrap: break-word;
}

.chat-bubble.own {
  align-self: flex-end;
  background: var(--primary);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.chat-bubble.peer {
  align-self: flex-start;
  background: #fff3b0;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.chat-bubble-meta {
  display: block;
  margin-top: 4px;
  font-size: 0.68rem;
  opacity: 0.75;
  text-align: right;
}

.chat-call-entry {
  display: flex;
  flex-direction: column;
  max-width: 78%;
}

.chat-call-entry.own {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-call-entry.peer {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-call-bubble {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  background: #e8e8e8;
  color: #1a1a1a;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.chat-call-bubble.outcome-answered { color: #1b5e20; }
.chat-call-bubble.outcome-declined { color: #b71c1c; }
.chat-call-bubble.outcome-no_answer { color: #8a6100; }
.chat-call-bubble.outcome-busy { color: #d35400; }
.chat-call-bubble.outcome-unreachable { color: #555555; }

.chat-call-icon {
  font-size: 0.9rem;
}

.chat-form {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.chat-form input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
}

.convex-button {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    -3px -3px 7px rgba(255, 255, 255, 0.12),
    4px 4px 10px rgba(0, 0, 0, 0.45);
  transition: box-shadow 0.12s ease, transform 0.12s ease;
}

.convex-button:hover {
  box-shadow:
    -2px -2px 5px rgba(255, 255, 255, 0.14),
    3px 3px 7px rgba(0, 0, 0, 0.5);
}

.convex-button:active {
  transform: translateY(1px);
  box-shadow:
    inset 2px 2px 5px rgba(0, 0, 0, 0.4),
    inset -2px -2px 4px rgba(255, 255, 255, 0.08);
}

.convex-circle {
  box-shadow:
    -3px -3px 7px rgba(255, 255, 255, 0.12),
    4px 4px 10px rgba(0, 0, 0, 0.45);
  transition: box-shadow 0.12s ease, transform 0.12s ease;
}

.convex-circle:hover {
  box-shadow:
    -2px -2px 5px rgba(255, 255, 255, 0.14),
    3px 3px 7px rgba(0, 0, 0, 0.5);
}

.convex-circle:active {
  transform: translateY(1px);
  box-shadow:
    inset 2px 2px 5px rgba(0, 0, 0, 0.4),
    inset -2px -2px 4px rgba(255, 255, 255, 0.08);
}

.chat-empty {
  color: var(--muted);
  text-align: center;
  padding: 20px 0;
}

.chat-load-more {
  color: #2e7d32;
  text-align: center;
  padding: 10px 0 16px;
  font-weight: 600;
  cursor: pointer;
}

.chat-load-more:hover {
  text-decoration: underline;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #1d2330;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  opacity: 0;
  transform: translateY(8px);
  transition: 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

.logout-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--danger);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: transform 0.15s ease, background 0.15s ease;
}

.logout-button:hover {
  background: #ff5252;
  transform: scale(1.05);
}

.account-modal-card {
  width: min(380px, 100%);
  text-align: left;
  max-height: 85vh;
  overflow-y: auto;
}

.account-modal-card h2 {
  text-align: center;
}

.account-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 16px 0 20px;
}

.account-avatar-wrap {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--panel-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.account-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-avatar-placeholder {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--muted);
}

.hidden-input {
  display: none;
}

.account-photo-btn {
  cursor: pointer;
  display: inline-block;
}

.account-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.account-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.account-form input,
.account-form select,
.account-form textarea {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 0.95rem;
}

.account-form textarea {
  font-family: inherit;
  resize: vertical;
}

.account-form input:disabled {
  opacity: 0.6;
}

/* The <select> box itself follows the dark theme, but the native dropdown
   popup list always renders with a white/light system background regardless
   of page theme - force dark text on the options themselves so they stay
   readable instead of inheriting the light theme text color. */
.account-form select option {
  color: #1a1a1a;
  background: #ffffff;
}

.account-permissions {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-permissions h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.permission-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
}

.permission-row > span:first-child {
  flex: 1;
  color: var(--text);
}

.permission-status {
  color: var(--muted);
  white-space: nowrap;
}

.ai-settings-hint {
  margin: -6px 0 4px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.ai-settings-warning {
  margin: -6px 0 4px;
  font-size: 0.8rem;
  color: var(--danger);
  font-weight: 600;
}

.ai-settings-note {
  margin: -6px 0 12px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.ai-settings-toggle {
  flex-direction: row !important;
  align-items: center;
  gap: 10px !important;
}

.ai-settings-toggle input {
  width: 18px;
  height: 18px;
}
