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

:root {
  --green: #00a884;
  --green-strong: #008069;
  --accent-text: #008069;
  --page-bg: #eae6df;
  --panel: #ffffff;
  --panel-header: #f0f2f5;
  --chat-bg: #efeae2;
  --chat-pattern: rgba(11, 20, 26, 0.06);
  --bubble-in: #ffffff;
  --bubble-out: #d9fdd3;
  --meta-out: #667781;
  --text: #111b21;
  --text-muted: #667781;
  --border: #e9edef;
  --input-bg: #ffffff;
  --chip-bg: #ffffff;
  --hover: rgba(11, 20, 26, 0.06);
  --card-bg: rgba(11, 20, 26, 0.05);
  --shimmer: rgba(255, 255, 255, 0.55);
  --menu-bg: #ffffff;
  --toast-bg: #3b4a54;
  --backdrop: rgba(11, 20, 26, 0.45);
  --shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  --danger: #d4002f;
  --danger-bg: #fde8ec;
  --success-bg: #e7f8f2;
  --info-bg: #e7f0fb;
  color-scheme: light;
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent-text: #00a884;
    --page-bg: #0c1317;
    --panel: #111b21;
    --panel-header: #202c33;
    --chat-bg: #0b141a;
    --chat-pattern: rgba(255, 255, 255, 0.035);
    --bubble-in: #202c33;
    --bubble-out: #005c4b;
    --meta-out: rgba(233, 237, 239, 0.6);
    --text: #e9edef;
    --text-muted: #8696a0;
    --border: #222d34;
    --input-bg: #2a3942;
    --chip-bg: #182229;
    --hover: rgba(255, 255, 255, 0.06);
    --card-bg: rgba(0, 0, 0, 0.2);
    --shimmer: rgba(255, 255, 255, 0.07);
    --menu-bg: #233138;
    --toast-bg: #3b4a54;
    --backdrop: rgba(0, 0, 0, 0.6);
    --shadow: 0 1px 0.5px rgba(0, 0, 0, 0.3);
    --danger: #f15c6d;
    --danger-bg: #3b1b22;
    --success-bg: #0f2e27;
    --info-bg: #13283b;
    color-scheme: dark;
  }
}

html, body { height: 100%; margin: 0; }
body { background: var(--page-bg); color: var(--text); font-size: 14.5px; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ */
/* Pages d'authentification                                            */
/* ------------------------------------------------------------------ */

.auth-page {
  min-height: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 72px 16px 40px;
}
.auth-band {
  position: fixed;
  inset: 0 0 auto 0;
  height: 222px;
  background: var(--green-strong);
}
.auth-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 36px 36px 28px;
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 17px 50px rgba(11, 20, 26, 0.19), 0 12px 15px rgba(11, 20, 26, 0.24);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  color: var(--green);
  font-weight: 600;
  font-size: 15px;
}
.auth-card h1 { margin: 0 0 20px; font-size: 24px; font-weight: 400; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--text-muted); }
.field input {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--input-bg);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.18); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 18px;
  font-size: 13.5px;
  color: var(--text-muted);
  cursor: pointer;
}
.checkbox input { accent-color: var(--green); }

.btn-primary {
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  border: 0;
  border-radius: 24px;
  background: var(--green);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--green-strong); }

.auth-switch { margin: 20px 0 0; text-align: center; font-size: 13.5px; color: var(--text-muted); }
.auth-switch a { color: var(--accent-text); font-weight: 600; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

.flashes { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 10px 12px; border-radius: 8px; font-size: 13.5px; }
.flash-error { background: var(--danger-bg); color: var(--danger); }
.flash-success { background: var(--success-bg); color: var(--accent-text); }
.flash-info { background: var(--info-bg); }

@media (max-width: 480px) {
  .auth-page { padding-top: 40px; }
  .auth-card { padding: 28px 20px 24px; }
  .row-2 { grid-template-columns: 1fr; gap: 0; }
}

/* ------------------------------------------------------------------ */
/* Chat                                                                */
/* ------------------------------------------------------------------ */

.chat-page { overflow: hidden; }
.app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  max-width: 1600px;
  margin: 0 auto;
  background: var(--panel);
  box-shadow: 0 6px 18px rgba(11, 20, 26, 0.05);
}
@media (min-width: 1441px) {
  .chat-page { padding: 19px 0; }
  .app { height: calc(100dvh - 38px); }
}

.panel-header {
  flex-shrink: 0;
  height: 59px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--panel-header);
}

.avatar {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #6a7175;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  user-select: none;
}
.avatar.small { width: 28px; height: 28px; font-size: 11.5px; }
.avatar .dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--green);
}
.group-avatar { background: #8696a0; }
.group-avatar svg { width: 24px; height: 24px; }

.icon-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.icon-btn:hover:not(:disabled) { background: var(--hover); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.icon-btn svg { width: 22px; height: 22px; }

/* Barre latérale */
.sidebar {
  width: 30%;
  min-width: 280px;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--panel);
}
.me, .chat-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.me strong, .me span, .chat-title strong, .chat-title span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.me strong { font-weight: 600; }
.me span { font-size: 12.5px; color: var(--text-muted); }

.sidebar-section { flex: 1; overflow-y: auto; padding: 6px 0; }
.sidebar-section h2 {
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 14px 16px 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.online-list { list-style: none; margin: 0; padding: 0; }
.online-list li { display: flex; align-items: center; gap: 13px; padding: 9px 16px; }
.online-list li:hover { background: var(--hover); }
.online-name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.online-name small { color: var(--text-muted); font-size: 13px; }

.sidebar-backdrop { display: none; }

/* Zone de discussion */
.chat {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--chat-bg);
}
.chat-title strong { font-size: 16px; font-weight: 500; }
.chat-title span { font-size: 13px; color: var(--text-muted); }
.chat-title span.typing { color: var(--green); }
.chat-title span.offline { color: var(--danger); }
.menu-btn { display: none; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0 12px;
  background-color: var(--chat-bg);
  background-image: radial-gradient(var(--chat-pattern) 1.2px, transparent 1.3px);
  background-size: 22px 22px;
}

.day-separator, .empty-state {
  display: flex;
  justify-content: center;
  margin: 12px 0 6px;
}
.day-separator { position: sticky; top: 8px; z-index: 2; }
.day-separator span, .empty-state span {
  padding: 5px 12px;
  border-radius: 7.5px;
  background: var(--chip-bg);
  box-shadow: var(--shadow);
  color: var(--text-muted);
  font-size: 12.5px;
}
.empty-state { margin-top: 30px; }

.msg-row { display: flex; align-items: flex-start; gap: 10px; margin-top: 2px; padding: 0 7%; }
.msg-row.first { margin-top: 10px; }
.msg-row.mine { justify-content: flex-end; }
.msg-row .avatar.spacer { visibility: hidden; }

.bubble {
  position: relative;
  max-width: min(65%, 640px);
  padding: 6px 7px 8px 9px;
  border-radius: 7.5px;
  background: var(--bubble-in);
  box-shadow: var(--shadow);
  line-height: 19px;
}
.mine .bubble { background: var(--bubble-out); }

/* Petite pointe sur le premier message d'une série, comme WhatsApp */
.theirs.first .bubble { border-top-left-radius: 0; }
.mine.first .bubble { border-top-right-radius: 0; }
.first .bubble::before {
  content: "";
  position: absolute;
  top: 0;
  width: 0;
  height: 0;
  border-style: solid;
}
.theirs.first .bubble::before {
  left: -8px;
  border-width: 0 8px 10px 0;
  border-color: transparent var(--bubble-in) transparent transparent;
}
.mine.first .bubble::before {
  right: -8px;
  border-width: 0 0 10px 8px;
  border-color: transparent transparent transparent var(--bubble-out);
}

.sender { margin-top: -1px; font-size: 12.8px; font-weight: 600; line-height: 21px; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; }
/* Réserve la place de l'heure sur la dernière ligne */
.text::after { content: ""; display: inline-block; width: 44px; }
.mine .text::after { width: 64px; }

.meta {
  position: absolute;
  right: 7px;
  bottom: 3px;
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 15px;
  white-space: nowrap;
}
.mine .meta { color: var(--meta-out); }
.status svg { display: block; width: 16px; height: 16px; }
.status.error { color: var(--danger); }
.msg-row.failed .bubble { opacity: 0.75; }

/* Message modifié : « Modifié » avant l'heure */
.edited .text::after { width: 92px; }
.mine.edited .text::after { width: 112px; }

/* Message supprimé */
.deleted .text { display: inline-flex; align-items: center; gap: 5px; font-style: italic; color: var(--text-muted); }
.mine.deleted .text { color: var(--meta-out); }
.deleted .text svg { width: 16px; height: 16px; flex-shrink: 0; }
.deleted .text::after, .mine.deleted .text::after { width: 38px; }

/* Bouton d'options (chevron) qui apparaît au survol */
.menu-trigger {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 30px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0 6px 0 12px;
  background: radial-gradient(at top right, var(--bubble-in) 55%, transparent 80%);
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s;
}
.mine .menu-trigger { background: radial-gradient(at top right, var(--bubble-out) 55%, transparent 80%); color: var(--meta-out); }
.media-top .menu-trigger { background: radial-gradient(at top right, rgba(11, 20, 26, 0.55), transparent 75%); color: #fff; }
.menu-trigger svg { width: 20px; height: 20px; }
.bubble:hover .menu-trigger, .menu-trigger.open, .menu-trigger:focus-visible { opacity: 1; }
@media (hover: none) { .menu-trigger { opacity: 0.9; } }

/* Pièces jointes */
.has-media .bubble { padding: 3px 3px 6px; }
.has-media .sender { padding: 2px 6px 1px; }
.has-media .text { display: block; padding: 6px 5px 0 6px; }
.attachment { position: relative; }

.image-link {
  position: relative;
  display: block;
  width: 330px;
  max-width: 100%;
  overflow: hidden;
  border-radius: 6px;
  background: var(--card-bg);
  cursor: zoom-in;
}
.image-link img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  transition: opacity 0.25s ease, filter 0.2s;
}

/* Chargement : emplacement animé + roue au centre, puis l'image apparaît en fondu */
.image-link.loading, .image-link.broken { aspect-ratio: 4 / 3; }
.image-link.loading {
  background: linear-gradient(100deg, transparent 30%, var(--shimmer) 50%, transparent 70%) var(--card-bg);
  background-size: 250% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  cursor: progress;
}
.image-link.loading img { position: absolute; inset: 0; height: 100%; opacity: 0; }
.image-spinner, .image-broken { display: none; }
.image-link.loading .image-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(11, 20, 26, 0.5);
}
.image-spinner::after {
  content: "";
  width: 26px;
  height: 26px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Échec du chargement : message, nouvel essai au clic */
.image-link.broken { cursor: pointer; }
.image-link.broken img { display: none; }
.image-link.broken .image-broken {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 16px;
  color: var(--text-muted);
  font-size: 12.5px;
  text-align: center;
}
.mine .image-link.broken .image-broken { color: var(--meta-out); }
.image-broken svg { width: 40px; height: 40px; margin-bottom: 6px; opacity: 0.7; }
.image-broken strong { font-size: 13.5px; font-weight: 600; }

/* Envoi : image assombrie sous le cercle de progression */
.image-link.uploading img { filter: brightness(0.7); }

@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .image-link.loading { animation: none; } }

.file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 310px;
  max-width: 100%;
  padding: 10px 12px 10px 8px;
  border-radius: 6px;
  background: var(--card-bg);
  color: inherit;
  text-decoration: none;
}
.file-card[href]:hover { filter: brightness(0.97); }
.file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.file-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.file-size { font-size: 12px; color: var(--text-muted); }
.mine .file-size { color: var(--meta-out); }
.file-download {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--text-muted);
  opacity: 0.8;
}
.file-download svg { width: 18px; height: 18px; }
.file-card:not([href]) .file-download { visibility: hidden; }

.file-icon { position: relative; flex-shrink: 0; width: 34px; height: 42px; display: grid; place-items: center; }
.file-icon svg { width: 42px; height: 42px; }
.file-ext {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 9px;
  color: #fff;
  font-size: 8.5px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.02em;
}

/* Heure sur l'image (image sans légende), ou sous le fichier */
.media-only .meta { position: static; justify-content: flex-end; margin: 4px 4px 0 0; }
.media-only.has-image .bubble { padding-bottom: 3px; }
.media-only.has-image .meta {
  position: absolute;
  right: 6px;
  bottom: 6px;
  margin: 0;
  padding: 10px 6px 2px 24px;
  border-radius: 0 0 6px 0;
  background: radial-gradient(at bottom right, rgba(11, 20, 26, 0.55), transparent 70%);
  color: #fff;
}

.upload-progress {
  position: absolute;
  left: 52px;
  right: 56px;
  bottom: 8px;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(127, 127, 127, 0.3);
}
.upload-progress:not(.upload-ring) span { display: block; width: 0; height: 100%; background: var(--green); transition: width 0.15s; }

.upload-ring {
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  display: grid;
  place-items: center;
  overflow: visible;
  border-radius: 50%;
  background: rgba(11, 20, 26, 0.55);
}
.upload-ring svg { position: absolute; inset: 4px; width: 48px; height: 48px; transform: rotate(-90deg); }
.ring-track, .ring-value { fill: none; stroke-width: 3; }
.ring-track { stroke: rgba(255, 255, 255, 0.25); }
.ring-value { stroke: #fff; stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray 0.15s; }
.ring-label { color: #fff; font-size: 11.5px; font-weight: 600; }

/* Zone de saisie : barre de modification, aperçu des fichiers, champ */
.composer-panel { flex-shrink: 0; background: var(--panel-header); }

.edit-bar { display: flex; align-items: center; gap: 12px; padding: 8px 16px 0 22px; }
.edit-bar > svg { flex-shrink: 0; width: 20px; height: 20px; color: var(--green); }
.edit-bar-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  border-left: 4px solid var(--green);
  border-radius: 6px;
  background: var(--card-bg);
}
.edit-bar-text strong { color: var(--accent-text); font-size: 13px; font-weight: 600; }
.edit-bar-text span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; color: var(--text-muted); }

.attach-tray { display: flex; gap: 8px; margin: 0; padding: 10px 16px 2px; overflow-x: auto; list-style: none; }
.app.editing .attach-tray { display: none; }
.tray-item {
  position: relative;
  flex-shrink: 0;
  height: 64px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--input-bg);
  box-shadow: var(--shadow);
}
.tray-item img { display: block; width: 64px; height: 100%; object-fit: cover; }
.tray-file { display: flex; align-items: center; gap: 8px; width: 200px; padding: 0 28px 0 8px; }
.tray-info { min-width: 0; display: flex; flex-direction: column; font-size: 12.5px; }
.tray-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(11, 20, 26, 0.6);
  color: #fff;
  cursor: pointer;
}
.tray-remove svg { width: 14px; height: 14px; }

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 16px 8px 10px;
}
.composer .icon-btn { margin-bottom: 1px; }
.composer textarea {
  flex: 1;
  max-height: 132px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  outline: none;
  background: var(--input-bg);
  line-height: 20px;
  resize: none;
}
.composer textarea::placeholder { color: var(--text-muted); }
.send-btn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.send-btn:hover:not(:disabled) { background: var(--green-strong); }
.send-btn:disabled { opacity: 0.45; cursor: default; }
.send-btn svg { width: 21px; height: 21px; margin-left: 2px; }

/* Mobile : la liste des membres devient un panneau coulissant */
@media (max-width: 800px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: 85%;
    min-width: 0;
    max-width: 360px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .app.sidebar-open .sidebar { transform: none; }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 10;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }
  .app.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .menu-btn { display: grid; margin-left: -8px; }
  .chat-header { gap: 8px; padding-left: 12px; }
  .msg-row { padding: 0 12px; }
  .bubble { max-width: 85%; }
  .composer { padding: 8px 10px; }
}

/* ------------------------------------------------------------------ */
/* Glisser-déposer, notifications, menu, fenêtres                      */
/* ------------------------------------------------------------------ */

.drop-overlay {
  position: absolute;
  inset: 59px 0 0 0;
  z-index: 12;
  display: grid;
  place-items: center;
  border: 3px dashed var(--green);
  background: color-mix(in srgb, var(--panel-header) 92%, transparent);
  color: var(--accent-text);
  font-size: 17px;
  text-align: center;
  pointer-events: none;
}
.drop-overlay svg { width: 60px; height: 60px; }
.drop-overlay p { margin: 8px 0 0; }

.toast {
  position: absolute;
  left: 50%;
  bottom: 84px;
  z-index: 15;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--toast-bg);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 13.5px;
  transform: translateX(-50%);
}

.msg-menu {
  position: fixed;
  z-index: 30;
  min-width: 180px;
  padding: 8px 0;
  border-radius: 10px;
  background: var(--menu-bg);
  box-shadow: 0 2px 5px rgba(11, 20, 26, 0.26), 0 2px 10px rgba(11, 20, 26, 0.16);
}
.msg-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 24px 10px 18px;
  border: 0;
  background: none;
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
}
.msg-menu button:hover, .msg-menu button:focus-visible { background: var(--hover); outline: none; }
.msg-menu svg { width: 19px; height: 19px; color: var(--text-muted); }
.msg-menu .danger, .msg-menu .danger svg { color: var(--danger); }

.modal {
  width: min(420px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 17px 50px rgba(11, 20, 26, 0.19), 0 12px 15px rgba(11, 20, 26, 0.24);
  color: var(--text);
}
.modal::backdrop { background: var(--backdrop); }
.modal[open] { animation: modal-in 0.16s ease-out; }
.modal[open]::backdrop { animation: fade-in 0.16s ease-out; }
.modal form { padding: 26px 24px 20px; text-align: center; }
.modal-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--accent-text);
}
.modal.danger .modal-icon { background: var(--danger-bg); color: var(--danger); }
.modal-icon svg { width: 26px; height: 26px; }
.modal h2 { margin: 0 0 8px; font-size: 18px; font-weight: 600; }
.modal p { margin: 0 0 20px; color: var(--text-muted); line-height: 1.45; }
.modal-quote {
  display: -webkit-box;
  margin: -6px 0 20px;
  padding: 8px 12px;
  overflow: hidden;
  border-left: 4px solid var(--danger);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 13.5px;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-secondary, .btn-danger, .btn-accent {
  padding: 10px 16px;
  border-radius: 22px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, filter 0.15s;
}
.btn-secondary { border: 1px solid var(--border); background: none; color: var(--accent-text); }
.btn-secondary:hover { background: var(--hover); }
.btn-danger { border: 0; background: var(--danger); color: #fff; }
.btn-accent { border: 0; background: var(--green); color: #fff; }
.btn-danger:hover, .btn-accent:hover { filter: brightness(0.92); }

@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.97); } }
@keyframes fade-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .modal[open], .modal[open]::backdrop { animation: none; }
}

.lightbox {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(11, 20, 26, 0.95);
  color: #fff;
}
.lightbox[open] { display: flex; flex-direction: column; }
.lightbox::backdrop { background: transparent; }
.lightbox-bar { flex-shrink: 0; height: 60px; display: flex; align-items: center; gap: 8px; padding: 0 12px 0 20px; }
.lightbox-bar span { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lightbox .icon-btn { color: #fff; }
.lightbox .icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.lightbox-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 16px 24px; }
.lightbox-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
