/* ==========================================================================
   Norwent — نظام التصميم
   فاتح/داكن · RTL/LTR · متجاوب
   ========================================================================== */

:root {
  --brand-1: #6366f1;
  --brand-2: #06b6d4;
  --brand-grad: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  /* Accent härleds ur varumärkesfärgerna (används av taggar, chips, roller) */
  --accent: var(--brand-1);
  --accent-2: var(--brand-2);
  --accent-soft: color-mix(in srgb, var(--brand-1) 12%, transparent);
  --warn: #b8791a;
  --warn-soft: color-mix(in srgb, #b8791a 14%, transparent);
  --warn-border: color-mix(in srgb, #b8791a 35%, transparent);
  --ok: #0f9d6b;
  --ok-soft: color-mix(in srgb, #0f9d6b 14%, transparent);

  --bg: #f7f8fb;
  --bg-elev: #ffffff;
  --bg-soft: #eef1f7;
  --bg-hover: #e9edf5;
  --border: #e2e6ef;
  --border-strong: #cdd4e2;

  --text: #101522;
  --text-2: #4a5468;
  --text-3: #7b869c;

  --danger: #e11d48;
  --success: #0f9d6b;
  --like: #e11d48;

  --radius-s: 10px;
  --radius: 16px;
  --radius-l: 22px;
  --shadow-s: 0 1px 2px rgba(16, 21, 34, .06);
  --shadow: 0 2px 10px rgba(16, 21, 34, .06), 0 8px 28px rgba(16, 21, 34, .05);
  --shadow-l: 0 10px 40px rgba(16, 21, 34, .14);

  --header-h: 62px;
  --bottom-h: 60px;
  --max-w: 1240px;

  --ease: cubic-bezier(.2, .7, .3, 1);
  --ff: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", "Noto Sans Arabic", "Noto Naskh Arabic", Tahoma, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #0b0e15;
  --bg-elev: #131826;
  --bg-soft: #1a2031;
  --bg-hover: #202840;
  --border: #232b3d;
  --border-strong: #333d55;

  --text: #eef1f8;
  --text-2: #a8b2c7;
  --text-3: #77839b;

  --accent: #8b8cf7;
  --accent-2: #3cc8de;
  --warn: #e2ab52;
  --ok: #3fc48c;

  --shadow-s: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow: 0 2px 12px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .3);
  --shadow-l: 0 14px 50px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ff);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
}

[dir="rtl"] body { letter-spacing: 0; }

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: color-mix(in srgb, var(--brand-1) 28%, transparent); }

:focus-visible {
  outline: 2px solid var(--brand-1);
  outline-offset: 2px;
  border-radius: 6px;
}

.icon {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  flex: 0 0 auto;
}
.icon.sm { width: 18px; height: 18px; }
.icon.lg { width: 26px; height: 26px; }

/* مدخل ملف مخفي بصرياً لكنه موجود في شجرة العناصر (يعمل مع أدوات الاختبار والنقر البرمجي) */
.visually-hidden-file {
  position: absolute; width: 1px; height: 1px;
  opacity: 0; pointer-events: none; margin: 0; padding: 0; border: 0;
  clip: rect(0 0 0 0); overflow: hidden;
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ============================ التخطيط ============================ */
#app { min-height: 100%; }

.app-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 300px;
  gap: 24px;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 18px;
  align-items: start;
}

.col-main { min-height: 100vh; padding-bottom: 40px; }
.col-side { position: sticky; top: calc(var(--header-h) + 16px); }

/* ============================ الشريط الجانبي ============================ */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 0 18px;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 10px;
  border-radius: var(--radius);
  font-weight: 800; font-size: 22px; letter-spacing: -.4px;
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--brand-grad);
  display: grid; place-items: center;
  color: #fff; box-shadow: 0 6px 18px rgba(99, 102, 241, .35);
  flex: 0 0 auto;
}
.brand-mark .icon { width: 21px; height: 21px; stroke-width: 2.4; }
.brand-text { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius);
  border: 0; background: transparent; color: var(--text-2);
  font-weight: 600; font-size: 15.5px;
  transition: background .16s var(--ease), color .16s var(--ease);
  text-align: start;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-s); }
.nav-item.active .icon { color: var(--brand-1); }
.nav-item .badge-dot {
  margin-inline-start: auto; width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand-1);
}

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }

.account-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius);
  background: var(--bg-elev); border: 1px solid var(--border);
  width: 100%; text-align: start;
  transition: box-shadow .16s var(--ease);
}
.account-chip:hover { box-shadow: var(--shadow); }
.account-meta { min-width: 0; }
.account-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-handle { color: var(--text-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================ الأفاتار ============================ */
.avatar {
  --size: 44px;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  display: grid; place-items: center;
  overflow: hidden; flex: 0 0 auto;
  font-weight: 700; font-size: calc(var(--size) * .38);
  color: #fff; background: var(--brand-grad);
  user-select: none;
  position: relative;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.xs { --size: 30px; }
.avatar.sm { --size: 38px; }
.avatar.md { --size: 48px; }
.avatar.lg { --size: 84px; }
.avatar.xl { --size: 116px; }
.avatar-ring { box-shadow: 0 0 0 4px var(--bg-elev); }

/* ألوان الأغلفة */
.cover-dawn   { background: linear-gradient(135deg, #f59e0b, #ec4899, #6366f1); }
.cover-ocean  { background: linear-gradient(135deg, #0ea5e9, #6366f1, #14b8a6); }
.cover-forest { background: linear-gradient(135deg, #16a34a, #0d9488, #84cc16); }
.cover-ember  { background: linear-gradient(135deg, #ef4444, #f97316, #facc15); }
.cover-violet { background: linear-gradient(135deg, #8b5cf6, #d946ef, #f43f5e); }
.cover-slate  { background: linear-gradient(135deg, #475569, #1e293b, #0ea5e9); }

/* ============================ العمود الأيمن ============================ */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-s);
}
.card-pad { padding: 16px; }
.card.pad { padding: 22px 24px; }

.side-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-s);
}
.side-card h3 {
  margin: 0 0 12px; font-size: 13px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3); font-weight: 700;
}

.search-box { position: relative; margin-bottom: 16px; }
.search-box .icon {
  position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); pointer-events: none;
}
.search-box input {
  width: 100%; padding: 11px 14px; padding-inline-start: 42px;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-elev); color: var(--text);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.search-box input:focus {
  outline: none; border-color: var(--brand-1);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-1) 15%, transparent);
}

.suggest-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
}
.suggest-row .account-meta { flex: 1 1 auto; min-width: 0; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat {
  background: var(--bg-soft); border-radius: var(--radius-s);
  padding: 10px; text-align: center;
}
.stat b { display: block; font-size: 19px; letter-spacing: -.4px; }
.stat span { font-size: 11.5px; color: var(--text-3); }

/* ============================ الأزرار ============================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 999px;
  border: 1px solid transparent; background: var(--bg-soft); color: var(--text);
  font-weight: 700; font-size: 14.5px;
  transition: transform .12s var(--ease), filter .16s var(--ease), background .16s var(--ease), box-shadow .16s var(--ease);
  white-space: nowrap; user-select: none;
}
.btn:hover { filter: brightness(.97); }
.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: 0 6px 18px rgba(99, 102, 241, .3); }
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 8px 24px rgba(99, 102, 241, .4); }
.btn-ghost:not(.btn-primary) { background: transparent; border-color: var(--border-strong); }
.btn-ghost:not(.btn-primary):hover { background: var(--bg-hover); }
.btn-soft { background: var(--bg-soft); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-round { width: 38px; height: 38px; padding: 0; border-radius: 50%; }

/* ============================ الشريط العلوي ============================ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--header-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-weight: 800; font-size: 17px; letter-spacing: -.3px; display: flex; align-items: center; gap: 8px; }
.topbar-spacer { flex: 1; }
.topbar .brand { padding: 0; margin: 0; font-size: 19px; }
.topbar .brand-mark { width: 32px; height: 32px; border-radius: 10px; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text-2);
  transition: background .16s var(--ease), color .16s var(--ease), transform .12s var(--ease);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn:active { transform: scale(.94); }

.lang-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-elev);
  font-size: 12.5px; font-weight: 700; color: var(--text-2);
}
.lang-toggle:hover { background: var(--bg-hover); }
.lang-toggle .cur { color: var(--brand-1); }

/* ============================ الخلاصة ============================ */
.feed-head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 4px 10px;
}
.tabs {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--bg-soft); border-radius: 999px;
}
.tab {
  border: 0; background: transparent; color: var(--text-2);
  padding: 8px 18px; border-radius: 999px; font-weight: 700; font-size: 14px;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-s); }

.composer {
  display: flex; gap: 12px; padding: 16px;
  margin-bottom: 14px;
}
.composer .avatar { margin-top: 2px; }
.composer-main { flex: 1; min-width: 0; }
.composer textarea {
  width: 100%; min-height: 56px; max-height: 340px;
  border: 0; background: transparent; resize: none;
  font-size: 17px; line-height: 1.6; padding: 6px 0; color: var(--text);
}
.composer textarea::placeholder { color: var(--text-3); }
.composer textarea:focus { outline: none; }
.composer-preview {
  position: relative; margin-top: 10px; border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border); background: var(--bg-soft);
}
.composer-preview img { display: block; width: 100%; max-height: 340px; object-fit: cover; }
.composer-preview .remove {
  position: absolute; top: 8px; inset-inline-end: 8px;
  width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: rgba(9, 12, 20, .62); color: #fff; display: grid; place-items: center;
  backdrop-filter: blur(4px);
}
.composer-foot {
  display: flex; align-items: center; gap: 6px;
  margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border);
}
.counter { font-size: 12.5px; color: var(--text-3); margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.counter.warn { color: #d97706; }
.counter.over { color: var(--danger); font-weight: 700; }

/* ============================ بطاقة المنشور ============================ */
.post {
  padding: 16px;
  margin-bottom: 12px;
  transition: box-shadow .18s var(--ease);
}
.post:hover { box-shadow: var(--shadow); }
.post-head { display: flex; align-items: flex-start; gap: 10px; }
.post-head .account-meta { flex: 1; min-width: 0; }
.post-author { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.post-author .name { font-weight: 700; }
.post-author .name:hover { text-decoration: underline; }
.post-author .handle, .post-time { color: var(--text-3); font-size: 13.5px; }
/* عزل اتجاه المعرّفات اللاتينية داخل سياق RTL */
.handle, .account-handle, .profile-handle, .prefix { unicode-bidi: isolate; }
.post-time:hover { text-decoration: underline; }
.post-body {
  margin: 10px 0 0; font-size: 15.5px; line-height: 1.72;
  white-space: pre-wrap; word-break: break-word;
}
.post-image {
  margin-top: 12px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); background: var(--bg-soft);
}
.post-image img { display: block; width: 100%; max-height: 560px; object-fit: cover; }

.post-actions { display: flex; align-items: center; gap: 4px; margin-top: 10px; margin-inline-start: -8px; }
.action {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 10px; border-radius: 999px; border: 0; background: transparent;
  color: var(--text-3); font-size: 13.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.action:hover { background: var(--bg-hover); color: var(--text); }
.action .icon { width: 19px; height: 19px; }
.action.liked { color: var(--like); }
.action.liked .icon { stroke-width: 0; fill: currentColor; }
.action.comment:hover { color: var(--brand-1); }
.action-menu { margin-inline-start: auto; }

.pop-heart { animation: pop .34s var(--ease); }
@keyframes pop {
  0% { transform: scale(.7); }
  55% { transform: scale(1.28); }
  100% { transform: scale(1); }
}

.post-menu-wrap { position: relative; }
.menu {
  position: absolute; inset-inline-end: 0; top: 44px; z-index: 25;
  min-width: 180px; padding: 6px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-l);
}
.menu button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: var(--radius-s);
  background: transparent; text-align: start; font-size: 14px; font-weight: 600; color: var(--text-2);
}
.menu button:hover { background: var(--bg-hover); color: var(--text); }
.menu button.danger { color: var(--danger); }

/* ============================ الحالات ============================ */
.empty {
  text-align: center; padding: 48px 24px; color: var(--text-3);
}
.empty .icon { width: 44px; height: 44px; margin-bottom: 12px; color: var(--border-strong); }
.empty h3 { margin: 0 0 6px; color: var(--text-2); font-size: 17px; }
.empty p { margin: 0; font-size: 14px; max-width: 380px; margin-inline: auto; }

.skeleton { padding: 16px; }
.sk-line, .sk-circle, .sk-box {
  background: linear-gradient(90deg, var(--bg-soft) 25%, var(--bg-hover) 50%, var(--bg-soft) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 6px;
}
.sk-circle { width: 44px; height: 44px; border-radius: 50%; }
.sk-line { height: 12px; margin-bottom: 8px; }
.sk-box { height: 180px; border-radius: var(--radius); margin-top: 12px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.4px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor; animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.no-spin { animation: none !important; }

.load-more { display: flex; justify-content: center; padding: 8px 0 32px; }

/* ============================ التنبيهات ============================ */
.toasts {
  position: fixed; inset-inline: 0; bottom: 22px; z-index: 100;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; padding: 0 16px;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 16px; border-radius: 999px;
  background: var(--text); color: var(--bg);
  font-size: 13.6px; font-weight: 650;
  box-shadow: var(--shadow-l); max-width: 92vw;
  animation: toastIn .24s var(--ease);
  pointer-events: auto;
}
.toast.error { background: var(--danger); color: #fff; }
.toast.success { background: var(--success); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }

/* ============================ شاشة الدخول ============================ */
.auth-wrap {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr;
}
.auth-hero {
  position: relative; overflow: hidden;
  background: var(--brand-grad); color: #fff;
  padding: 52px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-hero::before, .auth-hero::after {
  content: ""; position: absolute; border-radius: 50%;
  background: rgba(255, 255, 255, .12); filter: blur(2px);
}
.auth-hero::before { width: 460px; height: 460px; bottom: -180px; inset-inline-start: -120px; }
.auth-hero::after { width: 300px; height: 300px; top: -110px; inset-inline-end: -80px; background: rgba(255,255,255,.08); }
.auth-hero > * { position: relative; z-index: 1; }
.auth-hero .brand { color: #fff; font-size: 26px; padding: 0; margin: 0; }
/* الشعار داخل اللافتة: نص أبيض صريح لأن الخلفية متدرّجة */
.auth-hero .brand-text { background: none; -webkit-background-clip: border-box; background-clip: border-box; color: #fff; -webkit-text-fill-color: #fff; }
.auth-hero .brand-mark { background: rgba(255, 255, 255, .18); box-shadow: none; backdrop-filter: blur(6px); }
.auth-hero h1 {
  font-size: clamp(30px, 4.2vw, 46px); line-height: 1.16; margin: 0 0 14px;
  letter-spacing: -.8px; font-weight: 800;
}
.auth-hero p.lead { font-size: 17px; opacity: .92; margin: 0 0 26px; max-width: 30ch; line-height: 1.65; }
.auth-feats { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.auth-feats li { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; opacity: .95; }
.auth-feats .icon { width: 20px; height: 20px; }
.auth-preview {
  margin-top: 32px; padding: 14px; border-radius: var(--radius-l);
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .22);
  backdrop-filter: blur(10px); max-width: 380px;
}
.auth-preview .mini { display: flex; gap: 10px; align-items: flex-start; }
.auth-preview .bubble {
  background: rgba(255, 255, 255, .9); color: #101522;
  border-radius: 14px; padding: 10px 13px; font-size: 13.5px; line-height: 1.6;
}
.auth-preview .row2 { display: flex; gap: 14px; margin-top: 10px; font-size: 12.5px; opacity: .9; align-items: center; }
.auth-preview .row2 span { display: inline-flex; align-items: center; gap: 5px; }

.auth-main {
  display: flex; flex-direction: column;
  padding: 28px 32px 40px;
  overflow-y: auto;
}
.auth-main-top { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-bottom: auto; }
.auth-form-wrap { width: 100%; max-width: 404px; margin: auto; padding: 24px 0; }
.auth-form-wrap h2 { font-size: 26px; letter-spacing: -.5px; margin: 0 0 6px; }
.auth-form-wrap .sub { color: var(--text-3); margin: 0 0 22px; font-size: 14.5px; }

.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 13px; font-weight: 700; color: var(--text-2);
  margin-bottom: 6px;
}
.input {
  width: 100%; padding: 12px 14px;
  border-radius: var(--radius-s); border: 1px solid var(--border);
  background: var(--bg-elev); color: var(--text);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.input:focus {
  outline: none; border-color: var(--brand-1);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-1) 15%, transparent);
}
.input.invalid { border-color: var(--danger); }
textarea.input { resize: vertical; min-height: 92px; line-height: 1.6; }
.hint { font-size: 12.3px; color: var(--text-3); margin-top: 5px; }
.err { font-size: 12.6px; color: var(--danger); margin-top: 5px; font-weight: 600; }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .prefix {
  position: absolute; inset-inline-start: 13px; color: var(--text-3);
  font-weight: 700; pointer-events: none;
}
.input-wrap .prefix + .input { padding-inline-start: 32px; }
.input-wrap .suffix-btn {
  position: absolute; inset-inline-end: 6px;
  width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: transparent; color: var(--text-3); display: grid; place-items: center;
}
.input-wrap .suffix-btn:hover { background: var(--bg-hover); color: var(--text); }
.input-wrap .suffix-btn + .input, .input.has-suffix { padding-inline-end: 44px; }

.auth-switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--text-3); }
.auth-switch a, .link { color: var(--brand-1); font-weight: 700; cursor: pointer; }
.auth-switch a:hover, .link:hover { text-decoration: underline; }

.avatar-pick { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.avatar-pick .avatar { --size: 68px; }
.avatar-pick-actions { display: flex; flex-direction: column; gap: 4px; }

.divider { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12.5px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.demo-box {
  margin-top: 16px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--bg-soft); border: 1px dashed var(--border-strong);
  font-size: 13px; color: var(--text-2);
}
.demo-box b { color: var(--text); }
.demo-box code {
  background: var(--bg-elev); padding: 1px 6px; border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  border: 1px solid var(--border);
}

/* ============================ الملف الشخصي ============================ */
.profile-cover { height: 168px; position: relative; }
.profile-cover .cover-dawn, .profile-cover .cover-ocean, .profile-cover .cover-forest,
.profile-cover .cover-ember, .profile-cover .cover-violet, .profile-cover .cover-slate {
  width: 100%; height: 100%;
}
.profile-cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,.22));
}
.profile-body { padding: 0 20px 16px; }
.profile-top { display: flex; align-items: flex-end; gap: 14px; margin-top: -44px; position: relative; z-index: 1; }
.profile-top .avatar { --size: 104px; }
.profile-actions { margin-inline-start: auto; display: flex; gap: 8px; padding-bottom: 6px; }
.profile-name { font-size: 23px; font-weight: 800; letter-spacing: -.5px; margin: 12px 0 1px; }
.profile-handle { color: var(--text-3); font-size: 14px; }
.profile-bio { margin: 10px 0 0; font-size: 15px; line-height: 1.65; white-space: pre-wrap; }
.profile-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 13.5px; color: var(--text-3); }
.profile-meta b { color: var(--text); font-weight: 700; }
.profile-meta a:hover b { text-decoration: underline; }

/* ============================ صفحة المنشور ============================ */
.back-row { display: flex; align-items: center; gap: 10px; padding: 12px 2px; }
.back-row h2 { margin: 0; font-size: 18px; }

.thread-post { padding: 18px; }
.thread-post .post-body { font-size: 18px; line-height: 1.75; }
.thread-post .post-time { font-size: 13.5px; display: block; margin-top: 12px; color: var(--text-3); }
.thread-stats {
  display: flex; gap: 18px; padding: 12px 0; margin-top: 10px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  font-size: 13.5px; color: var(--text-3);
}
.thread-stats b { color: var(--text); }
.thread-actions { display: flex; gap: 6px; margin-top: 8px; margin-inline-start: -8px; }

.comment-form { display: flex; gap: 10px; padding: 14px 16px; align-items: flex-start; }
.comment-form .input { border-radius: var(--radius); }
.comment-form-actions { display: flex; justify-content: flex-end; margin-top: 8px; }

.comment { display: flex; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--border); position: relative; }
.comment:last-child { border-bottom: 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-meta { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: 13.6px; }
.comment-text { margin: 3px 0 0; font-size: 14.6px; line-height: 1.65; white-space: pre-wrap; }
.comment .del {
  opacity: 0; transition: opacity .15s var(--ease);
  border: 0; background: transparent; color: var(--text-3);
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
}
.comment:hover .del, .comment:focus-within .del { opacity: 1; }
.comment .del:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }

/* ============================ الاستكشاف / البحث ============================ */
.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 800; margin: 22px 4px 10px;
}
.section-title .icon { color: var(--brand-1); width: 19px; height: 19px; }
.section-title .count { color: var(--text-3); font-weight: 600; font-size: 13px; }

.user-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 8px;
  transition: background .15s var(--ease);
}
.user-row:hover { background: var(--bg-elev); }
.user-row .account-meta { flex: 1; min-width: 0; }
.user-row .bio-line { color: var(--text-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.trend-grid { display: grid; gap: 12px; }

/* ============================ الإعدادات ============================ */
.settings-section { margin-bottom: 18px; }
.settings-section h3 { margin: 0 0 4px; font-size: 17px; }
.settings-section .desc { color: var(--text-3); font-size: 13.6px; margin: 0 0 16px; }
.cover-choices { display: flex; gap: 8px; flex-wrap: wrap; }
.cover-choice {
  width: 46px; height: 46px; border-radius: 12px; border: 2px solid transparent; padding: 0;
  position: relative;
}
.cover-choice.active { border-color: var(--brand-1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-1) 20%, transparent); }
.cover-choice.active::after {
  content: ""; position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0,0,0,.35); border-radius: 10px;
}
.settings-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.settings-row:last-child { border-bottom: 0; }
.settings-row .account-meta { flex: 1; }
.seg { display: inline-flex; padding: 3px; background: var(--bg-soft); border-radius: 999px; gap: 2px; }
.seg button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 700; color: var(--text-2);
}
.seg button.active { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-s); }

/* ============================ الشريط السفلي (الجوال) ============================ */
.bottom-nav {
  display: none;
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40;
  height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-top: 1px solid var(--border);
  align-items: center;
  justify-content: space-around;
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text-3); font-size: 10px; font-weight: 700;
  /* Fem poster: fast lika bredd så etiketterna inte radbryter */
  flex: 1 1 0; min-width: 0; padding: 6px 2px; border-radius: 12px;
  line-height: 1.15;
}
.bottom-nav a > span:not(.bnav-icon) {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: block; text-align: center;
}
.bottom-nav a.active { color: var(--brand-1); }
.bottom-nav a .icon { width: 23px; height: 23px; }

.fab {
  display: none;
  position: fixed; inset-inline-end: 18px; bottom: calc(var(--bottom-h) + 16px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%; border: 0; z-index: 41;
  background: var(--brand-grad); color: #fff;
  box-shadow: 0 10px 26px rgba(99, 102, 241, .45);
  place-items: center;
}
.fab .icon { width: 26px; height: 26px; stroke-width: 2.2; }

/* ============================ النوافذ المنبثقة ============================ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(8, 11, 18, .5);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  animation: fadeIn .18s var(--ease);
}
.modal {
  width: 100%; max-width: 460px; max-height: 88vh; overflow: auto;
  background: var(--bg-elev); border-radius: var(--radius-l);
  border: 1px solid var(--border); box-shadow: var(--shadow-l);
  animation: modalIn .2s var(--ease);
}
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 6px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-head .icon-btn { margin-inline-start: auto; width: 34px; height: 34px; }
.modal-body { padding: 10px 18px 18px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px 18px; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98) } to { opacity: 1; transform: none } }

/* ============================ متجاوب ============================ */
@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 84px minmax(0, 1fr) 288px; gap: 18px; }
  .sidebar .nav-item span, .sidebar .brand-text, .account-chip .account-meta, .sidebar-foot .btn span { display: none; }
  .sidebar .nav-item { justify-content: center; padding: 13px 0; }
  .sidebar .brand { justify-content: center; padding: 6px 0; }
  .account-chip { justify-content: center; padding: 6px; }
  .sidebar-foot .btn { padding: 10px 0; }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 84px minmax(0, 1fr); }
  .col-side { display: none; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-main { padding: 20px; }
}

@media (max-width: 640px) {
  :root { --header-h: 56px; }
  .app-shell { grid-template-columns: 1fr; padding: 0; gap: 0; }
  .sidebar { display: none; }
  .col-main { padding-bottom: calc(var(--bottom-h) + 24px); }
  .bottom-nav { display: flex; }
  .fab { display: grid; }
  .card { border-radius: 0; border-inline: 0; box-shadow: none; }
  .card:first-of-type { border-top: 0; }
  .post { padding: 14px; margin-bottom: 8px; }
  .post-body { font-size: 15.2px; }
  .composer { border-radius: 0; }
  .profile-cover { height: 128px; }
  .profile-top .avatar { --size: 84px; }
  .profile-body { padding: 0 16px 14px; }
  .thread-post { padding: 16px; border-radius: 0; }
  .mobile-only { display: flex !important; }
  .desktop-only { display: none !important; }
  .toasts { bottom: calc(var(--bottom-h) + 18px); }
  .auth-form-wrap { padding: 12px 0; }
}

@media (min-width: 641px) {
  .mobile-only { display: none !important; }
}

/* النوافذ على الجوال: ورقة سفلية */
@media (max-width: 640px) {
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%; max-height: 92vh;
    border-radius: 22px 22px 0 0;
    animation: sheetIn .24s var(--ease);
  }
  .modal-actions { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  @keyframes sheetIn { from { transform: translateY(100%); } to { transform: none; } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   Notifikationer, repost och redigering
   ========================================================================== */

/* --- Badges --- */
.nav-badge {
  margin-inline-start: auto;
  min-width: 20px; height: 20px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: #fff;
  font-size: 11.5px; font-weight: 800; line-height: 1;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.bnav-icon { position: relative; display: inline-flex; }
.bnav-badge {
  position: absolute; top: -5px; inset-inline-end: -9px;
  min-width: 16px; height: 16px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: #fff;
  font-size: 9.5px; font-weight: 800; line-height: 1;
  border-radius: 999px; border: 2px solid var(--bg-elev);
}
.pill-unread {
  min-width: 22px; height: 22px; padding: 0 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger); color: #fff;
  font-size: 12px; font-weight: 800; border-radius: 999px;
}
.title-row { display: flex; align-items: center; gap: 8px; }

/* --- Repost --- */
.action.repost.reposted { color: var(--success); }
.repost-note {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.8px; font-weight: 650; color: var(--text-3);
  margin-bottom: 6px; padding-inline-start: 2px;
}
.repost-note .icon { color: var(--success); }
.repost-note a { color: var(--text-2); font-weight: 700; }
.repost-note a:hover { text-decoration: underline; }
.repost-note-body {
  margin: 0 0 10px; font-size: 15px; color: var(--text);
}
.post > .card.post {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
  margin-bottom: 0;
  padding: 12px;
  background: var(--bg-soft);
}
.post > .card.post:hover { box-shadow: none; background: var(--bg-hover); }

/* --- Redigerad --- */
.edited-badge { color: var(--text-3); font-size: 12.5px; }

/* --- Notifikationslista --- */
.notif-head { display: flex; justify-content: flex-end; padding: 12px 2px 8px; }
.notif-list { overflow: hidden; }
.notif {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
  position: relative;
  transition: background .15s var(--ease);
}
.notif:last-child { border-bottom: 0; }
.notif:hover { background: var(--bg-hover); }
.notif.unread { background: color-mix(in srgb, var(--brand-1) 7%, transparent); }
.notif.unread:hover { background: color-mix(in srgb, var(--brand-1) 11%, transparent); }
.notif-icon {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; flex: 0 0 auto;
  background: var(--bg-soft); color: var(--text-3);
  margin-top: 2px;
}
.notif-icon.notif-like { background: color-mix(in srgb, var(--like) 14%, transparent); color: var(--like); }
.notif-icon.notif-comment,
.notif-icon.notif-comment_reply { background: color-mix(in srgb, var(--brand-1) 14%, transparent); color: var(--brand-1); }
.notif-icon.notif-follow { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.notif-icon.notif-repost { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.notif-body { flex: 1; min-width: 0; }
.notif-text { font-size: 14.4px; line-height: 1.55; }
.notif-text b { font-weight: 700; }
.notif-preview {
  margin-top: 3px; font-size: 13.4px; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.5;
}
.notif-time { margin-top: 4px; font-size: 12.4px; color: var(--text-3); }
.notif-thumb {
  width: 46px; height: 46px; border-radius: 10px; object-fit: cover;
  flex: 0 0 auto; border: 1px solid var(--border);
}
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand-1); flex: 0 0 auto; margin-top: 8px;
}

@media (max-width: 640px) {
  .notif { padding: 12px 14px; }
  .notif-icon { display: none; }
}

/* ======================= استعادة كلمة المرور والتحقق ======================= */

.auth-wrap.single { grid-template-columns: minmax(0, 500px); justify-content: center; align-items: center; min-height: 100vh; }
.auth-wrap.single .auth-main { padding: 40px 28px; }
.auth-wrap.single .auth-form-wrap { max-width: 440px; }
.auth-wrap.single .card.pad { text-align: start; }
.auth-wrap.single .card.pad h2 { font-size: 24px; margin: 0 0 8px; }
.auth-wrap.single .card.pad .sub { color: var(--text-3); font-size: 14.5px; margin: 0 0 18px; line-height: 1.65; }
.auth-wrap.single .card.pad .btn-block { margin-top: 14px; }
.auth-row { display: flex; justify-content: flex-end; margin-top: -4px; margin-bottom: 4px; }
.auth-row a { font-size: 13.5px; color: var(--accent); text-decoration: none; font-weight: 600; }
.auth-row a:hover { text-decoration: underline; }

.dev-link {
  margin: 14px 0; padding: 12px 14px; border-radius: 12px;
  background: var(--warn-soft, rgba(240,180,60,.14));
  border: 1px solid var(--warn-border, rgba(240,180,60,.4));
  font-size: 13px; word-break: break-all;
}
.dev-link-a { color: var(--accent); text-decoration: none; display: block; margin: 4px 0 6px; font-weight: 600; }
.dev-link .hint { color: var(--text-3); font-size: 12px; }

.verify-ok { color: var(--ok, #22a06b); display: flex; justify-content: center; margin-bottom: 10px; }
.verify-fail { color: var(--danger); display: flex; justify-content: center; margin-bottom: 10px; }
.icon.lg { width: 54px; height: 54px; stroke-width: 1.4; }

/* ======================= الوسوم ======================= */

.tag-head { display: flex; align-items: center; gap: 14px; padding: 18px 20px; }
.tag-badge {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  font-size: 28px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2, #7b61ff));
  flex: none;
}
.tag-title { font-size: 22px; margin: 0 0 2px; letter-spacing: -.01em; }

.tag-list { display: flex; flex-direction: column; }
.tag-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 16px; text-decoration: none; color: inherit;
  border-top: 1px solid var(--border);
}
.tag-row:first-child { border-top: 0; }
.tag-row:hover { background: var(--bg-hover); }
.tag-name { font-weight: 650; font-size: 14.5px; }
.tag-uses { color: var(--text-3); font-size: 12.5px; }
.pad-sm { padding: 12px 16px 16px; }

/* ======================= الإبلاغ ======================= */

.report-reasons { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.report-reason {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
  font-size: 14px; transition: background .15s, border-color .15s;
}
.report-reason:hover { background: var(--bg-hover); }
.report-reason input { accent-color: var(--accent); width: 16px; height: 16px; }
.report-reason.sel { border-color: var(--accent); background: var(--accent-soft, rgba(0,120,255,.08)); }

/* ======================= بانر التحقق ======================= */

.verify-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: 14px; margin-bottom: 12px;
  background: var(--warn-soft, rgba(240,180,60,.14));
  border: 1px solid var(--warn-border, rgba(240,180,60,.4));
  font-size: 13.5px;
}
.verify-banner .btn { margin-inline-start: auto; }

/* ======================= إعدادات الحساب ======================= */

.danger-zone { border-color: rgba(220,60,60,.35) !important; }
.danger-zone h3 { color: var(--danger); }

/* ======================= روابط الوسوم داخل النص ======================= */
.tag-link { color: var(--accent); text-decoration: none; font-weight: 550; }
.tag-link:hover { text-decoration: underline; }
.mention-link { color: var(--accent); text-decoration: none; font-weight: 550; }
.mention-link:hover { text-decoration: underline; }
.sep { border: 0; border-top: 1px solid var(--border); margin: 20px 0 16px; }
.danger-zone .desc { font-size: 13px; color: var(--text-3); margin: 0 0 12px; }

/* ======================= لوحة الإدارة ======================= */

.admin-tabs { margin: 0 0 14px; }
.admin-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  border: 1px solid var(--border); background: var(--bg-elev); color: var(--text-2);
  padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { background: var(--bg-hover); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.report-card { padding: 14px 16px; margin-bottom: 12px; }
.report-card.handled { opacity: .62; }
.report-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.report-reason-badge {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.report-status {
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--bg-soft); color: var(--text-3);
}
.report-status.status-open { background: color-mix(in srgb, var(--warn, #d99a2b) 16%, transparent); color: var(--warn, #b8791a); }
.report-status.status-resolved { background: color-mix(in srgb, var(--ok, #22a06b) 14%, transparent); color: var(--ok, #1a7a51); }
.report-meta { margin-inline-start: auto; font-size: 12px; color: var(--text-3); }
.report-by { font-size: 13px; color: var(--text-3); margin-bottom: 8px; }
.report-by a { color: var(--text); font-weight: 600; text-decoration: none; }
.report-by a:hover { text-decoration: underline; }
.report-note {
  margin: 0 0 10px; padding: 9px 12px; border-radius: 10px;
  background: var(--bg-soft); font-size: 13.5px; color: var(--text-2);
  border-inline-start: 3px solid var(--border-strong, var(--border));
}
.report-target { margin: 8px 0; pointer-events: auto; }
.report-target .post { border-radius: 12px; }
.comment-target {
  padding: 12px 14px; border-radius: 12px; background: var(--bg-soft);
  border: 1px solid var(--border);
}
.report-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }

.admin-search {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 14px; margin-bottom: 14px;
}
.admin-search svg { width: 18px; height: 18px; color: var(--text-3); flex: none; }
.admin-search input { border: 0; background: transparent; color: var(--text); font: inherit; flex: 1; outline: none; }

.admin-user {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 10px;
}
.admin-user .account-name { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.role-badge {
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; letter-spacing: .02em;
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat-cell {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px 18px;
}
.stat-value { font-size: 27px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.stat-label { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.stat-cell.tone-warn .stat-value { color: var(--warn, #b8791a); }
.stat-cell.tone-ok .stat-value { color: var(--ok, #1a7a51); }

.admin-hints { margin: 0; padding-inline-start: 18px; font-size: 13.5px; color: var(--text-2); line-height: 1.7; }
.admin-hints li { margin-bottom: 6px; }

@media (max-width: 720px) {
  .report-meta { margin-inline-start: 0; width: 100%; }
  .report-actions .btn { flex: 1; justify-content: center; }
  .admin-user { flex-wrap: wrap; }
}

.report-excerpt {
  padding: 12px 14px; border-radius: 12px; background: var(--bg-soft);
  border: 1px dashed var(--border-strong);
}
.report-excerpt .post-body { margin: 6px 0 0; color: var(--text-2); font-style: italic; }

/* ── Trådade kommentarer (fas 6) ─────────────────────────────── */
.comment-replies {
  /* .comment är display:flex — utan flex-basis:100% blir svarsblocket ett
     ihopklämt flex-barn (några px brett) i stället för en rad under föräldern. */
  flex: 0 0 100%;
  width: 100%;
  margin-top: 10px;
  padding-inline-start: 16px;
  border-inline-start: 2px solid var(--border);
  display: block;
}

.comment:has(> .comment-replies) {
  flex-wrap: wrap;
}

.comment-replies > .comment {
  margin-bottom: 10px;
}

.comment-replies > .comment:last-child {
  margin-bottom: 0;
}

[dir="rtl"] .comment-replies {
  padding-inline-start: 0;
  padding-inline-end: 16px;
  border-inline-start: 0;
  border-inline-end: 2px solid var(--border);
}

.comment.comment-reply {
  min-width: 0;                /* tillåt inte att kortet krymper ihop */
}

.comment-replyto {
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 4px;
  opacity: .85;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}

.comment-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 0;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-3);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.comment-action:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.comment-action.liked {
  color: var(--danger, #e0245e);
}

.comment-action.liked svg {
  fill: currentColor;
}

.comment-action:disabled {
  opacity: .5;
  cursor: default;
}

.comment-form-inline {
  margin-top: 10px;
  margin-inline-start: 34px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: var(--bg-soft);
}

.comment-form-inline textarea {
  background: var(--bg-elev);
}

/* ── Direktmeddelanden (fas 7) ──────────────────────────────── */
.conv-list { overflow: hidden; }

.conv-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background .15s;
}
.conv-row:last-child { border-bottom: 0; }
.conv-row:hover { background: var(--bg-soft); }
.conv-row.unread { background: color-mix(in srgb, var(--accent) 5%, transparent); }

.conv-main { flex: 1; min-width: 0; }
.conv-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.conv-name { font-weight: 700; font-size: 15px; }
.conv-preview {
  font-size: 13.5px; color: var(--text-3); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-you { color: var(--text-2); }
.conv-row.unread .conv-preview { color: var(--text); font-weight: 600; }

.conv-badge, .msg-badge {
  background: var(--accent); color: #fff;
  font-size: 11.5px; font-weight: 700;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px;
  display: inline-grid; place-items: center;
  flex: none;
}

.people-results { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.people-results:empty { margin-top: 0; }

.person-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 12px 5px 6px;
  cursor: pointer; font: inherit; font-size: 13.5px; color: var(--text);
  transition: border-color .15s, background .15s;
}
.person-chip:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }

/* Samtalsvyn */
.msg-shell { display: flex; flex-direction: column; height: calc(100dvh - 150px); min-height: 420px; overflow: hidden; }

.msg-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border); flex: none;
}
.msg-head-user { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; flex: 1; min-width: 0; }

.msg-list {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
  overscroll-behavior: contain;
}
.msg-empty { margin: auto; text-align: center; }

.msg { display: flex; flex-direction: column; max-width: 78%; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }

.msg-bubble {
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 14.8px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
}
.msg.mine .msg-bubble {
  background: var(--accent); color: #fff;
  border-end-end-radius: 5px;   /* logiskt: spetsen mot avsändaren */
}
.msg.theirs .msg-bubble {
  background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border);
  border-end-start-radius: 5px;
}
.msg-time { font-size: 11px; color: var(--text-3); margin-top: 3px; padding: 0 4px; }

.msg-form {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px; border-top: 1px solid var(--border); flex: none;
}
.msg-input { resize: none; max-height: 120px; line-height: 1.5; }
.msg-send { flex: none; height: 38px; }

.back-btn { flex: none; }

/* Mobil: full höjd och ingen sidopanel */
@media (max-width: 720px) {
  .msg-shell { height: calc(100dvh - 200px); }
  .msg { max-width: 88%; }
}

/* Meddelandevyn har egen inmatning — göm "nytt inlägg"-knappen där */
body:has(.msg-shell) .fab { display: none; }

/* Textfältet i samtalet är en rad tills man skriver mer */
textarea.input.msg-input { min-height: 38px; height: 38px; padding: 8px 12px; }

/* ── Språkutbyte (fas 8) ─────────────────────────────────────── */
.lang-select { max-width: 280px; }

.lang-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }
.lang-chip {
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 5px 13px; border-radius: 999px; cursor: pointer;
  background: var(--bg-soft); color: var(--text-2);
  border: 1px solid var(--border);
  transition: all .15s;
}
.lang-chip:hover { border-color: var(--accent); color: var(--text); }
.lang-chip.on {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

.switch-row {
  display: flex; align-items: flex-start; gap: 10px;
  margin-top: 16px; cursor: pointer; user-select: none;
}
.switch-row strong { display: block; font-size: 14px; }
.switch-row .hint { display: block; margin-top: 2px; }
.switch-input {
  appearance: none; -webkit-appearance: none;
  width: 40px; height: 23px; border-radius: 999px; flex: none;
  background: var(--border-strong); position: relative; cursor: pointer;
  transition: background .18s; margin-top: 1px;
}
.switch-input::after {
  content: ''; position: absolute; top: 3px; inset-inline-start: 3px;
  width: 17px; height: 17px; border-radius: 50%; background: #fff;
  transition: inset-inline-start .18s;
}
.switch-input:checked { background: var(--accent); }
.switch-input:checked::after { inset-inline-start: 20px; }

/* Partnerkort */
.page-desc { color: var(--text-2); font-size: 14px; margin: -4px 0 14px; }

.lang-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.lang-legend-item {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 13px; font-size: 12.5px; color: var(--text-3);
}
.lang-legend-item b { color: var(--text); font-weight: 700; }

.partner-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
}
.partner-card { padding: 15px; display: flex; flex-direction: column; gap: 11px; }
.partner-top { display: flex; align-items: center; gap: 11px; }
.partner-id { min-width: 0; }
.partner-name {
  display: block; font-weight: 700; font-size: 15px;
  text-decoration: none; color: inherit;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.partner-name:hover { color: var(--accent); }

.partner-langs { display: flex; flex-direction: column; gap: 6px; }
.lang-tag { display: flex; align-items: baseline; gap: 6px; font-size: 13px; }
.lang-tag-label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-3); flex: none;
}
.lang-tag.learn b { color: var(--accent); }
.lang-tag.speak b { color: var(--text-2); }

.partner-why { font-size: 12.5px; color: var(--text-3); margin: 0; }
.partner-actions { margin-top: auto; }
.partner-actions .btn { width: 100%; justify-content: center; }

.empty-state { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 20px; }
.empty-state .icon { color: var(--text-3); margin-bottom: 4px; }
.empty-state h3 { margin: 0; font-size: 17px; }
.empty-state .hint { max-width: 340px; }
.empty-state .btn { margin-top: 6px; }
.partner-link { margin-bottom: 12px; }
