/* ===========================
   Apt Charge – Clean UI + No-Jump Navigation
   Author: you ✌️
   =========================== */

/* -------------------------------------------------
   0) فونت سراسری - Sans Serif (فونت‌های سیستم - بدون نیاز به لود)
   ------------------------------------------------- */
html, body, body *, body *::before, body *::after {
  font-family: var(--font-iran-yekan) !important;
  font-variant-numeric: normal !important;
}

/* -------------------------------------------------
   0) ضدّپرش سراسری (قطعی)
   ------------------------------------------------- */
:root { scrollbar-gutter: stable both-edges; }   /* رزرو فضای اسکرول‌بار */
html { overflow-y: auto; }                       /* حالت نرمالِ مدرن */

@supports not (scrollbar-gutter: stable both-edges) {
  html { overflow-y: scroll; }                   /* فallback برای مرورگرهای قدیمی */
  body { padding-left: calc(100vw - 100%); padding-right: calc(100vw - 100%); }
}

/* وقتی محتوا عوض می‌شود، باکس اصلی ارتفاع پایدار دارد → اسکرول‌بار غیب/ظاهر نشود */
.shell { min-height: calc(100vh - 140px); }      /* اگر هدر/فوتر متفاوت است، این مقدار را تنظیم کن */
body, .wrap, .shell { overflow-x: hidden; }      /* جلوگیری از هُل به چپ/راست در RTL */

/* -------------------------------------------------
   1) ریست سبک
   ------------------------------------------------- */
* { 
  box-sizing: border-box;
  font-family: var(--font-iran-yekan) !important;
  font-variant-numeric: normal;
}
html, body { margin: 0; padding: 0; }
img { max-width: 100%; height: auto; display: block; }

/* -------------------------------------------------
   2) تم‌ها و متغیرها
   ------------------------------------------------- */
/* Light (پیش‌فرض پرانرژی) */
:root{
  --bg:            #f5f7fb;   /* clean neutral background */
  --card:          #ffffff;
  --text:          #1b3c59;
  --muted:         #6b7280;

  --primary:       #1f6f5f;   /* teal */
  --primary-600:   #1b3c59;   /* navy */
  --primary-50:    #f1f5f9;

  --success:       #1f6f5f;
  --danger:        #d9534f;   /* muted red */
  --warning:       #c27803;
  --tertiary:      #1b3c59;
  --tertiary-600:  #0f253a;

  --border:        #e5e7eb;
  --border-strong: #cbd5e1;

  --shadow:        0 1px 3px rgba(0,0,0,.03);
  --shadow-hover:  0 8px 24px rgba(0,0,0,.08);

  --radius:        8px;

  --focus-ring:    0 0 0 3px rgba(31,111,95,.18);
}

/* Cool */
html.theme-cool{
  --bg:            #f4f7fb;
  --card:          #ffffff;
  --text:          #0f172a;
  --muted:         #475569;

  --primary:       #1f6f5f;
  --primary-600:   #1b3c59;
  --primary-50:    #e2e8f0;
  --tertiary:      #1b3c59;
  --tertiary-600:  #0f253a;

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

  --shadow:        0 1px 3px rgba(0,0,0,.05);
  --shadow-hover:  0 10px 26px rgba(0,0,0,.10);
}

/* Dark */
html.theme-dark{
  --bg:            #0f172a;
  --card:          #1e293b;
  --text:          #f8fafc;
  --muted:         #94a3b8;

  --primary:       #c084fc;
  --primary-600:   #a855f7;
  --primary-50:    #2e1065;
  --tertiary:      #f472b6;   /* pink-400 */
  --tertiary-600:  #ec4899;   /* pink-500 */

  --border:        #334155;
  --border-strong: #475569;

  --shadow:        0 8px 30px rgba(0,0,0,.45);
  --shadow-hover:  0 16px 46px rgba(0,0,0,.65);
}

/* -------------------------------------------------
   3) تایپوگرافی و بدنه
   ------------------------------------------------- */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-iran-yekan) !important;
  font-variant-numeric: normal;
  line-height: 1.65;
  font-size: 15px;
  margin: 0;
  padding: 0;
}

a{
  color: var(--primary);
  text-decoration: none;
  transition: color .18s ease;
}
a:hover{ color: var(--primary-600); }

/* -------------------------------------------------
   4) لِی‌اوت
   ------------------------------------------------- */
.wrap{ max-width: 100%; margin: 0; padding: 16px; }

.shell { 
  display: flex; 
  flex-direction: column; 
  gap: 16px; 
}

/* -------------------------------------------------
   5) ناوبار قدیمی - حذف شده (استفاده از phx-header.css)
   ------------------------------------------------- */

/* -------------------------------------------------
   6) دکمه‌ها و بَچ‌ها
   ------------------------------------------------- */
.btn{
  background: linear-gradient(135deg,var(--primary),var(--primary-600));
  border: none; border-radius: 6px;
  padding: 10px 16px; color:#fff; cursor:pointer; font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
  transition: box-shadow .2s ease, transform .12s ease;
}
.btn:hover{ transform: translateY(-1px); box-shadow: 0 10px 28px rgba(0,0,0,.25); }
.btn:active{ transform: none; }

.btn-secondary{ background: linear-gradient(135deg,#14b8a6,#0d9488); }
.btn-danger{ background: linear-gradient(135deg,#ef4444,#b91c1c); }
.btn-muted{
  background: #e5e7eb; color: #111827; border: 1px solid #d1d5db;
}

.badge{
  display:inline-block; padding:6px 10px; border-radius:6px;
  background: var(--primary-50); color: var(--text); border: 1px solid var(--border);
}

/* -------------------------------------------------
   7) کارت‌ها
   ------------------------------------------------- */
.card{
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); transition: box-shadow .25s ease, transform .2s ease;
}
.card:hover{ box-shadow: var(--shadow-hover); transform: translateY(-2px); }

/* -------------------------------------------------
   8) فرم‌ها
   ------------------------------------------------- */
input, select, textarea{
  width: 100%; padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px; background: #fff; color: var(--text);
  transition: border-color .18s ease, box-shadow .18s ease;
}
input:focus, select:focus, textarea:focus{
  border-color: var(--primary); outline: none; box-shadow: var(--focus-ring);
}
label{ display:block; margin-bottom:6px; font-size: .92rem; color: var(--muted); }
small.muted{ color: var(--muted); }

/* -------------------------------------------------
   9) گرید ریسپانسیو
   ------------------------------------------------- */
.grid{ display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
@media (max-width: 992px){ .grid{ grid-template-columns: repeat(2,1fr); } }
@media (max-width: 600px){ .grid{ grid-template-columns: 1fr; } }

.g2{ grid-template-columns: repeat(2,1fr); }
.g3{ grid-template-columns: repeat(3,1fr); }

/* -------------------------------------------------
   10) جدول‌ها
   ------------------------------------------------- */
.table-wrap{
  overflow: auto; border-radius: 6px; border: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}
.tbl{
  width: 100%; border-collapse: separate; border-spacing: 0; min-width: 720px;
}
.tbl th{
  background: var(--primary-50); color: var(--text); padding: 12px; text-align: right;
  position: sticky; top: 0; z-index: 1;
}
.tbl td{ padding: 10px; border-bottom: 1px solid var(--border); }
.tbl tr:hover td{ background: rgba(0,0,0,.04); }

/* -------------------------------------------------
   11) پیام‌ها
   ------------------------------------------------- */
.alert{
  border-radius: 6px; padding: 10px 12px; border:1px solid var(--border);
  background: #fff;
}
.alert-success{ border-color: #bbf7d0; background: #f0fdf4; color:#166534; }
.alert-danger{  border-color: #fecaca; background: #fef2f2; color:#991b1b; }

/* -------------------------------------------------
   12) ابزارهای کمکی
   ------------------------------------------------- */
.mt-1{ margin-top: 6px; } .mt-2{ margin-top: 12px; } .mt-3{ margin-top: 18px; }
.mb-1{ margin-bottom: 6px; } .mb-2{ margin-bottom: 12px; } .mb-3{ margin-bottom: 18px; }
.flex{ display: flex; } .aic{ align-items: center; } .jcsb{ justify-content: space-between; }
.center{ text-align: center; }

/* -------------------------------------------------
   13) دسترس‌پذیری
   ------------------------------------------------- */
:focus-visible{ outline: 2px solid var(--primary); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce){
  *{ animation: none !important; transition: none !important; }
}

/* -------------------------------------------------
   14) ریسپانسیو
   ------------------------------------------------- */

/* -------------------------------------------------
   Auth Experience
   ------------------------------------------------- */
.auth-shell{
  display: grid;
  grid-template-columns: minmax(0,1.1fr) minmax(0,420px);
  gap: 32px;
  align-items: stretch;
  margin: 40px 0 56px;
  width: 100%;
  max-width: 100%;
}
.auth-shell > :only-child{
  grid-column: 1 / -1;
}
.auth-hero{
  position: relative;
  padding: 36px 32px;
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,.22) 0%, rgba(255,255,255,0) 60%),
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 75%, transparent), color-mix(in srgb, var(--primary-600) 85%, transparent));
  color: #fff;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
  min-height: 100%;
}
.hero-badge{
  align-self: flex-start;
  background: rgba(255,255,255,.18);
  color: #fff;
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
}
.auth-hero h1{
  margin: 0;
  font-size: 30px;
  line-height: 1.35;
}
.auth-hero p{
  margin: 0;
  font-size: 15px;
  color: rgba(255,255,255,.82);
  max-width: 520px;
}
.hero-highlights{
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0 0;
  padding: 0;
}
.hero-highlights li{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(15,23,42,.28);
  color: rgba(255,255,255,.92);
  font-weight: 500;
  backdrop-filter: blur(6px);
}
.hero-highlights li::before{
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.85);
  flex-shrink: 0;
}
.hero-footnote{
  margin-top: auto;
  font-size: 13px;
  line-height: 1.8;
  color: rgba(255,255,255,.72);
  max-width: 520px;
}
.auth-card{
  padding: 32px 36px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.auth-card-header h2{
  margin: 0;
  font-size: 24px;
}
.auth-card-header p{
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}
.auth-badge{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-50);
  color: var(--primary-600);
  border-radius: 8px;
  padding: 4px 12px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .05em;
}
.auth-form{
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-form .form-field{
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-form-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(240px,1fr));
  gap: 16px;
  align-items: start;
}
.auth-form-grid .form-field{
  height: 100%;
}
.auth-form label{
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
}
.auth-form input{
  border-radius: 6px;
}
.auth-form .form-captcha{
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.auth-form .captcha-box{
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.auth-form .captcha-question{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--primary-600);
  color: #111827;
  font-weight: 600;
  white-space: nowrap;
}
.auth-form .captcha-box input{
  flex: 1;
  min-width: 120px;
}
.auth-form .captcha-tip{
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.input-password{
  display: flex;
  align-items: center;
  gap: 10px;
}
.input-password input{
  flex: 1;
}
.input-password .auth-toggle{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.72);
  color: var(--muted);
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.input-password .auth-toggle:hover,
.input-password .auth-toggle.is-active{
  background: var(--primary-600);
  border-color: var(--primary-600);
  color: #111827;
}
.input-password .auth-toggle:focus-visible{
  outline: none;
  box-shadow: var(--focus-ring);
}
.form-hint{
  font-size: 12px;
  color: var(--muted);
  margin-top: -4px;
}
.btn-full{
  width: 100%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.auth-meta{
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-radius: 8px;
  border: 1px dashed color-mix(in srgb, var(--primary) 45%, transparent);
  background: color-mix(in srgb, var(--primary-50) 40%, white 60%);
  padding: 20px 22px;
}
.auth-meta strong{
  display: block;
  margin-bottom: 6px;
  color: var(--primary-600);
  font-size: 14px;
}
.auth-meta p{
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}
.auth-alert{
  margin: 0;
}
@media (max-width: 1100px){
  .auth-shell{
    grid-template-columns: minmax(0,1fr);
    margin: 28px 0 48px;
  }
  .auth-card{
    padding: 28px 30px;
  }
  .auth-hero{
    order: 2;
    padding: 32px 30px;
  }
}
@media (max-width: 640px){
  .auth-shell{
    gap: 24px;
    margin: 24px 0 40px;
  }
  .auth-card{
    padding: 24px;
  }
  .hero-highlights li{
    font-size: 14px;
    padding: 10px 14px;
  }
  .input-password{
    flex-direction: column;
    align-items: stretch;
  }
  .input-password .auth-toggle{
    width: 100%;
  }
}

/* -------------------------------------------------
   Print Overrides
   ------------------------------------------------- */
@media print{
  .phx-header, .theme-toggle { display:none !important; }
  .wrap{ max-width: 100%; padding: 0; }
  .card, .table-wrap{ box-shadow: none; border-color: #ddd; }
}



/* ===== No-Shift RTL Scrollbar Compensation ===== */
/* پوشش داده شده در ابتدای فایل با scrollbar-gutter + fallback */

.theme-toggle {
  cursor: pointer;
  background: linear-gradient(135deg, #4f46e5, #3b82f6);
  border: none;
  border-radius: 50px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background: linear-gradient(135deg, #6366f1, #2563eb);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.25);
}

.theme-toggle:active {
  transform: scale(0.95);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* وقتی theme-toggle همراه با کلاس btn استفاده می‌شود، از استایل دکمه‌های دیگر استفاده کند */
.btn.theme-toggle,
.btn.btn-secondary.theme-toggle {
  background: linear-gradient(135deg, #14b8a6, #0d9488) !important;
  border-radius: 6px !important;
  padding: 10px 16px !important;
  box-shadow: 0 6px 20px rgba(0,0,0,.2) !important;
  transition: box-shadow .2s ease, transform .12s ease !important;
  font-size: inherit !important;
}

.btn.theme-toggle:hover,
.btn.btn-secondary.theme-toggle:hover {
  background: linear-gradient(135deg, #14b8a6, #0d9488) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 10px 28px rgba(0,0,0,.25) !important;
}

.btn.theme-toggle:active,
.btn.btn-secondary.theme-toggle:active {
  transform: none !important;
  box-shadow: 0 6px 20px rgba(0,0,0,.2) !important;
}


/* ====== Anti-shift for calc form (RTL-safe) ====== */

/* 1) کارت پارامترها: هیچ تغییری موقع :focus / :active باعث ری‌فلو نشه */
.calc-form .card, .criteria-grid, .crit-col { min-width: 0; }
.criteria-grid { align-items: stretch; }

.crit-col { border: 1px solid var(--border); border-radius: 6px; }
.crit-col:focus-within { outline: 2px solid color-mix(in srgb, var(--primary), transparent 70%); outline-offset: 2px; }
.crit-col, .crit-col * { transition: background-color .15s ease, color .15s ease, box-shadow .15s ease; }
.crit-col.is-clickable { cursor: pointer; }
.crit-col.is-clickable input,
.crit-col.is-clickable .crit-active,
.crit-col.is-clickable .coef { cursor: auto; }
.crit-col.is-active { border-color: color-mix(in srgb, var(--primary) 60%, transparent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent); background-color: color-mix(in srgb, var(--primary) 6%, var(--surface) 94%); }
.crit-col.manager-mode.is-active { background-color: color-mix(in srgb, var(--primary) 10%, var(--surface) 90%); }
.crit-col .coef.disabled { opacity: .6; background-color: color-mix(in srgb, var(--surface) 92%, white 8%); }
.jalali-input.is-invalid {
  border-color: #e63946;
  box-shadow: 0 0 0 2px color-mix(in srgb, #e63946 25%, transparent);
}

/* ورودی‌ها: مرز همیشه یکسان؛ transform و تغییر وزن ممنوع */
.crit-col input, .crit-col label { font-weight: 500; }
.crit-col input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,0,0,.08); outline: 0; }
.crit-col input:active { transform: none !important; }

/* 2) نمایش/مخفی‌شدن خطا و کارت نتیجه بدون تکان عرضی صفحه */
#coef_error { min-height: 0; }
#result_card { will-change: contents; }

/* 3) اگر با ظاهر شدن نتیجه اسکرول‌بار ایجاد می‌شود، محتوای اصلی همیشه فضای کافی داشته باشد */
.shell { min-height: calc(100vh - 140px); } /* با layout خودت تنظیمش کن */

/* 4) جلوگیری از اسکرول افقی ناگهانی در این بخش */
.calc-form, .calc-form .card { overflow-x: hidden; }

/* Result card should span full width of the 2-column grid */
.calc-form #result_card { grid-column: 1 / -1; }

/* روی موبایل هم که تک‌ستونه است، مشکلی نیست؛ ولی برای اطمینان: */
@media (max-width: 992px){
  .calc-form #result_card { grid-column: auto; }
}


/* Unit edit overrides */
.unit-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
  margin-bottom: 16px;
}
.unit-details .detail-card {
  background: var(--card);
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  border-radius: 8px;
  padding: 14px 16px;
  line-height: 1.6;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.unit-details .detail-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--primary);
  font-weight: 600;
}
.unit-details .detail-card .detail-note {
  display: block;
  font-size: .85rem;
  color: var(--muted);
}
.unit-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 18px;
}
@media (max-width: 720px){
  .unit-form {
    grid-template-columns: 1fr;
  }
}
.unit-form .form-hint {
  grid-column: 1 / -1;
  font-size: .85rem;
  color: var(--muted);
  margin: 0;
}
.unit-form .full-span {
  grid-column: 1 / -1;
}
.unit-form .checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.unit-form .checkbox-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.unit-form .unit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}
.unit-form .unit-actions button {
  min-width: 140px;
}

/* ====== Auth Action Cards (Login Page) ====== */
.auth-action-card {
  background: linear-gradient(135deg, var(--card) 0%, color-mix(in srgb, var(--primary) 3%, var(--card)) 100%);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  margin: 16px 0;
}

.auth-action-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.auth-action-card-secondary {
  background: linear-gradient(135deg, var(--card) 0%, color-mix(in srgb, var(--success) 3%, var(--card)) 100%);
}

.auth-action-icon {
  font-size: 2.5rem;
  line-height: 1;
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border-radius: 8px;
  transition: transform .3s ease;
}

.auth-action-card:hover .auth-action-icon {
  transform: scale(1.1) rotate(5deg);
}

.auth-action-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-action-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}

.auth-action-desc {
  margin: 0;
  font-size: .9rem;
  color: var(--muted);
  line-height: 1.6;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-radius: 6px;
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 4px;
  position: relative;
  overflow: hidden;
}

.btn-action::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  background: rgba(255,255,255,.15);
  transition: width .3s ease;
  z-index: 0;
}

.btn-action:hover::before {
  width: 100%;
}

.btn-action > span {
  position: relative;
  z-index: 1;
}

.btn-primary-action {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-600) 100%);
  color: white;
  border: 2px solid transparent;
}

.btn-primary-action:hover {
  box-shadow: var(--shadow-hover);
  transform: translateX(-4px);
  border-color: rgba(255,255,255,.3);
}

.btn-secondary-action {
  background: linear-gradient(135deg, var(--success) 0%, #15803d 100%);
  color: white;
  border: 2px solid transparent;
}

.btn-secondary-action:hover {
  box-shadow: 0 14px 40px rgba(22,163,74,.3);
  transform: translateX(-4px);
  border-color: rgba(255,255,255,.3);
}

.btn-tertiary-action {
  background: linear-gradient(135deg, var(--tertiary) 0%, var(--tertiary-600) 100%);
  color: white;
  border: 2px solid transparent;
}

.btn-tertiary-action:hover {
  box-shadow: 0 14px 40px color-mix(in srgb, var(--tertiary) 35%, transparent);
  transform: translateX(-4px);
  border-color: rgba(255,255,255,.3);
}

.auth-action-card-tertiary {
  background: linear-gradient(135deg, var(--card) 0%, color-mix(in srgb, var(--tertiary) 3%, var(--card)) 100%);
}

.btn-action-arrow {
  font-size: 1.2em;
  transition: transform .25s ease;
  display: inline-block;
}

.btn-action:hover .btn-action-arrow {
  transform: translateX(-6px);
}

.auth-divider {
  text-align: center;
  margin: 24px 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.auth-divider span {
  padding: 0 16px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 600;
  background: var(--card);
  position: relative;
}

@media (max-width: 640px) {
  .auth-action-card {
    flex-direction: column;
    text-align: center;
    gap: 16px;
    padding: 20px;
  }
  
  .auth-action-icon {
    margin: 0 auto;
  }
  
.btn-action {
    width: 100%;
  }
}

/* -------------------------------------------------
   Dashboard KPI grid & panels (modern SaaS)
   ------------------------------------------------- */
.dashboard-overview{
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.kpi-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.kpi-card-wide{
  grid-column: 1 / -1;
}

@media (max-width: 1100px){
  .kpi-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi-card-wide{
    grid-column: span 1;
  }
}

@media (max-width: 720px){
  .kpi-grid{
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  
  .kpi-card{
    padding: 10px 6px;
    gap: 6px;
  }
  
  .kpi-header{
    gap: 0;
    justify-content: center;
  }
  
  .kpi-icon{
    display: none;
  }
  
  .kpi-title{
    font-size: 11px;
    text-align: center;
    line-height: 1.3;
    font-weight: 600;
  }
  
  .kpi-value{
    font-size: 20px;
    text-align: center;
    line-height: 1.2;
  }
  
  .kpi-meta{
    font-size: 10px;
    display: none;
  }
  
  .kpi-card-wide{
    grid-column: span 3;
  }
}

@media (max-width: 480px){
  .kpi-grid{
    gap: 6px;
  }
  
  .kpi-card{
    padding: 8px 4px;
    gap: 4px;
    min-width: 0;
  }
  
  .kpi-header{
    justify-content: center;
    gap: 0;
  }
  
  .kpi-icon{
    display: none;
  }
  
  .kpi-title{
    font-size: 10px;
    text-align: center;
    line-height: 1.3;
    font-weight: 600;
  }
  
  .kpi-value{
    font-size: 18px;
    text-align: center;
    line-height: 1.2;
  }
}

@media (max-width: 360px){
  .kpi-grid{
    gap: 4px;
  }
  
  .kpi-card{
    padding: 6px 3px;
    gap: 3px;
  }
  
  .kpi-header{
    justify-content: center;
    gap: 0;
  }
  
  .kpi-icon{
    display: none;
  }
  
  .kpi-title{
    font-size: 9px;
    text-align: center;
    line-height: 1.3;
    font-weight: 600;
  }
  
  .kpi-value{
    font-size: 16px;
    text-align: center;
    line-height: 1.2;
  }
}

.kpi-card{
  --kpi-accent: #1b3c59;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}

.kpi-card.is-teal{ --kpi-accent: #1f6f5f; }
.kpi-card.is-navy{ --kpi-accent: #1b3c59; }
.kpi-card.is-red{ --kpi-accent: #d9534f; }

.kpi-card:hover{
  box-shadow: 0 8px 18px rgba(0,0,0,0.06);
  transform: translateY(-1px);
  border-color: #d5d9dd;
}

.kpi-header{
  display: flex;
  align-items: center;
  gap: 10px;
  color: #4b5563;
  font-weight: 700;
}

.kpi-icon{
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f8f9fa;
  display: grid;
  place-items: center;
  color: #6b7280;
}

.kpi-icon svg{
  width: 20px;
  height: 20px;
}

.kpi-title{
  font-size: 14px;
  color: #1b3c59;
}

.kpi-value{
  font-size: 32px;
  font-weight: 800;
  color: var(--kpi-accent);
  line-height: 1.2;
}

.kpi-meta{
  font-size: 13px;
  color: #6b7280;
  line-height: 1.6;
}

.kpi-progress{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-progress-track{
  width: 100%;
  height: 6px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.kpi-progress-fill{
  height: 100%;
  background: #1f6f5f;
  border-radius: 999px;
  transition: width .25s ease;
}

.kpi-progress-label{
  font-size: 12px;
  color: #4b5563;
}

.dashboard-panel{
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  padding: 18px 20px;
}

.dashboard-panel .panel-heading{
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.dashboard-panel .panel-icon{
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f8f9fa;
  color: #1b3c59;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.dashboard-panel .panel-title{
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: #1b3c59;
}

.dashboard-panel .panel-subtitle{
  margin: 0;
  font-size: 13px;
  color: #6b7280;
}

/* ============================================
   تابلو اعلانات ساختمان (Building Bulletin Board)
   ============================================ */

.bb-section {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  padding: 24px;
  margin-top: 0;
  margin-bottom: 0;
}

.bb-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.bb-header-title h3 {
  margin: 0 0 4px 0;
  font-size: 20px;
  font-weight: 800;
  color: #1e293b;
}

.bb-building-name {
  font-size: 14px;
  color: #64748b;
  font-weight: 600;
}

.bb-btn-create {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
}

.bb-filters-wrapper {
  margin-bottom: 20px;
}

.bb-search-box {
  position: relative;
  margin-bottom: 12px;
}

.bb-search-input {
  width: 100%;
  padding: 10px 40px 10px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: #ffffff;
  direction: rtl;
}

.bb-search-input:focus {
  outline: none;
  border-color: #1f6f5f;
  box-shadow: 0 0 0 3px rgba(31, 111, 95, 0.1);
}

.bb-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.bb-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}

.bb-filter-pill {
  padding: 8px 16px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  position: relative;
}

.bb-filter-pill:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.bb-filter-pill.active {
  background: #1f6f5f;
  color: #ffffff;
  border-color: #1f6f5f;
  box-shadow: 0 2px 8px rgba(31, 111, 95, 0.3);
}

.bb-content-wrapper {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
}

.bb-announcements {
  min-width: 0;
}

.bb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.bb-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  cursor: pointer;
}

.bb-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  transform: translateY(-4px);
  border-color: #cbd5e1;
}

.bb-card:active {
  transform: translateY(-2px);
}

.bb-pinned-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: #fef3c7;
  color: #92400e;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.bb-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.bb-type-icon {
  font-size: 18px;
}

.bb-type-label {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}

.bb-priority-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid;
}

.bb-card-body {
  margin-bottom: 12px;
}

.bb-card-title {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.4;
}

.bb-card-text {
  margin: 0;
  font-size: 13px;
  color: #475569;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bb-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
  gap: 12px;
  flex-wrap: wrap;
}

.bb-card-footer-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.bb-card-footer-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.bb-card-date {
  font-size: 12px;
  color: #94a3b8;
}

.bb-card-creator {
  font-size: 11px;
  color: #cbd5e1;
}

.bb-btn-view,
.bb-btn-edit,
.bb-btn-archive {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.bb-btn-view:hover {
  background: #eff6ff;
  color: #2563eb;
}

.bb-btn-edit:hover {
  background: #fef3c7;
  color: #d97706;
}

.bb-btn-archive:hover {
  background: #fef2f2;
  color: #dc2626;
}

.bb-empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #94a3b8;
}

.bb-empty-state svg {
  margin: 0 auto 16px;
  color: #cbd5e1;
}

.bb-empty-state p {
  margin: 0 0 16px;
  font-size: 14px;
}

.bb-timeline {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  height: fit-content;
  position: sticky;
  top: 20px;
}

.bb-timeline-title {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
}

.bb-timeline-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bb-timeline-item {
  display: flex;
  gap: 12px;
  position: relative;
  padding-right: 8px;
}

.bb-timeline-item:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 5px;
  top: 20px;
  bottom: -16px;
  width: 2px;
  background: #e5e7eb;
}

.bb-timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1f6f5f;
  border: 2px solid #ffffff;
  flex-shrink: 0;
  margin-top: 4px;
  position: relative;
  z-index: 1;
}

.bb-timeline-content {
  flex: 1;
  min-width: 0;
}

.bb-timeline-text {
  font-size: 13px;
  color: #1e293b;
  line-height: 1.5;
  margin-bottom: 4px;
}

.bb-timeline-time {
  font-size: 11px;
  color: #94a3b8;
}

.bb-timeline-empty {
  text-align: center;
  padding: 24px;
  color: #94a3b8;
  font-size: 13px;
}

/* مودال */
.bb-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.bb-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease-out;
}

.bb-modal-content {
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.bb-modal-content {
  position: relative;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1;
}

.bb-modal-large {
  max-width: 800px;
}

.bb-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
}

.bb-modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: #1e293b;
}

.bb-modal-close {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bb-modal-close:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.bb-form-group {
  margin-bottom: 16px;
}

.bb-form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.bb-form-group .required {
  color: #ef4444;
}

.bb-form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.bb-form-control:focus {
  outline: none;
  border-color: #1f6f5f;
  box-shadow: 0 0 0 3px rgba(31, 111, 95, 0.1);
}

.bb-form-help {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
}

.bb-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.bb-form-group input[type="checkbox"] {
  margin-left: 8px;
}

.bb-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid #e5e7eb;
}

/* استایل‌های مشاهده جزئیات اعلان */
.bb-view-content {
  padding: 24px;
}

.bb-loading {
  text-align: center;
  padding: 40px;
  color: #94a3b8;
  font-size: 14px;
}

.bb-error {
  text-align: center;
  padding: 40px;
  color: #dc2626;
  font-size: 14px;
}

.bb-view-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.bb-view-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.bb-view-building {
  font-size: 13px;
  color: #64748b;
  margin-top: 8px;
}

.bb-view-body {
  margin-bottom: 24px;
}

.bb-view-body h2 {
  margin: 0 0 16px 0;
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.4;
}

.bb-view-text {
  font-size: 15px;
  color: #475569;
  line-height: 1.8;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.bb-view-footer {
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: #64748b;
}

.bb-view-footer div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bb-view-footer strong {
  color: #1e293b;
  min-width: 100px;
}

/* ریسپانسیو */
@media (max-width: 1024px) {
  .bb-content-wrapper {
    grid-template-columns: 1fr;
  }
  
  .bb-timeline {
    position: static;
  }
}

@media (max-width: 768px) {
  .bb-section {
    padding: 16px;
  }
  
  .bb-grid {
    grid-template-columns: 1fr;
  }
  
  .bb-filters {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .bb-form-row {
    grid-template-columns: 1fr;
  }
  
  .bb-modal-content {
    max-width: 100%;
    margin: 16px;
  }
}

@media (max-width: 500px) {
  .bb-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .bb-btn-create {
    width: 100%;
    justify-content: center;
  }
}

/* ========================================
   Accordion System (Phoenix) - Enhanced UI/UX
   ======================================== */
.phx-accordion {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
}

.phx-acc-item {
  background: var(--card);
  border: none;
  border-radius: 0;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: none;
  position: relative;
  margin-bottom: 0;
}

.phx-acc-item + .phx-acc-item {
  border-top: 1px solid var(--border);
}

.phx-acc-item::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 0;
  background: linear-gradient(180deg, var(--primary), var(--primary-600));
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0;
  z-index: 1;
}

.phx-acc-item:first-child::before {
  border-top-right-radius: 12px;
}

.phx-acc-item:last-child::before {
  border-bottom-right-radius: 12px;
}

.phx-acc-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.phx-acc-item.is-active {
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(31, 111, 95, 0.12), 0 4px 8px rgba(31, 111, 95, 0.08);
}

.phx-acc-item.is-active::before {
  height: 100%;
}

.phx-acc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 18px;
  cursor: pointer;
  user-select: none;
  /* هدر تیره‌تر از بادی آکاردئون برای تمایز واضح‌تر */
  background: color-mix(in srgb, var(--card) 75%, #d1d5db 25%);
  border: none;
  width: 100%;
  text-align: right;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  position: relative;
  z-index: 2;
  min-height: 48px;
}

.phx-acc-header:hover {
  background: linear-gradient(to left, var(--primary-50) 0%, transparent 100%);
}

.phx-acc-header:active {
  transform: scale(0.995);
}

.phx-acc-header:focus-visible {
  box-shadow: inset 0 0 0 3px rgba(31, 111, 95, 0.15);
  background: linear-gradient(to left, var(--primary-50) 0%, transparent 100%);
}

.phx-acc-header.is-open {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to left, rgba(31, 111, 95, 0.03) 0%, transparent 100%);
}

.phx-acc-header-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.phx-acc-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  line-height: 1.4;
  letter-spacing: -0.01em;
  transition: color 0.2s ease;
}

.phx-acc-header.is-open .phx-acc-title {
  color: var(--primary);
}

.phx-acc-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
  font-weight: 500;
}

.phx-acc-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-right: 16px;
  flex-shrink: 0;
}

.phx-acc-badge {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.phx-acc-badge.badge--danger,
.phx-acc-badge.badge-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  border: none;
}

.phx-acc-badge.badge--warning,
.phx-acc-badge.badge-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border: none;
}

.phx-acc-badge.badge--success,
.phx-acc-badge.badge-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border: none;
}

.phx-acc-badge.badge {
  background: linear-gradient(135deg, var(--primary), var(--primary-600));
  color: #ffffff;
  border: none;
}

.phx-acc-header:hover .phx-acc-badge {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.phx-acc-chevron {
  color: var(--muted);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: transparent;
}

.phx-acc-header:hover .phx-acc-chevron {
  color: var(--primary);
  background: rgba(31, 111, 95, 0.08);
}

.phx-acc-header.is-open .phx-acc-chevron {
  transform: rotate(180deg);
  color: var(--primary);
  background: rgba(31, 111, 95, 0.12);
}

.phx-acc-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
}

/* برای تابلو اعلانات (acc_noticeboard)، ارتفاع بدنه اصلی را در حالت باز محدود نکن
   تا بتواند محتوای اکاردیون‌های داخلی (تابلو اعلانات هر ساختمان) را کامل نمایش دهد. */
.phx-acc-item[data-acc-id="acc_noticeboard"] > .phx-acc-body.is-open {
  max-height: none !important;
}

/* برای اکاردیون‌های ساختمان در داشبورد (bulletin_buildings)، ارتفاع بدنه را در حالت
   باز محدود نکن تا محتوای بلند هر ساختمان کاملاً قابل مشاهده باشد (مشکل بریده شدن
   محتوا وقتی همه اکاردیون‌ها بسته هستند و یکی باز می‌شود). */
.phx-acc-item[data-group="bulletin_buildings"] > .phx-acc-body.is-open {
  max-height: none !important;
}

/* برای اکاردیون‌های صفحه هاب ساختمان (building_hub)، ارتفاع بدنه را در حالت باز
   آزاد می‌کنیم تا فرم‌ها و جداول بلند داخل هر بخش (اسکلت ساختمان، تنظیمات جریمه و ...)
   کامل نمایش داده شوند. */
.phx-acc-item[data-group="building_hub"] > .phx-acc-body.is-open {
  max-height: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .phx-acc-body,
  .phx-acc-chevron,
  .phx-acc-item,
  .phx-acc-header,
  .phx-acc-badge {
    transition: none;
  }
  
  .phx-acc-item:hover {
    transform: none;
  }
  
  .phx-acc-header:active {
    transform: none;
  }
}

.phx-acc-body.is-open {
  max-height: 10000px;
  opacity: 1;
  padding-top: 0;
}

.phx-acc-inner {
  padding: 10px 18px;
  animation: fadeInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .phx-acc-inner {
    animation: none;
  }
}

/* برای جداول داخل accordion */
.phx-acc-inner .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.phx-acc-inner .tbl {
  width: 100%;
  min-width: 600px;
}

/* برای چارت‌ها داخل accordion */
.phx-acc-inner canvas {
  max-width: 100%;
  height: auto;
}

/* Dark theme support */
html.theme-dark .phx-acc-item {
  background: var(--card);
  border-color: var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

html.theme-dark .phx-acc-item:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  border-color: var(--border-strong);
}

html.theme-dark .phx-acc-item.is-active {
  box-shadow: 0 12px 32px rgba(192, 132, 252, 0.2), 0 4px 12px rgba(192, 132, 252, 0.15);
}

html.theme-dark .phx-acc-header:hover {
  background: linear-gradient(to left, rgba(192, 132, 252, 0.1) 0%, transparent 100%);
}

html.theme-dark .phx-acc-header.is-open {
  background: linear-gradient(to left, rgba(192, 132, 252, 0.08) 0%, transparent 100%);
  border-bottom-color: var(--border);
}

html.theme-dark .phx-acc-title {
  color: var(--text);
}

html.theme-dark .phx-acc-header.is-open .phx-acc-title {
  color: var(--primary);
}

html.theme-dark .phx-acc-subtitle {
  color: var(--muted);
}

html.theme-dark .phx-acc-header:hover .phx-acc-chevron {
  background: rgba(192, 132, 252, 0.15);
}

html.theme-dark .phx-acc-header.is-open .phx-acc-chevron {
  background: rgba(192, 132, 252, 0.2);
}

html.theme-dark .phx-acc-item::before {
  background: linear-gradient(180deg, var(--primary), var(--primary-600));
}

/* Cool theme support */
html.theme-cool .phx-acc-item {
  background: var(--card);
  border-color: var(--border);
}

html.theme-cool .phx-acc-header:hover {
  background: linear-gradient(to left, var(--primary-50) 0%, transparent 100%);
}

html.theme-cool .phx-acc-header.is-open {
  background: linear-gradient(to left, rgba(31, 111, 95, 0.04) 0%, transparent 100%);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .phx-accordion {
    gap: 0;
  }
  
  .phx-acc-item {
    border-radius: 0;
  }
  
  .phx-acc-item:first-child {
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
  }
  
  .phx-acc-item:last-child {
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
  }
  
  .phx-acc-header {
    padding: 12px 16px;
    min-height: 52px;
  }
  
  .phx-acc-title {
    font-size: 16px;
  }
  
  .phx-acc-subtitle {
    font-size: 12px;
  }
  
  .phx-acc-inner {
    padding: 14px 16px;
  }
  
  .phx-acc-header-right {
    margin-right: 12px;
    gap: 12px;
  }
  
  .phx-acc-badge {
    padding: 5px 12px;
    font-size: 11px;
  }
  
  .phx-acc-chevron {
    width: 22px;
    height: 22px;
  }
}

@media (max-width: 500px) {
  .phx-acc-header {
    padding: 12px 14px;
    min-height: auto;
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .phx-acc-header-left {
    width: 100%;
    order: 1;
  }
  
  .phx-acc-header-right {
    width: 100%;
    justify-content: space-between;
    margin-right: 0;
    order: 2;
    margin-top: 4px;
  }
  
  .phx-acc-inner {
    padding: 12px 14px;
  }
  
  .phx-acc-title {
    font-size: 15px;
  }
}

