/* ============================================================
   NOVA — premium monochrome UI
   Every selector below is used by the existing E2EE client.
   No feature JS depends on these values, so restyling is safe.
   ============================================================ */

/* --- App frame ------------------------------------------------ */
.e2ee-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(0px, 3vw, 40px);
  background: var(--bg);
}
.e2ee-card {
  width: min(1240px, 100%);
  height: min(860px, calc(100dvh - 80px));
  min-height: 560px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1), var(--shadow-2);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  animation: nova-fade 240ms var(--ease) both;
}
.e2ee-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.e2ee-top .brand, .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 700 15px/1 var(--font);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--text);
}
.brand-mark {
  width: 26px; height: 26px;
  border: 1.5px solid currentColor;
  border-radius: 8px;
  display: grid; place-items: center;
  transform: rotate(-8deg);
  opacity: .9;
}
.brand-mark::after { content: ''; width: 9px; height: 9px; border-radius: 3px; background: currentColor; }
.e2ee-link { font-size: 12px; color: var(--muted); text-decoration: none; transition: color var(--dur) var(--ease); }
.e2ee-link:hover { color: var(--text); }
.e2ee-body { min-height: 0; display: grid; grid-template-columns: 328px minmax(0,1fr); }
.e2ee-sidebar {
  min-height: 0;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.e2ee-main { min-width: 0; display: flex; flex-direction: column; background: var(--bg); }

/* --- Typography / shared controls ----------------------------- */
.e2ee-auth h1, .e2ee-modal-card h3, .e2ee-placeholder b {
  font-weight: 660;
  letter-spacing: -.045em;
  color: var(--text);
}
.e2ee-auth h1 { font-size: clamp(28px,4vw,36px); line-height: 1.1; margin: 0 0 10px; }
.e2ee-auth .empty-icon { width: 40px; height: 40px; margin-bottom: 20px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--text); font-size: 0; }
.e2ee-auth .empty-icon::before { content: ''; width: 12px; height: 10px; border: 1.5px solid currentColor; border-radius: 3px; position: relative; }
.e2ee-auth .empty-icon::after { content: ''; position: absolute; width: 7px; height: 6px; border: 1.5px solid currentColor; border-bottom: 0; border-radius: 5px 5px 0 0; margin-top: -12px; }
.e2ee-auth p, .e2ee-modal-card p { color: var(--muted); font-size: 13px; line-height: 1.65; }
.primary-btn {
  min-height: 44px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px; font-weight: 640;
  padding: 0 18px;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.primary-btn:hover:not(:disabled) { background: #fff; transform: translateY(-1px); }
.primary-btn:active:not(:disabled) { transform: translateY(0) scale(.985); }
.text-btn {
  color: var(--muted);
  font-size: 12px; font-weight: 560;
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.text-btn:hover { color: var(--text); background: var(--surface-3); }
.text-btn.danger { color: var(--danger) !important; }
.text-btn.danger:hover { background: #c98d921a; }
.e2ee-field, .field { display: grid; gap: 7px; margin: 14px 0; }
.field label, .e2ee-field label { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.field input, .e2ee-field input, .e2ee-search,
.e2ee-group-form input, .e2ee-group-form textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.field input:hover, .e2ee-search:hover { border-color: var(--line-strong); }
.field input:focus, .e2ee-search:focus,
.e2ee-group-form input:focus, .e2ee-group-form textarea:focus {
  border-color: #4a4a50; background: var(--surface-3); box-shadow: 0 0 0 3px #ffffff0a;
}
.field input::placeholder, .e2ee-search::placeholder, textarea::placeholder { color: var(--faint); }
.field small, .e2ee-field small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.e2ee-error { min-height: 18px; color: var(--danger); font-size: 12px; margin: 8px 0; animation: nova-fade 160ms var(--ease); }
.e2ee-status { padding: 8px 18px; color: var(--muted); font-size: 11px; letter-spacing: .01em; }
.e2ee-action-status { border-top: 1px solid var(--line); color: var(--text-2); background: var(--surface); }
.e2ee-action-status[hidden] { display: none; }
.e2e-status { padding: 6px 0; color: var(--muted); font-size: 11px; }

/* --- Login / onboarding --------------------------------------- */
.e2ee-auth { width: min(440px,100%); margin: auto; padding: clamp(24px,5vw,48px); animation: nova-fade-up 260ms var(--ease) both; }
.e2ee-auth .primary-btn { width: 100%; }
.e2ee-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.e2ee-buttons button { font-size: 12px; }
.e2ee-auth .e2ee-buttons .text-btn { background: var(--surface-2); border: 1px solid var(--line); min-height: 44px; }
.e2ee-auth .e2ee-buttons .text-btn:hover { border-color: var(--line-strong); background: var(--surface-3); }
.e2ee-warning {
  margin: 12px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px; line-height: 1.6;
}

/* --- Sidebar / chat list -------------------------------------- */
.e2ee-account { padding: 18px 16px 14px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 44px minmax(0,1fr); align-items: center; gap: 12px; }
.e2ee-account::before { content: 'N'; grid-row: 1 / 3; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--line-strong); color: var(--text); font-size: 17px; font-weight: 700; }
.e2ee-account strong { display: block; font-size: 15px; font-weight: 660; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e2ee-account span { display: block; margin-top: 3px; font-size: 12px; color: var(--ok); letter-spacing: .01em; }
.e2ee-nav { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.e2ee-nav button { min-height: 38px; border: 1px solid var(--line); border-radius: 10px; color: var(--text-2); font-size: 12px; font-weight: 620; background: var(--surface-2); transition: color var(--dur) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.e2ee-nav button:hover { color: var(--text); background: var(--surface-3); border-color: var(--line-strong); }
.e2ee-search { margin: 12px 12px 10px; width: calc(100% - 24px); min-height: 46px; font-size: 14px; }
.e2ee-search-results, .e2ee-room-list { padding: 0 8px; overflow-y: auto; min-height: 0; }
.e2ee-room-list { flex: 1; }
.e2ee-room {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 10px; margin-bottom: 2px;
  border: 1px solid transparent; border-radius: 12px;
  background: transparent; text-align: left; color: var(--text-2);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.e2ee-room:hover { background: var(--surface-2); color: var(--text); }
.e2ee-room.selected { background: var(--surface-3); border-color: var(--line); color: var(--text); }
.e2ee-room-copy { min-width: 0; flex: 1; }
.e2ee-room-time { flex: none; align-self: flex-start; margin-top: 4px; font-size: 10px; color: var(--faint); font-variant-numeric: tabular-nums; }
.e2ee-room strong { display: block; font-size: 14px; font-weight: 660; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e2ee-room small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e2ee-room .avatar, .room-avatar, .avatar, .avatar.small {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text);
  font-size: 16px; font-weight: 700;
}
.e2ee-toolbar { padding: 12px; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.e2ee-toolbar button { border-radius: 10px; padding: 10px 12px; text-align: left; font-size: 13px; font-weight: 600; color: var(--text-2); transition: color var(--dur) var(--ease), background var(--dur) var(--ease); }
.e2ee-toolbar button:hover { color: var(--text); background: var(--surface-2); }
.e2ee-security-tools strong { font-size: 11px; color: var(--muted); padding: 4px 12px 6px; text-transform: uppercase; letter-spacing: .08em; }

/* --- Conversation header / timeline --------------------------- */
.e2ee-head {
  min-height: 72px; flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.e2ee-head { position: relative; }
.e2ee-head > div { min-width: 0; padding-left: 54px; }
.e2ee-head br { display: none; }
.e2ee-head > div::before { content: ''; position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface-3); }
.e2ee-head strong { font-size: 16px; font-weight: 680; }
.e2ee-head span { font-size: 12px; color: var(--muted); }
.e2ee-head > div strong, .e2ee-head > div span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e2ee-head-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.nova-back { display: none; }
.e2ee-lock { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius-pill); color: var(--ok) !important; font-size: 10px !important; letter-spacing: .04em; background: var(--surface-2); white-space: nowrap; }
.e2ee-action {
  margin-left: 8px; padding: 10px 13px;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius-xs);
  background: var(--surface-2) !important;
  color: var(--text-2) !important;
  font-size: 12px !important; font-weight: 620 !important; white-space: nowrap;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.e2ee-action:hover:not(:disabled) { color: var(--text) !important; border-color: var(--line-strong) !important; background: var(--surface-3) !important; }
.e2ee-action:disabled { display: none; }
.e2ee-timeline {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
  padding: 28px clamp(16px,5vw,72px);
  scroll-behavior: smooth;
}
.e2ee-placeholder { margin: auto; text-align: center; color: var(--muted); padding: 26px; max-width: 380px; }
.e2ee-placeholder b { display: block; font-size: 22px; margin-bottom: 8px; }
.e2ee-bubble {
  max-width: min(72%, 540px);
  align-self: flex-start;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) var(--radius) 5px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 15px; line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere;
  animation: nova-fade-up 180ms var(--ease) both;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.e2ee-bubble:hover { border-color: var(--line-strong); background: var(--surface-3); }
.e2ee-bubble.mine { align-self: flex-end; background: var(--surface-4); border-color: var(--line-strong); border-radius: var(--radius) var(--radius) 5px var(--radius); }
.e2ee-bubble small { display: block; margin-top: 5px; text-align: right; font-size: 9px; color: var(--faint); }
.e2ee-compose { flex: none; padding: 12px clamp(12px,4vw,24px) 18px; border-top: 1px solid var(--line); background: var(--surface); }
.e2ee-compose form { display: flex; gap: 8px; align-items: flex-end; }
.e2ee-compose textarea { flex: 1; resize: none; min-height: 50px; max-height: 130px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface-2); color: var(--text); font-size: 15px; line-height: 1.5; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.e2ee-compose textarea:focus { border-color: var(--line-strong); background: var(--surface-3); }
.e2ee-compose button { min-height: 50px; min-width: 50px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 15px; transition: transform var(--dur) var(--ease), background var(--dur) var(--ease); }
.e2ee-compose button:hover:not(:disabled) { background: #fff; transform: translateY(-1px); }
.e2ee-compose #matrix-attach { border: 1px solid var(--line) !important; background: var(--surface-2) !important; color: var(--text-2) !important; font-size: 20px; }
.e2ee-compose #matrix-attach:hover { color: var(--text) !important; border-color: var(--line-strong) !important; }
.e2ee-compose #matrix-attach { display: grid; place-items: center; }
.e2ee-compose #matrix-attach::before { content: ''; width: 15px; height: 15px; background: linear-gradient(currentColor,currentColor) center/15px 1.5px no-repeat, linear-gradient(currentColor,currentColor) center/1.5px 15px no-repeat; }
#matrix-send > button[aria-label="Отправить"], .nova-send { display: grid; place-items: center; }
#matrix-send > button[aria-label="Отправить"]::before, .nova-send::before { content: ''; width: 0; height: 0; border-left: 9px solid currentColor; border-top: 6px solid transparent; border-bottom: 6px solid transparent; margin-left: 2px; }

/* --- Message affordances -------------------------------------- */
.e2ee-reply-preview { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 8px; padding: 8px 11px; border: 1px solid var(--line); border-left: 2px solid var(--text-2); border-radius: var(--radius-xs); background: var(--surface-2); color: var(--text-2); font-size: 11px; }
.e2ee-reply-preview span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.e2ee-reply-quote { margin: 0 0 8px; padding: 6px 9px; border-left: 2px solid var(--line-strong); border-radius: 5px; background: #ffffff08; color: var(--muted); font-size: 10px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.e2ee-reaction-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.e2ee-reaction-chip { border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text-2); padding: 2px 8px; font-size: 11px; transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.e2ee-reaction-chip.mine { border-color: var(--line-strong); color: var(--text); background: var(--surface-4); }
.e2ee-message-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 7px; opacity: .85; transition: opacity var(--dur) var(--ease); }
.e2ee-message-actions .text-btn { border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; background: var(--surface-3); }
.e2ee-bubble:hover .e2ee-message-actions, .e2ee-message-actions:focus-within { opacity: 1; }
.e2ee-message-actions .text-btn { padding: 2px 5px; font-size: 10px; }
.e2ee-emoji-row { display: flex; gap: 2px; }
.e2ee-emoji { border: 0; background: transparent; font-size: 16px; padding: 2px; border-radius: 6px; transition: background var(--dur) var(--ease), transform var(--dur) var(--ease); }
.e2ee-emoji:hover { background: var(--surface-4); transform: scale(1.12); }
.e2ee-file-download { display: block; max-width: 100%; margin: 0 0 7px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--surface-3); color: var(--text); font-size: 12px; font-weight: 600; text-align: left; overflow-wrap: anywhere; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.e2ee-file-download:hover { border-color: var(--line-strong); background: var(--surface-4); }
.e2ee-thumbnail-preview, .e2ee-attachment-cancel { display: block; margin: 0 0 7px; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--surface-2); color: var(--text-2); font-size: 11px; transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.e2ee-thumbnail-preview:hover { color: var(--text); border-color: var(--line-strong); }
.e2ee-attachment-cancel { border-color: transparent; background: transparent; color: var(--muted); padding-left: 0; text-decoration: none; }
.e2ee-attachment-cancel:hover { color: var(--danger); }
.e2ee-thumbnail { display: block; max-width: min(240px,100%); max-height: 180px; margin: 0 0 7px; border: 1px solid var(--line); border-radius: var(--radius-sm); object-fit: contain; background: var(--surface-3); }

/* --- Modals / dialogs ----------------------------------------- */
.e2ee-modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 18px; background: #000000c9; backdrop-filter: blur(6px); animation: nova-fade 160ms var(--ease) both; }
.e2ee-modal-card {
  width: min(460px,100%); max-height: min(86dvh, 820px); overflow-y: auto;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  animation: nova-pop 200ms var(--ease) both;
}
.e2ee-modal-card h3 { font-size: 20px; margin: 0 0 8px; }
.e2ee-modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.e2ee-modal-actions button { min-height: 40px; border-radius: var(--radius-sm); padding: 0 14px; font-size: 12px; font-weight: 600; }
.e2ee-modal-actions .primary-btn { background: var(--accent); color: var(--accent-ink); }
.e2ee-modal-actions .text-btn { border: 1px solid var(--line); }
.e2ee-secret-code { max-height: 150px; overflow: auto; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-2); overflow-wrap: anywhere; white-space: pre-wrap; font: 500 12px/1.6 var(--font-mono); user-select: all; }
.e2ee-qr-content { margin: 14px 0; text-align: center; }
.e2ee-qr-image { width: 280px; max-width: 100%; height: auto; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }

/* --- Groups ---------------------------------------------------- */
.e2ee-create-group { display: block; width: calc(100% - 28px); margin: 12px 14px 0; min-height: 42px; border: 1px solid var(--line) !important; border-radius: var(--radius-sm); background: var(--surface-2) !important; color: var(--text-2) !important; font-size: 12px; font-weight: 600; transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.e2ee-create-group:hover { color: var(--text) !important; border-color: var(--line-strong) !important; }
.e2ee-group-form { display: grid; gap: 12px; margin-top: 14px; }
.e2ee-group-form label { display: grid; gap: 6px; color: var(--text-2); font-size: 11px; font-weight: 600; }
.e2ee-group-members { max-height: 240px; overflow-y: auto; margin: 14px 0; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px; }
.e2ee-group-member { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.e2ee-group-member:last-child { border-bottom: 0; }
.e2ee-group-member span { white-space: pre-line; overflow-wrap: anywhere; }
.e2ee-group-member.invited { color: var(--faint); }
.e2e-group-manager, .e2ee-group-manager { width: min(560px,100%); }
.e2ee-banned-members { margin-top: 18px; }
.e2ee-banned-members:empty { display: none; }
.e2ee-group-member-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.e2ee-group-member-actions .text-btn { padding: 4px 6px; font-size: 10px; }
.e2ee-group-member-actions .text-btn.danger { color: var(--danger) !important; }
.e2ee-group-member-actions .text-btn.danger:hover { background: #c98d921a; }

/* --- Calls ----------------------------------------------------- */
.e2ee-call-card { width: min(720px,100%); max-width: 720px; padding: 0; overflow: hidden; }
.nova-call-ui { display: flex; flex-direction: column; }
.nova-call-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.nova-call-avatar { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface-3); font-size: 18px; font-weight: 700; color: var(--text); }
.nova-call-avatar.big { width: 96px; height: 96px; font-size: 34px; }
.nova-call-who { min-width: 0; flex: 1; }
.nova-call-who h3 { margin: 0; font-size: 18px; font-weight: 680; letter-spacing: -.03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#nova-call-status { margin: 4px 0 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.nova-call-stage { position: relative; min-height: 360px; background: #0b0b0d; display: grid; place-items: center; overflow: hidden; }
.nova-call-stage #nova-call-remote-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #0b0b0d; opacity: 0; transition: opacity 240ms var(--ease); }
.nova-call-stage.has-video #nova-call-remote-video { opacity: 1; }
.nova-call-placeholder { display: grid; place-items: center; gap: 10px; padding: 30px; text-align: center; color: var(--muted); transition: opacity 200ms var(--ease); }
.nova-call-placeholder strong { color: var(--text); font-size: 15px; font-weight: 620; }
.nova-call-placeholder small { font-size: 11px; max-width: 240px; line-height: 1.5; }
.nova-call-stage.has-video .nova-call-placeholder { opacity: 0; pointer-events: none; }
.nova-call-local { position: absolute; right: 16px; bottom: 16px; width: 150px; border: 1px solid var(--line-strong); border-radius: 14px; overflow: hidden; background: var(--surface-3); box-shadow: var(--shadow-2); }
.nova-call-local video { display: block; width: 100%; height: 100px; object-fit: cover; background: #0b0b0d; }
.nova-call-local span { display: block; padding: 4px 8px; font-size: 10px; color: var(--muted); }
.nova-call-local:not(.has-video) video { height: 0; }
.nova-call-controls { display: flex; justify-content: center; gap: 22px; padding: 20px 18px 24px; border-top: 1px solid var(--line); background: var(--surface); }
.nova-call-btn { width: 64px; display: grid; justify-items: center; gap: 8px; color: var(--text-2); font-size: 11px; font-weight: 600; }
.nova-call-btn svg { width: 52px; height: 52px; padding: 14px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface-2); fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.nova-call-btn:hover svg { background: var(--surface-4); color: var(--text); transform: translateY(-1px); }
.nova-call-btn[data-active="1"] svg { color: var(--danger); border-color: #c98d9255; background: #c98d921a; }
.nova-call-btn.danger svg { background: var(--danger); border-color: var(--danger); color: #150608; fill: var(--danger); }
.nova-call-btn.danger:hover svg { background: #d9a0a4; border-color: #d9a0a4; }
@media (max-width: 760px) {
  .e2ee-call-card { width: 100%; max-height: 100dvh; border: 0; border-radius: 0; }
  .nova-call-stage { min-height: 46dvh; }
  .nova-call-local { width: 104px; right: 10px; bottom: 10px; }
  .nova-call-controls { gap: 14px; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}

/* --- Incoming call --------------------------------------------- */
.nova-incoming-modal { z-index: 60; background: #000000d9; }
.nova-incoming-card { width: min(420px,100%); display: grid; justify-items: center; gap: 10px; padding: 34px 26px 26px; text-align: center; border: 1px solid var(--line-strong); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-2); animation: nova-pop 220ms var(--ease) both; }
.nova-incoming-avatar { width: 96px; height: 96px; display: grid; place-items: center; margin-bottom: 6px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface-3); color: var(--text); font-size: 34px; font-weight: 700; box-shadow: 0 0 0 0 #ffffff12; animation: nova-incoming-pulse 2.4s var(--ease) infinite; }
@keyframes nova-incoming-pulse { 0% { box-shadow: 0 0 0 0 #ffffff14; } 70% { box-shadow: 0 0 0 20px #ffffff00; } 100% { box-shadow: 0 0 0 0 #ffffff00; } }
.nova-incoming-badge { padding: 5px 11px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface-2); color: var(--muted); font-size: 11px; }
.nova-incoming-card h3 { margin: 4px 0 0; font-size: 22px; font-weight: 680; letter-spacing: -.04em; overflow-wrap: anywhere; }
.nova-incoming-card p { margin: 0 0 4px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.nova-incoming-actions { display: flex; justify-content: center; gap: 32px; width: 100%; margin-top: 18px; padding-top: 20px; border-top: 1px solid var(--line); }
.nova-incoming-btn { display: grid; justify-items: center; gap: 9px; color: var(--text-2); font-size: 12px; font-weight: 620; }
.nova-incoming-btn svg { width: 62px; height: 62px; padding: 17px; border-radius: 50%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--dur) var(--ease), background var(--dur) var(--ease); }
.nova-incoming-btn:hover svg { transform: translateY(-2px); }
.nova-incoming-btn.decline svg { background: var(--danger); border: 1px solid var(--danger); color: #17080a; fill: var(--danger); }
.nova-incoming-btn.answer svg { background: var(--accent); border: 1px solid var(--accent); color: var(--accent-ink); stroke-width: 2.4; }
@media (max-width: 760px) {
  .nova-incoming-modal { padding: 0; background: var(--bg); }
  .nova-incoming-card { width: 100%; max-width: none; height: 100dvh; border: 0; border-radius: 0; box-shadow: none; padding: calc(40px + env(safe-area-inset-top)) 24px calc(40px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; justify-content: center; }
  .nova-incoming-avatar { width: 128px; height: 128px; font-size: 46px; }
  .nova-incoming-card h3 { font-size: 26px; margin-top: 16px; }
  .nova-incoming-card p { font-size: 13px; max-width: 300px; }
  .nova-incoming-actions { position: absolute; left: 24px; right: 24px; bottom: calc(36px + env(safe-area-inset-bottom)); width: auto; border: 0; padding: 0; justify-content: space-around; }
  .nova-incoming-btn { font-size: 13px; gap: 12px; }
  .nova-incoming-btn svg { width: 76px; height: 76px; padding: 20px; }
}

/* --- Nearby ---------------------------------------------------- */
.nova-nearby-sas { font: 700 38px/1.2 var(--font); letter-spacing: .22em; text-align: center; color: var(--text); padding: 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2); margin: 14px 0; animation: nova-fade 200ms var(--ease) both; }
.nova-nearby-peers { display: grid; gap: 8px; margin: 12px 0; }
.nova-nearby-peer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.nova-nearby-peer strong { display: block; font-size: 12px; font-weight: 620; }
.nova-nearby-peer small { display: block; color: var(--muted); font-size: 10px; }
.nova-nearby-log { flex: 1; min-height: 160px; max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.nova-nearby-log .e2ee-bubble { max-width: 86%; }

/* --- Contacts / Profile / Settings panels ---------------------- */
.nova-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.nova-panel-head h3 { margin: 0; }
.nova-panel-body { display: grid; gap: 6px; }
.nova-panel-section { padding: 14px 0; border-top: 1px solid var(--line); }
.nova-panel-section:first-child { border-top: 0; padding-top: 0; }
.nova-panel-section h4 { margin: 0 0 10px; color: var(--faint); font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .12em; }
.nova-panel-row { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.nova-panel-row .e2ee-room-copy { min-width: 0; flex: 1; }
.nova-panel-row strong { display: block; font-size: 12px; font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nova-panel-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nova-contact-actions { display: flex; gap: 6px; flex: none; }
.e2ee-action.danger { color: var(--danger) !important; border-color: #c98d9244 !important; }
.e2ee-action.danger:hover { background: #c98d921a !important; }
.nova-panel-results, .nova-panel-devices { display: grid; gap: 6px; max-height: 340px; overflow-y: auto; }
.nova-panel-results { margin-top: 10px; }
.nova-panel-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.nova-note { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); font-size: 12px; line-height: 1.6; }
.nova-contacts-search { margin: 0; width: 100%; }

/* --- State colors ---------------------------------------------- */
.e2ee-offline { color: var(--warn) !important; }
.e2ee-verified { color: var(--ok) !important; }
.e2ee-unverified { color: var(--warn) !important; }

/* --- Legacy class compatibility (kept for shared components) --- */
.auth-shell { min-height: 100dvh; display: grid; background: var(--bg); }
.auth-aside { display: none; }
.auth-main { display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(400px,100%); }
.auth-card h2 { font-size: 28px; font-weight: 660; letter-spacing: -.045em; margin: 0 0 8px; }
.auth-card > p { color: var(--muted); font-size: 13px; line-height: 1.65; }
.auth-e2ee-link { display: block; margin-top: 22px; text-align: center; color: var(--text-2); font-size: 12px; text-decoration: none; }
.auth-e2ee-link:hover { color: var(--text); }
.app-bg, .workspace, .chat-pane, .composer-wrap, .composer, .messages { background: var(--bg); color: var(--text); }
.sidebar { background: var(--surface); border-color: var(--line); }
.brand-dark, .chat-item, .profile-info strong, .chat-title strong, .empty h3 { color: var(--text); }
.searchbox { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.searchbox input, .composer textarea { background: transparent; color: var(--text); }
.chat-item:hover { background: var(--surface-2); }
.chat-item.active { background: var(--surface-3); }
.bubble { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.mine .bubble { background: var(--surface-4); border-color: var(--line-strong); }
.day-divider { background: var(--surface); border-color: var(--line); }
.empty-icon { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.result-item:hover { background: var(--surface-2); }
.empty.compact { padding: 26px 14px; }
.message-actions { display: flex; justify-content: flex-end; gap: 4px; margin-top: 2px; }
.message-actions .text-btn { font-size: 10px; padding: 3px 5px; }

.nova-mobile-nav { display: none; }

/* --- Responsive ------------------------------------------------- */
@media (max-width: 1040px) {
  .e2ee-body { grid-template-columns: 280px minmax(0,1fr); }
  .e2ee-head .e2ee-action { padding: 7px 9px !important; font-size: 10px !important; }
}
@media (max-width: 760px) {
  .e2ee-shell { padding: 0 0 64px; align-content: start; }
  .e2ee-card { width: 100%; height: calc(100dvh - 64px); min-height: 0; border: 0; border-radius: 0; box-shadow: none; }
  .nova-mobile-nav { display: grid; grid-template-columns: repeat(4,1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .nova-mobile-nav button { min-height: 50px; border-radius: 10px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 620; }
  .nova-mobile-nav button:active { background: var(--surface-3); color: var(--text); }
  .e2ee-nav { display: none; }
  .e2ee-account::before { width: 40px; height: 40px; }
  .e2ee-head > div::before { width: 38px; height: 38px; }
  .e2ee-head strong { font-size: 15px; }
  .e2ee-head span { font-size: 11px; }
  .e2ee-action { margin-left: 4px; padding: 8px 10px !important; font-size: 11px !important; }
  .e2ee-compose textarea { min-height: 46px; font-size: 15px; }
  .e2ee-compose button { min-height: 46px; min-width: 46px; }
  .e2ee-top { padding: 14px 16px; }
  .e2ee-body { grid-template-columns: 1fr; }
  .e2ee-sidebar { grid-row: 1; }
  .e2ee-main { display: none; grid-row: 1; }
  .e2ee-body.room-open .e2ee-sidebar { display: none; }
  .e2ee-body.room-open .e2ee-main { display: flex; }
  .e2ee-head { min-height: 96px; padding: 8px 12px; gap: 8px; flex-wrap: wrap; align-content: center; }
  .nova-back { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
  .nova-back::before { content: ''; width: 10px; height: 10px; border-left: 2px solid var(--text); border-bottom: 2px solid var(--text); transform: rotate(45deg); margin-left: 3px; }
  .e2ee-head > div { flex: 1 1 calc(100% - 50px); padding-left: 0; }
  .e2ee-head > div::before { display: none; }
  .e2ee-head > div span { display: block; margin-top: 2px; }
  .e2ee-head-actions { flex: 1 1 100%; margin-left: 0; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .e2ee-head-actions .e2ee-action { margin-left: 0; flex: none; padding: 8px 11px !important; font-size: 11px !important; }
  .e2ee-lock { display: none; }
  .e2ee-timeline { padding: 16px 12px; }
  .e2ee-bubble { max-width: 88%; }
  .e2ee-message-actions { opacity: 1 !important; }
  .e2ee-message-actions .text-btn { padding: 6px 10px; font-size: 11px; }
  .e2ee-call-videos { grid-template-columns: 1fr; }
  .e2ee-call-videos video { min-height: 120px; }
  .e2ee-auth { padding: 22px; }
  .e2ee-modal { padding: 10px; }
  .e2ee-modal-card { padding: 18px; max-height: 92dvh; }
}
@media (max-width: 380px) {
  .e2ee-buttons { grid-template-columns: 1fr; }
  .e2ee-head .e2ee-action { font-size: 9px !important; }
}
