/* ===== نرم‌افزار مدیریت مدرسه — پوسته مدرن ===== */
@font-face {
  font-family: Vazirmatn;
  src: url("/assets/fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Vazirmatn;
  src: url("/assets/fonts/Vazirmatn-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: Vazirmatn;
  src: url("/assets/fonts/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #eef1f6;
  --paper: #ffffff;
  --ink: #17252d;
  --muted: #64748b;
  --line: #e2e8f0;
  --side: #0d3b34;
  --side-2: #14584c;
  --accent: #d97706;
  --accent-2: #059669;
  --good: #059669;
  --warn: #d97706;
  --bad: #dc2626;
  --info: #2563eb;
  --gold: #f59e0b;
  --ring: rgba(5, 150, 105, .18);
  --shadow: 0 1px 2px rgba(23, 37, 45, .05), 0 8px 24px rgba(23, 37, 45, .07);
  --shadow-lg: 0 24px 60px rgba(13, 59, 52, .22);

  /* --- دیزاین توکن‌ها: شعاع، فاصله و آیکون — یک منبع واحد برای همه‌جا --- */
  --radius-xs: 8px;   /* چیپ‌ها و دکمه‌های ریز */
  --radius-sm: 11px;  /* ورودی‌ها و دکمه‌های sm */
  --radius-md: 13px;  /* آیتم‌های منو و پیل‌ها */
  --radius-lg: 16px;  /* کارت‌ها و جعبه‌های مسیر */
  --radius-xl: 20px;  /* مودال و کارد بزرگ */
  --radius-full: 999px;
  --gap: 12px;        /* فاصله استاندارد داخل ردیف‌ها */
  --gap-lg: 16px;     /* فاصله بین کارت‌ها */
  --pad-card: 20px;   /* پدینگ کارت */
  --dur: .18s;        /* مدت استاندارد ترنزیشن */
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  display: flex;
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(5, 150, 105, .08), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(217, 119, 6, .07), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: Vazirmatn, Tahoma, sans-serif;
  font-size: 15px;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c7d0dc; border-radius: var(--radius-xs); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #aab6c6; }

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

/* ===== سایدبار (سمت راست، همیشه تمام‌قد و ثابت هنگام اسکرول) ===== */
.sidebar {
  width: 252px;
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  overflow-y: auto;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26'%3E%3Ccircle cx='3' cy='3' r='1.2' fill='%23ffffff' fill-opacity='.05'/%3E%3Ccircle cx='16' cy='16' r='1.2' fill='%23ffffff' fill-opacity='.05'/%3E%3C/svg%3E"),
    radial-gradient(400px 260px at 0% 0%, rgba(245, 158, 11, .14), transparent 60%),
    linear-gradient(200deg, #124d42 0%, var(--side) 45%, #082621 100%);
  color: #f4efe6;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  flex-shrink: 0;
  box-shadow: -6px 0 30px rgba(8, 38, 33, .25);
}
.brand { display: flex; gap: 14px; align-items: center; padding: 12px 10px 26px; position: relative; }
.brand::after {
  content: ''; position: absolute; right: 10px; left: 10px; bottom: 10px; height: 1.5px;
  background: linear-gradient(90deg, transparent, rgba(251, 191, 36, .45), transparent);
}
.brand-logo {
  width: 54px; height: 54px; border-radius: var(--radius-lg); object-fit: cover; background: #000; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, .4), 0 10px 26px rgba(245, 158, 11, .35);
  animation: logoGlow 4.5s ease-in-out infinite;
  transition: transform .25s ease;
}
.brand-logo:hover { transform: scale(1.06) rotate(-2deg); }
@keyframes logoGlow {
  0%, 100% { box-shadow: 0 0 0 2px rgba(251, 191, 36, .35), 0 8px 22px rgba(245, 158, 11, .28); }
  50% { box-shadow: 0 0 0 2px rgba(251, 191, 36, .6), 0 12px 32px rgba(245, 158, 11, .55); }
}
.brand strong { display: block; font-size: 15px; }
.brand span { display: block; font-size: 12px; opacity: .65; }
/* برند Choroma: متن طلایی گرادیانی + سال در قاب ظریف */
#brand-title {
  display: block; font-size: 22px !important; font-weight: 800 !important; line-height: 1.2;
  letter-spacing: .5px;
  background: linear-gradient(115deg, #fef3c7 5%, #fbbf24 45%, #f59e0b 75%, #b45309 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent !important;
  filter: drop-shadow(0 2px 6px rgba(245, 158, 11, .35));
}
#brand-year {
  display: inline-block; margin-top: 6px !important; font-size: 11.5px !important; opacity: 1 !important;
  color: #e7f0eb; background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(251, 191, 36, .3); border-radius: 999px; padding: 2.5px 12px;
  backdrop-filter: blur(4px);
}
.sidebar nav { display: flex; flex-direction: column; gap: 5px; flex: 1; }
.sidebar nav a {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  text-decoration: none; padding: 11px 13px; border-radius: var(--radius-md);
  color: #dce8e2; opacity: .8; font-weight: 500;
  transition: background .18s, opacity .18s, transform .18s;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, .07); opacity: 1; transform: translateX(-2px); }
.sidebar nav a.active {
  background: linear-gradient(120deg, rgba(251, 191, 36, .18), rgba(255, 255, 255, .06));
  color: #fde68a; opacity: 1;
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, .25);
}
.sidebar nav a.active::before {
  content: ''; position: absolute; right: -14px; top: 20%; bottom: 20%;
  width: 4px; border-radius: 4px 0 0 4px; background: var(--gold);
}
.sidebar nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; flex-shrink: 0; }
.sidebar-foot {
  font-size: 12px; opacity: .8; padding: 12px; margin-top: 10px; line-height: 1.7;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .09);
  border-radius: var(--radius-md);
}
.sidebar-foot.warn { background: rgba(220, 38, 38, .18); border-color: rgba(220, 38, 38, .35); }
.sidebar-foot.about-box { font-size: 11.5px; opacity: 1; line-height: 1.9; }
.sidebar-foot.about-box strong { color: #fde68a; }
.sidebar-foot.about-box a { color: #fbbf24; font-weight: 700; text-decoration: none; }
.sidebar-foot.about-box a:hover { text-decoration: underline; }
.sidebar-foot .side-btn {
  background: rgba(255, 255, 255, .13);
  color: #f4efe6;
  border: 1px solid rgba(255, 255, 255, .25);
  box-shadow: none;
  margin-top: 6px;
  width: 100%;
}
.sidebar-foot .side-btn:hover {
  background: rgba(251, 191, 36, .25);
  border-color: rgba(251, 191, 36, .5);
  color: #fde68a;
}

/* ===== بدنه اصلی ===== */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-right: 252px; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 30px 10px;
  flex-wrap: wrap; /* در صفحه باریک، چیپ‌ها به خط بعد بروند نه اینکه بیرون بزنند */
}
.topbar h1 {
  font-size: 23px; margin: 0; flex: 1; font-weight: 700; letter-spacing: -.01em;
  min-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar h1::after {
  content: ''; display: block; width: 44px; height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent-2), var(--gold)); margin-top: 6px;
}
.topbar-date {
  color: var(--side); font-weight: 700; font-size: 13.5px;
  background: linear-gradient(120deg, #ecfdf5, #fef3c7);
  border: 1px solid #d1e7dd;
  padding: 9px 16px; border-radius: 999px;
  box-shadow: var(--shadow);
  white-space: nowrap;
}
.topbar-clock {
  font-weight: 700; font-size: 14px; color: var(--side);
  background: linear-gradient(120deg, #eff6ff, #ecfdf5);
  border: 1px solid #bfdbfe;
  padding: 9px 16px; border-radius: 999px;
  box-shadow: var(--shadow);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.icon-btn {
  border: 0; background: var(--paper); border-radius: var(--radius-sm);
  padding: 9px 13px; cursor: pointer; box-shadow: var(--shadow); font-size: 16px;
}
/* منوی همبرگری فقط در صفحه باریک لازم است؛ راهنما/حالت شب همیشه دیده می‌شوند */
#menu-btn { display: none; }
.view { padding: 12px 30px 40px; }

/* ===== شبکه‌ها و کارت‌ها ===== */
.grid { display: grid; gap: 16px; }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 1.4fr 1fr; }
.grid-dash { grid-template-columns: 1.3fr .9fr; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--pad-card);
  position: relative;
}
.card h2, .card h3 { margin: 0 0 14px; font-size: 16px; font-weight: 700; }
.card > h3:first-child::before, .card > h2:first-child::before {
  content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 3px;
  background: linear-gradient(135deg, var(--accent-2), var(--gold));
  margin-left: 9px; vertical-align: 2px;
}

/* کارت‌های آماری */
.stat { overflow: hidden; transition: transform .18s, box-shadow .18s; }
.stat::after {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--accent-2), var(--gold));
  opacity: 0; transition: opacity .18s;
}
.stat:hover { transform: translateY(-3px); box-shadow: 0 16px 34px rgba(23, 37, 45, .12); }
.stat:hover::after { opacity: 1; }
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stat .value { font-size: 32px; font-weight: 800; margin-top: 5px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat.good .value { color: var(--good); }
.stat.bad .value { color: var(--bad); }
.stat.warn .value { color: var(--warn); }

/* ===== دکمه‌ها ===== */
.btn {
  border: 0; border-radius: var(--radius-sm); padding: 10px 16px; cursor: pointer;
  background: linear-gradient(135deg, #116a5a, var(--side)); color: #fff; font-weight: 600;
  transition: transform .12s, filter .12s, box-shadow .12s;
  box-shadow: 0 4px 14px rgba(13, 59, 52, .25);
}
.btn:hover { filter: brightness(1.1); box-shadow: 0 6px 18px rgba(13, 59, 52, .3); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn.accent { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 4px 14px rgba(217, 119, 6, .3); }
.btn.good { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 4px 14px rgba(5, 150, 105, .3); }
.btn.danger { background: linear-gradient(135deg, #ef4444, #b91c1c); box-shadow: 0 4px 14px rgba(220, 38, 38, .3); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: var(--radius-sm); }
.btn.sel {
  background: linear-gradient(135deg, #116a5a, var(--side));
  color: #fff;
  box-shadow: 0 0 0 3px var(--ring);
}

/* دکمه‌های کنار فیلدهای دارای برچسب، هم‌خط با کادر ورودی قرار می‌گیرند */
.row:has(.field) { align-items: flex-end; }
.row:has(.field) > .btn { margin-bottom: 0.5px; }
.row:has(.field) > label:not(.field),
.row:has(.field) > span:not(.field) { padding-bottom: 11px; }

/* ===== فرم‌ها ===== */
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 140px; }
.field label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea {
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 10px 13px;
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent-2); box-shadow: 0 0 0 4px var(--ring);
}
.field textarea { min-height: 90px; resize: vertical; }

/* ===== جدول ===== */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: right; font-size: 12px; color: var(--muted); font-weight: 700;
  padding: 9px 8px; border-bottom: 2px solid var(--line);
  background: #f8fafc;
}
.table th:first-child { border-radius: 0 10px 10px 0; }
.table th:last-child { border-radius: var(--radius-sm) 0 0 10px; }
.table td { padding: 12px 9px; border-bottom: 1px solid #f1f5f9; text-align: right; transition: background var(--dur); }
.table td[dir="ltr"] { text-align: right; font-variant-numeric: tabular-nums; }
.table tr:hover td { background: #f8fafc; }
.clickable { cursor: pointer; }

/* ===== نشان‌ها ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3.5px 11px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
}
.badge.present, .badge.normal { background: #d1fae5; color: #065f46; }
.badge.absent, .badge.critical { background: #fee2e2; color: #991b1b; }
.badge.late, .badge.important { background: #fef3c7; color: #92400e; }
.badge.auto { background: #dbeafe; color: #1e40af; }
.badge.manual { background: #ede9fe; color: #5b21b6; }
.badge.success { background: #d1fae5; color: #065f46; }
.badge.failed { background: #fee2e2; color: #991b1b; }
.badge.good { background: #d1fae5; color: #065f46; }

/* ===== جستجوی زنده ===== */
.suggest { position: relative; }
.suggest-list {
  position: absolute; top: 100%; right: 0; left: 0; z-index: 20;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); max-height: 240px; overflow: auto; margin-top: 4px;
  padding: 4px;
}
.suggest-list button {
  display: block; width: 100%; text-align: right; border: 0; background: none;
  padding: 9px 12px; cursor: pointer; border-radius: var(--radius-sm);
}
.suggest-list button:hover { background: #ecfdf5; }
.suggest-list small { color: var(--muted); margin-right: 8px; }

/* ===== تقویم ===== */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal .wd {
  text-align: center; font-size: 12px; font-weight: 700; color: var(--muted);
  padding: 6px 4px; background: #f8fafc; border-radius: var(--radius-sm);
}
.cal .day {
  min-height: 78px; border-radius: var(--radius-sm); padding: 7px 8px; background: #fff;
  border: 1.5px solid #edf1f6; font-size: 13px; cursor: pointer;
  display: flex; flex-direction: column; justify-content: space-between; gap: 2px;
  transition: transform .13s ease, border-color .13s ease, box-shadow .13s ease;
}
.cal .day:hover { border-color: var(--accent-2); box-shadow: 0 6px 16px rgba(5, 150, 105, .14); transform: translateY(-1px); }
.cal .day.today { border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--ring); }
.cal .day.holiday, .cal .day.weekend { background: linear-gradient(160deg, #fef2f2, #fee2e2); border-color: #fecaca; }
.cal .day.holiday .day-num, .cal .day.weekend .day-num { color: #b91c1c; font-weight: 700; }
.cal .day.holiday:hover, .cal .day.weekend:hover { border-color: #f87171; box-shadow: 0 6px 16px rgba(220, 38, 38, .16); }
.cal .day.has-event { box-shadow: inset 0 -3px 0 var(--accent); }
.cal .day-num { font-weight: 600; }
.day-titles { display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.day-title {
  font-size: 10px; line-height: 1.55; color: #7a684d; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; font-weight: 500;
}
.day-title.hol { color: #b91c1c; font-weight: 700; }
.day-title.sch { color: #4f46e5; }
.day-more { font-size: 10px; color: var(--muted); font-weight: 600; }
/* تاریخ ریز میلادی و قمری در هر روز تقویم */
.day-alt {
  display: flex; justify-content: space-between; gap: 3px; margin-top: 1px;
  font-size: 8.5px; line-height: 1.3; color: #94a3b8; font-weight: 400;
}
.day-alt .gr, .day-alt .hj {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 48%;
}
.day-alt .hj { color: #a78bfa; }
.cal-legend {
  display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted);
  margin-bottom: 12px; align-items: center;
  background: #f8fafc; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 14px;
}
.lg { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-left: 4px; }
.lg-holiday { background: #dc2626; }
.lg-occasion { background: #d97706; }
.lg-custom { background: #6366f1; }
.lg-weekend { background: #ef9a9a; }
.cal-day-details h4 { margin: 12px 0 6px; font-size: 14px; }
.cal-day-details ul { margin: 0; padding-right: 18px; }
.cal-day-details li { margin-bottom: 6px; line-height: 1.9; }
.row-holiday td { background: #fef2f2; }
table .badge { margin-left: 2px; }

/* ===== ردیف کلاس ===== */
.class-pill {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-radius: var(--radius-lg); margin-bottom: 8px; cursor: pointer;
  background: linear-gradient(120deg, #f8fafc, #f1f5f9);
  border: 1px solid var(--line);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.class-pill:hover { transform: translateY(-1px); border-color: #a7d8c8; box-shadow: 0 8px 20px rgba(5, 150, 105, .12); }

/* حالت فشرده (تنظیمات: پایه‌ها/کلاس‌ها) */
.pill-list .class-pill { padding: 7px 11px; margin-bottom: 6px; border-radius: var(--radius-sm); font-size: 13.5px; gap: 6px; }
.pill-list .class-pill .btn.sm { padding: 4px 9px; font-size: 12px; }
details > summary { list-style-position: inside; }
details[open] > summary { color: var(--side); }

.empty { color: var(--muted); text-align: center; padding: 30px 8px; }
.muted { color: var(--muted); }
.danger-box {
  background: #fef2f2; color: #991b1c; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid #fecaca;
}
.path-box {
  background: #f0fdf9; border: 1px solid #a7d8c8; border-radius: var(--radius-lg);
  padding: 14px 16px; margin: 14px 0;
}
.path-box strong { display: block; margin-bottom: 4px; }
.path-box p { margin: 0 0 10px; color: var(--muted); font-size: 13px; line-height: 1.9; }
.profile-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 18px; margin-top: 8px; font-size: 13.5px;
}

/* ===== مودال ===== */
.modal-back {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(15, 32, 39, .45); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .15s ease;
}
.modal {
  background: var(--paper);
  border-radius: var(--radius-xl); padding: 22px;
  width: min(620px, 100%); min-width: 320px; max-height: 86vh; overflow: auto;
  box-shadow: var(--shadow-lg);
  animation: popIn .16s ease;
  resize: both; /* قابل اندازه‌گیری توسط کاربر */
}
.modal h3 { margin-top: 0; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }

/* ===== توست ===== */
.toast-wrap { position: fixed; left: 20px; bottom: 20px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #0d3b34; color: #fff; padding: 12px 18px; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500;
  border-right: 4px solid var(--gold);
  animation: popIn .18s ease;
}
.toast.err { background: #7f1d1d; border-right-color: #fca5a5; }

/* ===== انتخاب سطح ===== */
.level-picks { display: flex; gap: 8px; }
.level-picks label {
  flex: 1; border: 1.5px solid var(--line); border-radius: var(--radius-md); padding: 11px;
  text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
  background: #fff;
}
.level-picks label:hover { border-color: #cbd5e1; }
.level-picks input { display: none; }
.level-picks input:checked + span.normal { color: var(--good); font-weight: 700; }
.level-picks input:checked + span.important { color: var(--warn); font-weight: 700; }
.level-picks input:checked + span.critical { color: var(--bad); font-weight: 700; }
.level-picks input:checked + span { display: inline-block; }

/* ===== نمودار ===== */
.chart-wrap { position: relative; height: 260px; }
.chart-tip {
  position: absolute; background: var(--ink); color: #fff; padding: 8px 10px;
  border-radius: var(--radius-sm); font-size: 12px; display: none; max-width: 240px; pointer-events: none;
  box-shadow: var(--shadow-lg);
}

/* ===== تب‌ها ===== */
.tabs {
  display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap;
  background: #fff; padding: 6px; border-radius: var(--radius-lg); border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.tabs button { border-radius: var(--radius-sm); box-shadow: none; }
.tabs button.active { background: linear-gradient(135deg, #116a5a, var(--side)); color: #fff; }

.preview-ok { color: var(--good); font-weight: 600; }
.preview-error { color: var(--bad); font-weight: 600; }
.preview-dup { color: var(--warn); font-weight: 600; }

/* ===== انتخابگر تاریخ شمسی و ساعت ===== */
.dp-pop {
  position: absolute; z-index: 110; width: 292px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 12px;
  animation: popIn .15s ease;
}
.dp-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; gap: 8px;
}
.dp-title { font-size: 14px; }
.dp-nav {
  border: 1px solid var(--line); background: #f8fafc; border-radius: var(--radius-xs);
  width: 30px; height: 30px; cursor: pointer; font-size: 15px; line-height: 1;
}
.dp-nav:hover { background: #ecfdf5; border-color: var(--accent-2); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.dp-wd { text-align: center; font-size: 11px; color: var(--muted); padding: 3px 0; font-weight: 700; }
.dp-day {
  border: 0; background: #f8fafc; border-radius: var(--radius-xs); padding: 6px 0;
  cursor: pointer; font-size: 12.5px; font-family: inherit; color: var(--ink);
  transition: background .12s, color .12s;
}
.dp-day:hover { background: #ecfdf5; }
.dp-day.dp-hol { background: #fef2f2; color: #b91c1c; }
.dp-day.dp-hol:hover { background: #fee2e2; }
.dp-day.dp-today { box-shadow: inset 0 0 0 1.5px var(--accent-2); font-weight: 700; }
.dp-day.dp-sel { background: var(--side); color: #fff; font-weight: 700; }
.dp-foot { display: flex; gap: 6px; margin-top: 10px; justify-content: flex-end; }
.tp-sec { margin-bottom: 8px; }
.tp-label { font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 5px; }
.tp-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.tp-chips button {
  border: 1px solid var(--line); background: #f8fafc; border-radius: var(--radius-xs);
  padding: 5px 9px; cursor: pointer; font-size: 12.5px; font-family: inherit;
}
.tp-chips button:hover { background: #ecfdf5; border-color: var(--accent-2); }
.tp-chips button.sel { background: var(--side); color: #fff; border-color: var(--side); }

/* ===== لوح ساز ===== */
/* ارتفاع قاب تقسیم بر زوم برنامه می‌شود؛ چون zoom روی بدنه، ارتفاع‌های
   vh را هم مقیاس می‌کند و بدون این جبران، پنجره لوح‌ساز با تغییر
   «اندازه نمایش برنامه (زوم)» کوچک می‌شد */
.lohyad-frame {
  width: 100%; height: calc((100vh - 150px) / var(--app-zoom, 1));
  border: 0; border-radius: var(--radius-lg); background: #fff; display: block;
}

@media (max-width: 1100px) {
  .grid-5, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-dash, .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .sidebar { transform: translateX(100%); transition: transform .2s; }
  body.menu-open .sidebar { transform: none; }
  .main { margin-right: 0; }
  #menu-btn { display: inline-block; }
}

@media print {
  .sidebar, .topbar, .btn, nav, .cal-legend { display: none !important; }
  body { display: block; background: #fff; }
  .main { padding: 0; margin-right: 0; }
  .view { padding: 0; }
  .card { box-shadow: none; border: 0; }
}

/* ===== دکمه حالت شب در نوار بالا ===== */
.theme-btn { display: inline-block; font-size: 15px; }
#logout-top-btn { display: inline-block; font-size: 13px; padding: 8px 16px; }
[hidden] { display: none !important; }
.toast-action {
  border: 0; background: rgba(255, 255, 255, .18); color: #fff; cursor: pointer;
  border-radius: var(--radius-xs); padding: 5px 12px; margin-right: 12px; font-family: inherit;
  font-weight: 700; font-size: 13px;
}
.toast-action:hover { background: rgba(255, 255, 255, .3); }

/* ===== ویجت سلام‌وحال داشبورد ===== */
.greeting-card { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; }
.greet-hi { font-size: 19px; font-weight: 700; color: var(--side); }
.greet-line { margin-top: 5px; font-size: 14px; color: var(--ink); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.greet-line strong { font-size: 15.5px; }
.ok-dot, .bad-dot, .warn-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.ok-dot { background: var(--good); }
.bad-dot { background: var(--bad); }
.warn-dot { background: var(--warn); }
/* خلاصه هفته: در حالت بسته کنار پیام سلام، در حالت باز تمام‌عرض کارت */
.greet-week { flex: 1 1 260px; min-width: 260px; max-width: 480px; transition: max-width .25s ease; }
.greet-week.week-open { flex-basis: 100%; max-width: 100%; }
.greet-week summary {
  cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--side);
  display: inline-flex; align-items: center; gap: 6px;
  list-style: none; user-select: none; border-radius: var(--radius-sm); padding: 4px 8px; margin: -4px -8px;
  transition: background .15s ease;
}
.greet-week summary::-webkit-details-marker { display: none; }
.greet-week summary::after { content: '◂'; font-size: 11px; transition: transform .2s ease; }
.greet-week details[open] summary::after { transform: rotate(-90deg); }
.greet-week summary:hover { background: rgba(13, 59, 52, .07); }
.greet-week .path-box { margin: 8px 0 0; font-size: 12.5px; }
/* انیمیشن نرم باز شدن خلاصه هفته (مرورگرهای مدرن: ارتفاع، بقیه: محو و لغزش) */
@keyframes weekReveal { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
.greet-week details[open] .path-box { animation: weekReveal .25s ease; }
:root { interpolate-size: allow-keywords; }
.greet-week details::details-content {
  transition: height .25s ease, content-visibility .25s allow-discrete;
}

/* ===== چیپ‌های نوار بالا: وضعیت سرور، بکاپ و موجودی پیامک ===== */
.top-chip {
  color: var(--side); font-weight: 700; font-size: 12.5px;
  background: var(--paper); border: 1px solid var(--line);
  padding: 9px 14px; border-radius: 999px;
  box-shadow: var(--shadow);
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.top-chip .ok-dot { width: 9px; height: 9px; }

/* ===== یکدست‌سازی نوار بالا: همه چیپ‌ها یک استایل واحد ===== */
.topbar-clock, .topbar-date, .theme-btn, #logout-top-btn, #top-server,
#top-backup, #top-user .badge {
  background: var(--paper) !important;
  border: 1px solid var(--line) !important;
  color: var(--side) !important;
  padding: 9px 14px !important;
  border-radius: 999px !important;
  box-shadow: var(--shadow) !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  white-space: nowrap;
}
#logout-top-btn { cursor: pointer; color: var(--bad) !important; }
#logout-top-btn:hover { background: #fff5f5 !important; border-color: #f3b4b4 !important; }
[data-theme="dark"] #logout-top-btn:hover { background: #2a1a1f !important; border-color: #6b2530 !important; }
.top-chip.warn { color: #9a6a12 !important; background: #fff7e6 !important; border-color: #eecd82 !important; }
#top-backup .btn.sm {
  background: var(--side) !important; color: #fff !important; border: 0 !important;
  border-radius: 999px !important; padding: 5px 12px !important;
  font-size: 11.5px !important; margin-right: 4px;
}
.topbar-user { display: inline-flex; }

/* ===== ماژول وظایف دانش‌آموزان — کارت رنگی و آیکون اختصاصی هر مسئولیت ===== */

/* ===== شمارنده و اسلایدر به‌روزرسانی/زوم سایدبار ===== */
/* باکس به‌روزرسانی خودکار: با رنگ طلایی از بقیه سایدبار متمایز می‌شود */
.sidebar-foot.autoref {
  color: #fff; font-size: 11.5px; font-weight: 700; opacity: 1;
  background: linear-gradient(135deg, rgba(245, 158, 11, .28), rgba(245, 158, 11, .08));
  border: 1px solid rgba(251, 191, 36, .55);
  box-shadow: 0 4px 16px rgba(245, 158, 11, .14), inset 0 1px 0 rgba(255, 255, 255, .12);
  /* متن و دکمه یک مجموعه وسط چارچوب می‌نشینند، نه چسبیده به لبه راست */
  display: flex; align-items: center; justify-content: center; gap: 7px;
  text-align: center;
}
.sidebar-foot.autoref .num { color: var(--gold); font-weight: 800; font-size: 13px; }
.sidebar-foot.autoref .ar-now { background: rgba(245, 158, 11, .4); color: #fff; border: 0;
  border-radius: var(--radius-xs); padding: 2px 8px; cursor: pointer; font-size: 12.5px; margin-right: 4px; }
.sidebar-foot.autoref .ar-now:hover { background: rgba(245, 158, 11, .6); }
.zoombox { color: #cfe8df; font-size: 11.5px; font-weight: 700; }
.zoombox input[type=range] { flex: 1; accent-color: #14b8a6; height: 4px; }
.zoombox .num { min-width: 44px; text-align: left; display: inline-block; }

/* ===== ماژول وظایف دانش‌آموزان (۵ نام در هر ردیف) ===== */
.duty-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
@media (max-width: 1100px) { .duty-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .duty-grid { grid-template-columns: repeat(2, 1fr); } }
.duty-card {
  position: relative; border-radius: var(--radius-lg); padding: 14px 10px 12px; text-align: center;
  border: 1px solid transparent; overflow: hidden;
  animation: dutyIn .35s ease backwards;
  transition: transform .18s ease, box-shadow .18s ease;
}
@keyframes dutyIn { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
.duty-card:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(15, 40, 35, .16); }
.duty-card .duty-ic {
  width: 42px; height: 42px; margin: 0 auto 8px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: rgba(255, 255, 255, .75); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6);
}
.duty-card .dnm { font-weight: 800; font-size: 13.5px; }
.duty-card .ddy { display: inline-block; margin-top: 5px; border-radius: 999px;
  padding: 3px 12px; font-size: 11.5px; font-weight: 700; background: rgba(255, 255, 255, .65); }
.duty-card .duty-del { position: absolute; top: 6px; left: 6px; width: 22px; height: 22px;
  border-radius: 50%; border: 0; background: rgba(255, 255, 255, .75); color: var(--bad);
  font-size: 11px; cursor: pointer; opacity: 0; transition: opacity .15s; line-height: 1; }
.duty-card:hover .duty-del { opacity: 1; }
/* — رنگ و حال‌وهوای اختصاصی هر وظیفه — */
.duty-card.th-morning { background: linear-gradient(150deg, #fef3c7, #fde68a); border-color: #f59e0b66; }
.duty-card.th-morning .ddy { background: #fff8e1; color: #92400e; }
.duty-card.th-yard { background: linear-gradient(150deg, #e0f2fe, #bae6fd); border-color: #0ea5e966; }
.duty-card.th-yard .ddy { background: #f0f9ff; color: #075985; }
.duty-card.th-assist { background: linear-gradient(150deg, #ede9fe, #ddd6fe); border-color: #8b5cf666; }
.duty-card.th-assist .ddy { background: #f5f3ff; color: #5b21b6; }
.duty-card.th-pray { background: linear-gradient(150deg, #d1fae5, #a7f3d0); border-color: #10b98166; }
.duty-card.th-pray .ddy { background: #ecfdf5; color: #065f46; }
.duty-card.th-hall { background: linear-gradient(150deg, #ffe4e6, #fecdd3); border-color: #f43f5e66; }
.duty-card.th-hall .ddy { background: #fff1f2; color: #9f1239; }
.duty-card.th-other { background: linear-gradient(150deg, #e2e8f0, #cbd5e1); border-color: #64748b66; }
.duty-card.th-other .ddy { background: #f1f5f9; color: #334155; }
/* — حالت تاریک: همان رنگ‌ها با پس‌زمینه عمیق — */
[data-theme="dark"] .duty-card .duty-ic { background: rgba(255, 255, 255, .1); box-shadow: none; }
[data-theme="dark"] .duty-card .ddy { background: rgba(255, 255, 255, .09); }
[data-theme="dark"] .duty-card.th-morning { background: linear-gradient(150deg, #4a3510, #2c2410); border-color: #f59e0b44; }
[data-theme="dark"] .duty-card.th-morning .ddy { color: #fcd34d; }
[data-theme="dark"] .duty-card.th-yard { background: linear-gradient(150deg, #0c4a6e, #082f49); border-color: #0ea5e944; }
[data-theme="dark"] .duty-card.th-yard .ddy { color: #7dd3fc; }
[data-theme="dark"] .duty-card.th-assist { background: linear-gradient(150deg, #4c1d95, #2e1065); border-color: #8b5cf644; }
[data-theme="dark"] .duty-card.th-assist .ddy { color: #c4b5fd; }
[data-theme="dark"] .duty-card.th-pray { background: linear-gradient(150deg, #065f46, #022c22); border-color: #10b98144; }
[data-theme="dark"] .duty-card.th-pray .ddy { color: #6ee7b7; }
[data-theme="dark"] .duty-card.th-hall { background: linear-gradient(150deg, #881337, #4c0519); border-color: #f43f5e44; }
[data-theme="dark"] .duty-card.th-hall .ddy { color: #fda4af; }
[data-theme="dark"] .duty-card.th-other { background: linear-gradient(150deg, #334155, #1e293b); border-color: #64748b44; }
[data-theme="dark"] .duty-card.th-other .ddy { color: #cbd5e1; }

/* ===== شمارنده به‌روزرسانی خودکار در پایین سایدبار (تم روشن هم همان طلایی) ===== */
.sidebar-foot.autoref { font-size: 11.5px; font-weight: 700; }
.sidebar-foot.autoref .num { color: var(--gold); font-weight: 800; }

/* ===== درباره Choroma ===== */
.about-modal { text-align: center; }
.about-logo { width: 110px; height: 110px; border-radius: var(--radius-xl); background: #000; object-fit: cover;
  box-shadow: var(--shadow-lg); }

.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ===== حالت شب ===== */
[data-theme="dark"] {
  --bg: #0d1720;
  --paper: #16222d;
  --ink: #e2e8f0;
  --muted: #8aa0b4;
  --line: #273644;
  --side: #092422;
  --ring: rgba(16, 185, 129, .3);
  /* سایه‌های حالت شب: عمیق‌تر و مشکی‌تر تا خاکستری کثیف نزنند */
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 26px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .65);
}
[data-theme="dark"] body {
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(16, 185, 129, .07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(217, 119, 6, .06), transparent 60%),
    var(--bg);
  color: var(--ink);
}
[data-theme="dark"] .sidebar {
  background: linear-gradient(200deg, #0c2a25 0%, #071d19 45%, #04120f 100%);
}
[data-theme="dark"] .topbar-date {
  background: linear-gradient(120deg, #0c2a25, #1e2431);
  border-color: #274036; color: #a7d8c8;
}
[data-theme="dark"] .topbar-clock {
  background: linear-gradient(120deg, #16222d, #0c2a25);
  border-color: #274036; color: #a7d8c8;
}
[data-theme="dark"] .icon-btn {
  background: var(--paper); color: var(--ink);
}
[data-theme="dark"] .btn.ghost {
  background: #1b2936; color: var(--ink); border-color: var(--line);
}
[data-theme="dark"] .btn.ghost:hover { background: #223242; border-color: #3b4f63; }

/* ===== نوار بالا در حالت تاریک — متن خوانا روی زمینه تیره ===== */
[data-theme="dark"] .top-chip,
[data-theme="dark"] .topbar-clock, [data-theme="dark"] .topbar-date,
[data-theme="dark"] .theme-btn, [data-theme="dark"] #logout-top-btn,
[data-theme="dark"] #top-server, [data-theme="dark"] #top-backup,
[data-theme="dark"] #top-user .badge {
  background: linear-gradient(120deg, #16222d, #0c2a25) !important;
  border-color: #274036 !important;
  color: #a7d8c8 !important;
}
[data-theme="dark"] .top-chip.warn {
  background: #3a2f14 !important; border-color: #6b5416 !important; color: #e8c86a !important;
}
[data-theme="dark"] #logout-top-btn { color: #f87171 !important; }
[data-theme="dark"] #top-backup .btn.sm { background: #0d9488 !important; color: #fff !important; }
[data-theme="dark"] .field input, [data-theme="dark"] .field select,
[data-theme="dark"] .field textarea,
[data-theme="dark"] .pill-list .row input {
  background: #101a24; color: var(--ink); border-color: var(--line);
}
[data-theme="dark"] .table th { background: #101a24; color: var(--muted); border-bottom-color: var(--line); }
[data-theme="dark"] .table td { border-bottom-color: #1c2836; }
[data-theme="dark"] .table tr:hover td { background: #1a2734; }
[data-theme="dark"] .suggest-list { background: var(--paper); border-color: var(--line); }
[data-theme="dark"] .suggest-list button:hover { background: #10231f; }
[data-theme="dark"] .class-pill {
  background: linear-gradient(120deg, #1a2734, #16222d); border-color: var(--line);
}
[data-theme="dark"] .card h2, [data-theme="dark"] .card h3 { color: var(--ink); }
[data-theme="dark"] .empty { color: var(--muted); }
[data-theme="dark"] .path-box { background: #10231f; border-color: #2a5348; color: var(--ink); }
[data-theme="dark"] .path-box p { color: var(--muted); }
/* ویجت سلام‌وحال: عنوان و خلاصه هفته در حالت شب خوانا بمانند */
[data-theme="dark"] .greet-hi,
[data-theme="dark"] .greet-week summary { color: #a7d8c8; }
[data-theme="dark"] .greet-week summary:hover { background: rgba(167, 216, 200, .12); }
[data-theme="dark"] .danger-box { background: #2a1214; color: #fca5a5; border-color: #58201f; }
[data-theme="dark"] .modal { background: var(--paper); color: var(--ink); }
[data-theme="dark"] .modal-back { background: rgba(0, 0, 0, .6); }
[data-theme="dark"] .toast { background: #0c2a25; }
[data-theme="dark"] .cal .day { background: #101a24; border-color: #1c2836; }
[data-theme="dark"] .cal .day.holiday, [data-theme="dark"] .cal .day.weekend {
  background: linear-gradient(160deg, #261114, #1d0c0e); border-color: #4a1f22; }
[data-theme="dark"] .cal .wd { background: #101a24; color: var(--muted); }
[data-theme="dark"] .cal-legend { background: #101a24; border-color: var(--line); color: var(--muted); }
[data-theme="dark"] .tabs { background: var(--paper); border-color: var(--line); }
[data-theme="dark"] .stat .label { color: var(--muted); }
[data-theme="dark"] .dp-pop { background: var(--paper); border-color: var(--line); }
[data-theme="dark"] .dp-day { background: #101a24; color: var(--ink); }
[data-theme="dark"] .dp-nav { background: #101a24; color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .tp-chips button { background: #101a24; color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .preview-ok { color: #34d399; }
[data-theme="dark"] .preview-error { color: #f87171; }
[data-theme="dark"] .day-alt .hj { color: #8b7cf6; }
[data-theme="dark"] .day-title { color: #8d7c5f; }

/* ===== شمارش معکوس رویداد در داشبورد ===== */
.countdown-card {
  display: flex; justify-content: space-between; align-items: center;
  gap: 18px; flex-wrap: wrap; overflow: hidden;
}
.countdown-card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 5px;
  background: linear-gradient(90deg, var(--accent-2), var(--gold), var(--bad));
  background-size: 200% 100%; animation: cdFlow 3s linear infinite;
}
.countdown-card.cd-critical::before { background: linear-gradient(90deg, #dc2626, #f59e0b, #dc2626); background-size: 200% 100%; }
.countdown-card.cd-important::before { background: linear-gradient(90deg, #d97706, #fbbf24, #d97706); background-size: 200% 100%; }
@keyframes cdFlow { from { background-position: 0% 0; } to { background-position: 200% 0; } }
.cd-title { font-size: 17px; font-weight: 700; margin: 6px 0 3px; }
.cd-info .muted { font-size: 12.5px; }
.countdown { display: flex; align-items: center; gap: 6px; }
.cd-chip {
  min-width: 62px; text-align: center; padding: 8px 6px;
  background: linear-gradient(160deg, #f8fafc, #eef2f7);
  border: 1.5px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.cd-chip .cd-num { font-size: 27px; font-weight: 800; color: var(--side); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.cd-chip .cd-lbl { font-size: 10.5px; color: var(--muted); font-weight: 600; margin-top: 1px; }
.cd-chip.tick { animation: cdTick .45s ease; }
@keyframes cdTick {
  0% { transform: scale(1); }
  40% { transform: scale(1.14); border-color: var(--accent); }
  100% { transform: scale(1); }
}
.cd-sep { font-size: 20px; font-weight: 700; color: var(--muted); animation: cdBlink 1s steps(2, start) infinite; }
@keyframes cdBlink { 50% { opacity: .25; } }
.cd-now { font-size: 18px; font-weight: 700; color: var(--good); animation: popIn .3s ease; }
[data-theme="dark"] .cd-chip { background: linear-gradient(160deg, #1b2936, #16222d); }
[data-theme="dark"] .cd-chip .cd-num { color: #a7d8c8; }

/* ===== ورود و کاربران ===== */
.login-screen {
  position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30'%3E%3Ccircle cx='3' cy='3' r='1.3' fill='%23ffffff' fill-opacity='.07'/%3E%3Ccircle cx='18' cy='18' r='1.3' fill='%23ffffff' fill-opacity='.07'/%3E%3C/svg%3E"),
    linear-gradient(160deg, var(--side), #123c34); backdrop-filter: blur(4px);
}
.login-card {
  background: #fff; border-radius: var(--radius-xl); padding: 30px 32px; width: min(380px, calc(100vw - 30px));
  box-shadow: var(--shadow-lg); text-align: center;
}
.login-logo { width: 88px; height: 88px; border-radius: var(--radius-xl); background: #000; object-fit: cover; }
.login-card .field { text-align: right; }
[data-theme=dark] .login-card { background: var(--paper); }
.topbar-user { display: flex; gap: 6px; align-items: center; }

/* ============================================================
   بهبودهای UI نسخه 2.2 — میکرو-تعامل، توپ‌تیپ شیشه‌ای، تایم‌لاین
   ============================================================ */

/* --- آیکون‌های خطی مشترک (core.js → icon()) --- */
.ic { vertical-align: -3.5px; margin-left: 6px; flex-shrink: 0; }

/* --- حلقه فوکوس برند روی همه ورودی‌ها (نه فقط داخل .field) --- */
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus, textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 4px var(--ring);
  outline: none;
}

/* --- اعداد با تایپوگرافی قوی --- */
.num, .topbar-clock, .cd-num { font-variant-numeric: tabular-nums; }

/* --- توپ‌تیپ شیشه‌ای عمومی (چیپ‌های نوار بالا، روزهای تقویم) --- */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 9px); right: 50%; transform: translateX(50%);
  background: rgba(10, 38, 33, .82); backdrop-filter: blur(8px);
  color: #fff; font-size: 12px; font-weight: 600; line-height: 1.7;
  padding: 7px 12px; border-radius: var(--radius-sm);
  white-space: nowrap; z-index: 500; pointer-events: none;
  box-shadow: 0 10px 30px rgba(13, 59, 52, .35);
  animation: tipIn var(--dur) ease;
}
@keyframes tipIn { from { opacity: 0; transform: translateX(50%) translateY(-3px); } }

/* --- نشانگر منبع زمان کنار ساعت نوار بالا --- */
.topbar-clock::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: #94a3b8; /* سیستم: خاکستری */
}
.topbar-clock.src-live::before {
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, .18);
}
.topbar-clock.src-manual::before { background: var(--warn); }

/* --- badge تعداد روی آیتم‌های منوی سایدبار --- */
.sidebar nav a .nav-badge {
  margin-inline-start: auto;
  background: var(--gold); color: #082621;
  font-size: 10.5px; font-weight: 800; line-height: 1.7;
  padding: 1px 8px; border-radius: var(--radius-full);
}
.sidebar nav a .nav-badge.warn { background: #fbbf24; }
.sidebar nav a .nav-badge.info { background: #60a5fa; color: #fff; }
.sidebar nav a .nav-badge.purple { background: #a78bfa; color: #fff; }

/* --- ورود پله‌ای آیتم‌های منو هنگام باز شدن برنامه --- */
@keyframes navIn { from { opacity: 0; transform: translateX(18px); } }
.sidebar nav a { animation: navIn .38s ease backwards; }
.sidebar nav a:nth-child(2) { animation-delay: .025s }
.sidebar nav a:nth-child(3) { animation-delay: .05s }
.sidebar nav a:nth-child(4) { animation-delay: .075s }
.sidebar nav a:nth-child(5) { animation-delay: .1s }
.sidebar nav a:nth-child(6) { animation-delay: .125s }
.sidebar nav a:nth-child(7) { animation-delay: .15s }
.sidebar nav a:nth-child(8) { animation-delay: .175s }
.sidebar nav a:nth-child(9) { animation-delay: .2s }
.sidebar nav a:nth-child(10) { animation-delay: .225s }
.sidebar nav a:nth-child(11) { animation-delay: .25s }
.sidebar nav a:nth-child(12) { animation-delay: .275s }
.sidebar nav a:nth-child(13) { animation-delay: .3s }
.sidebar nav a:nth-child(14) { animation-delay: .325s }

/* --- نقطه رنگی زیر روزهای دارای رویداد + بهبود تقویم --- */
.cal .day { position: relative; }
.cal .day.has-event::after {
  content: ''; position: absolute; bottom: 5px; right: 50%; transform: translateX(50%);
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 0 2.5px rgba(245, 158, 11, .18);
}
.cal .day.today.has-event::after { background: var(--accent-2); box-shadow: 0 0 0 2.5px rgba(5, 150, 105, .18); }

/* --- ستون عملیات چسبان در جدول‌های اسکرول‌شونده (RTL: سمت چپ) --- */
.table tr > *:last-child { position: sticky; left: 0; }
.table td:last-child { background: var(--paper); }
.table tr:hover td:last-child { background: #f8fafc; }
[data-theme="dark"] .table td:last-child { background: #16222d; }
[data-theme="dark"] .table th:last-child { background: #101a24; }
[data-theme="dark"] .table tr:hover td:last-child { background: #1a2734; }

/* --- شمارنده نتایج زیر جدول‌ها --- */
.result-count {
  color: var(--muted); font-size: 12.5px; font-weight: 600; margin-top: 8px;
}
.result-count strong { color: var(--side); font-variant-numeric: tabular-nums; }

/* --- تیک لحظه‌ای ثبت حضور --- */
.pop-check {
  position: absolute; right: 50%; top: 50%;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--good); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 800;
  z-index: 50; pointer-events: none;
  box-shadow: 0 4px 12px rgba(5, 150, 105, .4);
  animation: checkPop .75s ease forwards;
}
@keyframes checkPop {
  0% { transform: translate(50%, -50%) scale(.2); opacity: 0; }
  35% { transform: translate(50%, -50%) scale(1.18); opacity: 1; }
  60% { transform: translate(50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(50%, -50%) scale(1); opacity: 0; }
}

/* --- hover lift کارت‌های داشبورد --- */
.card.dash-card, .countdown-card {
  transition: transform var(--dur), box-shadow var(--dur);
}
.card.dash-card:hover, .countdown-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(13, 59, 52, .14);
}

/* --- کارت تولد: 🎂 شناور و badge جشن --- */
.bday-cake { display: inline-block; animation: cakeFloat 2.6s ease-in-out infinite; }
@keyframes cakeFloat {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-3px) rotate(4deg); }
}
.badge.party {
  background: linear-gradient(120deg, #f59e0b, #ef4444);
  color: #fff; font-weight: 800;
}

/* --- تایم‌لاین زنگ‌های امروز در داشبورد --- */
.bell-timeline {
  position: relative; height: 30px; margin-top: 12px; margin-bottom: 26px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.bl-seg {
  position: absolute; top: 6px; height: 17px; border-radius: 5px;
  background: linear-gradient(180deg, #10b981, #059669);
  overflow: hidden;
}
.bl-seg.brk { background: var(--line); }
.bl-seg span {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 9.5px; color: #fff; font-weight: 700; white-space: nowrap;
}
.bl-seg.brk span { color: var(--muted); }
.bl-now {
  position: absolute; top: 2px; bottom: 2px; width: 2.5px;
  background: var(--bad); border-radius: 2px; z-index: 2;
  transition: right .8s ease;
}
.bl-now::after {
  content: ''; position: absolute; top: -3px; right: -2.5px;
  width: 7.5px; height: 7.5px; border-radius: 50%; background: var(--bad);
}

/* --- احترام به تنظیم «کاهش حرکت» ویندوز --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ============================================================
   پکیج پریمیوم نسخه 2.3 — اسپلش، ripple، هاله طلایی، حالت تمرکز
   ============================================================ */

/* --- اسپلش سینمایی شروع --- */
#boot-splash {
  position: fixed; inset: 0; z-index: 999;
  display: grid; place-items: center;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='26'%3E%3Ccircle cx='3' cy='3' r='1.2' fill='%23ffffff' fill-opacity='.05'/%3E%3Ccircle cx='16' cy='16' r='1.2' fill='%23ffffff' fill-opacity='.05'/%3E%3C/svg%3E"),
    radial-gradient(1200px 800px at 50% 40%, rgba(16, 185, 129, .22), transparent 75%),
    linear-gradient(200deg, #124d42 0%, var(--side) 45%, #082621 100%);
  animation: splashIn .5s ease;
  transition: opacity .6s ease, visibility .6s;
  overflow: hidden;
}
#boot-splash.bye { opacity: 0; visibility: hidden; pointer-events: none; }
@keyframes splashIn { from { opacity: 0; } }
.splash-inner { position: relative; text-align: center; overflow: visible; }
.splash-inner img {
  /* لوگوی طلایی شفاف — بدون پس‌زمینه، بزرگ و با هاله نرم */
  width: 230px; height: 230px; object-fit: contain;
  filter: drop-shadow(0 24px 50px rgba(0, 0, 0, .55))
          drop-shadow(0 0 55px rgba(251, 191, 36, .30));
  animation: splashPop .9s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes splashPop {
  0% { transform: scale(.55); opacity: 0; filter: brightness(2.2) drop-shadow(0 24px 50px rgba(0,0,0,.55)); }
  60% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); }
}
.splash-name {
  margin-top: 22px; font-size: 42px; font-weight: 800; letter-spacing: 1px;
  background: linear-gradient(115deg, #fef3c7 5%, #fbbf24 45%, #f59e0b 75%, #b45309 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: splashName .9s ease backwards .15s;
}
@keyframes splashName { from { opacity: 0; transform: translateY(10px); } }
/* نور جاروب‌شونده روی کل صفحه اسپلش */
.splash-sheen {
  position: fixed; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 32%,
    rgba(255, 255, 255, .10) 42%, rgba(255, 255, 255, .28) 50%,
    rgba(255, 255, 255, .10) 58%, transparent 68%);
  transform: translateX(140%);
  animation: sheen 1.5s ease .2s forwards;
}
@keyframes sheen { to { transform: translateX(-140%); } }

/* --- ripple دکمه‌ها --- */
.btn { position: relative; overflow: hidden; }
.ripple-ink {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, .35) 0%, rgba(255, 255, 255, .12) 45%, transparent 70%);
  transform: scale(0); animation: ripple .6s ease-out forwards;
}
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

/* --- هاله گرادیانی طلایی دور کارت‌های داشبورد هنگام hover --- */
.card.dash-card { overflow: visible; }
.card.dash-card::after {
  content: ''; position: absolute; inset: -1px; border-radius: inherit;
  padding: 1px; pointer-events: none;
  background: linear-gradient(120deg, rgba(251, 191, 36, .75), rgba(16, 185, 129, .45), rgba(251, 191, 36, .75));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity var(--dur);
}
.card.dash-card:hover::after { opacity: 1; }

/* --- دکمه جمع‌کردن کارت داشبورد --- */
.dash-fold {
  position: absolute; top: 10px; left: 10px; z-index: 5;
  width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--muted); cursor: pointer;
  font-size: 12px; line-height: 1; display: grid; place-items: center;
  transition: transform var(--dur), background var(--dur), color var(--dur);
}
.dash-fold:hover { background: var(--accent-2); color: #fff; border-color: var(--accent-2); }
.dash-fold.up { transform: rotate(-90deg); }
/* جای خالی سمت چپِ سربرگ، تا دکمه جمع‌کردن روی متن/محتوای کارت نیفتد */
.dash-card > h3:first-child, .dash-card > .row:first-child { padding-left: 42px; }
.dash-card.folded { padding-bottom: 12px; }
.dash-card.folded > *:not(h3):not(.dash-fold):not(.dash-head) { display: none !important; }
/* کارت‌هایی که سربرگشان داخل ردیف است (مثل یادآوری) — سربرگشان باقی می‌ماند */
.dash-card.folded > .dash-head { display: flex !important; align-items: center; }
.dash-card.folded h3 { margin-bottom: 0 !important; }

/* --- حالت تمرکز: چیپ‌های نوار بالا جمع می‌شوند --- */
body.focus-mode .top-chip,
body.focus-mode .topbar-clock,
body.focus-mode .topbar-date,
body.focus-mode #top-user { display: none !important; }
#focus-btn.active { background: var(--accent-2); color: #fff; }

/* --- ترنزیشن ورود صفحه --- */
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } }
.view.page-in > * { animation: pageIn .16s ease backwards; }
.view.page-in > *:nth-child(2) { animation-delay: .03s }
.view.page-in > *:nth-child(3) { animation-delay: .05s }

/* --- flip عددی شمارش معکوس --- */
.cd-chip { perspective: 300px; }
.cd-chip.flip .cd-num { animation: numFlip .45s ease; }
@keyframes numFlip {
  0% { transform: rotateX(0); }
  45% { transform: rotateX(88deg); opacity: .4; }
  55% { transform: rotateX(-88deg); opacity: .6; }
  100% { transform: rotateX(0); opacity: 1; }
}

/* --- پارالاکس + پترن متحرک صفحه ورود --- */
.login-screen {
  transition: none;
  /* لایه اول پس‌زمینه (پترن) با متغیرهای --par-x/--par-y جابه‌جا می‌شود */
  animation: dotsDrift 26s linear infinite;
}
@keyframes dotsDrift {
  from { background-position: 0 0, 0 0, 0 0; }
  to { background-position: 60px 60px, 0 0, 0 0; }
}
.login-logo { transition: transform .18s ease-out; will-change: transform; }

/* --- ripple/لودینگ دکمه ورود --- */
.btn.loading { opacity: .85; pointer-events: none; }
.btn-spin {
  display: inline-block; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff;
  vertical-align: -2px; margin-left: 6px;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- سنجه قدرت رمز --- */
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap input { width: 100%; padding-left: 42px; }
.pw-eye {
  position: absolute; left: 6px; border: 0; background: transparent; cursor: pointer;
  font-size: 15px; opacity: .65; padding: 4px; border-radius: 8px;
}
.pw-eye:hover { opacity: 1; background: var(--bg); }
.pw-meter { display: flex; gap: 4px; align-items: center; margin-top: 7px; }
.pw-meter i {
  height: 5px; flex: 1; border-radius: 99px; background: var(--line);
  transition: background var(--dur);
}
.pw-meter i.on.s1, .pw-meter i.on.s0 { background: var(--bad); }
.pw-meter i.on.s2 { background: var(--warn); }
.pw-meter i.on.s3 { background: #84cc16; }
.pw-meter i.on.s4 { background: var(--good); }
.pw-label { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-right: 7px; min-width: 60px; }
.pw-label.s0, .pw-label.s1 { color: var(--bad); }
.pw-label.s2 { color: var(--warn); }
.pw-label.s3 { color: #65a30d; }
.pw-label.s4 { color: var(--good); }

/* --- کانفتی --- */
.confetti-cv {
  position: fixed; inset: 0; z-index: 990; pointer-events: none;
}

/* --- slip زنده مبلغ --- */
.money-slip {
  display: block; margin-top: 4px; font-size: 12px; font-weight: 700;
  color: var(--accent-2); font-variant-numeric: tabular-nums;
}

/* --- رنگ‌آمیزی شرطی ردیف‌های مالی --- */
.table tr.row-debt td { background: rgba(217, 119, 6, .05); }
.table tr.row-debt-high td { background: rgba(220, 38, 38, .07); }
.table tr.row-debt-high td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.table tr.row-clear td { background: rgba(5, 150, 105, .05); }
[data-theme="dark"] .table tr.row-debt td { background: rgba(217, 119, 6, .08); }
[data-theme="dark"] .table tr.row-debt-high td { background: rgba(220, 38, 38, .1); }
[data-theme="dark"] .table tr.row-clear td { background: rgba(5, 150, 105, .08); }

/* --- هاله نارنجی ردیف‌های تکراری هنگام ورود گروهی --- */
@keyframes dupPulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(217, 119, 6, .55); }
  50% { box-shadow: inset 0 0 0 2px rgba(217, 119, 6, .95); }
}
.table tr.imp-dup td {
  background: rgba(245, 158, 11, .09);
  animation: dupPulse 1.6s ease-in-out 3;
}
.table tr.imp-dup td:first-child { box-shadow: inset 3px 0 0 var(--warn); }

/* --- اسکرول‌بار باریک جدول‌ها --- */
.tbl-scroll { scrollbar-width: thin; scrollbar-color: #c7d0dc transparent; }
.tbl-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.tbl-scroll::-webkit-scrollbar-thumb {
  background: #c7d0dc; border-radius: 99px; border: 2px solid transparent; background-clip: content-box;
}
.tbl-scroll::-webkit-scrollbar-thumb:hover { background: var(--accent-2); background-clip: content-box; }

/* --- tooltip چندخطی برای راهنمای بلند --- */
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  white-space: normal; width: max-content; max-width: 300px;
}


