/* =========================================================
   NEXA UI KIT — style.css (Clean / Unified)
   - Light/Dark + RTL + Pro UI
   - Full-page background: turquoise image (ONLY)
   - Glass effect only on content cards/panels (NOT whole page)
   - Removed duplicate/contradictory overrides that were breaking layout
========================================================= */

/* =========================
   Fonts
========================= */
@font-face {
  font-family: "NexaUI";
  src: url("../fonts/BNazanin.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: "BNazanin";
  src: url("../fonts/BNazanin.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}
@font-face {
  font-family: "BTitr";
  src: url("../fonts/BTitr.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

/* =========================
   Reset / Base
========================= */
* { box-sizing: border-box; }

html{
  background: linear-gradient(135deg, #0b1b3a 0%, #0b5b7a 35%, #12b7c9 100%) !important;
  background-attachment: fixed !important;
}

html, body {
  height: auto;
  /* min-height fixed */ min-height: 100%;
  font-family: "NexaUI", Tahoma, Arial, sans-serif;
  background: linear-gradient(135deg, var(--bgA) 0%, var(--bgB) 100%);
  background-attachment: fixed;
}

/* بک‌گراند اصلی را روی html هم می‌گذاریم تا هیچ‌وقت پایین صفحه رنگ جدا نیفتد */
html{
  background-color: #0b7f86 !important;
  background-image:
    linear-gradient(180deg, rgba(0,0,0,.10), rgba(0,0,0,.10)),
    none !important;
  background-repeat: repeat-y !important;
  background-position: top center !important;
  background-size: 100% auto !important;
  background-attachment: scroll !important;
}

#root, .app, .app-root {
  /* min-height fixed */ min-height: 100vh;
  background: transparent;
}

body {
  margin: 0;
  /* Prefer modern variable font (CDN), fallback to bundled fonts */
  font-family: var(--font-sans);
  font-weight: normal;
  color: var(--text);

  /* ✅ Background ONLY: turquoise image — repeat on scroll */
  background-color: #0b7f86 !important;
  background-image:
    linear-gradient(180deg, rgba(0,0,0,.10), rgba(0,0,0,.10)),
    none !important;
  background-repeat: repeat-y !important;
  background-position: top center !important;
  background-size: 100% auto !important;
  background-attachment: scroll !important;

  /* min-height fixed */ min-height: 100vh;
  line-height: 1.9;
  position: relative;
}

a { color: inherit; text-decoration: none; }
img { max-width: auto; display: block; }
button, input, select, textarea { font-family: inherit; }

h1,h2,h3,h4,h5,h6,
.title,.page-title,.section-title,.brand-title {
  font-family: var(--font-display);
  font-weight: normal;
}

::selection { background: rgba(245,158,11,.25); }

/* Optional decorative pattern overlay (very subtle) */
body::before{
  content:"";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(800px 500px at 20% 20%, rgba(255,255,255,.14), transparent 60%),
    radial-gradient(900px 600px at 80% 60%, rgba(255,255,255,.10), transparent 62%),
    radial-gradient(700px 500px at 30% 85%, rgba(0,0,0,.10), transparent 55%);
  pointer-events:none;
  z-index: -1;
}

/* =========================
   Theme Vars
========================= */
:root {
  /* background gradient (from provided palette) */
  --bgA: #184773;
  --bgB: #1e9f89;
  --bgC: #1c6e79;

  /* Typography */
  --font-sans: "NexaUI", Tahoma, sans-serif;
  --font-display: "NexaUI", Tahoma, sans-serif;
  --text-lg: 22px;
  --text-md: 16px;
  --text-sm: 13px;
  --text-sm: 13px;

  /* glass surfaces */
  --card: rgba(255,255,255,.20);
  --cardStrong: rgba(255,255,255,.30);
  --cardSolid: rgba(255,255,255,.92);

  /* topbar */
  --topbar: rgba(79, 167, 199, .92);
  --topbar2: rgba(63, 154, 189, .92);
  --topbarText: #083247;
  --topbarBorder: rgba(8,50,71,.18);

  /* text & borders */
  --text: #0f172a;
  --muted: rgba(15,23,42,.72);
  --border: rgba(15,23,42,.12);
  --shadow: 0 18px 45px rgba(15,23,42,.10);

  --primary: #4f46e5;
  --primary2: #a5b4fc;
  --danger: #ef4444;

  --radius: 16px;
  --radius2: 12px;

  --focus: rgba(79,70,229,.18);
}

/* Dark theme overrides */
html[data-theme="dark"] {
  --card: rgba(13,19,34,.34);
  --cardStrong: rgba(13,19,34,.46);
  --cardSolid: rgba(11,18,32,.92);

  --topbar: rgba(25, 120, 150, .88);
  --topbar2: rgba(18, 96, 126, .88);
  --topbarText: #e6f6ff;
  --topbarBorder: rgba(255,255,255,.14);

  --text: #e5e7eb;
  --muted: rgba(229,231,235,.74);
  --border: rgba(255,255,255,.12);
  --shadow: 0 22px 70px rgba(0,0,0,.55);

  --focus: rgba(79,70,229,.18);
}

/* =========================
   Layout
========================= */
.container,
.page-container{
  max-width: 1200px;
  margin: 38px auto;
  padding: 0 16px;
}

.section-gap { margin-top: 18px; }

.hr {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
  border: none;
}

/* =========================
   Header / Topbar
========================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 400;
  background: linear-gradient(135deg, var(--topbar), var(--topbar2));
  border-bottom: 1px solid var(--topbarBorder);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 12px 16px;
}

.topbar a, .topbar button { color: var(--topbarText); }

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto; /* ☰ | برند | آیکون‌ها */
  align-items: center;
  gap: 12px;
  position: relative;
}

/* Burger */
#menuToggle{
  width:44px;
  height:44px;
  border-radius:12px;
  font-size:20px;
  line-height:1;
  justify-self: start; /* راست در RTL */
}

/* Brand */
.brand,
.brand-center{
  display: flex;
  align-items: center;
  justify-content:center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.20);
  color: var(--topbarText);
  box-shadow: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* logo image — بدون کادر سفید */
.logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: transparent;
  border: 0;
  padding: 0;
  border-radius: 0;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,.18));
}

.brand-text { display: flex; flex-direction: column; gap: 2px; text-align:center; }
.brand-title { font-size: 20px; line-height: 1.2; }
.brand-sub { font-size: 12px; opacity: .85; }

/* Right actions */
.top-actions{
  justify-self: end; /* چپ در RTL */
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.icon-btn {
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.20);
  color: var(--topbarText);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  transition: .18s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Lucide icons */
.icon-btn i, .menu-item i{
  width: 20px;
  height: 20px;
  display: inline-block;
}
.menu-item i{ margin-left: 8px; }

html[data-theme="dark"] .icon-btn{
  border-color: rgba(255,255,255,.18);
  background: rgba(0,0,0,.18);
  color: var(--topbarText);
}

.icon-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

/* Mobile: two rows (actions + burger | brand full width) */
@media (max-width: 720px){
  html, body{
    background-color: #0b7f86;
    background-attachment: scroll;
    background-position: center top;
  }

  .topbar-inner{
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "burger actions"
      "brand  brand";
  }
  #menuToggle{ grid-area: burger; }
  .top-actions{ grid-area: actions; justify-self: end; }
  .brand-center, .brand{ grid-area: brand; justify-self: center; }
}

/* =========================
   Dropdown menu (☰)
========================= */
.menu-dropdown{
  position: absolute;
  top: calc(100% + 10px);
  right: 18px;
  width: 260px;
  max-width: calc(100vw - 28px);
  background: rgba(255,255,255,.90);
  border: 1px solid rgba(8,50,71,.18);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 10px;
  display: none;
  z-index: 500;
}

@media (max-width: 720px){
  .menu-dropdown{
    right: 12px;
    left: 12px;
    width: auto;
    top: calc(100% + 8px);
  }
}

html[data-theme="dark"] .menu-dropdown{
  background: rgba(10, 25, 34, .86);
  border-color: rgba(255,255,255,.14);
}

.menu-dropdown.open{ display:block; }

.menu-list{ display:flex; flex-direction:column; gap:8px; margin:0; padding:0; list-style:none; }

.menu-item{
  display:flex;
  align-items:center;
  gap:10px;
  width:100%;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration:none;
  color: inherit;
  background: rgba(255,255,255,.42);
  border: 1px solid rgba(8,50,71,.10);
}
html[data-theme="dark"] .menu-item{ background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.10); }
.menu-item:hover{ background: rgba(255,255,255,.58); }
html[data-theme="dark"] .menu-item:hover{ background: rgba(255,255,255,.12); }

/* =========================
   Nav (Centered)
========================= */
.nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(255,255,255,.55);
  transition: .18s ease;
}

html[data-theme="dark"] .nav a { background: rgba(255,255,255,.06); }

.nav a:hover {
  border-color: var(--border);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(0,0,0,.10);
}

.nav form { margin: 0; }
.nav form button { margin: 0; }

/* =========================
   Admin toolbar (2nd menu)
========================= */
.admin-toolbar {
  max-width: 1200px;
  margin: 18px auto 10px;
  padding: 12px 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.admin-toolbar a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.55);
  border: 1px solid transparent;
  transition: .18s ease;
  white-space: nowrap;
}

html[data-theme="dark"] .admin-toolbar a { background: rgba(255,255,255,.06); }

.admin-toolbar a:hover {
  border-color: var(--border);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(0,0,0,.10);
}

/* =========================
   Components — Card / Panel
========================= */
.card, .box, .content-card, .auth-card, .splash-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Inner subtle card */
.card.subtle {
  background: rgba(255,255,255,.35);
  border: 1px dashed var(--border);
  box-shadow: none;
  margin-top: 10px;
}
html[data-theme="dark"] .card.subtle { background: rgba(255,255,255,.04); }

/*
  ✅ Readability fix:
  اکثر صفحات پنل با کلاس .panel رندر می‌شوند. قبلاً .panel شفاف بود و
  متن‌ها روی بک‌گراند طرح‌دار بدون «کادر» خوانایی نداشت.
*/
.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(255,255,255,.28);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.muted { color: var(--muted); }
.small { font-size: var(--text-sm); }

/* grids */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

@media (max-width: 980px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 650px) {
  .grid { grid-template-columns: 1fr; }
}

/* =========================
   Forms
========================= */
.form { display: flex; flex-direction: column; gap: 10px; }

label {
  font-weight: normal;
  font-size: 13px;
  color: var(--text);
}

input, select, textarea {
  border: 1px solid var(--border);
  background: var(--cardSolid);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
  transition: .18s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}

textarea { resize: vertical; /* min-height fixed */ min-height: 110px; }

input:focus, select:focus, textarea:focus {
  border-color: rgba(245,158,11,.55);
  box-shadow: 0 0 0 4px var(--focus);
}

::placeholder{color: rgba(15,23,42,.55);}
html[data-theme="dark"] ::placeholder{color: rgba(229,231,235,.55);}

.help {
  font-size: 12px;
  color: var(--muted);
  margin-top: -4px;
}

/* =========================
   ✅ Auth pages (Login / Register) — responsive & centered
   - fixes: mobile fields sticking, misaligned quick links, off-center icons
========================= */
.auth-card{
  max-width: 720px;
  margin: 22px auto;
}

.auth-card .h-title{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  margin-bottom: 6px;
}

.auth-card h1, .auth-card h2, .auth-card h3{
  text-align:center;
  width:100%;
}

/* Force vertical form layout (browser defaults are inline-ish) */
.auth-card form{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top: 10px;
}
.auth-card form label{
  display:block;
  margin-top: 6px;
}
.auth-card form input,
.auth-card form select,
.auth-card form textarea{
  display:block;
  width:100%;
}

/* Two-column rows inside register (desktop) */
.auth-card .row{
  display:flex;
  gap:12px;
  align-items:stretch;
  flex-wrap:wrap;
}
.auth-card .row > div{
  flex: 1 1 280px;
  min-width: 0;
}

/* Hide empty placeholder columns in register to avoid huge gaps */
.auth-card .row > div:empty{ display:none; }

/* Quick links bar (bottom) */
.auth-quickbar{
  margin-top: 14px;
  display:flex;
  justify-content:center;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.auth-quickbar .qbtn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
}
.auth-quickbar .qbtn:hover{ transform: translateY(-1px); box-shadow: var(--shadow); }
.auth-quickbar .qbtn span{ line-height: 1; }

@media (max-width: 720px){
  .auth-card{ max-width: 92vw; margin: 16px auto; padding: 16px; }
  .auth-card .row{ flex-direction:column; }
  .auth-quickbar{ flex-direction:column; align-items:stretch; }
  .auth-quickbar .qbtn{ width:100%; }
}

/* =========================
   Buttons / Chips / Badges
========================= */
.btn {
  border: 1px solid transparent;
  cursor: pointer;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 800;
  transition: .18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 12px 26px rgba(15,23,42,.10), 0 2px 6px rgba(15,23,42,.08);
  transform: translateY(0);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 18px 38px rgba(15,23,42,.12), 0 6px 14px rgba(15,23,42,.10); }
.btn:active { transform: translateY(0); box-shadow: 0 10px 22px rgba(15,23,42,.12), 0 2px 6px rgba(15,23,42,.10); }


.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #ffffff;
}


.btn-primary:hover { opacity: .92; transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  border-color: var(--border);
}

.btn-outline:hover { background: rgba(148,163,184,.12); }

.btn-danger {
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.28);
  color: var(--danger);
}

.btn-danger:hover { transform: translateY(-1px); }

.btn-xs { padding: 6px 10px; border-radius: 10px; font-size: 12px; }

.chip {
  border: 1px solid var(--border);
  background: var(--cardSolid);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: .18s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.chip:hover { transform: translateY(-1px); }
.chip.danger { border-color: rgba(239,68,68,.35); color: var(--danger); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(79,70,229,.14);
  border: 1px solid rgba(79,70,229,.14);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

/* Highlight active admin-toolbar link */
.tool-link.active {
  background: linear-gradient(135deg, var(--primary), var(--primary2)) !important;
  color: #111827 !important;
}

/* =========================
   Tables
========================= */
.table {
  width: auto;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: var(--radius2);
  border: 1px solid var(--border);
  background: var(--cardSolid);
}

.table th, .table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: right;
}

.table th { color: var(--text); font-weight: normal; }
.table tr:last-child td { border-bottom: none; }

/* =========================
   Forum
========================= */
.post {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: var(--cardSolid);
  box-shadow: 0 10px 24px rgba(0,0,0,.06);
}

.post .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.post .content { margin-top: 10px; }

.reply {
  border-right: 3px solid rgba(245,158,11,.55);
  padding: 10px 12px;
  margin-top: 10px;
  background: rgba(148,163,184,.08);
  border-radius: 12px;
}

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { justify-content: space-between; }

/* =========================
   Utility
========================= */
.center { text-align: center; }
.hidden { display: none !important; }

.pill {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.55);
}
html[data-theme="dark"] .pill { background: rgba(255,255,255,.06); }

/* =========================
   Admin Page / Tabs UI
========================= */
.admin-page { gap: 16px; }
.admin-page .page-title { margin: 0; }
.admin-page h2, .admin-page h3, .admin-page h4 { margin: 0 0 10px; }

.alert {
  background: rgba(16,185,129,.14);
  border: 1px solid rgba(16,185,129,.25);
  padding: 12px 14px;
  border-radius: 14px;
}

.info {
  background: rgba(59,130,246,.12);
  border: 1px solid rgba(59,130,246,.20);
  padding: 12px 14px;
  border-radius: 14px;
}
html[data-theme="dark"] .info { background: rgba(59,130,246,.10); }

/* Tabs bar */
.tabs {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  margin: 10px 0 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.tab-btn {
  border: 1px solid transparent;
  background: rgba(255,255,255,.55);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: .18s ease;
}
html[data-theme="dark"] .tab-btn { background: rgba(255,255,255,.06); }

.tab-btn:hover { border-color: var(--border); transform: translateY(-1px); }

.tab-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #111827;
}

.tab { display: none; }
.tab.active { display: block; }

.tab-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 0 14px;
}
.dot { opacity: .7; margin: 0 6px; }

.stack { display: flex; flex-direction: column; gap: 12px; }

.card-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.title { font-family: var(--font-display); font-size: var(--text-lg); line-height: 1.4; }

/* قاب برای عنوان‌ها/تیترها تا همیشه دیده بشن */
.page-title,
.section-title,
.title,
.card h1, .card h2, .card h3,
.box h1, .box h2, .box h3,
.content-card h1, .content-card h2, .content-card h3,
.auth-card h1, .auth-card h2, .auth-card h3{
  display: inline-block;
  padding: 6px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.14);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* اگر section-title قبلاً تعریف نشده بود */
.section-title{ margin: 0 0 10px; font-weight: 900; }



.meta {
  color: var(--muted);
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.desc { margin-top: 8px; }

/* Actions row */
.actions {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

/* =========================
   ✅ ویترین دانش: Thumbnail + Sticker Fallback
========================= */
.thumb { margin-top: 10px; }

.thumb-link {
  position: relative;
  display: block;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(15,23,42,.06);
  border: 1px solid var(--border);
  box-shadow: 0 12px 28px rgba(0,0,0,.08);
  transition: .18s ease;
}

.thumb-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(0,0,0,.10);
}

html[data-theme="dark"] .thumb-link { background: rgba(255,255,255,.06); }

.thumb-img {
  width: auto;
  height: 220px;
  object-fit: cover;
  display: block;
}

/* fallback when image missing */
.thumb-link.no-img {
  height: 220px;
  background:
    radial-gradient(520px 260px at 30% 15%, rgba(245,158,11,.22), transparent 60%),
    linear-gradient(135deg, rgba(42,58,87,.20), rgba(59,79,115,.12));
}

html[data-theme="dark"] .thumb-link.no-img {
  background:
    radial-gradient(520px 260px at 30% 15%, rgba(245,158,11,.18), transparent 60%),
    linear-gradient(135deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
}

.type-badge {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.80);
  border: 1px solid rgba(15,23,42,.10);
  color: #111827;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 14px 30px rgba(0,0,0,.12);
}

html[data-theme="dark"] .type-badge {
  background: rgba(13,19,34,.72);
  border: 1px solid rgba(255,255,255,.10);
  color: #e5e7eb;
}

.type-badge.is-fallback {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 34px;
  padding: 12px 16px;
  background: rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.16);
  color: #fff;
}

html[data-theme="dark"] .type-badge.is-fallback { background: rgba(0,0,0,.55); }

@media (max-width: 650px) {
  .thumb-img { height: 200px; }
  .thumb-link.no-img { height: 200px; }
}

/* =========================
   Splash / Start page
========================= */
.splash-page{
  /* min-height fixed */ min-height: calc(100vh - 70px);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:30px;
}

.splash-card{
  width: 420px;
  max-width: 95%;
  background: var(--cardStrong);
  border-radius: 22px;
  padding: 12px 16px;
  text-align:center;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ✅ logo ~2x bigger + کمی به چپ */
.splash-logo{
  height: 110px; /* کمی کوچیک‌تر */
  margin: 0 auto 14px;
  transform: translateX(18px); /* نیم سانت به راست نسبت به قبل */
}


.splash-title{
  font-size: 22px;
  font-weight: 900;
  margin: 0;
  color: var(--text);
}

.splash-subtitle{
  margin-top: 8px;
  color: var(--text);
  font-weight:700;
}

.splash-loader{
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 6px solid rgba(217,231,255,.70);
  border-top-color: rgba(30,136,229,.95);
  margin: 18px auto 0;
  animation: spin 1s linear infinite;
}

@keyframes spin{
  from{ transform: rotate(0deg); }
  to{ transform: rotate(360deg); }
}

/* Desktop */
@media (min-width: 721px){
  body{ background-attachment: scroll; }
}

/* =========================
   Mobile polish
========================= */
@media (max-width: 720px){
  .card, .box, .content-card, .auth-card, .splash-card{ padding: 18px; border-radius: 18px; }
  .actions{ flex-direction: column; }
  .actions .btn, .actions a.btn{ width: auto; justify-content: center; }
  label{ font-size: 14px; }
  input, select, textarea{ font-size: 16px; } /* prevents iOS zoom */
  /* ✅ Mobile: reduce vertical gaps in register/login */
  .auth-card form{ gap: 8px; }
  .auth-card .row{ gap: 8px; }
  .auth-card form label{ margin-top: 4px; }
  .auth-card input, .auth-card select, .auth-card textarea{ padding: 10px 12px; }
}

/* ===== Custom Background Pattern (morocco) ===== */
html, body {
  background-color: #0b7f86 !important;
  background-image:
    linear-gradient(rgba(255,255,255,0.92), rgba(255,255,255,0.92)),
    none !important;
  background-repeat: repeat !important;
  background-size: auto !important;
  background-attachment: fixed !important;
}


/* ===== FIX: Logo right, text centered, no brand card ===== */
@media (min-width: 721px){
  /* remove the glass card behind brand */
  .brand, .brand-center{
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
  }

  /* let children be positioned independently */
  .brand, .brand-center{ display: contents !important; }

  /* keep topbar as positioning context */
  .topbar-inner{ position: relative !important; }

  /* logo fixed on the right */
  .topbar-inner .logo{
    position: absolute !important;
    right: 18px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 42px !important;
    height: 42px !important;
    z-index: 2 !important;
  }

  /* center the brand text in header */
  .topbar-inner .brand-text{
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    text-align: center !important;
    z-index: 1 !important;
    pointer-events: none; /* clicks go to buttons not text */
  }

  /* if title/sub are not inside .brand-text in some pages */
  .topbar-inner .brand-title,
  .topbar-inner .brand-sub{
    text-align: center !important;
  }
}




/* Remove any brand box/card look */
.brand, .brand-center {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

/* Make brand stretch (so we can absolutely place its children) */
.brand, .brand-center { display: block !important; }

/* Logo fixed on RIGHT */
.brand .logo, .brand-center .logo,
.topbar-inner .logo {
  position: absolute !important;
  right: 18px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 42px !important;
  height: 42px !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
}

/* Title fixed in EXACT center */
.brand-text, .brand-title, .brand-sub {
  text-align: center !important;
}
.brand-text {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  margin: 0 !important;
}
.brand-title { font-size: 18px !important; line-height: 1.2 !important; }
.brand-sub { font-size: 12px !important; opacity: .9 !important; }

/* Actions (Home/Register/Night/Day) fixed on LEFT */
.top-actions {
  position: absolute !important;
  left: 18px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  justify-self: auto !important;
}

/* Optional: keep burger out of the way (if exists) */
#menuToggle{
  position: absolute !important;
  right: 70px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
}


/* ===== Background override: Morocco Blue pattern (visible) ===== */
html, body {
  background-color: #0b7f86 !important;
  background-repeat: repeat !important;
  background-position: top left !important;
  background-size: auto !important;
  background-attachment: scroll !important;
}


/* ===== Topbar layout override v7 (Stable) ===== */
/* IMPORTANT: منوی سه‌خط (Dropdown) زیر هدر باز می‌شود.
   اگر overflow:hidden باشد، منو بریده می‌شود و آیتم‌ها کلیک‌نمی‌خورند. */
.topbar { overflow: visible !important; }
.topbar-inner{
  position: relative !important;
  height: 64px !important;
  align-items: center !important;
}

/* remove the glass card behind brand */
.brand, .brand-center{
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
}

/* brand container should not affect layout */
.brand, .brand-center{
  display: block !important;
  width: auto !important;
  /* min-height fixed */ min-height: 0 !important;
}

/* Logo fixed RIGHT */
.brand .logo, .brand-center .logo, .topbar-inner .logo{
  position: absolute !important;
  right: 18px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 42px !important;
  height: 42px !important;
  margin: 0 !important;
}

/* Title fixed DEAD CENTER */
.brand-text{
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  text-align: center !important;
  margin: 0 !important;
  white-space: nowrap !important;
}
.brand-title{ font-size: 18px !important; line-height: 1.2 !important; }
.brand-sub{ font-size: 12px !important; opacity: .9 !important; }

/* Actions fixed LEFT */
.top-actions{
  position: absolute !important;
  left: 18px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  flex-wrap: nowrap !important;
  justify-self: auto !important;
}

/* Keep burger (if any) from breaking layout */
#menuToggle{
  position: absolute !important;
  right: 70px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
}

/* Mobile: don't force absolute (stack naturally) */
@media (max-width: 720px){
  .topbar-inner{ height: auto !important; }
  .brand-text, .top-actions, .logo, #menuToggle{
    position: static !important;
    transform: none !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
  }
  .brand, .brand-center{
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 10px !important;
  }
  .brand-text{ white-space: normal !important; }
}


/* toast */
.toast{
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 9999;
  min-width: 180px;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.10);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 13px;
  display:none;
}
.toast.show{ display:block; }
.toast.success{ background: rgba(16,185,129,.18); }
.toast.error{ background: rgba(239,68,68,.14); }

/* soften cards (override app.css white cards) */
.card{
  background: rgba(255,255,255,.32) !important;
  border: 1px solid rgba(0,0,0,.10) !important;
}

/* chat box */
.chat-box{
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(0,0,0,.08) !important;
  border-radius: 14px;
}


.btn-sm{padding: 6px 10px;font-size:12px;line-height:1.2;border-radius:10px;}


/* ===== Custom Background: Blue 3D Dots (Only Change) ===== */
html, body {
  background-repeat: no-repeat !important;
  background-position: center center !important;
  background-size: cover !important;
}



/* =========================
   Topbar user chip (panel greeting)
========================= */
.userchip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 8px 10px;
  border-radius:999px;
  background: rgba(255,255,255,.45);
  border: 1px solid rgba(8,50,71,.18);
  box-shadow: 0 10px 25px rgba(15,23,42,.08);
  font-size: 13px;
  color: var(--topbarText);
  white-space: nowrap;
  max-width: min(520px, 55vw);
  overflow: hidden;
  text-overflow: ellipsis;
}
.userchip .sep{ opacity:.55; }
.userchip .emoji{ font-size:14px; }
.role-dot{
  width:8px; height:8px; border-radius:99px; display:inline-block;
  box-shadow: 0 0 0 4px rgba(245,158,11,.14);
}
.role-dot.user{ background:#22c55e; }
.role-dot.referee{ background:#3b82f6; }
.role-dot.manager{ background:#f59e0b; }

/* =========================
   Sticky tab bar under topbar
========================= */
.tabs.tabs-sticky{
  position: sticky;
  top: 74px; /* زیر منوبار */
  z-index: 350;
  margin-top: 0;
  background: rgba(255,255,255,.55);
}
[data-theme="dark"] .tabs.tabs-sticky{
  background: rgba(17,24,39,.62);
}

/* Icon + label in tabs */
.tab-btn, .tab-btn.tab-link{
  display:inline-flex;
  align-items:center;
  gap:8px;
}
.tab-btn i[data-lucide],
.qbtn i[data-lucide],
.icon-inline i[data-lucide]{
  width:18px;
  height:18px;
  stroke-width:2;
}
.tab-btn.tab-link{ text-decoration:none; }

/* Auth quickbar */
.auth-quickbar .qbtn{
  gap:8px;
}


.btn-block{ width:100%; }
.section-title{ text-align:center; font-weight:900; margin:0 0 12px 0; }

/* =========================
   Modal (simple, no dependency)
========================= */
.modal{ position:fixed; inset:0; display:none; z-index:50; }
.modal.open{ display:block; }
.modal-backdrop{ position:absolute; inset:0; background: rgba(2,6,23,.55); backdrop-filter: blur(2px); }
.modal-card{
  position:relative;
  margin: 7vh auto;
  max-width: 900px;
  width: calc(100% - 24px);
  background: var(--cardSolid);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(0,0,0,.35);
  padding: 14px;
}


@media (max-width: 980px) {
  .forum-top{ grid-template-columns: 1fr !important; }
}


.file-selected{display:inline-block; padding: 6px 10px; border-radius:999px; background: rgba(255,255,255,.35); border:1px solid rgba(255,255,255,.35);}


/* ===== Final background override (no images) ===== */
:root{
  --bgTop:#174372;
  --bgBottom:#1C6671;
}
html, body { /* min-height fixed */ min-height: 100%; }
body{
  background: linear-gradient(to bottom, var(--bgTop), var(--bgBottom)) !important;
  background-image: none !important;
  background-color: transparent !important;
  background-repeat: no-repeat !important;
  background-attachment: fixed !important;
  background-position: center center !important;
  background-size: cover !important;
}



/* ===== Mobile fit (prevent horizontal deform) ===== */
html, body{
  width: auto;
  max-width: auto;
  overflow-x: hidden;
}
img, video, canvas, iframe{ max-width: auto; height: auto; }

/* ===== Collapsible panel menu (tabs under topbar) ===== */
.panel-menu{
  position: sticky;
  top: 74px; /* زیر منوبار */
  z-index: 360;
}
.panel-menu__header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.55);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 25px rgba(0,0,0,.12);
}
.panel-menu__title{
  font-weight: 800;
  font-size: 13px;
}
.panel-menu__toggle{
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(255,255,255,.45);
  box-shadow: 0 10px 20px rgba(0,0,0,.12);
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
}
.panel-menu__toggle:active{ transform: scale(.98); }
.panel-menu__body{
  margin-top:10px;
  overflow:hidden;
  max-height: 1000px;
  opacity:1;
  transition: max-height .25s ease, opacity .2s ease, margin-top .2s ease;
}
.panel-menu.is-collapsed .panel-menu__body{
  max-height: 0;
  opacity: 0;
  margin-top:0;
}
.panel-menu__chev{
  transition: transform .2s ease;
}
.panel-menu.is-collapsed .panel-menu__chev{
  transform: rotate(180deg);
}
/* prevent double-sticky */
.panel-menu .tabs-sticky{
  position: static;
  top: auto;
}

/* On small screens make header a bit tighter */
@media (max-width: 520px){
  .panel-menu__header{ padding: 8px 10px; }
  .panel-menu__title{ font-size: 12px; }
}


/* ===== Custom Background: Blue → Teal Gradient (No Image) ===== */
html, body {
  background: linear-gradient(
    to bottom,
    #174372 0%,
    #1C6671 100%
  ) !important;
}



/* ===== Ticket Chat (User Panel) ===== */
.chat-box{
  padding: 12px;
  max-height: 520px;
  overflow: auto;
}

.chat-row{
  display: flex;
  margin: 8px 0;
  align-items: flex-start;
}

.chat-row.mine{ justify-content: flex-end; }
.chat-row.theirs{ justify-content: flex-start; }

.chat-bubble{
  display: inline-block;
  width: fit-content;
  max-width: 84%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(0,0,0,.03);
}

.chat-row.mine .chat-bubble{
  background: rgba(0,140,255,.10);
}

.msg-status{
  margin-top: 6px;
  font-size: 12px;
  opacity: .75;
}

/* Flash messages */
.flash-stack{margin:14px 0; display:grid; gap:10px;}
.alert{padding: 12px 14px; border-radius:14px; border:1px solid rgba(0,0,0,.08); background:rgba(255,255,255,.7);}
.alert-success{border-color:rgba(16,185,129,.35); background:rgba(16,185,129,.12); color:#065f46;}
.alert-danger{border-color:rgba(239,68,68,.35); background:rgba(239,68,68,.10); color:#7f1d1d;}
.alert-info{border-color:rgba(59,130,246,.35); background:rgba(59,130,246,.10); color:#1e3a8a;}

/* Chat bubble sizing fix */
.chat-row{align-items:flex-start;}
.chat-bubble{display:inline-block; width:fit-content; max-width:92%;}


body, button, input, select, textarea {
  font-family: Tahoma, Arial, "Segoe UI", sans-serif;
}
.nexa-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:1.15em;
  height:1.15em;
  min-width:1.15em;
  line-height:1;
  color:currentColor;
  vertical-align:middle;
}
.nexa-icon__svg{
  width:100%;
  height:100%;
  display:block;
  overflow:visible;
}
.icon-btn .nexa-icon, .menu-item .nexa-icon, .btn .nexa-icon{
  margin-inline: 2px;
}
.thumb-sticker-icon .nexa-icon{
  width:52px;
  height:52px;
}
.userchip .nexa-icon{
  width:18px;
  height:18px;
}

/* ===== Round9: Instagram-like media frames + true mobile fit ===== */
:root{
  --mobile-safe-padding: 10px;
  --showcase-ratio-desktop: 16 / 10;
  --showcase-ratio-mobile: 4 / 5;
}

/* Prevent hidden horizontal overflow from flex/grid children */
.container, .page-container, .panel, .card, .grid, .grid2, .stack,
.row, .actions, .tabs, .tab, .messenger-shell, .messenger-main, .messenger-sidebar,
.chat-panel, .chat-header, .chat-composer, .panel-menu, .panel-menu__body{
  min-width: 0;
}

/* Stable media frame for showcase/archive cards */
.pub-item .thumb,
.pub-item .thumb-wrap,
.pub-card .thumb,
.pub-card .thumb-wrap,
.archpub-card .thumb,
.archpub-card .thumb-wrap,
.status-item .thumb,
.status-item .thumb-wrap{
  width: auto;
  aspect-ratio: var(--showcase-ratio-desktop);
  /* min-height fixed */ min-height: 220px;
  max-height: 420px;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.90), rgba(241,245,249,.92));
  border: 1px solid rgba(15,23,42,.10);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55), 0 10px 28px rgba(15,23,42,.06);
}

.pub-item .thumb-link,
.pub-card .thumb-link,
.archpub-card .thumb-link{
  display:block;
  width:100%;
  height:100%;
}

.pub-item .thumb-img,
.pub-item img.thumb,
.pub-item video.thumb,
.pub-item .thumb-wrap > img,
.pub-item .thumb-wrap > video,
.pub-card .thumb-img,
.pub-card img.thumb,
.pub-card video.thumb,
.archpub-card .thumb-img,
.archpub-card img.thumb,
.archpub-card video.thumb,
.status-item .thumb-img,
.status-item img.thumb,
.status-item video.thumb{
  width:100%;
  height:100%;
  object-fit: cover;
  object-position: center center;
  display:block;
}

/* Keep video usable without breaking the card proportions */
.pub-item video.thumb,
.pub-card video.thumb,
.archpub-card video.thumb,
.status-item video.thumb{
  background:#0f172a;
}

.pub-item .thumb-placeholder,
.pub-card .thumb-placeholder,
.archpub-card .thumb-placeholder,
.status-item .thumb-placeholder{
  width:100%;
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
}

/* Cleaner card structure */
.pub-item,
.pub-card,
.archpub-card{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.pub-item .desc,
.pub-card .desc,
.archpub-card .desc{
  display:-webkit-box;
  -webkit-line-clamp:4;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

/* Mobile-first panel usability */
@media (max-width: 900px){
  .container,
  .page-container{
    width:100%;
    max-width:100%;
    padding-inline: var(--mobile-safe-padding);
    margin-inline:auto;
  }

  .panel{
    padding: 12px;
    border-radius: 16px;
  }

  .card{
    padding: 12px;
    border-radius: 16px;
  }

  .tabs{
    justify-content:flex-start;
    flex-wrap:nowrap;
    overflow-x:auto;
    overflow-y:hidden;
    padding: 8px;
    gap:8px;
    scroll-snap-type:x proximity;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none;
  }
  .tabs::-webkit-scrollbar{ display:none; }

  .tab-btn,
  .tab-btn.tab-link{
    flex: 0 0 auto;
    white-space: nowrap;
    scroll-snap-align:start;
    font-size: 13px;
    padding: 9px 12px;
  }

  .panel-menu{
    top: 66px;
  }

  .panel-menu__body{
    overflow: visible;
  }

  .messenger-shell,
  .grid,
  .grid2{
    grid-template-columns: 1fr !important;
  }

  .row,
  .spread,
  .actions,
  .chat-header,
  .chat-toolbar{
    flex-wrap:wrap;
  }

  .row > *,
  .spread > *,
  .actions > *,
  .chat-header > *,
  .chat-toolbar > *{
    min-width:0;
    max-width:100%;
  }

  .chat-box{
    max-height: min(58vh, 520px);
    padding: 10px;
  }

  .chat-bubble{
    max-width: 94%;
  }

  /* Inline template grids used in some panels */
  div[style*="grid-template-columns: 1fr 1.2fr"],
  div[style*="grid-template-columns:1fr 1.2fr"],
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns:1fr 1fr"],
  div[style*="grid-template-columns: 1fr 1.1fr"],
  div[style*="grid-template-columns:1fr 1.1fr"]{
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 640px){
  :root{
    --mobile-safe-padding: 8px;
  }

  .pub-item .thumb,
  .pub-item .thumb-wrap,
  .pub-card .thumb,
  .pub-card .thumb-wrap,
  .archpub-card .thumb,
  .archpub-card .thumb-wrap,
  .status-item .thumb,
  .status-item .thumb-wrap{
    aspect-ratio: var(--showcase-ratio-mobile);
    /* min-height fixed */ min-height: 260px;
    max-height: min(70vh, 520px);
    border-radius: 18px;
  }

  .thumb-placeholder-inner{
    width:min(86%, 260px);
    padding: 12px 14px;
  }

  .thumb-placeholder-icon{
    width:58px;
    height:58px;
  }

  .card-head .title,
  .title{
    line-height:1.8;
    overflow-wrap:anywhere;
  }

  .meta,
  .desc,
  .muted,
  p,
  span,
  label,
  .btn{
    overflow-wrap:anywhere;
  }

  table{
    display:block;
    width:100%;
    overflow-x:auto;
  }
}


/* === Round10 LMS + UI theme === */
:root{
  --brand:#2563eb;
  --brand-soft:#dbeafe;
  --bg-app:#f5f7fb;
  --surface:#ffffff;
  --surface-2:#f8fafc;
  --text:#0f172a;
  --muted:#64748b;
  --line:#dbe3ef;
  --shadow:0 14px 34px rgba(15,23,42,.07);
}
html,body{background:var(--bg-app) !important;color:var(--text);} 
body{overflow-x:hidden;}
.topbar,.header,.panel,.card,.modal-content{background-color:var(--surface);} 
.card,.panel,.item-link,.tab-btn,.pill,select,input,textarea{border-color:var(--line)!important;}
.card,.panel{box-shadow:var(--shadow);}
.topbar{background:linear-gradient(180deg,#fff,#f8fbff)!important;border-bottom:1px solid var(--line)!important;}
.brand-text .title,.brand-text .sub,.tab-btn,.btn,.panel-menu__title,h1,h2,h3,h4,label,strong{color:var(--text)!important;}
.btn{background:var(--brand);border-color:var(--brand);color:#fff;}
.btn:hover{filter:brightness(.98)}
.btn.btn-outline,.btn-outline{background:#fff;color:var(--brand)!important;border:1px solid var(--line)!important;}
.btn-ghost,.btn.btn-ghost{background:var(--surface-2)!important;color:var(--text)!important;border:1px solid var(--line)!important;}
.pill{background:#eff6ff;color:#1d4ed8;border:1px solid #bfdbfe;}
.pill-success{background:#ecfdf5;color:#047857;border:1px solid #a7f3d0;}
.panel-soft{background:transparent;box-shadow:none;padding:0;}
.page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-bottom:18px;}
.page-head h1{margin:0;font-size:30px;}
.page-head .eyebrow{font-size:12px;font-weight:900;color:var(--brand);margin-bottom:6px;}
.page-head__actions{display:flex;gap:10px;flex-wrap:wrap;}
.course-filters{padding:16px;margin-bottom:18px;}
.course-filters__grid{display:grid;grid-template-columns:minmax(0,2fr) repeat(3,minmax(0,1fr));gap:12px;}
.courses-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;}
.course-card-v2{padding:0;overflow:hidden;display:flex;flex-direction:column;min-width:0;}
.course-card-v2__media{position:relative;display:block;aspect-ratio:16/9;background:#e2e8f0;overflow:hidden;}
.course-card-v2__media img{width:100%;height:100%;object-fit:cover;display:block;}
.course-card-v2__placeholder,.course-hero__placeholder{width:100%;height:100%;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:10px;background:linear-gradient(135deg,#eff6ff,#f8fafc);color:#1d4ed8;font-weight:800;}
.course-card-v2__placeholder i,.course-hero__placeholder i{width:64px;height:64px;}
.course-badge{position:absolute;top:12px;left:12px;padding: 7px 12px;border-radius:999px;font-size:12px;font-weight:800;background:rgba(255,255,255,.96);box-shadow:0 8px 22px rgba(15,23,42,.12);}
.course-badge--ongoing{color:#047857;}.course-badge--upcoming{color:#1d4ed8;}.course-badge--finished{color:#475569;}
.course-card-v2__body{padding:16px;display:flex;flex-direction:column;gap:12px;/* min-height fixed */ min-height:220px;}
.course-card-v2__meta{display:flex;gap:8px;flex-wrap:wrap;color:var(--muted);font-size:12px;}
.course-card-v2 h3{margin:0;font-size:18px;line-height:1.8;/* min-height fixed */ min-height:66px;}
.course-card-v2 p{margin:0;color:var(--muted);line-height:1.9;/* min-height fixed */ min-height:74px;overflow:hidden;}
.course-card-v2__footer{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:auto;}
.course-content-grid{display:grid;grid-template-columns:340px minmax(0,1fr);gap:18px;margin-top:18px;}
.course-hero{display:grid;grid-template-columns:minmax(280px,1fr) minmax(0,1.1fr);gap:20px;padding:18px;}
.course-hero__media{border-radius:22px;overflow:hidden;background:#e2e8f0;/* min-height fixed */ min-height:240px;}
.course-hero__media img{width:100%;height:100%;object-fit:cover;display:block;}
.course-hero__body{display:flex;flex-direction:column;gap:14px;min-width:0;}
.course-hero__chips{display:flex;gap:8px;flex-wrap:wrap;}
.course-hero h1{margin:0;font-size:30px;line-height:1.6;}
.course-hero__text{margin:0;color:var(--muted);line-height:2;}
.course-hero__facts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;}
.course-hero__facts > div{padding:12px;border:1px solid var(--line);border-radius:16px;background:var(--surface-2);display:flex;flex-direction:column;gap:6px;}
.course-hero__facts b{font-size:12px;color:var(--muted);}
.inline-form{display:flex;gap:10px;flex-wrap:wrap;}
.inline-form input{flex:1 1 280px;}
.course-outline,.course-resources{padding:18px;}
.session-list-modern{display:flex;flex-direction:column;gap:10px;}
.session-item-modern{border:1px solid var(--line);border-radius:16px;padding:0;background:var(--surface-2);overflow:hidden;}
.session-item-modern summary{list-style:none;cursor:pointer;padding: 12px 16px;display:flex;align-items:center;gap:10px;}
.session-item-modern p,.session-item-modern .btn,.session-item-modern .resource-list{margin:0 16px 12px;}
.session-order{display:inline-flex;align-items:center;justify-content:center;min-width:76px;padding: 6px 10px;border-radius:999px;background:#eaf2ff;color:#1d4ed8;font-size:12px;font-weight:800;}
.resource-list{list-style:none;padding:0;margin:0;display:flex;flex-direction:column;gap:10px;}
.resource-list li{padding: 12px 14px;border:1px solid var(--line);border-radius:14px;background:var(--surface);display:flex;align-items:center;justify-content:space-between;gap:12px;}
.resource-list--wide li{align-items:flex-start;}
.manager-courses-grid{display:grid;grid-template-columns:340px minmax(0,1fr);gap:18px;}
.two-col-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;}
.empty-state{text-align:center;padding:32px;}
.compact{gap:8px;}
.actions.compact{display:flex;flex-wrap:wrap;}
@media (max-width:1100px){.courses-grid{grid-template-columns:repeat(2,minmax(0,1fr));}.course-content-grid,.manager-courses-grid,.course-hero,.two-col-grid{grid-template-columns:1fr;}.course-hero__facts{grid-template-columns:1fr 1fr 1fr;}}
@media (max-width:760px){.page-head h1{font-size:24px}.course-filters__grid,.courses-grid,.course-content-grid,.manager-courses-grid,.two-col-grid,.course-hero__facts{grid-template-columns:1fr;}.course-card-v2 h3,.course-card-v2 p{/* min-height fixed */ min-height:auto}.course-hero{padding:12px}.course-hero__media{/* min-height fixed */ min-height:200px}.course-card-v2__media{aspect-ratio:4/3}.tabs{overflow:auto hidden;scrollbar-width:thin;padding-bottom:4px}.tab-btn{white-space:nowrap;flex:0 0 auto}.panel,.card{min-width:0}.row,.actions{min-width:0}.topbar-inner,.content-wrap,.container,.panel{max-width:100%;}.table-wrap,table{display:block;overflow:auto}.messenger-shell{grid-template-columns:1fr}.chat-header,.chat-toolbar{flex-wrap:wrap}}


html, body, button, input, select, textarea { font-family: var(--font-sans); font-size: var(--text-md); }
.small, .muted.small, .meta, .badge, .pill { font-size: var(--text-sm); }
h1, h2, h3, .brand-title, .title, .h-title h2 { font-family: var(--font-display) !important; font-size: var(--text-lg); }
small, .muted, .small, .brand-sub, .meta, .hint, .helper-text { font-size: var(--text-sm) !important; }


.admin-desk-shell{align-items:start;}
.admin-desk-list{max-height:760px;}
.score-guide-card .btn{min-width:220px;}
@media (max-width: 900px){ .admin-desk-shell{grid-template-columns:1fr;} }


/* round21: user points statuses + course page spacing */
.courses-shell{padding: 12px 16px 28px;}
.page-head--courses{padding: 10px 6px 2px;}
.page-head--courses .page-head__actions{align-items:center;}
.course-filters{padding:18px;margin:6px 0 22px;}
.courses-grid{padding: 6px 2px 2px;gap:22px;}
.course-card-v2__body{padding: 12px 16px 20px;}
.course-card-v2__footer{padding-top:6px;}
@media (max-width:760px){
  .courses-shell{padding: 12px 10px 22px;}
  .page-head--courses{padding: 4px 2px 0;}
  .course-filters{padding:14px;}
  .courses-grid{padding:4px 0 0;gap:16px;}
}


/* round21-final: publication labels + course detail spacing */
.status-pill{font-weight:800;}
.course-detail-shell{padding: 12px 16px 28px;}
.course-hero{padding:22px;}
.course-outline,.course-resources{padding:22px;}
.course-resources .resource-list li,
.course-outline .resource-list li{padding: 12px 16px;}
.course-resources .resource-list,
.course-outline .resource-list{gap:12px;}
.course-locked{padding: 12px 16px;}
@media (max-width:760px){
  .course-detail-shell{padding: 12px 10px 22px;}
  .course-hero{padding:16px;}
  .course-outline,.course-resources{padding:16px;}
  .course-resources .resource-list li,
  .course-outline .resource-list li{padding: 12px 14px;}
  .course-locked{padding: 12px 16px;}
}


/* ===== Chat critical fix: compact bubbles + safer composer ===== */
.chat-box{
  min-height: 0 !important;
  height: auto !important;
  max-height: min(56vh, 520px) !important;
  padding: 12px !important;
}

.chat-row{
  display:flex !important;
  width:100%;
  margin:8px 0 !important;
  align-items:flex-start !important;
}

.chat-row.mine{justify-content:flex-start !important;}
.chat-row.theirs{justify-content:flex-end !important;}

html[dir="rtl"] .chat-row.mine{justify-content:flex-start !important;}
html[dir="rtl"] .chat-row.theirs{justify-content:flex-end !important;}

.chat-bubble{
  display:inline-flex !important;
  flex-direction:column;
  width:auto !important;
  min-width:0 !important;
  max-width:min(72%, 560px) !important;
  padding:10px 12px !important;
  border-radius:16px !important;
  box-sizing:border-box;
}

.chat-bubble .row.spread,
.chat-bubble .chat-meta{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}

.chat-bubble img{
  display:block;
  max-width:min(100%, 240px);
  height:auto;
}

.form[data-ajax="support-message"]{
  position:relative;
}

.form[data-ajax="support-message"] textarea{
  min-height:92px !important;
}

.form[data-ajax="support-message"] button[type="submit"][disabled]{
  opacity:.7;
  cursor:not-allowed;
}

@media (max-width: 768px){
  .chat-bubble{max-width:88% !important;}
}


/* ===== Round26: balanced media viewer + denser publication cards ===== */
.content-media-frame{
  width:100%;
  max-width:min(980px, 100%);
  margin:10px auto 0;
  border:1px solid rgba(15,23,42,.10);
  border-radius:22px;
  overflow:hidden;
  background:linear-gradient(180deg, rgba(248,250,252,.96), rgba(241,245,249,.98));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55), 0 12px 32px rgba(15,23,42,.08);
}
.content-media-frame.video-frame,
.content-media-frame.image-frame{
  aspect-ratio: 16 / 10;
  min-height: 280px;
  max-height: min(76vh, 760px);
  display:flex;
  align-items:center;
  justify-content:center;
}
.content-media-frame.pdf-frame{
  height:min(78vh, 920px);
}
.content-media-el{
  width:100%;
  height:100%;
  display:block;
  border:0;
  background:#0f172a;
}
.content-media-el.video-el,
.content-media-el.image-el{
  object-fit:contain;
  object-position:center;
}
.content-media-el.image-el{
  background:linear-gradient(180deg, rgba(248,250,252,.96), rgba(241,245,249,.98));
}

.pub-item,
.pub-card,
.archpub-card{
  padding:14px;
  gap:10px;
}
.pub-item .card-head,
.pub-card .card-head,
.archpub-card .card-head{
  min-height:auto;
}
.pub-item .title,
.pub-card .title,
.archpub-card .title{
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
  line-height:1.95;
  min-height:3.9em;
  font-size:1rem;
}
.pub-item .thumb,
.pub-item .thumb-wrap,
.pub-card .thumb,
.pub-card .thumb-wrap,
.archpub-card .thumb,
.archpub-card .thumb-wrap{
  aspect-ratio: 4 / 3;
  min-height: 170px;
  max-height: 260px;
  margin-top:8px;
  border-radius:18px;
}
.pub-item .actions,
.pub-card .actions,
.archpub-card .actions{
  margin-top:8px;
  gap:8px;
}
.pub-item .actions .btn,
.pub-card .actions .btn,
.archpub-card .actions .btn{
  padding:10px 14px;
  min-height:42px;
}
.pub-item .muted.small,
.pub-card .muted.small,
.archpub-card .muted.small{
  margin-top:2px !important;
}

@media (max-width: 980px){
  .content-media-frame.video-frame,
  .content-media-frame.image-frame{
    aspect-ratio: 4 / 5;
    min-height: 240px;
    max-height: min(72vh, 620px);
  }
  .content-media-frame.pdf-frame{
    height:min(72vh, 760px);
  }
  .pub-item .thumb,
  .pub-item .thumb-wrap,
  .pub-card .thumb,
  .pub-card .thumb-wrap,
  .archpub-card .thumb,
  .archpub-card .thumb-wrap{
    min-height:150px;
    max-height:220px;
  }
}

@media (max-width: 640px){
  .content-media-frame.video-frame,
  .content-media-frame.image-frame{
    aspect-ratio: 4 / 5;
    min-height: 220px;
    max-height: 68vh;
    border-radius:16px;
  }
  .content-media-frame.pdf-frame{
    height:68vh;
    border-radius:16px;
  }
}
