/* ===================================================================
 *  ProstataPirates – privater Familien-Chat
 *  Mobile-first, app-feeling, Senioren-freundlich, Light + Dark
 * =================================================================== */

:root {
  --bg: #f5f7fb;
  --bg-card: #ffffff;
  --bg-bubble-other: #ffffff;
  --bg-bubble-me: #2563eb;
  --bg-input: #ffffff;
  --bg-topbar: rgba(255, 255, 255, 0.92);
  --bg-overlay: rgba(15, 23, 42, 0.55);

  --text: #0f172a;
  --text-muted: #64748b;
  --text-on-me: #ffffff;
  --text-on-primary: #ffffff;

  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --accent: #f59e0b;
  --danger: #dc2626;
  --success: #10b981;

  --shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  --shadow-strong: 0 10px 30px rgba(15, 23, 42, 0.18);

  --radius: 18px;
  --radius-sm: 12px;
  --radius-bubble: 22px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Inter", sans-serif;
  --fs-base: 16.5px;
  --fs-sm: 14px;
  --fs-lg: 18px;

  --topbar-h: 56px;
  --composer-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Etwas heller als „fast schwarz“ – besser lesbar auf OLED / mit Overlays */
    --bg: #141c2b;
    --bg-card: #1a2438;
    --bg-bubble-other: #243047;
    --bg-bubble-me: #2563eb;
    --bg-input: #243047;
    --bg-topbar: rgba(20, 28, 43, 0.94);
    --bg-overlay: rgba(15, 23, 42, 0.52);

    --text: #f8fafc;
    --text-muted: #a8b8d0;

    --border: #2a3a55;
    --border-strong: #3d4f6e;

    --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-strong: 0 12px 40px rgba(0, 0, 0, 0.45);
  }
}

/* Manuelle Override-Klassen (Dark/Light vom User per Profil) */
body.theme-light { color-scheme: light; }
body.theme-dark  { color-scheme: dark; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior-y: none;
}

body {
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

button { cursor: pointer; }

.muted { color: var(--text-muted); font-size: var(--fs-sm); }

/* ─────────── Auth-Seiten ─────────── */
body.auth-page {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #f1f5f9;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 30px 26px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-strong);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.auth-brand img { border-radius: 14px; box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3); }
.auth-brand h1 { margin: 0; font-size: 22px; }
.auth-brand p { margin: 0; color: rgba(241, 245, 249, 0.7); font-size: 13px; }
.auth-info { color: rgba(241, 245, 249, 0.85); font-size: 14px; margin: 0 0 16px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; }
.auth-form label span { font-size: 14px; color: rgba(241, 245, 249, 0.85); }
.auth-form input[type="text"], .auth-form input[type="password"] {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  font-size: 17px;
}
.auth-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.auth-form .check { flex-direction: row; align-items: center; gap: 10px; }
.auth-form .check input { width: 20px; height: 20px; }
.footer-hint { margin: 20px 0 0; text-align: center; color: rgba(241, 245, 249, 0.6); font-size: 13px; }

.btn-primary {
  background: var(--primary);
  color: var(--text-on-primary);
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 600;
  font-size: var(--fs-lg);
  transition: background 0.15s, transform 0.05s;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary.big { padding: 16px 18px; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 600;
  font-size: var(--fs-base);
}
.btn-secondary.big { padding: 14px 16px; font-size: var(--fs-lg); width: 100%; }

.btn-danger {
  background: var(--danger);
  color: white;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
}

.error-bar { background: #fee2e2; color: #991b1b; padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 14px; border: 1px solid #fecaca; }
.info-bar { background: #ecfdf5; color: #065f46; padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 14px; border: 1px solid #a7f3d0; }
@media (prefers-color-scheme: dark) {
  .error-bar { background: #3f1d1d; color: #fecaca; border-color: #7f1d1d; }
  .info-bar { background: #14342b; color: #a7f3d0; border-color: #064e3b; }
}

/* ─────────── App-Shell + Topbar ─────────── */
.chat-page, body.page {
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
}

.app-shell {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  height: 100dvh;
  position: relative;
}

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  padding: calc(var(--safe-top) + 6px) 10px 8px;
  background: var(--bg-topbar);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
/* Chat: Mitglieder + Gruppenbild + Titel + Aktionen */
.chat-page .topbar {
  /* minmax(0,1fr): Titel darf schrumpfen, sonst Überlappung mit Lupe auf schmalen Handys */
  grid-template-columns: 44px 40px minmax(0, 1fr) auto;
}
.topbar-title {
  min-width: 0;
  overflow: hidden;
}
.topbar-title .t-name {
  font-weight: 700;
  font-size: 17px;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  justify-content: flex-end;
}

.group-avatar {
  width: 40px; height: 40px;
  padding: 0; border: 0; background: transparent;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18), 0 0 0 2px var(--bg-topbar);
  transition: transform 120ms ease;
}
.group-avatar:active { transform: scale(0.94); }
.group-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

/* Lightbox-Variante (klick auf Avatar zeigt Bild groß) */
.group-avatar-large {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-overlay);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  padding: 32px;
  cursor: pointer;
}
.group-avatar-large img {
  max-width: min(92vw, 480px);
  max-height: 80vh;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.topbar-title .t-sub {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  min-width: 0;
}
.topbar-title .t-sub #onlineCount {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 360px) {
  .topbar {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 4px;
    padding-left: 8px;
    padding-right: 8px;
  }
  .chat-page .topbar {
    grid-template-columns: 40px 36px minmax(0, 1fr) auto;
  }
  .topbar-title .t-name { font-size: 15px; }
  .icon-btn { width: 40px; height: 40px; }
  .icon-btn svg { width: 22px; height: 22px; }
  .group-avatar { width: 36px; height: 36px; }
}

/* Push-Hinweis (Chat): kein System-Popup ohne Tipp – nur dieser Kasten erscheint automatisch */
.push-nudge {
  padding: 12px 14px;
  background: rgba(37, 99, 235, 0.12);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.4;
}
.push-nudge-text { margin: 0; color: var(--text); }
.push-nudge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.push-nudge-actions .btn-primary,
.push-nudge-actions .btn-secondary { flex: 1; min-width: 140px; }

.icon-btn {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0;
  background: transparent;
  border-radius: 12px;
  color: var(--text);
  position: relative;
}
.icon-btn:hover { background: rgba(0,0,0,0.05); }
@media (prefers-color-scheme: dark) { .icon-btn:hover { background: rgba(255,255,255,0.06); } }
.icon-btn svg { width: 24px; height: 24px; fill: currentColor; }
.icon-btn.big { width: 48px; height: 48px; }
.icon-btn.primary { background: var(--primary); color: var(--text-on-primary); }
.icon-btn.primary:hover { background: var(--primary-hover); }

#onlineBadge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); display: inline-block; }

/* ─────────── Info-Strip + Pinned ─────────── */
.info-strip {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  max-height: 35vh;
  overflow-y: auto;
}
.info-strip details {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 10px;
  padding: 8px 12px;
  margin: 4px 0;
  font-size: 14px;
}
.info-strip summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.info-strip summary::-webkit-details-marker { display: none; }
.info-body { margin-top: 8px; line-height: 1.45; }

/* ─────────── Search Bar ─────────── */
.search-bar[hidden],
.search-results[hidden],
.jump-newest[hidden] {
  display: none !important;
  pointer-events: none;
}
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.search-bar input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 16px;
}
.search-results { padding: 8px 10px; overflow-y: auto; max-height: 50vh; }
.search-results .sr-item { padding: 12px; border-radius: 12px; background: var(--bg-card); margin-bottom: 8px; cursor: pointer; }
.search-results .sr-item:hover { background: rgba(0,0,0,0.04); }

/* ─────────── Messages ─────────── */
.messages-scroller {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 10px 8px;
  /* smooth + Touch-Scroll + Bilder die nachladen → auf iOS oft Flackern / „Zucken“ */
  scroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.messages { display: flex; flex-direction: column; gap: 8px; min-height: 100%; justify-content: flex-end; }

.load-more { display: flex; justify-content: center; padding: 6px 0 12px; }
.load-more button {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 14px; font-size: 13px; color: var(--text-muted);
}

.day-divider { text-align: center; margin: 14px 0 6px; font-size: 12px; color: var(--text-muted); position: relative; }
.day-divider::before, .day-divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.day-divider span { display: inline-block; padding: 4px 12px; background: var(--bg-card); border-radius: 999px; border: 1px solid var(--border); }

.msg {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 8px;
  align-items: flex-end;
  max-width: 100%;
  position: relative;
}
/* Eigene Nachrichten: DOM ist immer [Avatar, Blase]. Ohne grid-column landet die Blase
   fälschlich in der 36px-Spalte → Text bricht zeichenweise um (Safari/iOS besonders sichtbar). */
.msg.is-me {
  grid-template-columns: 1fr 36px;
}
.msg.is-me .msg-avatar {
  grid-column: 2;
  grid-row: 1;
}
.msg.is-me .msg-bubble {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  background: var(--bg-bubble-me);
  color: var(--text-on-me);
  border-bottom-right-radius: 6px;
  border-bottom-left-radius: var(--radius-bubble);
}
.msg.is-me .msg-name { display: none; }
.msg.is-me .msg-time { color: rgba(255,255,255,0.7); }
.msg.is-me .msg-body a { color: #fcd34d; }

.msg-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: white;
  font-size: 13px; font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; }

.msg-bubble {
  background: var(--bg-bubble-other);
  border-radius: var(--radius-bubble);
  border-bottom-left-radius: 6px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  position: relative;
  max-width: min(78%, 540px);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.msg-bubble.is-system { background: transparent; box-shadow: none; padding: 6px 10px; color: var(--text-muted); font-size: 13px; text-align: center; }
.msg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.msg-name { font-weight: 700; font-size: 13.5px; color: var(--accent); }
.msg-time { font-size: 11.5px; color: var(--text-muted); }
.msg-body { white-space: pre-wrap; font-size: var(--fs-base); }
.msg-body em.deleted { color: var(--text-muted); font-style: italic; }
.msg-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; display: flex; gap: 8px; }
.msg-meta .read-by { display: inline-flex; gap: 2px; }
.msg-meta .read-by .ra { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); color: white; font-size: 8px; display: inline-flex; align-items: center; justify-content: center; }

.msg-attachments { margin-top: 6px; display: flex; flex-direction: column; gap: 6px; }
.msg-attachments .att-image img {
  max-width: 320px;
  max-height: 320px;
  width: auto;
  height: auto;
  border-radius: 14px;
  cursor: zoom-in;
  display: block;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.04);
}
.msg-attachments .att-file { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,0.05); padding: 8px 12px; border-radius: 12px; color: inherit; }
.msg.is-me .msg-attachments .att-file { background: rgba(255,255,255,0.15); }
.msg-attachments .att-file .af-icon { font-size: 22px; }
.msg-attachments .att-file .af-name { font-weight: 600; font-size: 14px; }
.msg-attachments .att-file .af-meta { font-size: 12px; opacity: 0.7; }
.msg-attachments .att-audio audio { width: 240px; max-width: 100%; }

.msg-extra { margin-top: 6px; }
.msg-extra .event-card {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 14px;
  padding: 12px 14px;
}
.msg-extra .event-card h4 { margin: 0 0 4px; font-size: 16px; color: var(--accent); display: flex; align-items: center; gap: 6px; }
.msg-extra .event-card p { margin: 2px 0; font-size: 14px; }
.msg-extra .poll { background: rgba(37, 99, 235, 0.08); border: 1px solid rgba(37, 99, 235, 0.25); border-radius: 14px; padding: 12px 14px; }
.msg-extra .poll h4 { margin: 0 0 8px; font-size: 16px; }
.msg-extra .poll-opt { padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; cursor: pointer; background: var(--bg-card); display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.msg-extra .poll-opt.voted { background: rgba(37, 99, 235, 0.18); border-color: var(--primary); font-weight: 600; }
.msg-extra .poll-opt .pct { font-size: 12px; color: var(--text-muted); }

.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.msg-reactions .rx { background: rgba(0,0,0,0.05); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; font-size: 13px; cursor: pointer; }
.msg-reactions .rx.mine { background: rgba(245, 158, 11, 0.2); border-color: var(--accent); }
.msg.is-me .msg-reactions .rx { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.3); color: white; }

.msg-actions {
  position: absolute;
  top: -16px; right: 8px;
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 4px;
  box-shadow: var(--shadow);
  z-index: 5;
}
.msg-actions button { background: transparent; border: 0; padding: 4px 6px; font-size: 14px; }
.msg.show-actions .msg-actions { display: flex; }
.msg.is-me .msg-actions { left: 8px; right: auto; }

.pinned .msg-bubble { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }

/* ─────────── Composer ─────────── */
.composer {
  display: grid;
  grid-template-columns: 48px 1fr 48px 48px;
  gap: 6px;
  align-items: end;
  padding: 8px 8px calc(8px + var(--safe-bottom));
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 20;
}
.composer textarea {
  resize: none;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 12px 16px;
  background: var(--bg-input);
  font-size: var(--fs-base);
  line-height: 1.4;
  max-height: 140px;
  overflow-y: auto;
}
.composer textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }

.recording .composer { background: rgba(220, 38, 38, 0.08); }
.recording #btnRecord { background: var(--danger); color: white; border-radius: 50%; }

.typing-indicator { padding: 6px 12px; font-size: 12px; color: var(--text-muted); font-style: italic; }

.jump-newest {
  position: absolute;
  bottom: calc(var(--composer-h) + 16px + var(--safe-bottom));
  right: 12px;
  background: var(--primary);
  color: white;
  border: 0;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow-strong);
  z-index: 25;
  font-weight: 600;
}

/* ─────────── Sheets / Modals ─────────── */
.sheet {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg-overlay);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.18s ease-out;
}
.sheet[hidden] { display: none !important; pointer-events: none; }
.sheet-card {
  width: 100%;
  max-width: 520px;
  background: var(--bg-card);
  border-radius: 24px 24px 0 0;
  padding: 18px 16px calc(18px + var(--safe-bottom));
  box-shadow: var(--shadow-strong);
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.22s ease-out;
}
.sheet-card h3 { margin: 0 0 12px; font-size: 18px; }
.sheet-card label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.sheet-card label span { font-size: 13px; color: var(--text-muted); }
.sheet-card label input, .sheet-card label textarea {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 16px;
}
.sheet-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 12px;
  border-radius: 12px;
  background: transparent;
  border: 0;
  text-align: left;
  font-size: 16px;
  color: var(--text);
  cursor: pointer;
}
.sheet-row:hover { background: rgba(0,0,0,0.04); }
.sheet-row-icon { font-size: 22px; width: 32px; text-align: center; }
.sheet-close { width: 100%; padding: 14px; margin-top: 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 12px; font-size: 16px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* Members-Sheet */
.members-list { list-style: none; padding: 0; margin: 0; }
.members-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 8px; border-radius: 12px;
}
.members-list li:hover { background: rgba(0,0,0,0.04); }
.members-list .ml-avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: white; font-weight: 700; overflow: hidden; }
.members-list .ml-avatar img { width: 100%; height: 100%; object-fit: cover; }
.members-list .ml-name { font-weight: 600; }
.members-list .ml-sub { font-size: 12px; color: var(--text-muted); }
.members-list .ml-online { width: 10px; height: 10px; border-radius: 50%; background: var(--success); margin-left: auto; }
.members-list .ml-online.off { background: var(--border-strong); }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.88);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.lightbox[hidden] { display: none !important; pointer-events: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* ─────────── Profile / Admin / Pages ─────────── */
.page-body { padding: 16px; max-width: 720px; margin: 0 auto; padding-bottom: calc(40px + var(--safe-bottom)); overflow-y: auto; height: calc(100dvh - var(--topbar-h)); }

.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-stack label { display: flex; flex-direction: column; gap: 6px; }
.form-stack label span { font-size: 14px; color: var(--text-muted); }
.form-stack label em { color: var(--text-muted); font-weight: normal; font-size: 12px; font-style: normal; }
.form-stack input, .form-stack textarea, .form-stack select {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 16px;
}
.form-stack input:disabled { opacity: 0.6; }
.form-stack .check { flex-direction: row; align-items: center; gap: 10px; }
.form-stack .check input { width: 22px; height: 22px; }

.card-section { background: var(--bg-card); border-radius: var(--radius); padding: 18px; margin-top: 18px; box-shadow: var(--shadow); }
.card-section h3 { margin: 0 0 12px; font-size: 16px; }

.profile-avatar-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.profile-avatar-row .avatar.big.is-uploading { opacity: 0.55; pointer-events: none; }
.avatar.big { width: 80px; height: 80px; border-radius: 50%; background: var(--accent); color: white; display: inline-flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; overflow: hidden; }
.avatar.big img { width: 100%; height: 100%; object-fit: cover; }

.admin-users { list-style: none; padding: 0; margin: 0; }
.admin-user { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.admin-user:last-child { border-bottom: 0; }
.au-name { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.au-sub { font-size: 12px; color: var(--text-muted); }
.au-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.au-actions button { padding: 8px 12px; font-size: 13px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge.gold { background: rgba(245, 158, 11, 0.18); color: #b45309; }
.badge.red { background: rgba(220, 38, 38, 0.15); color: #b91c1c; }
@media (prefers-color-scheme: dark) {
  .badge.gold { color: #fcd34d; }
  .badge.red { color: #fca5a5; }
}

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.media-tile img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; }
.file-list { list-style: none; padding: 0; margin: 0; }
.file-list li { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }

/* ─────────── Tablet+ ─────────── */
@media (min-width: 768px) {
  .messages-scroller { padding: 16px 20px; }
  .msg-bubble { max-width: min(70%, 600px); }
  .composer { padding: 12px 20px calc(12px + var(--safe-bottom)); }
  .info-strip { padding: 10px 20px; }
}
@media (min-width: 1100px) {
  .app-shell { max-width: 980px; margin: 0 auto; box-shadow: var(--shadow-strong); }
}
