/* ============================================================
   همفکران — لایهٔ ظاهری بر پایهٔ استایل‌گاید HFS
   Primary #3C01AF · Secondary #49CFF8 · Logo Decor #D3A524
   دکمه ۰٫۳rem · کارت ۱۶px · نشان pill
   تایپوگرافی سیال · فواصل ۸۸ / ۷۲ / ۴۸ · RTL
   ============================================================ */

/* ---------------- ۱) توکن‌ها ---------------- */
:root {
  /* brand */
  --hfs-indigo: #3C01AF;
  --hfs-cyan: #49CFF8;
  --hfs-gold: #D3A524;

  /* neutral */
  --bn-bg: #F4F6FA;
  --bn-bg-deep: #EDF0F7;
  --bn-tile: #FFFFFF;
  --bn-tile-flat: #FFFFFF;
  --bn-tile2: rgba(19, 21, 44, .04);
  --bn-tile3: rgba(19, 21, 44, .07);
  --bn-line: #E5E7EB;
  --bn-line2: #CBD2DE;
  --bn-side: #FFFFFF;

  /* ink */
  --bn-ink: #13152C;
  --bn-ink2: #6B7280;
  --bn-ink3: #9AA1AE;

  /* accents mapped to HFS */
  --bn-purple: #3C01AF;
  --bn-purple-2: #3C01AF;
  --bn-cyan: #49CFF8;
  --bn-pink: #D6006C;
  --bn-green: #1089B1;
  --bn-amber: #D3A524;
  --bn-orange: #D3A524;
  --bn-red: #EF4444;
  --bn-grad: linear-gradient(90deg, #3C01AF, #5A1AD8);
  --bn-grad-cyan: linear-gradient(90deg, #49CFF8, #1089B1);

  /* geometry — دقیقاً مطابق استایل‌گاید */
  --bn-r-lg: 16px;     /* کارت‌ها، مودال‌ها، کانتینرها */
  --bn-r-md: .3rem;    /* دکمه‌ها و عناصر استاندارد */
  --bn-r-sm: .3rem;
  --bn-pad: 24px;
  --bn-gap: 24px;
  --hfs-grid-gap: 3rem;
  --hfs-section: 72px;
  --hfs-hero: 88px;

  --bn-sh: 0 1px 2px rgba(19, 21, 44, .04), 0 8px 24px -16px rgba(19, 21, 44, .18);
  --bn-sh-pop: 0 2px 4px rgba(19, 21, 44, .05), 0 24px 56px -28px rgba(19, 21, 44, .3);
  --bn-focus: 0 0 0 3px rgba(60, 1, 175, .22);
}

html[data-theme="dark"] {
  --bn-bg: #0B0C1B;
  --bn-bg-deep: #07080F;
  --bn-tile: #16182E;
  --bn-tile-flat: #16182E;
  --bn-tile2: rgba(255, 255, 255, .055);
  --bn-tile3: rgba(255, 255, 255, .1);
  --bn-line: rgba(255, 255, 255, .1);
  --bn-line2: rgba(255, 255, 255, .18);
  --bn-side: #101124;

  --bn-ink: #F4F6FA;
  --bn-ink2: #B4BAC8;
  --bn-ink3: #868D9E;

  --bn-purple: #7C4DFF;
  --bn-purple-2: #49CFF8;
  --bn-grad: linear-gradient(90deg, #4A08C9, #7C4DFF);

  --bn-sh: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 40px -24px rgba(0, 0, 0, .8);
  --bn-sh-pop: 0 30px 70px -34px rgba(0, 0, 0, .85);
  color-scheme: dark;
}

* { box-sizing: border-box; }
::selection { background: rgba(73, 207, 248, .45); color: var(--bn-ink); }
:focus-visible { outline: 2px solid var(--hfs-indigo); outline-offset: 2px; }

/* ---------------- ۲) پوستهٔ برنامه ---------------- */
body {
  background: var(--bn-bg) !important;
  color: var(--bn-ink2) !important;
  font-family: Vazirmatn, system-ui, sans-serif !important;
  font-size: 16px;
  line-height: 1.75;
}
.app-shell { background: var(--bn-bg) !important; }
.main { position: relative; z-index: 1; }

/* هالهٔ ملایم — فقط شب */
html[data-theme="dark"] .app-shell::before {
  content: ''; position: fixed; top: -300px; inset-inline-start: -200px;
  width: 660px; height: 660px; border-radius: 50%; pointer-events: none; z-index: 0; filter: blur(26px);
  background: radial-gradient(circle, rgba(60, 1, 175, .5), transparent 66%);
}
html[data-theme="dark"] .app-shell::after {
  content: ''; position: fixed; top: 160px; inset-inline-end: -240px;
  width: 560px; height: 560px; border-radius: 50%; pointer-events: none; z-index: 0; filter: blur(26px);
  background: radial-gradient(circle, rgba(73, 207, 248, .18), transparent 68%);
}

/* منوی کناری */
.sidebar {
  background: var(--bn-side) !important;
  border-color: var(--bn-line) !important;
  display: flex; flex-direction: column;
  height: 100vh; position: sticky; top: 0; padding-bottom: 0 !important;
}
.sidebar .brand { text-decoration: none !important; }
.sidebar .brand-name {
  color: var(--bn-ink) !important; letter-spacing: .2px;
  text-decoration: none !important; border-bottom: 0 !important;
}
.sidebar > nav, .sidebar .nav, .sidebar .nav-groups {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding-bottom: 8px; scrollbar-width: thin;
}
.sidebar > nav::-webkit-scrollbar, .sidebar .nav::-webkit-scrollbar { width: 8px; }
.sidebar > nav::-webkit-scrollbar-thumb, .sidebar .nav::-webkit-scrollbar-thumb { background: var(--bn-tile3); border-radius: 999px; }
.sidebar-foot {
  flex: 0 0 auto; margin-top: auto;
  border-top: 1px solid var(--bn-line) !important; border-color: var(--bn-line) !important;
  background: var(--bn-side); padding-top: 10px;
}
.nav-label { color: var(--bn-ink3) !important; font-size: 11px !important; letter-spacing: .4px; font-weight: 700; }
.nav-link {
  position: relative;
  color: var(--bn-ink2) !important; background: transparent !important;
  border-radius: var(--bn-r-md) !important; padding: 11px 12px !important;
  font-size: 14px !important; font-weight: 700;
  border: 1px solid transparent !important;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.nav-link:hover { background: rgba(60, 1, 175, .07) !important; color: var(--hfs-indigo) !important; }
html[data-theme="dark"] .nav-link:hover { background: var(--bn-tile2) !important; color: var(--bn-ink) !important; }
.nav-link.active {
  background: rgba(60, 1, 175, .09) !important; color: var(--hfs-indigo) !important;
  border-color: rgba(60, 1, 175, .18) !important;
}
html[data-theme="dark"] .nav-link.active { background: var(--bn-tile2) !important; color: var(--bn-ink) !important; border-color: var(--bn-line2) !important; }
.nav-link.active::before {
  content: ''; position: absolute; inset-inline-start: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 999px; background: var(--bn-grad);
}
.nav-link svg { opacity: .85; }
.nav-link.active svg { opacity: 1; }
.user-chip {
  border-radius: var(--bn-r-lg) !important; background: var(--bn-tile2) !important;
  border: 1px solid var(--bn-line) !important;
}
.user-chip-name { color: var(--bn-ink) !important; }
.user-chip-role { color: var(--bn-ink3) !important; }

/* نوار بالا — تیتر با مقیاس سیال H3 */
.topbar { background: transparent !important; border-color: var(--bn-line) !important; }
.topbar h1 {
  color: var(--bn-ink) !important;
  font-size: calc(19px + 1vw) !important; line-height: 1.4 !important; font-weight: 700;
}
.topbar-sub { color: var(--bn-ink3) !important; font-size: 13px !important; }
.topbar-actions { gap: 10px !important; }
.content { background: transparent !important; }

.bn-theme-btn {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: var(--bn-r-md); cursor: pointer;
  background: var(--bn-tile2); border: 1px solid var(--bn-line); color: var(--bn-ink2);
  display: grid; place-items: center; transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.bn-theme-btn:hover { color: var(--hfs-indigo); border-color: rgba(60, 1, 175, .35); background: rgba(60, 1, 175, .07); }

.btn-back {
  background: var(--bn-tile2) !important; border: 1px solid var(--bn-line) !important;
  color: var(--bn-ink2) !important; border-radius: var(--bn-r-md) !important;
}
.btn-logout {
  background: rgba(239, 68, 68, .1) !important; border: 1px solid rgba(239, 68, 68, .3) !important;
  color: #EF4444 !important; border-radius: var(--bn-r-md) !important;
}
.tabbar { background: var(--bn-tile-flat) !important; border-color: var(--bn-line) !important; }
.tabbar a { color: var(--bn-ink3) !important; }
.tabbar a.active { color: var(--hfs-indigo) !important; }

/* مقیاس تایپوگرافی سیال — قابل استفاده در هر صفحه */
.hfs-h1 { font-size: calc(32px + 2vw); line-height: 1.2; font-weight: 800; color: var(--bn-ink); }
.hfs-h2 { font-size: calc(22px + 1.3vw); line-height: 1.2; font-weight: 800; color: var(--bn-ink); }
.hfs-h3 { font-size: calc(19px + 1vw); line-height: 1.4; font-weight: 700; color: var(--bn-ink); }
.hfs-body { font-size: 16px; line-height: 1.75; font-weight: 400; color: var(--bn-ink2); }
.hfs-section { padding-block: var(--hfs-section); }
.hfs-hero { padding-block: var(--hfs-hero); }
.hfs-grid { display: grid; gap: var(--hfs-grid-gap); }

/* ---------------- ۳) عناصر پایه ---------------- */
h1, h2, h3, h4, h5, b, strong, th, label,
.card-title, .ledger-title, .title, .name { color: var(--bn-ink); }
p, td, li { color: var(--bn-ink2); }
.muted, .mono, .hint, small, time { color: var(--bn-ink3); }
a { color: var(--bn-purple); text-decoration: none; }
a:hover { color: var(--bn-purple-2); }
html[data-theme="dark"] a { color: #49CFF8; }
html[data-theme="dark"] a:hover { color: #8EE0FB; }

/* سطح‌ها */
.card, .modal, .modal-box, .panel, .box, .sheet, .letterhead,
.dropdown, .menu, .popover, .task-card, .board-col {
  background: var(--bn-tile) !important;
  border: 1px solid var(--bn-line) !important;
  border-radius: var(--bn-r-lg) !important;
  box-shadow: var(--bn-sh);
  color: var(--bn-ink);
}
.card-pad { padding: var(--bn-pad) !important; }
.card-head {
  border-color: var(--bn-line) !important;
  padding: 15px var(--bn-pad) !important;
}
.card-head h3, .card-head h4 { font-size: 14.5px !important; font-weight: 700; }
.ledger, .list { background: transparent !important; }
.ledger-row, .row {
  border-color: var(--bn-line) !important;
  border-radius: var(--bn-r-md);
  transition: background .14s ease;
}
.ledger-row:hover { background: var(--bn-tile2); }
.empty-row { color: var(--bn-ink3) !important; background: transparent !important; font-size: 12.5px; }
hr, .hr { border-color: var(--bn-line) !important; }

/* دکمه‌ها */
.btn {
  border-radius: var(--bn-r-md) !important;
  min-height: 44px;
  font-family: inherit; font-weight: 700; font-size: 12.5px;
  padding: 10px 15px;
  background: var(--bn-tile2) !important;
  border: 1px solid var(--bn-line) !important;
  color: var(--bn-ink2) !important;
  transition: color .15s ease, border-color .15s ease, filter .15s ease, transform .08s ease;
}
.btn:hover { color: var(--bn-ink) !important; border-color: var(--bn-line2) !important; }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 6px 10px; font-size: 11.5px; border-radius: var(--bn-r-sm) !important; }
.btn-primary {
  background: var(--bn-grad) !important; border-color: transparent !important; color: #fff !important;
  box-shadow: 0 14px 30px -16px rgba(60, 1, 175, .85);
}
.btn-primary:hover { filter: brightness(1.07); color: #fff !important; }
.btn-danger {
  background: rgba(239, 68, 68, .16) !important;
  border-color: rgba(239, 68, 68, .36) !important; color: #EF4444 !important;
}
.btn-ghost { background: transparent !important; }
.btn-ghost:hover { background: var(--bn-tile2) !important; }

/* فیلدها */
input, textarea, select, .input {
  background: var(--bn-tile2) !important;
  border: 1px solid var(--bn-line) !important;
  color: var(--bn-ink) !important;
  border-radius: var(--bn-r-md) !important;
  font-family: inherit !important; font-size: 12.5px;
  padding: 11px 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus, .input:focus {
  outline: 0; border-color: var(--bn-purple) !important; box-shadow: var(--bn-focus);
}
input::placeholder, textarea::placeholder { color: var(--bn-ink3) !important; }
option { background: var(--bn-tile-flat); color: var(--bn-ink); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--bn-purple); padding: 0; }
html[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
html[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.7); }
.chip-select, label.chip-select {
  background: var(--bn-tile2) !important; border: 1px solid var(--bn-line) !important;
  color: var(--bn-ink) !important; border-radius: 999px !important; padding: 9px 14px !important;
  font-size: 12px; font-weight: 600;
}
.toolbar { gap: 12px !important; }
.filters { gap: 8px !important; }

/* نشان‌ها */
.seal, .badge, .pill, .status, .tag {
  background: var(--bn-tile3); border: 1px solid var(--bn-line); color: var(--bn-ink);
  border-radius: 999px; font-size: 10.5px; font-weight: 700; padding: 4px 10px;
}
.seal-received { background: rgba(239, 68, 68, .16); border-color: rgba(239, 68, 68, .3); color: #EF4444; }
.seal-sent     { background: rgba(60, 1, 175, .16); border-color: rgba(60, 1, 175, .3); color: #3C01AF; }
.seal-draft    { background: rgba(148, 163, 184, .18); border-color: rgba(148, 163, 184, .3); color: #64748b; }
.seal-archived { background: rgba(16, 137, 177, .16); border-color: rgba(16, 137, 177, .3); color: #1089B1; }
html[data-theme="dark"] .seal-received { color: #FCA5A5; }
html[data-theme="dark"] .seal-sent     { color: #8EE0FB; }
html[data-theme="dark"] .seal-draft    { color: #cbd5e1; }
html[data-theme="dark"] .seal-archived { color: #49CFF8; }

/* جدول‌ها */
table, .table { border-color: var(--bn-line) !important; color: var(--bn-ink2); }
th {
  background: var(--bn-tile2) !important; color: var(--bn-ink) !important;
  font-size: 12px; font-weight: 700;
}
td, th { border-color: var(--bn-line) !important; }

/* پنجره‌ها */
.modal-overlay { background: rgba(4, 6, 22, .68) !important; backdrop-filter: blur(3px); }
.modal, .modal-box { box-shadow: var(--bn-sh-pop) !important; border-color: var(--bn-line2) !important; }
.toast {
  background: var(--bn-tile-flat) !important; border: 1px solid var(--bn-line2) !important;
  color: var(--bn-ink) !important; border-radius: var(--bn-r-md) !important; box-shadow: var(--bn-sh-pop);
}

/* صفحهٔ ورود */
.auth-shell, .auth-card, .login-card {
  background: var(--bn-tile) !important; border: 1px solid var(--bn-line) !important;
  border-radius: 26px !important; box-shadow: var(--bn-sh-pop);
}
.auth-shell h1, .login-card h1 { color: var(--bn-ink) !important; }

/* نوار ضبط صدا — فقط هنگام ضبط، بدون قرمزی */
#voiceBar[hidden] { display: none !important; }
#voiceBar {
  display: flex !important; align-items: center; gap: 10px;
  background: var(--bn-tile2) !important; border: 1px solid var(--bn-line) !important;
  color: var(--bn-ink2) !important; box-shadow: none !important; border-radius: var(--bn-r-md) !important;
}
#voiceBar b, #voiceBar strong { color: var(--bn-ink) !important; }
#voiceBar .dot, #voiceBar [class*="dot"] { background: var(--bn-red) !important; }
#voiceBar button, #voiceBar a {
  background: transparent !important; border: 1px solid var(--bn-line) !important;
  color: var(--bn-ink2) !important; border-radius: var(--bn-r-sm) !important; padding: 6px 12px !important;
}

/* ---------------- ۴) داشبورد بنتو ---------------- */
.bn-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--bn-gap); align-items: start; }
.bn-col { display: flex; flex-direction: column; gap: var(--bn-gap); min-width: 0; }
@media (max-width: 1180px) { .bn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) { .bn-grid { grid-template-columns: minmax(0, 1fr); } }

.bn-tile {
  background: var(--bn-tile); border: 1px solid var(--bn-line); border-radius: var(--bn-r-lg);
  padding: var(--bn-pad); box-shadow: var(--bn-sh); color: var(--bn-ink);
  display: flex; flex-direction: column; gap: 13px;
  animation: bnRise .5s cubic-bezier(.22, 1, .36, 1) both;
}
@keyframes bnRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes bnPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.bn-tile-head { display: flex; align-items: center; gap: 10px; }
.bn-tile-head h3 { margin: 0; font-size: 14.5px; font-weight: 700; }
.bn-tile-head .bn-meta { margin-inline-start: auto; font-size: 11.5px; color: var(--bn-ink3); }
.bn-sub { font-size: 11px; color: var(--bn-ink3); margin-top: 2px; }

.bn-ico {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center;
  background: rgba(60, 1, 175, .16); color: var(--bn-purple);
}
html[data-theme="dark"] .bn-ico { color: #49CFF8; }
.bn-ico.is-cyan { background: rgba(73, 207, 248, .16); color: #1089B1; }
.bn-ico.is-purple { background: rgba(60, 1, 175, .18); color: #3C01AF; }
.bn-ico.is-pink { background: rgba(214, 0, 108, .16); color: #D6006C; }
.bn-ico.is-green { background: rgba(16, 137, 177, .16); color: #1089B1; }
.bn-ico.is-amber { background: rgba(211, 165, 36, .18); color: #8A6A10; }
.bn-ico.is-orange { background: rgba(211, 165, 36, .16); color: #8A6A10; }
html[data-theme="dark"] .bn-ico.is-cyan { color: var(--bn-cyan); }
html[data-theme="dark"] .bn-ico.is-purple { color: #49CFF8; }
html[data-theme="dark"] .bn-ico.is-pink { color: #D6006C; }
html[data-theme="dark"] .bn-ico.is-green { color: var(--bn-green); }
html[data-theme="dark"] .bn-ico.is-amber { color: var(--bn-amber); }
html[data-theme="dark"] .bn-ico.is-orange { color: #D3A524; }

.bn-btn {
  cursor: pointer; border: 1px solid var(--bn-line); background: var(--bn-tile2); color: var(--bn-ink2);
  border-radius: var(--bn-r-md); padding: 11px 14px; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: color .15s ease, border-color .15s ease, filter .15s ease, transform .08s ease;
}
.bn-btn:hover { color: var(--bn-ink); border-color: var(--bn-line2); }
.bn-btn:active { transform: translateY(1px); }
.bn-btn-grow { flex: 1; min-width: 130px; }
.bn-btn-block { width: 100%; }
.bn-btn-purple {
  border: 0; color: #fff !important; font-weight: 800; background: var(--bn-grad);
  box-shadow: 0 14px 30px -16px rgba(60, 1, 175, .9);
}
.bn-btn-cyan { border: 0; color: #04222c !important; font-weight: 800; background: var(--bn-grad-cyan); }
.bn-btn-orange {
  border: 0; color: #fff !important; font-size: 14px; font-weight: 800; padding: 14px;
  border-radius: var(--bn-r-md); background: linear-gradient(90deg, #D3A524, #B4881B);
  box-shadow: 0 14px 34px -16px rgba(211, 165, 36, .8);
}
.bn-btn-amber { border: 0; color: #3b2400 !important; font-weight: 800; background: linear-gradient(90deg, #D3A524, #D3A524); }
.bn-btn-purple:hover, .bn-btn-orange:hover, .bn-btn-cyan:hover, .bn-btn-amber:hover { filter: brightness(1.07); }

.bn-pill {
  display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
  padding: 6px 12px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  background: rgba(16, 137, 177, .14); border: 1px solid rgba(16, 137, 177, .3); color: #1089B1;
}
html[data-theme="dark"] .bn-pill { color: var(--bn-green); }
.bn-pill.is-out { background: rgba(148, 163, 184, .14); border-color: rgba(148, 163, 184, .3); color: var(--bn-ink3); }

.bn-clock { text-align: center; }
.bn-clock b { display: block; font-size: 29px; font-weight: 800; letter-spacing: 1px; line-height: 1; }
.bn-clock span { display: block; font-size: 11px; color: var(--bn-ink3); margin-top: 5px; }

.bn-bar { height: 7px; border-radius: 999px; background: var(--bn-tile2); overflow: hidden; }
.bn-bar i { display: block; height: 100%; border-radius: 999px; background: var(--bn-grad); }

.bn-row { display: flex; align-items: center; gap: 11px; padding: 9px 5px; border-radius: var(--bn-r-md); }
.bn-row:hover { background: var(--bn-tile2); }
.bn-row-main { flex: 1; min-width: 0; }
.bn-row-title { font-size: 12.8px; font-weight: 600; line-height: 1.7; color: var(--bn-ink); }
.bn-row-sub { font-size: 10.5px; color: var(--bn-ink3); margin-top: 2px; }
.bn-row.is-done .bn-row-title { text-decoration: line-through; opacity: .45; }

.bn-check {
  width: 22px; height: 22px; flex-shrink: 0; border-radius: 7px; cursor: pointer; padding: 0;
  border: 1.8px solid var(--bn-line2) !important; background: transparent !important; color: #fff;
  display: grid; place-items: center;
}
.bn-check[data-done="1"] { background: #1089B1 !important; border-color: #1089B1 !important; }
.bn-check svg { opacity: 0; }
.bn-check[data-done="1"] svg { opacity: 1; }

.bn-tag {
  font-size: 10.5px; font-weight: 700; padding: 4px 9px; border-radius: 999px; white-space: nowrap;
  background: rgba(60, 1, 175, .16); color: #3C01AF;
}
.bn-tag.is-late { background: rgba(239, 68, 68, .16); color: #EF4444; }
.bn-tag.is-soon { background: rgba(211, 165, 36, .18); color: #8A6A10; }
.bn-tag.is-week { background: rgba(16, 137, 177, .16); color: #1089B1; }
html[data-theme="dark"] .bn-tag { color: #8EE0FB; }
html[data-theme="dark"] .bn-tag.is-late { color: #EF4444; }
html[data-theme="dark"] .bn-tag.is-soon { color: var(--bn-amber); }
html[data-theme="dark"] .bn-tag.is-week { color: var(--bn-green); }

.bn-date-chip {
  width: 42px; flex-shrink: 0; text-align: center; border-radius: 11px; padding: 6px 0;
  background: var(--bn-tile2); border: 1px solid var(--bn-line);
}
.bn-date-chip b { display: block; font-size: 14px; line-height: 1.2; }
.bn-date-chip span { font-size: 9.5px; color: var(--bn-ink3); }

.bn-ring {
  width: 74px; height: 74px; border-radius: 50%; align-self: center; display: grid; place-items: center;
  background: conic-gradient(var(--bn-purple) 0turn var(--bn-turn, .62turn), var(--bn-tile2) var(--bn-turn, .62turn) 1turn);
}
.bn-ring span {
  width: 56px; height: 56px; border-radius: 50%; background: var(--bn-bg);
  display: grid; place-items: center; font-size: 14px; font-weight: 800;
}
.bn-dashed {
  border: 1px dashed var(--bn-line2); border-radius: var(--bn-r-md); padding: 16px;
  font-size: 12px; color: var(--bn-ink2); line-height: 2.1; text-align: center;
}
.bn-inner {
  border: 1px solid var(--bn-line); border-radius: var(--bn-r-md); padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.bn-empty { padding: 20px 8px; text-align: center; color: var(--bn-ink3); font-size: 12.5px; }
.bn-stack-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--bn-gap); }
@media (max-width: 520px) { .bn-stack-2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------------- ۵) نوار جستجو (نامه‌ها، وظایف) ---------------- */
.ux-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: var(--bn-gap); }
.ux-search {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px;
  background: var(--bn-tile2); border: 1px solid var(--bn-line);
  min-width: 240px; flex: 1; max-width: 420px; color: var(--bn-ink2);
}
.ux-search input {
  flex: 1; min-width: 0; border: 0 !important; outline: 0; background: transparent !important;
  color: var(--bn-ink); font-size: 12.5px; padding: 0; box-shadow: none !important;
}
.ux-count { font-size: 11.5px; font-weight: 700; color: var(--bn-ink3); }
.ux-chip {
  cursor: pointer; font-size: 11.5px; font-weight: 700; padding: 8px 14px; border-radius: 999px;
  background: var(--bn-tile2); border: 1px solid var(--bn-line); color: var(--bn-ink2);
  margin-inline-start: auto;
}
.ux-chip:hover { color: var(--bn-ink); border-color: var(--bn-line2); }
.ux-chip.is-on { background: var(--bn-grad); color: #fff; border-color: transparent; }

.letter-lanes .card { overflow: hidden; }
.letter-lanes .card-head { position: sticky; top: 0; z-index: 2; background: var(--bn-tile-flat); }
.letter-lanes .ledger { max-height: 62vh; overflow: auto; }
.letter-lanes .ledger-row { padding: 12px 14px; }
.letter-lanes.ux-is-dense .ledger-row { padding: 9px 12px; gap: 8px; }
.letter-lanes.ux-is-dense .ledger-row .muted:not(.mono) { display: none; }
.letter-lanes.ux-is-dense .ledger-title { font-size: 12.5px; }

/* برد وظایف */
.board { align-items: start; gap: var(--bn-gap) !important; }
.board-col { padding: 0 !important; overflow: hidden; }
.board-col-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px !important;
  border-bottom: 1px solid var(--bn-line) !important; background: transparent !important;
}
.board-col-head h4 { margin: 0; font-size: 13.5px !important; color: var(--bn-ink) !important; }
.board-count {
  margin-inline-start: auto; background: var(--bn-tile2) !important; border: 1px solid var(--bn-line) !important;
  color: var(--bn-ink2) !important; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 2px 9px;
}
.board-col-body { padding: 12px !important; display: flex; flex-direction: column; gap: 10px; background: transparent !important; }
.board-col-body .card, .task-card {
  background: var(--bn-tile2) !important; box-shadow: none !important;
  border-radius: var(--bn-r-md) !important; padding: 13px !important;
}
.board-col-body .card:hover, .task-card:hover { border-color: var(--bn-line2) !important; }
@media (max-width: 860px) { }

.ch-dialog { position: fixed; inset: 0; z-index: 90; background: rgba(4, 6, 22, .66); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; }
.ch-dialog-box {
  width: min(560px, 100%); max-height: 88vh; overflow: auto;
  background: var(--bn-tile); border: 1px solid var(--bn-line2); border-radius: 26px;
  box-shadow: var(--bn-sh-pop); padding: 22px; display: flex; flex-direction: column; gap: 14px; color: var(--bn-ink);
}
.ch-users { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow: auto; padding: 4px 0; }
.ch-users-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ch-users-head .bn-row-sub { flex: 1; min-width: 140px; margin: 0; }
.ch-pick {
  display: flex; align-items: center; gap: 10px; width: 100%; cursor: pointer; text-align: start;
  padding: 8px 11px; border-radius: var(--bn-r-md);
  background: var(--bn-tile2) !important; border: 1px solid var(--bn-line) !important; color: var(--bn-ink2);
}
.ch-pick:hover { border-color: var(--bn-line2) !important; color: var(--bn-ink); }
.ch-pick.is-on {
  background: rgba(60, 1, 175, .18) !important; border-color: rgba(60, 1, 175, .45) !important; color: var(--bn-ink);
}
.ch-pick-name { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; }
.ch-pick-role { font-size: 10px; color: var(--bn-ink3); }
.ch-pick-tick { width: 18px; text-align: center; font-size: 12px; opacity: 0; color: var(--bn-purple); }
.ch-mem {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 8px 11px; border-radius: var(--bn-r-md);
  background: var(--bn-tile2); border: 1px solid var(--bn-line); color: var(--bn-ink2);
}
.ch-mem:hover { border-color: var(--bn-line2); color: var(--bn-ink); }
.ch-mem.is-on { background: rgba(60, 1, 175, .16); border-color: rgba(60, 1, 175, .42); color: var(--bn-ink); }
.ch-mem input[type="checkbox"] { width: 17px; height: 17px; flex-shrink: 0; margin: 0; }
.ch-pick.is-on .ch-pick-tick { opacity: 1; }
html[data-theme="dark"] .ch-pick.is-on .ch-pick-tick { color: #8EE0FB; }

/* فیلدهای پنجره‌ها هرگز سفید نشوند */
html[data-theme="dark"] .ch-dialog-box input,
html[data-theme="dark"] .ch-dialog-box textarea,
html[data-theme="dark"] .ch-dialog-box select,
html[data-theme="dark"] .nw-field input,
html[data-theme="dark"] .nw-field textarea,
html[data-theme="dark"] .nw-field select,
html[data-theme="dark"] .modal input,
html[data-theme="dark"] .modal textarea,
html[data-theme="dark"] .modal select {
  background: #141a43 !important;
  border: 1px solid var(--bn-line2) !important;
  color: var(--bn-ink) !important;
  -webkit-text-fill-color: var(--bn-ink) !important;
}
html[data-theme="dark"] .ch-dialog-box input::placeholder,
html[data-theme="dark"] .nw-field input::placeholder,
html[data-theme="dark"] .nw-field textarea::placeholder { color: var(--bn-ink3) !important; }
.ch-x {
  margin-inline-start: auto; cursor: pointer; width: 30px; height: 30px; border-radius: var(--bn-r-sm);
  background: var(--bn-tile2); border: 1px solid var(--bn-line); color: var(--bn-ink2);
  display: grid; place-items: center; font-size: 13px; line-height: 1;
}
.ch-x:hover { color: var(--bn-ink); border-color: var(--bn-line2); }
.ch-member-list { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow: auto; }
.ch-member { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--bn-r-md); border: 1px solid var(--bn-line); }
.ch-member span.bn-row-sub { display: block; }

/* ابزارهای نوار پیام */
.ch-media {
  display: block; width: 100%; max-width: 340px; margin: 8px 0 2px;
  border-radius: var(--bn-r-md); background: #000;
}
audio.ch-media { background: transparent; }

/* ---------- گفتگوی عمومی موجود — بازطراحی خوانا ---------- */
.chat-log, .chat-msg { color: var(--bn-ink); }

/* هر پیام: آواتار + بدنه، با فاصلهٔ نفس‌گیر */
.chat-msg { gap: 10px !important; margin-bottom: 14px !important; align-items: flex-start; }
.chat-avatar {
  width: 34px !important; height: 34px !important; border-radius: 50% !important;
  font-size: 13px !important; flex-shrink: 0;
}
.chat-msg-body { max-width: min(680px, 78%); }
.chat-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.chat-time, .chat-edited { font-size: 10.5px !important; color: var(--bn-ink3) !important; }

/* حباب پیام — اندازهٔ درست، بدون کشیدگی بی‌مورد */
.chat-bubble {
  display: inline-block; width: auto !important; max-width: 100%;
  padding: 11px 14px !important;
  border-radius: 16px 16px 16px 6px !important;
  background: var(--bn-tile2) !important;
  border: 1px solid var(--bn-line) !important;
  color: var(--bn-ink) !important;
  font-size: 13px !important; line-height: 2 !important;
  white-space: pre-wrap; word-break: break-word;
}
.chat-msg.is-mine .chat-bubble,
.chat-msg.mine .chat-bubble,
.chat-msg.own .chat-bubble {
  border-radius: 16px 16px 6px 16px !important;
  background: rgba(60, 1, 175, .2) !important;
  border-color: rgba(60, 1, 175, .42) !important;
}
html[data-theme="dark"] .chat-bubble { background: #1b2150 !important; border-color: var(--bn-line2) !important; }
html[data-theme="dark"] .chat-msg.is-mine .chat-bubble,
html[data-theme="dark"] .chat-msg.mine .chat-bubble,
html[data-theme="dark"] .chat-msg.own .chat-bubble { background: #2b2374 !important; border-color: rgba(60, 1, 175, .55) !important; }

/* نقل‌قول ریپلای — خوانا، با نوار رنگی و متن روشن */
.chat-quote {
  display: flex; flex-direction: column; gap: 3px; cursor: pointer;
  margin-bottom: 7px; padding: 8px 11px;
  border-radius: 12px;
  border: 1px solid var(--bn-line) !important;
  border-inline-start: 3px solid var(--bn-purple) !important;
  background: var(--bn-tile3) !important;
  opacity: 1 !important;
}
.chat-quote:hover { border-color: var(--bn-line2) !important; }
.chat-quote-name {
  font-size: 11px !important; font-weight: 700;
  color: var(--bn-purple) !important; opacity: 1 !important;
}
.chat-quote-text {
  font-size: 11.5px !important; line-height: 1.9;
  color: var(--bn-ink2) !important; opacity: 1 !important;
  display: block; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
html[data-theme="dark"] .chat-quote { background: rgba(255, 255, 255, .07) !important; }
html[data-theme="dark"] .chat-quote-name { color: #49CFF8 !important; }
html[data-theme="dark"] .chat-quote-text { color: #dfe3ff !important; }

/* ابزارهای هر پیام — کوچک و کم‌ادعا، فقط با هوور */
.chat-tools { display: flex; gap: 5px; opacity: 0; transition: opacity .15s ease; }
.chat-msg:hover .chat-tools, .chat-tools:focus-within { opacity: 1; }
.chat-tools button {
  width: 28px; height: 28px; padding: 0 !important; border-radius: 9px !important;
  background: var(--bn-tile2) !important; border: 1px solid var(--bn-line) !important;
  color: var(--bn-ink2) !important; font-size: 12px;
}
.chat-tools button:hover { color: var(--bn-ink) !important; border-color: var(--bn-line2) !important; }
.chat-reactions { display: flex; gap: 5px; margin-top: 6px; }
.chat-reactions button, .chat-like {
  border-radius: 999px !important; padding: 3px 9px !important; font-size: 11px !important;
  background: var(--bn-tile2) !important; border: 1px solid var(--bn-line) !important; color: var(--bn-ink2) !important;
}
.chat-like.is-on { background: rgba(211, 165, 36, .18) !important; border-color: rgba(211, 165, 36, .4) !important; color: #8A6A10 !important; }
html[data-theme="dark"] .chat-like.is-on { color: var(--bn-amber) !important; }

/* جداکنندهٔ روز */
.chat-day { display: flex; justify-content: center; margin: 16px 0 12px; }
.chat-day span {
  font-size: 10.5px; font-weight: 700; padding: 4px 12px; border-radius: 999px;
  background: var(--bn-tile2); border: 1px solid var(--bn-line); color: var(--bn-ink3);
}

/* نوار حضور بالای گفتگو */
html[data-theme="dark"] .presence-bar,
html[data-theme="dark"] .online-bar,
html[data-theme="dark"] .chat-online {
  background: var(--bn-tile2) !important; border-color: var(--bn-line) !important; color: var(--bn-ink) !important;
}

/* پیام صوتی */
.chat-voice, .voice-bubble {
  background: var(--bn-tile2) !important; border: 1px solid var(--bn-line) !important;
  border-radius: 16px !important; color: var(--bn-ink) !important;
}

/* متن تایپ‌شده در همهٔ فیلدها و صفحهٔ ورود */
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] [contenteditable="true"] {
  color: var(--bn-ink) !important; -webkit-text-fill-color: var(--bn-ink) !important;
  caret-color: var(--bn-purple);
}
html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] input:-webkit-autofill:hover,
html[data-theme="dark"] input:-webkit-autofill:focus,
html[data-theme="dark"] textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--bn-ink) !important;
  -webkit-box-shadow: 0 0 0 1000px #1a2050 inset !important;
  caret-color: var(--bn-ink) !important;
}
html:not([data-theme="dark"]) input,
html:not([data-theme="dark"]) textarea,
html:not([data-theme="dark"]) select {
  color: var(--bn-ink) !important; -webkit-text-fill-color: var(--bn-ink) !important;
}
html:not([data-theme="dark"]) input:-webkit-autofill {
  -webkit-text-fill-color: #101433 !important;
  -webkit-box-shadow: 0 0 0 1000px #ffffff inset !important;
}

/* ---------------- ۷) اخبار و اطلاعیه‌ها ---------------- */
.nw-urgent {
  display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-radius: var(--bn-r-lg);
  background: linear-gradient(90deg, #EF4444, #C42A2A); color: #fff;
  box-shadow: 0 20px 44px -24px rgba(239, 68, 68, .9); text-decoration: none;
}
.nw-urgent:hover { color: #fff; filter: brightness(1.05); }
.nw-urgent b { font-size: 13.5px; flex: 1; min-width: 0; }
.nw-urgent .nw-urgent-badge { font-size: 10.5px; font-weight: 800; padding: 5px 11px; border-radius: 999px; background: rgba(255, 255, 255, .2); white-space: nowrap; }
.nw-urgent .nw-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: bnPulse 1.4s infinite; }

.nw-filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.nw-chip {
  cursor: pointer; font-size: 11.5px; font-weight: 700; padding: 8px 14px; border-radius: 999px;
  background: var(--bn-tile2); border: 1px solid var(--bn-line); color: var(--bn-ink2);
  display: inline-flex; align-items: center; gap: 6px;
}
.nw-chip:hover { color: var(--bn-ink); border-color: var(--bn-line2); }
.nw-chip.is-on { background: var(--bn-grad); color: #fff; border-color: transparent; }

.nw-search {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px;
  background: var(--bn-tile2); border: 1px solid var(--bn-line); min-width: 220px;
}
.nw-search input { flex: 1; min-width: 0; border: 0 !important; outline: 0; background: transparent !important; padding: 0; box-shadow: none !important; }

.nw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--bn-gap); }
.nw-card {
  background: var(--bn-tile); border: 1px solid var(--bn-line); border-radius: var(--bn-r-lg); padding: var(--bn-pad);
  box-shadow: var(--bn-sh); display: flex; flex-direction: column; gap: 12px;
  animation: bnRise .45s cubic-bezier(.22, 1, .36, 1) both;
  transition: transform .16s ease, border-color .16s ease;
}
.nw-card:hover { transform: translateY(-2px); border-color: var(--bn-line2); }
.nw-plate { height: 104px; border-radius: var(--bn-r-md); display: grid; place-items: center; font-size: 34px; background: var(--bn-grad); }
.nw-plate.cat-hr { background: var(--bn-grad); }
.nw-plate.cat-it { background: var(--bn-grad-cyan); }
.nw-plate.cat-circular { background: linear-gradient(140deg, #EF4444, #C42A2A); }
.nw-plate.cat-event { background: linear-gradient(140deg, #D3A524, #D3A524); }
.nw-plate.cat-win { background: linear-gradient(140deg, #1089B1, #1089B1); }

.nw-cat { font-size: 9.5px; font-weight: 700; padding: 4px 9px; border-radius: 999px; background: rgba(60, 1, 175, .16); color: #3C01AF; }
html[data-theme="dark"] .nw-cat { color: #49CFF8; }
.nw-cat.cat-it { background: rgba(73, 207, 248, .16); color: #1089B1; }
.nw-cat.cat-circular { background: rgba(239, 68, 68, .16); color: #EF4444; }
.nw-cat.cat-event { background: rgba(211, 165, 36, .18); color: #8A6A10; }
.nw-cat.cat-win { background: rgba(16, 137, 177, .16); color: #1089B1; }
.nw-cat.is-pinned { background: rgba(211, 165, 36, .18); color: #8A6A10; }
html[data-theme="dark"] .nw-cat.cat-it { color: var(--bn-cyan); }
html[data-theme="dark"] .nw-cat.cat-circular { color: #EF4444; }
html[data-theme="dark"] .nw-cat.cat-event,
html[data-theme="dark"] .nw-cat.is-pinned { color: var(--bn-amber); }
html[data-theme="dark"] .nw-cat.cat-win { color: var(--bn-green); }

.nw-unread { margin-inline-start: auto; display: flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 700; color: #1089B1; }
html[data-theme="dark"] .nw-unread { color: var(--bn-cyan); }
.nw-unread i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: block; }

.nw-card-title { color: var(--bn-ink); font-size: 14.5px; font-weight: 700; line-height: 1.8; }
.nw-card-title:hover { color: var(--bn-purple); }
.nw-card p { margin: 0; font-size: 12px; color: var(--bn-ink2); line-height: 2; }
.nw-card-meta { font-size: 10.5px; color: var(--bn-ink3); }

.nw-file {
  display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: var(--bn-r-sm);
  background: var(--bn-tile2); border: 1px solid var(--bn-line); font-size: 11px; color: var(--bn-ink2);
}
.nw-file:hover { color: var(--bn-ink); }

.nw-actions { display: flex; align-items: center; gap: 6px; padding-top: 11px; border-top: 1px solid var(--bn-line); }
.nw-act {
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: var(--bn-r-sm);
  border: 1px solid var(--bn-line); background: var(--bn-tile2); color: var(--bn-ink2); font-size: 11px; font-weight: 700;
}
.nw-act:hover { color: var(--bn-ink); border-color: var(--bn-line2); }
.nw-act.is-liked { background: rgba(211, 165, 36, .18); color: #8A6A10; }
.nw-act.is-saved { background: rgba(60, 1, 175, .2); color: #3C01AF; }
html[data-theme="dark"] .nw-act.is-liked { color: var(--bn-amber); }
html[data-theme="dark"] .nw-act.is-saved { color: #49CFF8; }
.nw-act-icon { width: 32px; height: 32px; padding: 0; justify-content: center; }
.nw-views { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--bn-ink3); margin-inline-start: auto; }

.nw-article { max-width: 820px; display: flex; flex-direction: column; gap: var(--bn-gap); }
.nw-hero { height: 200px; border-radius: 24px; display: grid; place-items: center; font-size: 64px; box-shadow: var(--bn-sh); overflow: hidden; }
.nw-hero img { width: 100%; height: 100%; object-fit: cover; }
.nw-article h2 { margin: 0; font-size: 25px; font-weight: 800; line-height: 1.7; text-wrap: pretty; }
.nw-article .nw-body p { margin: 0 0 14px; font-size: 14px; color: var(--bn-ink2); line-height: 2.3; text-wrap: pretty; }
.nw-article-bar { display: flex; align-items: center; gap: 9px; padding: 14px 0; border-top: 1px solid var(--bn-line); border-bottom: 1px solid var(--bn-line); }

.nw-comment { display: flex; gap: 11px; padding: 14px; border-radius: var(--bn-r-md); background: var(--bn-tile); border: 1px solid var(--bn-line); }
.nw-comment-av { width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; overflow: hidden; }
.nw-comment-av img { width: 100%; height: 100%; object-fit: cover; }
.nw-comment-body { flex: 1; min-width: 0; }
.nw-comment-body .nw-comment-head { display: flex; align-items: center; gap: 8px; }
.nw-comment-body b { font-size: 12.5px; }
.nw-comment-text { font-size: 12.5px; color: var(--bn-ink2); line-height: 2.1; margin-top: 5px; }
.nw-comment-form { display: flex; gap: 10px; align-items: flex-end; }
.nw-comment-form textarea { flex: 1; min-width: 0; resize: vertical; line-height: 2; }

.nw-form { display: flex; flex-direction: column; gap: var(--bn-gap); max-width: 760px; }
.nw-field { display: flex; flex-direction: column; gap: 7px; font-size: 11.5px; font-weight: 700; color: var(--bn-ink2); }
.nw-field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.nw-field-row > .nw-field { flex: 1; min-width: 180px; }
.nw-drop { border: 1px dashed var(--bn-line2); border-radius: var(--bn-r-md); padding: 22px; text-align: center; color: var(--bn-ink3); font-size: 12px; line-height: 2; cursor: pointer; }
.nw-drop:hover { border-color: var(--bn-purple); color: var(--bn-ink2); }

/* ---------------- ۸) هشدار پایان نشست ---------------- */
.idle-warn {
  position: fixed; inset-block-end: 20px; inset-inline-start: 50%; transform: translateX(-50%);
  z-index: 120; display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; border-radius: var(--bn-r-lg);
  background: var(--bn-tile-flat); border: 1px solid rgba(239, 68, 68, .4);
  box-shadow: var(--bn-sh-pop); color: var(--bn-ink);
  animation: bnRise .3s cubic-bezier(.22, 1, .36, 1) both;
  max-width: calc(100vw - 32px);
}
.idle-warn b { font-size: 13px; white-space: nowrap; }
.idle-warn .idle-count { font-size: 12px; color: var(--bn-ink2); }
.idle-warn .idle-stay { padding: 9px 15px; font-size: 12px; }

/* اعلان صفحهٔ ورود */
.auth-note {
  display: flex; align-items: center; gap: 9px; padding: 12px 15px; border-radius: var(--bn-r-md);
  background: rgba(211, 165, 36, .14); border: 1px solid rgba(211, 165, 36, .34);
  color: #8A6A10; font-size: 12.5px; line-height: 1.9;
}
html[data-theme="dark"] .auth-note { color: #D3A524; }


/* ============================================================
   صفحهٔ ورود — کارت و فیلدها همیشه خوانا
   (این صفحه پوستهٔ app-shell ندارد، پس مستقل تنظیم می‌شود)
   ============================================================ */
.auth-shell, .auth-card, .login-card, .auth-box, .auth-panel {
  background: #141a43 !important;
  border: 1px solid rgba(255, 255, 255, .12) !important;
  border-radius: 26px !important;
  color: #f2f4ff !important;
  box-shadow: 0 50px 90px -45px rgba(0, 0, 0, .85) !important;
}
.auth-shell h1, .auth-card h1, .login-card h1,
.auth-shell h2, .auth-card h2 { color: #f2f4ff !important; }
.auth-shell p, .auth-card p, .login-card p,
.auth-shell .muted, .auth-card .muted { color: #b9bfe6 !important; }
.auth-shell label, .auth-card label, .login-card label,
.auth-shell .field label { color: #b9bfe6 !important; font-size: 12px; font-weight: 700; }

/* فیلدهای ایمیل و رمز — زمینهٔ روشن‌تر، متن سفید، مکان‌نمای بنفش */
.auth-shell input, .auth-card input, .login-card input,
.auth-box input, .auth-panel input,
form[action*="login"] input, form[action*="register"] input,
form[action*="password"] input {
  background: #1e2559 !important;
  border: 1px solid rgba(255, 255, 255, .18) !important;
  border-radius: 15px !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  caret-color: #49CFF8 !important;
  font-size: 14px !important;
  padding: 13px 15px !important;
  letter-spacing: .2px;
}
.auth-shell input::placeholder, .auth-card input::placeholder,
.login-card input::placeholder, form[action*="login"] input::placeholder {
  color: #8a90bf !important; -webkit-text-fill-color: #8a90bf !important;
}
.auth-shell input:focus, .auth-card input:focus,
.login-card input:focus, form[action*="login"] input:focus {
  outline: 0 !important;
  border-color: #3C01AF !important;
  box-shadow: 0 0 0 3px rgba(60, 1, 175, .3) !important;
  background: #232a63 !important;
}
/* پرکردن خودکار مرورگر هم سفید بماند */
.auth-shell input:-webkit-autofill,
.auth-card input:-webkit-autofill,
.login-card input:-webkit-autofill,
form[action*="login"] input:-webkit-autofill,
form[action*="login"] input:-webkit-autofill:hover,
form[action*="login"] input:-webkit-autofill:focus {
  -webkit-text-fill-color: #ffffff !important;
  -webkit-box-shadow: 0 0 0 1000px #1e2559 inset !important;
  caret-color: #ffffff !important;
}
/* رمز عبور: نقطه‌ها پررنگ و خوانا */
.auth-shell input[type="password"], .auth-card input[type="password"],
.login-card input[type="password"], form[action*="login"] input[type="password"] {
  letter-spacing: 3px; font-size: 15px !important;
}
/* دکمهٔ ورود و لینک‌ها */
.auth-shell button[type="submit"], .auth-card button[type="submit"],
.login-card button[type="submit"], form[action*="login"] button[type="submit"] {
  background: linear-gradient(90deg, #3C01AF, #3C01AF) !important;
  border: 0 !important; color: #fff !important; font-weight: 800 !important;
  border-radius: 15px !important; padding: 14px !important; font-size: 14px !important;
  box-shadow: 0 16px 34px -18px rgba(60, 1, 175, .95) !important;
}
.auth-shell a, .auth-card a, .login-card a { color: #49CFF8 !important; font-weight: 700; }
.auth-shell a:hover, .auth-card a:hover, .login-card a:hover { color: #8EE0FB !important; }


/* ---------- کانال‌ها: پیام وضعیت و رادیوها ---------- */
.ch-flash {
  margin-bottom: 14px; padding: 12px 16px; border-radius: var(--bn-r-md);
  background: rgba(16, 137, 177, .14); border: 1px solid rgba(16, 137, 177, .34);
  color: #1089B1; font-size: 12.5px; font-weight: 700;
}
html[data-theme="dark"] .ch-flash { color: #49CFF8; }
.ch-flash.is-err {
  background: rgba(239, 68, 68, .14); border-color: rgba(239, 68, 68, .34); color: #EF4444;
}
html[data-theme="dark"] .ch-flash.is-err { color: #FCA5A5; }

.ch-radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ch-radio {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 9px 14px; border-radius: 999px;
  background: var(--bn-tile2); border: 1px solid var(--bn-line); color: var(--bn-ink2);
  font-size: 11.5px; font-weight: 700;
}
.ch-radio:hover { color: var(--bn-ink); border-color: var(--bn-line2); }
.ch-radio input { width: 15px; height: 15px; margin: 0; }
.ch-radio:has(input:checked) {
  background: rgba(60, 1, 175, .18); border-color: rgba(60, 1, 175, .45); color: var(--bn-ink);
}
.ch-users { max-height: 260px; }
.ch-edited { font-size: 9.5px; color: var(--bn-ink3); font-style: italic; }

/* نقل‌قول پاسخ داخل حباب */
.ch-quote {
  display: flex; flex-direction: column; gap: 2px; text-decoration: none;
  margin: 2px 0 8px; padding: 7px 10px; border-radius: 11px;
  background: var(--bn-tile3); border: 1px solid var(--bn-line);
  border-inline-start: 3px solid var(--bn-purple);
}
.ch-quote:hover { border-color: var(--bn-line2); }
.ch-quote-name { font-size: 10.5px; font-weight: 700; color: var(--bn-purple); }
html[data-theme="dark"] .ch-quote-name { color: #49CFF8; }
.ch-quote-text {
  font-size: 11px; line-height: 1.8; color: var(--bn-ink2);
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}

/* فرم ویرایش درون حباب */
.ch-edit-form { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.ch-edit-form textarea {
  width: 100%; resize: vertical; min-height: 62px; line-height: 2; font-size: 12.5px;
}
.ch-edit-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* بخش‌های مدیریتی زیر گفتگو */
.ch-admin-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: var(--bn-gap); margin-top: var(--bn-gap); align-items: start;
}
.ch-admin-grid .ch-users { max-height: 300px; }
.ch-admin-grid input[type="search"] { width: 100%; }


/* ============================================================
   کارنامهٔ حضور
   ============================================================ */
.at-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--bn-gap); }
.at-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px var(--bn-pad); border-bottom: 1px solid var(--bn-line);
}
.at-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.at-filters select { min-width: 150px; }
.at-toolbar .ux-count { margin-inline-start: auto; }

.at-table-wrap { overflow-x: auto; }
.at-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.at-table th {
  text-align: start; padding: 11px 14px; font-size: 11.5px; font-weight: 700;
  background: var(--bn-tile2) !important; color: var(--bn-ink) !important;
  border-bottom: 1px solid var(--bn-line) !important; white-space: nowrap;
}
.at-table td {
  padding: 11px 14px; border-bottom: 1px solid var(--bn-line) !important;
  color: var(--bn-ink2); vertical-align: middle;
}
.at-table tr:hover td { background: var(--bn-tile2); }
.at-mono { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--bn-ink) !important; }
.at-person { display: inline-flex; align-items: center; gap: 8px; }
.at-person b { font-size: 12.5px; color: var(--bn-ink); }
.at-live {
  font-size: 9.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  background: rgba(16, 137, 177, .16); color: #1089B1; margin-inline-start: 4px;
}
html[data-theme="dark"] .at-live { color: var(--bn-green); }
.at-badge {
  display: inline-block; font-size: 10.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--bn-tile3); border: 1px solid var(--bn-line); color: var(--bn-ink2);
}
.at-badge.is-pending  { background: rgba(211, 165, 36, .16); border-color: rgba(211, 165, 36, .34); color: #8A6A10; }
.at-badge.is-approved { background: rgba(16, 137, 177, .16); border-color: rgba(16, 137, 177, .34); color: #1089B1; }
.at-badge.is-rejected { background: rgba(239, 68, 68, .16); border-color: rgba(239, 68, 68, .34); color: #EF4444; }
html[data-theme="dark"] .at-badge.is-pending  { color: var(--bn-amber); }
html[data-theme="dark"] .at-badge.is-approved { color: #49CFF8; }
html[data-theme="dark"] .at-badge.is-rejected { color: #FCA5A5; }
.at-acts { display: flex; gap: 6px; }
.at-acts form { display: inline; }


/* ---------- ورود و خروج دفتر کار ---------- */
.of-top {
  display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: var(--bn-gap); align-items: start;
}
@media (max-width: 900px) { .of-top { grid-template-columns: minmax(0, 1fr); } }
.of-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--bn-gap); }
.of-top > .bn-tile:first-child { position: sticky; top: 14px; }
@media (max-width: 900px) { .of-top > .bn-tile:first-child { position: static; } }
.board-col, .task-card, .board-col-body .card {
  border-radius: var(--bn-r-lg) !important;
}
.bn-btn, .btn { border-radius: var(--bn-r-md) !important; min-height: 44px; }
.bn-btn-purple, .btn-primary {
  background: var(--hfs-indigo) !important; border: 0 !important; color: #fff !important;
  box-shadow: none !important;
}
.bn-btn-purple:hover, .btn-primary:hover { filter: brightness(1.16); }
.bn-btn-purple:active, .btn-primary:active { filter: brightness(.94); }
.bn-btn-cyan { background: var(--hfs-cyan) !important; color: var(--bn-ink) !important; border: 0 !important; }
.bn-btn-orange, .bn-btn-amber {
  background: var(--hfs-gold) !important; color: var(--bn-ink) !important; border: 0 !important;
  box-shadow: none !important;
}
.bn-btn-orange:hover, .bn-btn-amber:hover, .bn-btn-cyan:hover { filter: brightness(1.06); }

/* فرم‌ها */
input, textarea, select, .input {
  border-radius: var(--bn-r-md) !important;
  min-height: 44px;
  font-size: 15px !important;
}
textarea { min-height: 92px; }
input:focus, textarea:focus, select:focus, .input:focus {
  border-color: var(--hfs-indigo) !important; box-shadow: var(--bn-focus) !important;
}

/* تیترهای کارت با مقیاس H3 و متن با ۱۶/۱٫۷۵ */
.bn-tile-head h3, .card-head h3, .card-head h4 {
  font-size: 17px !important; line-height: 1.4; font-weight: 700; color: var(--bn-ink) !important;
}
.bn-row-title, .ledger-title, .nw-card-title { color: var(--bn-ink) !important; }
.bn-row-sub, .bn-sub, .nw-card-meta, .muted { color: var(--bn-ink3) !important; }

/* بنر خبر فوری: قرمز semantic */
.nw-urgent { background: #EF4444 !important; box-shadow: none !important; }

/* پروگرس‌بارها */
.bn-bar i { background: var(--bn-grad) !important; }
.bn-ring { background: conic-gradient(var(--hfs-indigo) 0turn var(--bn-turn, .62turn), var(--bn-tile2) var(--bn-turn, .62turn) 1turn) !important; }

/* صفحهٔ ورود روی زمینهٔ روشن HFS */
html:not([data-theme="dark"]) .auth-shell,
html:not([data-theme="dark"]) .auth-card,
html:not([data-theme="dark"]) .login-card {
  background: #FFFFFF !important; border: 1px solid var(--bn-line) !important;
  border-radius: var(--bn-r-lg) !important; color: var(--bn-ink) !important;
  box-shadow: var(--bn-sh-pop) !important;
}
html:not([data-theme="dark"]) .auth-shell input,
html:not([data-theme="dark"]) .auth-card input,
html:not([data-theme="dark"]) .login-card input,
html:not([data-theme="dark"]) form[action*="login"] input {
  background: #F4F6FA !important; border: 1px solid var(--bn-line) !important;
  color: var(--bn-ink) !important; -webkit-text-fill-color: var(--bn-ink) !important;
  border-radius: var(--bn-r-md) !important; caret-color: var(--hfs-indigo) !important;
}
html:not([data-theme="dark"]) .auth-shell input:-webkit-autofill,
html:not([data-theme="dark"]) form[action*="login"] input:-webkit-autofill {
  -webkit-text-fill-color: var(--bn-ink) !important;
  -webkit-box-shadow: 0 0 0 1000px #F4F6FA inset !important;
}
html:not([data-theme="dark"]) .auth-shell label,
html:not([data-theme="dark"]) .login-card label { color: var(--bn-ink2) !important; }
.auth-shell button[type="submit"], .auth-card button[type="submit"],
.login-card button[type="submit"], form[action*="login"] button[type="submit"] {
  background: var(--hfs-indigo) !important; border: 0 !important; color: #fff !important;
  border-radius: var(--bn-r-md) !important; box-shadow: none !important; min-height: 48px;
}
.auth-shell a, .auth-card a, .login-card a { color: var(--hfs-indigo) !important; }


/* ---------- نام برند در صفحهٔ ورود: سفید و خوانا ---------- */
.auth-shell .brand-name, .auth-card .brand-name, .login-card .brand-name,
.auth-shell h1, .auth-card h1, .login-card h1,
.auth-brand, .auth-title {
  color: #FFFFFF !important;
  -webkit-text-fill-color: #FFFFFF !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
.auth-shell .muted, .auth-card .muted, .login-card .muted,
.auth-shell p, .auth-card p, .login-card p { color: rgba(255, 255, 255, .72) !important; }
.auth-shell label, .auth-card label, .login-card label { color: rgba(255, 255, 255, .82) !important; }
.auth-shell, .auth-card, .login-card {
  background: #16182E !important; border-color: rgba(255, 255, 255, .12) !important;
}
.auth-shell input, .auth-card input, .login-card input, form[action*="login"] input {
  background: #1F2140 !important; border-color: rgba(255, 255, 255, .16) !important;
  color: #FFFFFF !important; -webkit-text-fill-color: #FFFFFF !important;
}
.auth-shell input:-webkit-autofill, form[action*="login"] input:-webkit-autofill {
  -webkit-text-fill-color: #FFFFFF !important;
  -webkit-box-shadow: 0 0 0 1000px #1F2140 inset !important;
}
.auth-shell a, .auth-card a, .login-card a { color: #8EE0FB !important; }
.auth-shell a:hover, .login-card a:hover { color: #C7EEFF !important; }

/* ---------- پیام تصویری: پیام خطای گویا ---------- */
.vm-warn {
  display: flex; align-items: flex-start; gap: 9px; margin-bottom: 12px;
  padding: 12px 14px; border-radius: var(--bn-r-md);
  background: rgba(239, 68, 68, .1); border: 1px solid rgba(239, 68, 68, .3);
  color: #EF4444; font-size: 13px; line-height: 1.9;
}
.vm-warn b { color: inherit; }


/* ============================================================
   موبایل و تبلت — چیدمان، اندازه و هدف لمسی
   ============================================================ */

/* تبلت */
@media (min-width: 861px) and (max-width: 1180px) {
  :root { --bn-pad: 20px; --bn-gap: 18px; --hfs-section: 48px; --hfs-hero: 64px; }
  .bn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .of-top { grid-template-columns: minmax(0, 320px) minmax(0, 1fr) !important; }
}

/* موبایل */
@media (max-width: 860px) {
  :root { --bn-pad: 16px; --bn-gap: 14px; --hfs-grid-gap: 1.5rem; --hfs-section: 36px; --hfs-hero: 48px; }

  body { font-size: 15px; line-height: 1.8; }

  /* منوی کناری کنار می‌رود — نوار پایین جای آن است */
  .sidebar { display: none !important; }
  .app-shell { grid-template-columns: 1fr !important; display: block !important; }
  .main { width: 100% !important; }
  .content { padding: 16px 14px 92px !important; }

  /* نوار بالا: دو ردیف، بدون فشردگی */
  .topbar {
    flex-wrap: wrap !important; gap: 10px !important;
    padding: 14px 14px !important; position: sticky; top: 0; z-index: 40;
    background: var(--bn-bg) !important;
  }
  .topbar h1 { font-size: 19px !important; }
  .topbar-sub { font-size: 12px !important; }
  .topbar-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .topbar-actions .ux-search, .topbar-actions .nw-search { flex: 1 1 100%; max-width: none; }

  /* نوار پایین موبایل: هدف لمسی ۵۶px */
  .tabbar {
    display: flex !important; position: fixed; inset-inline: 0; bottom: 0; z-index: 60;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)) !important;
    border-top: 1px solid var(--bn-line) !important;
    box-shadow: 0 -8px 24px -18px rgba(19, 21, 44, .4);
  }
  .tabbar a { min-height: 56px; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 10.5px; }
  .tabbar a svg { width: 21px; height: 21px; }

  /* همهٔ شبکه‌ها تک‌ستونه */
  .bn-grid, .bn-stack-2, .nw-grid, .at-stats, .of-stats,
  .ch-admin-grid, .grid, .grid-2, .grid-3, .board, .letter-lanes {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .bn-col, .board, .letter-lanes { gap: var(--bn-gap) !important; }
  .bn-tile { gap: 12px !important; }
  .card-pad { padding: 16px !important; }
  .card-head { padding: 13px 16px !important; }
  .bn-tile-head h3, .card-head h3, .card-head h4 { font-size: 15.5px !important; }
  .bn-clock b { font-size: 24px !important; }
  .bn-check { min-height: 26px !important; width: 26px; height: 26px; }
  .bn-btn-grow { flex: 1 1 100%; min-width: 0; }
  .ch-dialog-box { border-radius: 14px !important; padding: 16px !important; max-height: 92vh; }
  .ch-users { max-height: 220px; }

  /* جدول‌های حضور: اسکرول افقی روان */
  .at-table-wrap { -webkit-overflow-scrolling: touch; }
  .at-table { font-size: 12px; min-width: 560px; }
  .at-table th, .at-table td { padding: 9px 11px; }
  .at-toolbar { padding: 12px 14px !important; }
  .at-filters select { min-width: 0; flex: 1 1 140px; }

  /* نامه‌ها: ستون‌ها زیر هم، بدون ارتفاع ثابت */
  .letter-lanes .ledger { max-height: none !important; }
  .letter-lanes .card-head { position: static !important; }

  /* اخبار */
  .nw-plate { height: 88px !important; }
  .nw-hero { height: 150px !important; font-size: 46px !important; }
  .nw-article h2 { font-size: 21px !important; }
  .nw-article .nw-body p { font-size: 15px !important; }
  .nw-actions { flex-wrap: wrap; gap: 8px; }
  .nw-views { margin-inline-start: 0 !important; }

  /* هشدار پایان نشست: تمام‌عرض پایین صفحه */
  .idle-warn {
    inset-inline: 12px; inset-block-end: calc(76px + env(safe-area-inset-bottom));
    transform: none; inset-inline-start: 12px; flex-wrap: wrap; gap: 10px;
  }

  /* صفحهٔ ورود */
  .auth-shell, .auth-card, .login-card { border-radius: 16px !important; padding: 22px !important; margin: 14px; }

  /* پنجره‌ها تمام‌عرض */
  .modal, .modal-box { border-radius: 16px !important; width: calc(100vw - 24px) !important; max-height: 90vh; overflow: auto; }
}

/* موبایل کوچک */
@media (max-width: 420px) {
  .content { padding: 12px 12px 92px !important; }
  .bn-tile, .card, .nw-card { padding: 14px !important; }
  .topbar h1 { font-size: 17.5px !important; }
  .bn-clock b { font-size: 21px !important; }
}

/* جلوگیری از زوم خودکار سافاری روی فیلدها */
@supports (-webkit-touch-callout: none) {
  input, textarea, select { font-size: 16px !important; }
}


/* ============================================================
   صفحهٔ ورود در تم روشن — کارت سفید، متن تیره و خوانا
   (قواعد پیشین که همیشه کارت را تیره می‌کردند اینجا نقض می‌شوند)
   ============================================================ */
html:not([data-theme="dark"]) .auth-shell,
html:not([data-theme="dark"]) .auth-card,
html:not([data-theme="dark"]) .login-card {
  background: #FFFFFF !important;
  border: 1px solid #E5E7EB !important;
  color: #13152C !important;
}
html:not([data-theme="dark"]) .auth-shell .brand-name,
html:not([data-theme="dark"]) .auth-card .brand-name,
html:not([data-theme="dark"]) .login-card .brand-name,
html:not([data-theme="dark"]) .auth-shell h1,
html:not([data-theme="dark"]) .auth-card h1,
html:not([data-theme="dark"]) .login-card h1,
html:not([data-theme="dark"]) .auth-brand,
html:not([data-theme="dark"]) .auth-title {
  color: #13152C !important;
  -webkit-text-fill-color: #13152C !important;
  text-shadow: none !important;
}
html:not([data-theme="dark"]) .auth-shell p,
html:not([data-theme="dark"]) .auth-card p,
html:not([data-theme="dark"]) .login-card p,
html:not([data-theme="dark"]) .auth-shell .muted,
html:not([data-theme="dark"]) .auth-card .muted,
html:not([data-theme="dark"]) .login-card .muted { color: #6B7280 !important; }

html:not([data-theme="dark"]) .auth-shell label,
html:not([data-theme="dark"]) .auth-card label,
html:not([data-theme="dark"]) .login-card label {
  color: #13152C !important; font-weight: 700;
}

html:not([data-theme="dark"]) .auth-shell input,
html:not([data-theme="dark"]) .auth-card input,
html:not([data-theme="dark"]) .login-card input,
html:not([data-theme="dark"]) form[action*="login"] input,
html:not([data-theme="dark"]) form[action*="register"] input,
html:not([data-theme="dark"]) form[action*="password"] input {
  background: #F4F6FA !important;
  border: 1px solid #E5E7EB !important;
  color: #13152C !important;
  -webkit-text-fill-color: #13152C !important;
  caret-color: #3C01AF !important;
}
html:not([data-theme="dark"]) .auth-shell input::placeholder,
html:not([data-theme="dark"]) form[action*="login"] input::placeholder {
  color: #9AA1AE !important; -webkit-text-fill-color: #9AA1AE !important;
}
html:not([data-theme="dark"]) .auth-shell input:focus,
html:not([data-theme="dark"]) form[action*="login"] input:focus {
  background: #FFFFFF !important;
  border-color: #3C01AF !important;
  box-shadow: 0 0 0 3px rgba(60, 1, 175, .18) !important;
}
html:not([data-theme="dark"]) .auth-shell input:-webkit-autofill,
html:not([data-theme="dark"]) .auth-card input:-webkit-autofill,
html:not([data-theme="dark"]) .login-card input:-webkit-autofill,
html:not([data-theme="dark"]) form[action*="login"] input:-webkit-autofill,
html:not([data-theme="dark"]) form[action*="login"] input:-webkit-autofill:focus {
  -webkit-text-fill-color: #13152C !important;
  -webkit-box-shadow: 0 0 0 1000px #F4F6FA inset !important;
  caret-color: #13152C !important;
}
html:not([data-theme="dark"]) .auth-shell a,
html:not([data-theme="dark"]) .auth-card a,
html:not([data-theme="dark"]) .login-card a { color: #3C01AF !important; font-weight: 700; }
html:not([data-theme="dark"]) .auth-shell a:hover,
html:not([data-theme="dark"]) .login-card a:hover { color: #1089B1 !important; }

/* دکمهٔ ورود در هر دو تم */
.auth-shell button[type="submit"], .auth-card button[type="submit"],
.login-card button[type="submit"], form[action*="login"] button[type="submit"] {
  background: #3C01AF !important; color: #FFFFFF !important;
  -webkit-text-fill-color: #FFFFFF !important;
  border: 0 !important; font-weight: 800 !important;
}


/* ============================================================
   گفتگو در تم شب — نوار «نفر آنلاین» و فهرست افراد
   (استایل روشن پروژه زمینهٔ سفید می‌داد و متن گم می‌شد)
   ============================================================ */
html[data-theme="dark"] #chatOnline {
  background: var(--bn-tile) !important;
  border-color: var(--bn-line) !important;
  color: var(--bn-ink2) !important;
}
html[data-theme="dark"] #chatOnline .online-pill {
  background: rgba(16, 137, 177, .16) !important;
  border: 1px solid rgba(16, 137, 177, .34) !important;
  color: #7FE3C0 !important;
}
html[data-theme="dark"] #chatOnline .online-dot { background: #22C55E !important; }
html[data-theme="dark"] #chatOnline .chat-online-toggle {
  background: var(--bn-tile2) !important;
  border: 1px solid var(--bn-line) !important;
  color: #8EE0FB !important;
}
html[data-theme="dark"] #chatOnline .chat-online-toggle:hover {
  background: rgba(73, 207, 248, .14) !important; color: #C7EEFF !important;
}
html[data-theme="dark"] #chatOnline .chat-online-list { background: transparent !important; }
html[data-theme="dark"] #chatOnline .chat-who {
  background: var(--bn-tile2) !important;
  border: 1px solid var(--bn-line) !important;
  color: var(--bn-ink) !important;
}
html[data-theme="dark"] #chatOnline .chat-who:hover {
  background: rgba(60, 1, 175, .2) !important;
  border-color: rgba(124, 77, 255, .4) !important;
  box-shadow: none !important;
}
html[data-theme="dark"] #chatOnline .chat-who.is-me {
  background: rgba(60, 1, 175, .24) !important;
  border-color: rgba(124, 77, 255, .45) !important;
  color: #FFFFFF !important;
}
html[data-theme="dark"] #chatOnline .chat-who-name { color: inherit !important; }
html[data-theme="dark"] #chatOnline .chat-who-tag {
  background: rgba(214, 0, 108, .2) !important; color: #FF9CC9 !important;
}
html[data-theme="dark"] #chatOnline .chat-who-avatar::after { border-color: var(--bn-tile) !important; }

/* حباب پیام و نوار ابزار چت در شب */
html[data-theme="dark"] .chat-msg-bubble, html[data-theme="dark"] .chat-bubble {
  background: var(--bn-tile2) !important; border-color: var(--bn-line) !important; color: var(--bn-ink) !important;
}
html[data-theme="dark"] .chat-msg.is-me .chat-msg-bubble,
html[data-theme="dark"] .chat-msg.is-mine .chat-msg-bubble {
  background: rgba(60, 1, 175, .28) !important; border-color: rgba(124, 77, 255, .4) !important; color: #FFFFFF !important;
}
html[data-theme="dark"] .chat-like, html[data-theme="dark"] .chat-msg-actions button {
  background: var(--bn-tile2) !important; border: 1px solid var(--bn-line) !important; color: var(--bn-ink2) !important;
}
html[data-theme="dark"] .chat-like.is-on { background: rgba(211, 165, 36, .2) !important; color: #F0CB63 !important; }

/* هر نوار سفیدِ باقی‌مانده در شب که متنش سفید بود */
html[data-theme="dark"] [style*="background:#fff"],
html[data-theme="dark"] [style*="background: #fff"],
html[data-theme="dark"] [style*="background:#FFFFFF"],
html[data-theme="dark"] [style*="background: #FFFFFF"] {
  background: var(--bn-tile) !important; color: var(--bn-ink) !important;
}


/* ============================================================
   پالایش ظاهری — حرکت، خوانایی و جزئیات
   ============================================================ */

/* اسکرول‌بار هم‌رنگ برند */
* { scrollbar-width: thin; scrollbar-color: var(--bn-line2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--bn-line2); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--bn-ink3); background-clip: content-box; }

/* حرکت آرام و محترم به تنظیم کاربر */
@media (prefers-reduced-motion: no-preference) {
  .bn-tile, .nw-card, .card { animation: hfsIn .42s cubic-bezier(.22, 1, .36, 1) both; }
  .bn-col > .bn-tile:nth-child(2) { animation-delay: .04s; }
  .bn-col > .bn-tile:nth-child(3) { animation-delay: .08s; }
  .bn-col > .bn-tile:nth-child(4) { animation-delay: .12s; }
  .nw-grid > .nw-card:nth-child(2) { animation-delay: .05s; }
  .nw-grid > .nw-card:nth-child(3) { animation-delay: .1s; }
  .nw-grid > .nw-card:nth-child(4) { animation-delay: .15s; }
}
@keyframes hfsIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* کارت‌ها: بالاآمدن ملایم و حاشیهٔ برند در هوور */
.bn-tile, .nw-card, .card {
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.nw-card:hover, .bn-tile:hover { border-color: rgba(60, 1, 175, .22) !important; }

/* ردیف‌های فهرست: نوار برند در ابتدای ردیف هنگام هوور */
.bn-row, .ledger-row { position: relative; }
.bn-row::before, .ledger-row::before {
  content: ''; position: absolute; inset-inline-start: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 0; border-radius: 999px; background: var(--bn-grad);
  transition: height .18s ease;
}
.bn-row:hover::before, .ledger-row:hover::before { height: 60%; }

/* دکمه‌ها: بازخورد فشردن و سایهٔ برند */
.bn-btn-purple, .btn-primary { box-shadow: 0 8px 20px -14px rgba(60, 1, 175, .8) !important; }
.bn-btn-purple:active, .btn-primary:active, .bn-btn:active, .btn:active { transform: translateY(1px) scale(.995); }

/* اسکلت بارگذاری برای فهرست‌هایی که با fetch پر می‌شوند */
.hfs-skeleton {
  height: 14px; border-radius: 999px;
  background: linear-gradient(90deg, var(--bn-tile2) 25%, var(--bn-tile3) 50%, var(--bn-tile2) 75%);
  background-size: 200% 100%; animation: hfsShine 1.3s infinite;
}
@keyframes hfsShine { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* راهنمای شناور (tooltip) بدون جاوااسکریپت */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); inset-inline-start: 50%;
  transform: translateX(50%); white-space: nowrap; z-index: 70;
  background: var(--bn-ink); color: #fff; font-size: 11px; font-weight: 700;
  padding: 6px 10px; border-radius: var(--bn-r-md); box-shadow: var(--bn-sh-pop);
  pointer-events: none;
}

/* حالت خالی گویاتر */
.bn-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; }

/* نشان‌های شماری روی منو */
.nav-link .nav-count {
  margin-inline-start: auto; min-width: 20px; text-align: center;
  background: #EF4444; color: #fff; border-radius: 999px;
  font-size: 10.5px; font-weight: 800; padding: 2px 7px;
}

/* عنوان چسبان در فهرست‌های بلند */
.at-table thead th { position: sticky; top: 0; z-index: 3; }

/* چاپ تمیز (کارنامهٔ حضور و اخبار) */
@media print {
  body, .app-shell, .content { background: #fff !important; color: #000 !important; }
  .bn-tile, .card, .nw-card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
  .at-table { min-width: 0 !important; font-size: 11px; }
}

/* دکمهٔ بازگشت به بالا */
.hfs-top {
  position: fixed; inset-block-end: 22px; inset-inline-start: 22px; z-index: 55;
  width: 44px; height: 44px; border-radius: 999px; cursor: pointer;
  background: var(--bn-tile); border: 1px solid var(--bn-line); color: var(--bn-ink2);
  display: grid; place-items: center; box-shadow: var(--bn-sh);
  opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease, color .15s ease;
}
.hfs-top.is-on { opacity: 1; pointer-events: auto; transform: none; }
.hfs-top:hover { color: var(--hfs-indigo); border-color: rgba(60, 1, 175, .35); }
@media (max-width: 860px) { .hfs-top { inset-block-end: calc(84px + env(safe-area-inset-bottom)); inset-inline-start: 14px; } }


/* ============================================================
   رفع شکستن حرف‌به‌حرف متن در موبایل
   علت: ظرف‌های فلکس/گرید که عرضشان به صفر می‌رسید
   ============================================================ */
@media (max-width: 860px) {
  /* هر فرزند فلکس/گرید حداقل عرض منطقی داشته باشد */
  .grid > *, .grid-2 > *, .grid-3 > *,
  .card > *, .bn-tile > *, .msg > *, .message > *,
  [class*="msg"] > *, [class*="thread"] > *, [class*="conv"] > * {
    min-width: 0;
  }

  /* بدنهٔ پیام و نامه: تمام‌عرض، بدون شکستن کلمه */
  .msg-body, .message-body, .msg-text, .message-text,
  .letter-body, .chat-msg-body, .thread-body, .mail-body,
  [class*="msg-body"], [class*="message-body"], [class*="msg-text"] {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    display: block !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
    word-break: normal !important;
    writing-mode: horizontal-tb !important;
    text-align: start;
    line-height: 1.9;
  }

  /* هر ردیفی که در دسکتاپ آواتار + متن بود، در گوشی بشکند نه متن */
  .msg, .message, .chat-msg, .thread-item, .mail-item, .letter-item,
  [class*="msg-row"], [class*="message-row"] {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }
  .msg > .avatar, .message > .avatar, [class*="avatar"] { flex: 0 0 auto !important; }

  /* ستون‌های عمودی تصادفی (نتیجهٔ عرض صفر) را خنثی کن */
  [style*="writing-mode"], [class*="vertical"] { writing-mode: horizontal-tb !important; }

  /* صفحهٔ پیام‌های خصوصی: چیدمان تک‌ستونه و خوانا */
  .messages-wrap, .msg-wrap, .thread-wrap, .mail-wrap {
    display: block !important;
  }
  .messages-list, .msg-list, .thread-list { width: 100% !important; }
  .messages-view, .msg-view, .thread-view { width: 100% !important; margin-top: 12px; }

  /* سربرگ صفحه: دکمه‌ها زیر عنوان، بدون فشردگی */
  .topbar-actions { row-gap: 8px; }
  .topbar-actions > * { flex: 0 0 auto; }
}

/* عرض‌های بسیار کم: باز هم متن حرف‌به‌حرف نشود */
@media (max-width: 380px) {
  .msg-body, .message-body, .letter-body, [class*="msg-text"] { font-size: 14.5px !important; }
  .bn-row, .ledger-row { flex-wrap: wrap; }
  .bn-row-main, .ledger-row > div { flex: 1 1 100%; min-width: 0; }
}


/* ============================================================
   منوی کناری — سه ناحیهٔ مستقل: برند / فهرست اسکرول‌دار / کارت کاربر
   کارت کاربر روی فهرست نمی‌افتد و فهرست زیر آن پنهان نمی‌شود.
   ============================================================ */
.sidebar {
  display: flex !important;
  flex-direction: column !important;
  height: 100vh !important;
  height: 100dvh !important;
  position: sticky !important; top: 0 !important;
  overflow: hidden !important;
  padding: 18px 14px 0 !important;
  gap: 0 !important;
}

/* ۱) برند — ثابت بالا */
.sidebar .brand {
  flex: 0 0 auto !important;
  padding-bottom: 14px !important;
  margin-bottom: 4px !important;
  border-bottom: 1px solid var(--bn-line);
}

/* ۲) فهرست — تنها بخش اسکرول‌شونده */
.sidebar > nav,
.sidebar .nav,
.sidebar .nav-groups,
.sidebar > div:not(.brand):not(.sidebar-foot):not(.user-chip) {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  padding: 8px 0 12px !important;
  margin: 0 !important;
  scrollbar-width: thin;
  scrollbar-color: var(--bn-line2) transparent;
  -webkit-overflow-scrolling: touch;
  /* محو شدن نرم در لبهٔ پایین، پیش از کارت کاربر */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 14px), transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 14px), transparent 100%);
}
.sidebar > nav::-webkit-scrollbar,
.sidebar .nav::-webkit-scrollbar { width: 7px; }
.sidebar > nav::-webkit-scrollbar-thumb,
.sidebar .nav::-webkit-scrollbar-thumb { background: var(--bn-line2); border-radius: 999px; }
.sidebar > nav::-webkit-scrollbar-track,
.sidebar .nav::-webkit-scrollbar-track { background: transparent; }

/* ۳) کارت کاربر — ثابت پایین، بی‌فشرده‌شدن */
.sidebar-foot,
.sidebar > .user-chip {
  flex: 0 0 auto !important;
  margin-top: 0 !important;
  padding: 12px 0 calc(14px + env(safe-area-inset-bottom)) !important;
  border-top: 1px solid var(--bn-line) !important;
  background: var(--bn-side) !important;
  position: relative; z-index: 3;
}
.sidebar-foot > * { flex-shrink: 0; }
.user-chip {
  display: flex !important; align-items: center; gap: 10px;
  padding: 10px 11px !important; min-height: 56px;
}
.user-chip img, .user-chip .avatar, .user-chip > span:first-child {
  width: 34px !important; height: 34px !important; flex-shrink: 0 !important;
  border-radius: 50% !important; overflow: hidden;
}
.user-chip-name, .user-chip-role { line-height: 1.5; }
.user-chip-name { font-size: 12.5px; font-weight: 700; }
.user-chip-role { font-size: 10.5px; }

/* عنوان دسته: چسبان و بدون همپوشانی با آیتم‌ها */
.sidebar .nav-label {
  position: sticky; top: -8px; z-index: 2;
  background: var(--bn-side); backdrop-filter: blur(6px);
  padding: 12px 10px 7px !important; margin: 0 !important;
}
.sidebar .nav-label:first-child { padding-top: 4px !important; }

@media (max-width: 860px) {
  body.hfs-drawer .sidebar { padding: 18px 14px 0 !important; }
  .sidebar .nav-link { padding: 13px 12px !important; }
  .user-chip { min-height: 60px; }
}
.bn-tile::before {
  content: ''; position: absolute; inset-block-start: 0; inset-inline: 0; height: 3px;
  background: var(--bn-grad); opacity: .9;
}
.bn-tile.is-plain::before { display: none; }

/* آیکون ماژول: دایرهٔ نرم با هالهٔ هم‌رنگ */
.bn-ico {
  width: 38px !important; height: 38px !important;
  border-radius: 13px !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}

/* تیتر ماژول: درشت‌تر با نشانگر */
.bn-tile-head h3, .card-head h3, .card-head h4 {
  font-size: 16px !important; font-weight: 800 !important; letter-spacing: -.2px;
}

/* کارت‌ها: بالاآمدن نرم روی هوور */
.bn-tile, .nw-card, .card {
  transition: transform .18s cubic-bezier(.22, 1, .36, 1), border-color .18s ease, box-shadow .18s ease;
}
@media (hover: hover) {
  .bn-tile:hover, .nw-card:hover, .board-col-body .card:hover {
    transform: translateY(-2px);
    border-color: rgba(60, 1, 175, .22) !important;
    box-shadow: 0 2px 4px rgba(19, 21, 44, .05), 0 22px 44px -26px rgba(60, 1, 175, .3) !important;
  }
  html[data-theme="dark"] .bn-tile:hover, html[data-theme="dark"] .nw-card:hover {
    border-color: rgba(124, 77, 255, .35) !important;
    box-shadow: 0 24px 50px -28px rgba(0, 0, 0, .9) !important;
  }
}

/* ردیف‌های لیست: نشانگر باریک هنگام هوور */
.bn-row { position: relative; }
.bn-row::before {
  content: ''; position: absolute; inset-inline-start: 0; inset-block: 8px;
  width: 3px; border-radius: 999px; background: var(--bn-grad);
  opacity: 0; transition: opacity .16s ease;
}
.bn-row:hover::before { opacity: 1; }

/* پروگرس و حلقه‌ها: گرادیان برند و ضخامت بیشتر */
.bn-bar { height: 8px !important; }
.bn-bar i { box-shadow: 0 0 12px -4px rgba(60, 1, 175, .6); }

/* نشان‌های وضعیت: پررنگ‌تر و خواناتر */
.bn-tag, .nw-cat, .seal, .badge, .pill, .status {
  font-weight: 800 !important; letter-spacing: -.1px;
}

/* کارت اخبار: تصویر با گوشهٔ نرم و متن با ریتم بهتر */
.nw-plate { border-radius: 13px !important; box-shadow: inset 0 -30px 40px -30px rgba(0, 0, 0, .35); }
.nw-card-title { font-size: 15.5px !important; font-weight: 800 !important; line-height: 1.7 !important; }
.nw-card p { font-size: 12.5px !important; }

/* سرصفحهٔ صفحه: عنوان با نشانگر رنگی */
.topbar h1 { position: relative; padding-inline-start: 13px; }
.topbar h1::before {
  content: ''; position: absolute; inset-inline-start: 0; inset-block: 4px;
  width: 4px; border-radius: 999px; background: var(--bn-grad);
}

/* خالی‌بودن: پیام دلپذیرتر */
.bn-empty {
  padding: 26px 12px !important; font-size: 13px !important;
  border: 1px dashed var(--bn-line); border-radius: var(--bn-r-md);
  background: var(--bn-tile2);
}

@media (max-width: 860px) {
  .bn-tile::before { height: 2.5px; }
  .bn-ico { width: 36px !important; height: 36px !important; }
  .bn-tile-head h3 { font-size: 15.5px !important; }
  .topbar h1 { padding-inline-start: 11px; }
}

/* نوار «در پاسخ به…» بالای کادر نوشتن */
.chat-replying, .reply-bar, #replyBar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px; border-radius: 12px;
  background: rgba(60, 1, 175, .07) !important;
  border: 1px solid rgba(60, 1, 175, .2) !important;
  border-inline-start: 3px solid var(--hfs-indigo) !important;
  color: var(--bn-ink) !important; font-size: 12.5px;
  margin-bottom: 10px;
}
html[data-theme="dark"] .chat-replying, html[data-theme="dark"] #replyBar {
  background: rgba(124, 77, 255, .16) !important;
  border-color: rgba(124, 77, 255, .32) !important;
  border-inline-start-color: #A78BFA !important;
}


/* ============================================================
   کارنامهٔ حضور — چاپ
   ============================================================ */
.at-print { margin-inline-start: 8px; }
.at-print-head, .at-print-foot { display: none; }

@media print {
  /* فقط کارنامه چاپ شود */
  .sidebar, .topbar, .tabbar, .hfs-notif, .hfs-install, .idle-warn,
  .at-toolbar, .at-print, .at-acts, .ch-flash, .bn-theme-btn,
  .hfs-burger, .hfs-jump-btn, .hfs-bell, .toast-wrap, .at-stats form { display: none !important; }

  html, body { background: #fff !important; color: #000 !important; }
  .app-shell, .main, .content { display: block !important; padding: 0 !important; margin: 0 !important; }
  .app-shell::before, .app-shell::after { display: none !important; }

  @page { size: A4 portrait; margin: 14mm 12mm; }

  /* سرصفحهٔ برگه */
  .at-print-head {
    display: flex !important; align-items: flex-end; gap: 14px;
    padding-bottom: 8px; margin-bottom: 12px;
    border-bottom: 2px solid #000;
  }
  .at-print-brand b { display: block; font-size: 14pt; font-weight: 800; }
  .at-print-brand span { font-size: 10pt; }
  .at-print-meta {
    margin-inline-start: auto; display: grid; grid-template-columns: auto auto; gap: 2px 18px;
    font-size: 8.5pt; text-align: start;
  }

  /* آمار بالای صفحه: فشرده و بی‌کادر */
  .at-stats {
    display: flex !important; gap: 18px; margin: 0 0 10px !important;
    font-size: 9pt;
  }
  .at-stats .bn-tile {
    display: block !important; padding: 0 !important; border: 0 !important;
    box-shadow: none !important; background: none !important;
  }
  .at-stats .bn-tile::before { display: none !important; }
  .at-stats b { font-size: 11pt !important; }

  /* جدول */
  .bn-tile, .at-sheet {
    border: 0 !important; box-shadow: none !important; background: none !important;
    padding: 0 !important; margin: 0 !important;
  }
  .bn-tile::before { display: none !important; }
  .at-table-wrap { overflow: visible !important; display: block !important; }
  .at-table {
    width: 100% !important; min-width: 0 !important;
    border-collapse: collapse !important; font-size: 9pt !important;
  }
  .at-table thead { display: table-header-group; }
  .at-table th {
    background: #f0f0f0 !important; color: #000 !important;
    border: 1px solid #999 !important; padding: 6px 8px !important; font-weight: 800;
  }
  .at-table td {
    border: 1px solid #bbb !important; padding: 5px 8px !important;
    color: #000 !important; background: #fff !important;
  }
  .at-table tr { break-inside: avoid; }
  .at-badge, .seal, .bn-tag {
    border: 1px solid #999 !important; background: none !important; color: #000 !important;
    padding: 1px 6px !important; font-size: 8pt !important;
  }

  /* پای برگه: امضاها */
  .at-print-foot {
    display: flex !important; justify-content: space-between; gap: 40px;
    margin-top: 34px; padding-top: 40px; font-size: 9pt;
  }
  .at-print-foot div {
    flex: 1; text-align: center; border-top: 1px solid #000; padding-top: 6px;
  }

  a[href]::after { content: none !important; }
}

@media (max-width: 860px) {
}


/* ============================================================
   بازبینی نهایی UI — چیدمان، تضاد، سلسله‌مراتب، یکدستی
   (اعمال روی همان اتوماسیون؛ چهار گروه اصلاح)
   ============================================================ */

/* ---------- ۱) شبکه و فاصله‌گذاری ---------- */
/* پس‌زمینهٔ روشن‌تر از کارت‌ها تا کارت‌ها بیرون بزنند */
:root {
  --bn-bg: #EEF1F7;
  --bn-bg-deep: #E6EAF3;
  --bn-pad: 24px;
}
body, .app-shell { background: var(--bn-bg) !important; }

/* ستون‌ها هم‌ارتفاع و بدون فضای مردهٔ پایین */
.bn-grid { align-items: stretch !important; }
.bn-col { height: 100%; }
.bn-col > .bn-tile:last-child { margin-bottom: 0; }

/* پدینگ یکسان در همهٔ کارت‌ها — بی‌استثنا */
.bn-tile, .card.card-pad, .nw-card, .ch-dialog-box { padding: var(--bn-pad) !important; }
.bn-tile.is-flush, .card:not(.card-pad) { padding: 0 !important; }
/* کارت‌هایی که فهرست دارند: پدینگ روی سر و بدنه، نه صفر */
.bn-tile > .bn-row:first-of-type { margin-top: 2px; }
.bn-tile > .bn-row { margin-inline: -8px; padding-inline: 8px !important; }
html[data-theme="dark"] .bn-tile-head h3, html[data-theme="dark"] .card-head h3 { color: #FFFFFF !important; }
.bn-row-title, .ledger-title, .nw-card-title { color: #13152C !important; font-weight: 700 !important; }
html[data-theme="dark"] .bn-row-title, html[data-theme="dark"] .ledger-title { color: var(--bn-ink) !important; }
.bn-row-sub, .bn-sub, .muted { color: #6B7280 !important; }

/* دکمهٔ خروج: متن تیره روی زمینهٔ روشن (WCAG) */
.btn-logout, .bn-btn.is-logout, a[href="/logout"].bn-btn, a[href="/logout"].btn {
  background: #FEF3C7 !important;
  border: 1px solid #D3A524 !important;
  color: #4A3505 !important;
  font-weight: 800 !important;
}
.btn-logout svg, a[href="/logout"] svg { color: #4A3505 !important; stroke: #4A3505 !important; }
.btn-logout:hover, a[href="/logout"].bn-btn:hover { background: #FDE68A !important; color: #3A2903 !important; }
html[data-theme="dark"] .btn-logout, html[data-theme="dark"] a[href="/logout"].bn-btn {
  background: rgba(211, 165, 36, .18) !important; border-color: rgba(211, 165, 36, .45) !important;
  color: #FCD34D !important;
}
html[data-theme="dark"] .btn-logout svg { color: #FCD34D !important; stroke: #FCD34D !important; }

/* ---------- ۳) منو و سربرگ ---------- */
/* نشان اعلان: چسبیده به لبهٔ منو، هم‌تراز عمودی */
.nav-link {
  display: flex !important; align-items: center !important;
  justify-content: flex-start !important; gap: 10px !important;
}
.nav-link .hfs-nav-badge, .nav-link > span:last-child:not(.nav-text) {
  margin-inline-start: auto !important;
  flex-shrink: 0;
  min-width: 22px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* آیتم فعال: متن و آیکون تیره روی زمینهٔ پاستلی */
.nav-link.active {
  background: #EDE7FE !important;
  border-color: #C9B8FB !important;
  color: #2A0180 !important;
}
.nav-link.active svg { color: #2A0180 !important; stroke: #2A0180 !important; opacity: 1 !important; }
html[data-theme="dark"] .nav-link.active {
  background: rgba(124, 77, 255, .2) !important; border-color: rgba(124, 77, 255, .4) !important;
  color: #E4DBFF !important;
}
html[data-theme="dark"] .nav-link.active svg { color: #E4DBFF !important; stroke: #E4DBFF !important; }

/* مهرهای تکراری نامه‌ها: نقطهٔ رنگی کم‌سر و صدا به‌جای قرص پُر */
.letter-lanes .seal, .bn-tile .seal {
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  display: inline-flex; align-items: center; gap: 6px;
  color: #6B7280 !important;
  white-space: nowrap;
}
.letter-lanes .seal::before, .bn-tile .seal::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: currentColor;
}
.letter-lanes .seal-received, .bn-tile .seal-received { color: #C42A2A !important; }
.letter-lanes .seal-sent,     .bn-tile .seal-sent     { color: #3C01AF !important; }
.letter-lanes .seal-draft,    .bn-tile .seal-draft    { color: #9AA1AE !important; }
.letter-lanes .seal-archived, .bn-tile .seal-archived { color: #8A9099 !important; opacity: .75; }
html[data-theme="dark"] .letter-lanes .seal { color: var(--bn-ink3) !important; }
html[data-theme="dark"] .letter-lanes .seal-received { color: #FCA5A5 !important; }
html[data-theme="dark"] .letter-lanes .seal-sent { color: #A78BFA !important; }

/* قرص وضعیت حضور: فضای نفس‌کشیدن افقی */
.bn-pill, .at-badge, .bn-tag {
  padding-inline: 14px !important;
  padding-block: 5px !important;
  line-height: 1.7 !important;
}

@media (max-width: 860px) {
  :root { --bn-pad: 16px; }
  .bn-tile, .card.card-pad, .nw-card { padding: var(--bn-pad) !important; }
  .bn-pill, .at-badge, .bn-tag { padding-inline: 12px !important; }
}


/* ============================================================
   منو — نشان اعلان فقط وقتی شمار دارد (دایره‌های قرمز الکی برداشته شد)
   ============================================================ */
.nav-link > span:last-child:not(.nav-text):not(.hfs-nav-badge) {
  margin-inline-start: auto !important;
  flex-shrink: 0;
  min-width: 0 !important; width: auto !important;
  height: auto !important;
  border-radius: 999px;
  background: transparent !important;
  color: inherit !important;
  padding: 0 !important;
  display: inline-flex; align-items: center; justify-content: center;
}
/* نشان واقعی: فقط اگر عدد داشته باشد */
.nav-link .hfs-nav-badge:empty { display: none !important; }
.hfs-nav-badge {
  min-width: 20px !important; height: 19px !important;
  padding: 0 6px !important; font-size: 10.5px !important;
  background: var(--bn-red) !important; color: #fff !important;
  display: inline-flex !important; align-items: center; justify-content: center;
}
/* هر نشان بی‌متن در منو حذف */
.sidebar [class*="badge"]:empty,
.sidebar [class*="dot"]:empty,
.sidebar .nav-link > span:empty { display: none !important; }

/* موبایل */
@media (max-width: 860px) {
}

/* موبایل */
@media (max-width: 860px) {

}

/* گوشی‌های خیلی کوچک */
@media (max-width: 420px) {

}

.ch-quote-text {
  display: block !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  color: var(--bn-ink3) !important;
  font-size: 10.5px !important;
}

/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 860px) {
}

/* ---------- Small phones ---------- */

@media (max-width: 480px) {
}

.ch-quote-text {
  display: block !important;
  min-width: 0 !important;

  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 1100px) and (min-width: 861px) {
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 860px) {
}

/* =========================================================
   SMALL PHONES
   ========================================================= */

@media (max-width: 480px) {
}

/* =========================================================
   VERY SMALL PHONES
   ========================================================= */

@media (max-width: 360px) {
}


/* ===== گوشی ===== */

@media (max-width: 860px) {
}

@media (max-width: 480px) {
}


/* =========================================================
   CHAT / CHANNELS FINAL LAYOUT FIX
   ========================================================= */

/* جلوگیری از خراب شدن Layout در زمان لود */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 1100px) {

}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 768px) {

  html,
  body {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  /* سایدبار اصلی سایت */
  aside,
  .sidebar,
  .app-sidebar {
    max-width: 100vw;
  }

}


/* =========================================================
   VERY SMALL PHONES
   ========================================================= */

@media (max-width: 480px) {

}

/* موبایل */
@media (max-width: 768px) {
}

...

/* ===== CHAT DARK MODE FIX ===== */
html.dark .ch-main,
body.dark .ch-main,
[data-theme="dark"] .ch-main {
  --chat-text: #f1f5f9;
  --chat-muted: #aab4c3;
  --chat-border: rgba(255,255,255,.12);
  --chat-hover: rgba(255,255,255,.07);
}

/* متن گفتگو */
html.dark .ch-main .ch-message,
body.dark .ch-main .ch-message,
[data-theme="dark"] .ch-main .ch-message,
html.dark .ch-main .message,
body.dark .ch-main .message,
[data-theme="dark"] .ch-main .message {
  color: #f1f5f9 !important;
}

/* متن پیام */
html.dark .ch-main .message-content,
body.dark .ch-main .message-content,
[data-theme="dark"] .ch-main .message-content,
html.dark .ch-main .ch-message-content,
body.dark .ch-main .ch-message-content,
[data-theme="dark"] .ch-main .ch-message-content {
  color: #f1f5f9 !important;
}

/* اطلاعات فرعی / زمان */
html.dark .ch-main .message-time,
body.dark .ch-main .message-time,
[data-theme="dark"] .ch-main .message-time,
html.dark .ch-main .text-muted,
body.dark .ch-main .text-muted,
[data-theme="dark"] .ch-main .text-muted {
  color: #aeb8c7 !important;
}

/* دکمه‌های عملیات پیام */
html.dark .ch-main button,
body.dark .ch-main button,
[data-theme="dark"] .ch-main button {
  color: #dbe4ef !important;
}

/* لایک */
html.dark .ch-main [class*="like"],
body.dark .ch-main [class*="like"],
[data-theme="dark"] .ch-main [class*="like"],
html.dark .ch-main [aria-label*="لایک"],
body.dark .ch-main [aria-label*="لایک"],
[data-theme="dark"] .ch-main [aria-label*="لایک"] {
  color: #fbbf24 !important;
  opacity: 1 !important;
}

/* حذف */
html.dark .ch-main [class*="delete"],
body.dark .ch-main [class*="delete"],
[data-theme="dark"] .ch-main [class*="delete"],
html.dark .ch-main [aria-label*="حذف"],
body.dark .ch-main [aria-label*="حذف"],
[data-theme="dark"] .ch-main [aria-label*="حذف"] {
  color: #ff6b7a !important;
  opacity: 1 !important;
}

/* ویرایش */
html.dark .ch-main [class*="edit"],
body.dark .ch-main [class*="edit"],
[data-theme="dark"] .ch-main [class*="edit"],
html.dark .ch-main [aria-label*="ویرایش"],
body.dark .ch-main [aria-label*="ویرایش"],
[data-theme="dark"] .ch-main [aria-label*="ویرایش"] {
  color: #60a5fa !important;
  opacity: 1 !important;
}

/* hover دکمه‌ها */
html.dark .ch-main button:hover,
body.dark .ch-main button:hover,
[data-theme="dark"] .ch-main button:hover {
  background: rgba(255,255,255,.09) !important;
  color: #ffffff !important;
}

/* SVG آیکن‌ها */
html.dark .ch-main button svg,
body.dark .ch-main button svg,
[data-theme="dark"] .ch-main button svg {
  opacity: 1 !important;
}

/* آیکن لایک */
html.dark .ch-main [class*="like"] svg,
body.dark .ch-main [class*="like"] svg,
[data-theme="dark"] .ch-main [class*="like"] svg {
  color: #fbbf24 !important;
  fill: currentColor;
}

/* آیکن حذف */
html.dark .ch-main [class*="delete"] svg,
body.dark .ch-main [class*="delete"] svg,
[data-theme="dark"] .ch-main [class*="delete"] svg {
  color: #ff6b7a !important;
}

/* آیکن ویرایش */
html.dark .ch-main [class*="edit"] svg,
body.dark .ch-main [class*="edit"] svg,
[data-theme="dark"] .ch-main [class*="edit"] svg {
  color: #60a5fa !important;
}

/* منوی عملیات پیام */
html.dark .ch-main .message-actions,
body.dark .ch-main .message-actions,
[data-theme="dark"] .ch-main .message-actions {
  opacity: 1 !important;
  visibility: visible !important;
}

/* کادر نوشتن پیام */
html.dark .ch-main textarea,
body.dark .ch-main textarea,
[data-theme="dark"] .ch-main textarea,
html.dark .ch-main input,
body.dark .ch-main input,
[data-theme="dark"] .ch-main input {
  color: #f8fafc !important;
  background: #151b26 !important;
  border-color: rgba(255,255,255,.14) !important;
}

html.dark .ch-main textarea::placeholder,
body.dark .ch-main textarea::placeholder,
[data-theme="dark"] .ch-main textarea::placeholder {
  color: #7f8a9b !important;
}

/* جلوگیری از کم‌رنگ شدن عملیات */
html.dark .ch-main .opacity-50,
body.dark .ch-main .opacity-50,
[data-theme="dark"] .ch-main .opacity-50,
html.dark .ch-main [style*="opacity"],
body.dark .ch-main [style*="opacity"],
[data-theme="dark"] .ch-main [style*="opacity"] {
  opacity: 1 !important;
}


/* =========================================================
   FIX — Groups & Channels / Desktop Light Theme
   فقط دسکتاپ — موبایل دست نخورده
   ========================================================= */

@media (min-width: 769px) {

  /* جلوگیری از بیرون‌زدگی کل صفحه */
  html,
  body {
    overflow-x: hidden !important;
  }

  /* کانتینر اصلی گروه‌ها */
  .ch-main {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  /* بخش اصلی گفتگو */
  .ch-main .ch-messages {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
  }

  /* ساختار صفحه گروه/کانال */
  .ch-layout,
  .channels-layout,
  .groups-layout,
  .ch-page {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  /* کارت لیست گفتگوها */
  .ch-sidebar,
  .ch-list,
  .channels-sidebar,
  .groups-sidebar {
    flex: 0 0 350px !important;
    width: 350px !important;
    max-width: 350px !important;
    min-width: 300px !important;
    box-sizing: border-box !important;
  }

  /* محتوای چت */
  .ch-content,
  .ch-chat,
  .channel-content,
  .group-content {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
  }

  /* هدر گفتگو */
  .ch-header {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
  }

  /* پیام‌ها */
  .ch-main .ch-message,
  .ch-main .message,
  .ch-messages > * {
    max-width: 92% !important;
    box-sizing: border-box !important;
  }

  /* متن پیام نباید عرض صفحه را خراب کند */
  .ch-main .ch-message *,
  .ch-main .message * {
    max-width: 100% !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  /* فضای بالای پیام‌ها را کنترل کن */
  .ch-main .ch-messages {
    padding-top: 12px !important;
  }

  /* کادر نوشتن پیام */
  .ch-main .ch-input,
  .ch-main .ch-composer,
  .ch-main .message-input,
  .ch-main form {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* خود textarea / input */
  .ch-main textarea,
  .ch-main input[type="text"] {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* ارتفاع طبیعی بخش چت */
  .ch-main {
    min-height: 0 !important;
  }

  /* پنل جستجو */
  .ch-search,
  .channel-search,
  .groups-search {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* کارت گروه فعال */
  .ch-list-item,
  .channel-item,
  .group-item {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* اسکرول فقط داخل بخش‌های لازم */
  .ch-messages {
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

}

/* =========================================================
   END DESKTOP FIX
   ========================================================= */


/* =========================================================
   FINAL MOBILE FIX — GROUPS / CHANNELS
   ========================================================= */

@media (max-width: 768px) {

  html,
  body {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  .ch-page,
  .ch-layout,
  .channels-layout,
  .groups-layout,
  .ch-main,
  .ch-content,
  .ch-chat,
  .channel-content,
  .group-content {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  /* لیست گروه و کانال */
  .ch-sidebar,
  .ch-list,
  .channels-sidebar,
  .groups-sidebar {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 100% !important;
    box-sizing: border-box !important;
  }

  /* جلوگیری از بیرون زدن محتوای چت */
  .ch-content,
  .ch-chat,
  .channel-content,
  .group-content {
    flex: 1 1 auto !important;
    overflow: hidden !important;
  }

  /* هدر */
  .ch-header {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  /* پیام‌ها */
  .ch-messages {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
  }

  .ch-main .ch-message,
  .ch-main .message,
  .ch-messages > * {
    max-width: 94% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .ch-main .ch-message *,
  .ch-main .message * {
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  /* کادر نوشتن پیام */
  .ch-main .ch-input,
  .ch-main .ch-composer,
  .ch-main .message-input,
  .ch-main form {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .ch-main textarea,
  .ch-main input[type="text"],
  .ch-main input[type="search"] {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  /* آیتم‌های گروه و کانال */
  .ch-list-item,
  .channel-item,
  .group-item {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  /* جلوگیری از بیرون زدن عکس، دکمه و متن */
  .ch-page img,
  .ch-page video,
  .ch-page button,
  .ch-page input,
  .ch-page textarea {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* جستجو */
  .ch-search,
  .channel-search,
  .groups-search {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

}

/* =========================================================
   END FINAL MOBILE FIX
   ========================================================= */

/* ---------- اخبار: کارت‌ها با عرض معقول ---------- */
.nw-grid{
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 360px));
  justify-content: start;
  align-items: start;
}
.nw-card{ max-width:360px; }
.nw-plate{ height:112px; font-size:30px; }
.nw-card p{
  display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical;
  overflow:hidden; line-height:1.9;
}
@media (min-width: 1600px){
  .nw-grid{ grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 380px)); }
  .nw-card{ max-width:380px; }
}
@media (max-width: 700px){
  .nw-grid{ grid-template-columns: minmax(0,1fr); }
  .nw-card{ max-width:none; }
  .nw-plate{ height:96px; font-size:26px; }
}
