/* ═══════════════════════════════════════════
   THÈMES
════════════════════════════════════════════ */

/* Variables globales par défaut (noir) */
:root {
  --bg: #000;
  --bg2: #1c1c1e;
  --bg3: #2c2c2e;
  --bg4: #3a3a3c;
  --text: #fff;
  --text2: #ebebf5cc;
  --text3: #ebebf599;
  --accent: #ff9500;
  --accent2: #ff6b00;
  --danger: #ff453a;
  --success: #30d158;
  --btn-fn: #a5a5a5;
  --btn-num: #333;
  --btn-op: #ff9500;
  --radius: 50%;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Thème Blanc */
body[data-theme="blanc"] {
  --bg: #f2f2f7;
  --bg2: #fff;
  --bg3: #e5e5ea;
  --bg4: #d1d1d6;
  --text: #000;
  --text2: #00000099;
  --text3: #00000066;
  --accent: #ff9500;
  --accent2: #ff6b00;
  --danger: #ff3b30;
  --success: #34c759;
  --btn-fn: #a5a5a5;
  --btn-num: #fff;
  --btn-op: #ff9500;
}

/* Thème Bleu Nuit */
body[data-theme="bleu"] {
  --bg: #0a0e1a;
  --bg2: #111827;
  --bg3: #1e2a3a;
  --bg4: #2a3a50;
  --text: #e8f0fe;
  --text2: #a8c0d6cc;
  --text3: #a8c0d699;
  --accent: #4d9fff;
  --accent2: #2277dd;
  --danger: #ff4d4d;
  --success: #4dff91;
  --btn-fn: #4a6080;
  --btn-num: #1e2a3a;
  --btn-op: #4d9fff;
}

/* Thème Vert Forêt */
body[data-theme="vert"] {
  --bg: #0a1a0e;
  --bg2: #111f15;
  --bg3: #1a3020;
  --bg4: #234028;
  --text: #e8f5e9;
  --text2: #a5d6a7cc;
  --text3: #a5d6a799;
  --accent: #4caf50;
  --accent2: #388e3c;
  --danger: #ff5252;
  --success: #69f0ae;
  --btn-fn: #3a6040;
  --btn-num: #1a3020;
  --btn-op: #4caf50;
}

/* Thème Bordeaux */
body[data-theme="bordeaux"] {
  --bg: #1a0a0e;
  --bg2: #2a1118;
  --bg3: #3d1a23;
  --bg4: #52232e;
  --text: #fce4ec;
  --text2: #f48fb1cc;
  --text3: #f48fb199;
  --accent: #e91e63;
  --accent2: #c2185b;
  --danger: #ff5252;
  --success: #69f0ae;
  --btn-fn: #7a3040;
  --btn-num: #3d1a23;
  --btn-op: #e91e63;
}

/* La calculatrice reste TOUJOURS noire quel que soit le thème */
#view-calc {
  --bg: #000 !important;
  --bg2: #1c1c1e !important;
  --bg3: #2c2c2e !important;
  --text: #fff !important;
  --text3: #ebebf599 !important;
  --btn-fn: #a5a5a5 !important;
  --btn-num: #333 !important;
  --btn-op: #ff9500 !important;
  background: #000 !important;
}


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

html, body {
  height: 100%; width: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* ═══════════════════════════════════════════
   VUES
════════════════════════════════════════════ */
.view {
  position: fixed; inset: 0;
  display: none; flex-direction: column;
  background: var(--bg);
  overflow: hidden;
  transition: opacity 0.2s;
}
.view.active { display: flex; }

/* ═══════════════════════════════════════════
   CALCULATRICE
════════════════════════════════════════════ */
.calc-wrap {
  display: flex; flex-direction: column;
  height: 100%;
  padding-bottom: calc(20px + var(--safe-bottom));
}

.calc-display {
  flex: 1;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0 24px 12px;
  background: var(--bg);
}

.calc-expr {
  font-size: 22px;
  color: var(--text3);
  text-align: right;
  min-height: 28px;
  letter-spacing: -0.3px;
}

.calc-result {
  font-size: 80px;
  font-weight: 200;
  color: var(--text);
  text-align: right;
  line-height: 1;
  letter-spacing: -2px;
  transition: font-size 0.1s;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 0 12px;
}

.btn-calc {
  aspect-ratio: 1;
  border-radius: 50%;
  border: none;
  font-size: 28px;
  font-weight: 400;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.1s;
  outline: none;
  width: 100%;
}
.btn-calc:active { filter: brightness(1.3); }
.btn-calc.fn  { background: var(--btn-fn); color: #000; }
.btn-calc.num { background: var(--btn-num); color: var(--text); }
.btn-calc.op  { background: var(--btn-op); color: #fff; }
.btn-calc.zero {
  grid-column: span 2;
  border-radius: 999px;
  aspect-ratio: unset;
  padding: 0 0 0 28px;
  justify-content: flex-start;
  min-height: 72px;
  font-size: 28px;
}

/* ═══════════════════════════════════════════
   PIN
════════════════════════════════════════════ */
.pin-wrap {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%;
  gap: 20px;
  padding: 20px;
  padding-bottom: calc(32px + var(--safe-bottom));
}

.pin-logo { font-size: 48px; }
.pin-title { font-size: 22px; font-weight: 600; color: var(--text); }
.pin-sub { font-size: 14px; color: var(--text3); text-align: center; }

.pin-dots { display: flex; gap: 18px; }
.dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--text);
  background: transparent;
  transition: background 0.15s, border-color 0.15s;
}
.dot.filled { background: var(--accent); border-color: var(--accent); }

.pin-error {
  font-size: 13px; color: var(--danger);
  opacity: 0; transition: opacity 0.2s;
  height: 16px;
}
.pin-error.show { opacity: 1; }

.pin-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px; width: 280px;
}

.btn-pin {
  height: 76px; border-radius: 50%;
  background: var(--bg3); border: none; color: var(--text);
  font-size: 24px; font-weight: 300;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; cursor: pointer;
  transition: background 0.1s;
  outline: none;
}
.btn-pin span { font-size: 9px; font-weight: 500; letter-spacing: 1.5px; color: var(--text3); }
.btn-pin:active { background: var(--bg4); }
.btn-pin.ghost { background: transparent; font-size: 20px; }

/* ═══════════════════════════════════════════
   SETUP
════════════════════════════════════════════ */
.setup-wrap {
  padding: 60px 24px 40px;
  display: flex; flex-direction: column; gap: 16px;
  overflow-y: auto; height: 100%;
}
.setup-logo { font-size: 56px; text-align: center; }
.setup-title { font-size: 28px; font-weight: 700; text-align: center; color: var(--text); }
.setup-sub { font-size: 14px; color: var(--text3); text-align: center; margin-bottom: 8px; }
.setup-error { color: var(--danger); font-size: 13px; min-height: 16px; }

/* ═══════════════════════════════════════════
   FORMULAIRES
════════════════════════════════════════════ */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text3); }
.form-group input {
  background: var(--bg3);
  border: none; border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px; color: var(--text);
  outline: none; width: 100%;
  -webkit-appearance: none;
}
.form-group input::placeholder { color: var(--text3); }
.form-group small { font-size: 11px; color: var(--text3); }

.id-row { display: flex; gap: 8px; }
.btn-refresh {
  background: var(--bg3); border: none; border-radius: 12px;
  padding: 0 16px; font-size: 20px; color: var(--accent); cursor: pointer;
}

.btn-primary {
  background: var(--accent); color: #fff;
  border: none; border-radius: 14px;
  padding: 16px; font-size: 17px; font-weight: 600;
  cursor: pointer; width: 100%; margin-top: 8px;
  transition: background 0.1s;
}
.btn-primary:active { background: var(--accent2); }

/* ═══════════════════════════════════════════
   HEADER & NAVIGATION
════════════════════════════════════════════ */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 56px 16px 12px;
  background: var(--bg);
  border-bottom: 0.5px solid var(--bg3);
  flex-shrink: 0;
}
.app-header-left { display: flex; align-items: center; gap: 10px; }
.app-title { font-size: 18px; font-weight: 600; color: var(--text); }
.back-btn { font-size: 28px; color: var(--accent); background: none; border: none; cursor: pointer; padding: 0 8px 0 0; line-height: 1; }
.icon-btn { font-size: 22px; background: none; border: none; cursor: pointer; padding: 4px; }

.avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; cursor: pointer;
}

/* ═══════════════════════════════════════════
   ONGLETS
════════════════════════════════════════════ */
.tabs-bar {
  display: flex; background: var(--bg2);
  padding: 6px; gap: 4px;
  border-bottom: 0.5px solid var(--bg3);
  flex-shrink: 0;
}
.tab {
  flex: 1; padding: 8px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: var(--text3);
  background: transparent; border: none; cursor: pointer;
  transition: all 0.15s;
}
.tab.active { background: var(--bg3); color: var(--text); }

/* ═══════════════════════════════════════════
   LISTE CONVERSATIONS
════════════════════════════════════════════ */
.conv-list { flex: 1; overflow-y: auto; }

.conv-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--bg3);
  cursor: pointer; transition: background 0.1s;
}
.conv-item:active { background: var(--bg3); }

.conv-avatar {
  width: 50px; height: 50px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; flex-shrink: 0;
}
.conv-info { flex: 1; min-width: 0; }
.conv-name { font-size: 16px; font-weight: 500; color: var(--text); }
.conv-preview { font-size: 14px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.conv-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.conv-time { font-size: 12px; color: var(--text3); }
.unread-badge {
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700;
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.empty-hint {
  display: flex; flex-direction: column; align-items: center;
  padding: 60px 20px; gap: 10px; color: var(--text3); text-align: center;
}
.empty-icon { font-size: 48px; }
.bottom-safe { height: calc(20px + var(--safe-bottom)); flex-shrink: 0; }

/* ═══════════════════════════════════════════
   NOUVEAU CHAT
════════════════════════════════════════════ */
.new-wrap { padding: 24px; display: flex; flex-direction: column; gap: 16px; flex: 1; }
.new-error { color: var(--danger); font-size: 13px; min-height: 16px; }

/* ═══════════════════════════════════════════
   CHAT
════════════════════════════════════════════ */
.chat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 52px 12px 12px;
  border-bottom: 0.5px solid var(--bg3);
  flex-shrink: 0; background: var(--bg);
}
.chat-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.chat-info { flex: 1; }
.chat-name { font-size: 16px; font-weight: 600; color: var(--text); }
.chat-status { font-size: 12px; color: var(--success); }
.chat-actions { display: flex; gap: 4px; }

.messages {
  flex: 1; overflow-y: auto;
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 8px;
}

.msg-row { display: flex; flex-direction: column; }
.msg-row.sent { align-items: flex-end; }
.msg-row.recv { align-items: flex-start; }

.msg-from { font-size: 11px; color: var(--text3); margin-bottom: 3px; padding: 0 4px; }

.msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 16px; line-height: 1.4;
  word-break: break-word;
}
.msg-row.sent .msg-bubble {
  background: var(--accent); color: #fff;
  border-bottom-right-radius: 4px;
}
.msg-row.recv .msg-bubble {
  background: var(--bg3); color: var(--text);
  border-bottom-left-radius: 4px;
}
.msg-time { font-size: 10px; color: var(--text3); margin-top: 3px; padding: 0 4px; }

.chat-input-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  padding-bottom: calc(18px + var(--safe-bottom));
  border-top: 0.5px solid var(--bg3);
  background: var(--bg);
}
.msg-input {
  flex: 1;
  background: var(--bg3); border: none; border-radius: 22px;
  padding: 11px 16px; font-size: 16px; color: var(--text);
  outline: none;
}
.msg-input::placeholder { color: var(--text3); }
.send-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); border: none;
  color: #fff; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: background 0.1s;
}
.send-btn:active { background: var(--accent2); }

/* ═══════════════════════════════════════════
   APPEL
════════════════════════════════════════════ */
.call-wrap {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; gap: 20px;
  background: var(--bg2);
  padding: 40px 20px;
  padding-bottom: calc(60px + var(--safe-bottom));
}
.call-avatar {
  width: 100px; height: 100px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 38px; font-weight: 700;
}
.call-name { font-size: 28px; font-weight: 700; color: var(--text); }
.call-status { font-size: 16px; color: var(--text3); }
.call-timer { font-size: 20px; font-weight: 300; color: var(--text); font-variant-numeric: tabular-nums; }

#remote-video, #local-video {
  width: 100%; max-height: 300px;
  border-radius: 16px; object-fit: cover;
  background: #000;
}
#local-video { width: 120px; height: 160px; position: absolute; bottom: 140px; right: 20px; }

.call-controls {
  display: flex; gap: 24px; align-items: center;
  margin-top: 16px;
}
.call-btn {
  width: 64px; height: 64px; border-radius: 50%;
  border: none; font-size: 26px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: filter 0.1s;
}
.call-btn:active { filter: brightness(1.3); }
.call-btn.hangup { background: var(--danger); }
.call-btn.answer { background: var(--success); }
.call-btn.mute, .call-btn.speaker, .call-btn.video-toggle { background: var(--bg3); }

/* ═══════════════════════════════════════════
   PROFIL
════════════════════════════════════════════ */
.profile-wrap {
  display: flex; flex-direction: column; align-items: center;
  padding: 32px 24px; gap: 16px; overflow-y: auto; flex: 1;
}
.profile-avatar {
  width: 90px; height: 90px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 700;
}
.profile-name { font-size: 24px; font-weight: 700; color: var(--text); }
.profile-id-box {
  background: var(--bg3); border-radius: 14px;
  padding: 16px 20px; width: 100%; text-align: center; display: flex; flex-direction: column; gap: 8px;
}
.profile-id-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text3); }
.profile-id-val { font-size: 22px; font-weight: 700; color: var(--accent); letter-spacing: 2px; }
.btn-copy {
  background: var(--bg4); border: none; border-radius: 8px;
  padding: 8px 20px; color: var(--accent); font-size: 14px; font-weight: 600;
  cursor: pointer; align-self: center;
}
.profile-section-title {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text3); align-self: flex-start; margin-top: 8px;
}
.profile-row {
  width: 100%; background: var(--bg3); border: none; border-radius: 14px;
  padding: 16px 20px; text-align: left; font-size: 16px; color: var(--text); cursor: pointer;
}
.profile-row.danger { color: var(--danger); }

/* ═══════════════════════════════════════════
   APPEL ENTRANT
════════════════════════════════════════════ */
.incoming-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: calc(40px + var(--safe-bottom));
}
.incoming-card {
  background: var(--bg2); border-radius: 28px;
  padding: 32px 24px; width: 90%; max-width: 380px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.incoming-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700;
}
.incoming-name { font-size: 22px; font-weight: 700; color: var(--text); }
.incoming-type { font-size: 14px; color: var(--text3); }
.incoming-btns { display: flex; gap: 40px; margin-top: 8px; }

/* ═══════════════════════════════════════════
   TOAST
════════════════════════════════════════════ */
.toast {
  position: fixed; bottom: calc(80px + var(--safe-bottom)); left: 50%; transform: translateX(-50%);
  background: var(--bg3); color: var(--text);
  padding: 10px 20px; border-radius: 20px; font-size: 14px;
  opacity: 0; transition: opacity 0.3s; pointer-events: none; white-space: nowrap; z-index: 998;
}
.toast.show { opacity: 1; }

/* ═══════════════════════════════════════════
   MESSAGES VOCAUX
════════════════════════════════════════════ */
.voice-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg3); border: none;
  font-size: 18px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.voice-btn:active { filter: brightness(1.3); }

.voice-msg {
  display: flex; align-items: center; gap: 8px;
  min-width: 160px;
}
.voice-play-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.25); border: none;
  color: #fff; font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.msg-row.recv .voice-play-btn { background: var(--accent); color: #fff; }
.voice-waveform {
  display: flex; align-items: center; gap: 2px; flex: 1;
}
.voice-waveform span {
  display: inline-block; width: 3px; border-radius: 2px;
  background: rgba(255,255,255,0.6); min-height: 4px;
}
.msg-row.recv .voice-waveform span { background: var(--text3); }
.voice-duration { font-size: 11px; color: rgba(255,255,255,0.7); flex-shrink: 0; }
.msg-row.recv .voice-duration { color: var(--text3); }

/* ═══════════════════════════════════════════
   AUTO-DESTRUCTION
════════════════════════════════════════════ */
.autodestruct-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: calc(20px + var(--safe-bottom));
}
.autodestruct-card {
  background: var(--bg2); border-radius: 24px;
  padding: 24px; width: 90%; max-width: 380px;
  display: flex; flex-direction: column; gap: 12px;
}
.ad-title { font-size: 18px; font-weight: 700; color: var(--text); }
.ad-sub { font-size: 13px; color: var(--text3); }
.ad-list { display: flex; flex-direction: column; gap: 8px; }
.ad-option {
  background: var(--bg3); border: none; border-radius: 12px;
  padding: 14px 16px; text-align: left;
  font-size: 16px; color: var(--text); cursor: pointer;
  transition: background 0.1s;
}
.ad-option:active { background: var(--bg4); }
.ad-option.selected { background: var(--accent); color: #fff; }

/* ═══════════════════════════════════════════
   PARTAGE D'ÉCRAN
════════════════════════════════════════════ */
.call-btn.screen-share { background: var(--bg3); }

/* ═══════════════════════════════════════════
   DIALOGUE CUSTOM
════════════════════════════════════════════ */
.dialog-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.dialog-card {
  background: var(--bg2); border-radius: 20px;
  padding: 24px 20px; width: 100%; max-width: 320px;
  display: flex; flex-direction: column; gap: 16px;
}
.dialog-message {
  font-size: 16px; font-weight: 500;
  color: var(--text); text-align: center;
}
.dialog-input {
  width: 100%; background: var(--bg3);
  border: none; border-radius: 12px;
  padding: 12px 16px; font-size: 16px;
  color: var(--text); outline: none;
}
.dialog-btns {
  display: flex; gap: 10px;
}
.dialog-btn {
  flex: 1; padding: 13px; border-radius: 12px;
  border: none; font-size: 16px; font-weight: 600;
  cursor: pointer;
}
.dialog-btn.cancel { background: var(--bg3); color: var(--text); }
.dialog-btn.confirm { background: var(--accent); color: #fff; }

/* Fix chat actions overflow on small screens */
.chat-actions {
  display: flex; gap: 0; flex-shrink: 0;
}
.chat-actions .icon-btn {
  font-size: 20px; padding: 4px 6px;
}


/* Fix layout on all devices */
.messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-input-bar {
  flex-shrink: 0;
}
.msg-bubble img {
  max-width: min(220px, 65vw);
  border-radius: 10px;
  display: block;
}

/* ═══════════════════════════════════════════
   APERÇU PHOTO
════════════════════════════════════════════ */
.photo-preview-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.photo-preview-card {
  background: var(--bg2); border-radius: 20px;
  padding: 20px; width: 100%; max-width: 340px;
  display: flex; flex-direction: column; gap: 16px;
  align-items: center;
}
.photo-preview-title {
  font-size: 16px; font-weight: 600; color: var(--text);
}
.photo-preview-img {
  width: 100%; max-height: 300px;
  object-fit: contain; border-radius: 12px;
}

/* Fix layout dans Chrome mobile (app non installée) */
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  padding-bottom: calc(10px + var(--safe-bottom));
  border-top: 0.5px solid var(--bg3);
  background: var(--bg);
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
}
.send-btn {
  flex-shrink: 0;
}
.msg-input {
  flex: 1;
  min-width: 0;
}

/* ═══════════════════════════════════════════
   SÉLECTEUR DE THÈME
════════════════════════════════════════════ */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  width: 100%;
}
.theme-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.theme-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid transparent;
  transition: border-color 0.2s;
}
.theme-btn.active .theme-circle {
  border-color: var(--accent);
}
.theme-label {
  font-size: 10px;
  color: var(--text3);
  text-align: center;
}

/* ═══════════════════════════════════════════
   FOND DE CONVERSATION
════════════════════════════════════════════ */
.messages {
  position: relative;
}
/* Rendre les bulles lisibles sur fond d'image */
.msg-row.sent .msg-bubble {
  backdrop-filter: blur(2px);
}
.msg-row.recv .msg-bubble {
  backdrop-filter: blur(2px);
}

/* ═══════════════════════════════════════════
   STYLES CALCULATRICE
════════════════════════════════════════════ */
.calc-style-preview {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  gap: 4px; font-size: 16px; font-weight: 600;
}
.calc-style-ios    { background: #1c1c1e; color: #fff; border-radius: 50%; }
.calc-style-flat   { background: #222; color: #fff; border-radius: 4px; }
.calc-style-dark   { background: #000; color: #ff9500; border-radius: 12px; border: 1px solid #333; }
.calc-style-round  { background: #2c2c2e; color: #fff; border-radius: 24px; }

/* Style Flat */
[data-calc-style="flat"] .btn-calc {
  border-radius: 8px !important;
}
[data-calc-style="flat"] .btn-calc.zero {
  border-radius: 8px !important;
}

/* Style Dark+ */
[data-calc-style="dark"] .btn-calc.num {
  background: #111;
  border: 1px solid #333;
}
[data-calc-style="dark"] .btn-calc.fn {
  background: #222;
  border: 1px solid #444;
}

/* Style Round */
[data-calc-style="round"] .btn-calc {
  border-radius: 28px !important;
}
[data-calc-style="round"] .calc-display {
  background: #111;
  border-radius: 24px;
  margin: 12px;
  padding: 20px 20px 12px;
}

/* ═══════════════════════════════════════════
   ACCUSÉS DE RÉCEPTION
════════════════════════════════════════════ */
.receipt {
  font-size: 11px;
  margin-left: 2px;
}
.receipt.sent { color: var(--text3); }
.receipt.read { color: var(--accent); }
