/* ============================================================
   دستیار ابلاغیه — سیستم طراحی «عدالت شیشه‌ای» (Glass of Justice)
   تم تیره حرفه‌ای + تم روشن اختیاری · RTL · ریسپانسیو (لپ‌تاپ + موبایل)
   توسعه‌دهنده: ارشاوین
   ============================================================ */

/* ---------- ۱) توکن‌ها ---------- */
:root {
  color-scheme: dark;

  --bg: #060a13;
  --bg-2: #0a1120;
  --bg-3: #0d1626;

  --glass: rgba(255, 255, 255, 0.035);
  --glass-2: rgba(255, 255, 255, 0.06);
  --card: rgba(17, 26, 44, 0.72);
  --card-solid: #111a2c;

  --border: rgba(255, 255, 255, 0.08);
  --border-2: rgba(255, 255, 255, 0.14);

  --text: #eaf0fa;
  --text-2: #ccd7e8;
  --muted: #9aabc4;

  --accent: #38bdf8;
  --accent-2: #6366f1;
  --accent-3: #22d3ee;
  --accent-ink: #04121c;

  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  --grad-accent: linear-gradient(135deg, #22d3ee 0%, #3b82f6 55%, #6366f1 100%);
  --grad-danger: linear-gradient(135deg, #f43f5e, #b91c1c);
  --grad-warn: linear-gradient(135deg, #fbbf24, #d97706);

  --r-xs: 8px;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 18px;
  --r-xl: 24px;

  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.35);
  --sh-2: 0 10px 26px -12px rgba(0, 0, 0, 0.75);
  --sh-3: 0 24px 60px -24px rgba(0, 0, 0, 0.85);
  --glow: 0 0 0 1px rgba(56, 189, 248, 0.25), 0 12px 30px -12px rgba(56, 189, 248, 0.45);

  --sidebar-w: 258px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t: 0.18s var(--ease);
}

/* تم روشن */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2f9;
  --bg-2: #e6ecf6;
  --bg-3: #ffffff;
  --glass: rgba(255, 255, 255, 0.75);
  --glass-2: rgba(255, 255, 255, 0.9);
  --card: rgba(255, 255, 255, 0.9);
  --card-solid: #ffffff;
  --border: rgba(15, 32, 63, 0.16);
  --border-2: rgba(15, 32, 63, 0.28);
  --text: #0b1730;
  --text-2: #1f3050;
  --muted: #4a5d7e;
  --accent: #0284c7;
  --accent-2: #0ea5e9;
  --accent-ink: #ffffff;
  --sh-2: 0 10px 26px -14px rgba(13, 27, 52, 0.3), 0 1px 2px rgba(13, 27, 52, 0.06);
  --sh-3: 0 26px 60px -26px rgba(13, 27, 52, 0.38);
}
html[data-theme="light"] .card,
html[data-theme="light"] .stat { border-color: rgba(15, 32, 63, 0.14); }
html[data-theme="light"] th { color: #33456a; letter-spacing: 0; }
html[data-theme="light"] .btn.ghost { border-color: rgba(2, 132, 199, 0.45); color: #0369a1; }
html[data-theme="light"] .btn.ghost:hover { background: rgba(2, 132, 199, 0.09); }
html[data-theme="light"] .state-chip.case-status.open { background: rgba(2, 132, 199, 0.12); color: #075985; border-color: rgba(2, 132, 199, 0.4); }
html[data-theme="light"] .stat .num { -webkit-text-fill-color: currentColor; background: none; color: #10233f; }
html[data-theme="light"] .stat.critical .num { color: #b45309; }
html[data-theme="light"] .stat.expired .num { color: #b91c1c; }
html[data-theme="light"] .nav-item { color: #33456a; }
html[data-theme="light"] .nav-item.active { color: #075985; background: rgba(2, 132, 199, 0.11); }
html[data-theme="light"] .hint, html[data-theme="light"] .muted { color: #4a5d7e; }

* { box-sizing: border-box; }

@font-face {
  font-family: "Vazirmatn";
  src: url("/fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("/fonts/Vazirmatn-Medium.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("/fonts/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  background:
    radial-gradient(1100px 620px at 100% -8%, rgba(56, 189, 248, 0.14), transparent 60%),
    radial-gradient(900px 520px at 0% 0%, rgba(99, 102, 241, 0.14), transparent 55%),
    linear-gradient(170deg, var(--bg) 0%, var(--bg-2) 60%, var(--bg) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  font-size: 15px;
  line-height: 1.75;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: rgba(56, 189, 248, 0.3); }

/* اسکرول‌بار نازک */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- آیکون‌ها ---------- */
.ico { width: 18px; height: 18px; display: inline-block; vertical-align: -0.18em; flex: 0 0 auto; }
svg.ico { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.btn svg.ico, .pagehead h1 svg.ico { width: 16px; height: 16px; }
.rules-row b { display: inline-flex; align-items: center; gap: 7px; }
.rules-row b svg.ico, .attach-row svg.ico { width: 15px; height: 15px; color: var(--muted); }
.rules-row b svg.ico { color: var(--accent); }
#i-dash { fill: currentColor; stroke: none; }
.brand .logo svg.ico { width: 21px; height: 21px; stroke-width: 1.8; }

/* ---------- ۲) اسکلت صفحه ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  padding: 18px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, rgba(10, 17, 32, 0.9), rgba(6, 10, 19, 0.86));
  backdrop-filter: blur(14px) saturate(140%);
  border-inline-start: 1px solid var(--border);
  z-index: 20;
}
html[data-theme="light"] .sidebar { background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(238, 242, 249, 0.86)); }

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 800;
  font-size: 16.5px;
  letter-spacing: -0.2px;
  padding: 6px 6px 16px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.brand .logo {
  width: 40px; height: 40px;
  flex: 0 0 40px;
  display: grid; place-items: center;
  font-size: 20px;
  border-radius: 12px;
  background: var(--grad-accent);
  box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.brand .brand-txt small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  user-select: none;
  transition: background var(--t), color var(--t), border-color var(--t), transform 0.1s var(--ease);
}
.nav-item > span:first-child {
  width: 30px; height: 30px; flex: 0 0 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  font-size: 15px;
  background: var(--glass);
  border: 1px solid var(--border);
  transition: background var(--t), border-color var(--t), color var(--t);
}
.nav-item > span:first-child .ico { width: 17px; height: 17px; }
.nav-item:hover { color: var(--text); background: var(--glass); border-color: var(--border); }
.nav-item:hover > span:first-child { background: var(--glass-2); border-color: var(--border-2); }
.nav-item.active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.18), rgba(99, 102, 241, 0.06));
  border-color: rgba(56, 189, 248, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.nav-item.active > span:first-child {
  background: var(--grad-accent);
  border-color: transparent;
  color: var(--accent-ink);
}
.nav-item.active::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  width: 3px; height: 58%;
  transform: translateY(-50%);
  border-radius: 0 3px 3px 0;
  background: var(--grad-accent);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.8);
}
.nav-item .badge {
  margin-inline-start: auto;
  background: var(--grad-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 8px;
  border-radius: 99px;
  box-shadow: 0 4px 12px -4px rgba(239, 68, 68, 0.8);
}

.sidebar .spacer { flex: 1; }

.side-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 11px;
  border-radius: var(--r-sm);
  background: var(--glass);
  border: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted);
}
.side-foot .dot-live {
  width: 7px; height: 7px; border-radius: 99px; flex: 0 0 7px;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.main {
  flex: 1;
  width: 100%;
  max-width: 1340px;
  padding: 18px 26px 70px;
  min-width: 0;
}

/* نوار بالای موبایل */
.appbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 30;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(6, 10, 19, 0.86);
  backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid var(--border);
}
html[data-theme="light"] .appbar { background: rgba(255, 255, 255, 0.86); }
.appbar .brand { padding: 0; margin: 0; border: none; font-size: 15px; flex: 1; }
.appbar .logo { width: 34px; height: 34px; flex: 0 0 34px; font-size: 17px; }

/* ---------- ۳) دکمه‌ها ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  height: 40px;
  box-sizing: border-box;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-2);
  background: var(--glass);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.1s var(--ease), background var(--t), border-color var(--t), box-shadow var(--t), opacity var(--t);
}
.btn:hover { background: var(--glass-2); border-color: rgba(56, 189, 248, 0.35); }
.btn:active { transform: translateY(1px) scale(0.985); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary {
  background: var(--grad-accent);
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 800;
  box-shadow: 0 10px 24px -12px rgba(56, 189, 248, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 14px 30px -12px rgba(56, 189, 248, 1); }
.btn.primary svg.ico, .btn.small svg.ico { width: 15px; height: 15px; }
.btn.small svg.ico { width: 13px; height: 13px; }
.btn.danger { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.4); color: #fca5a5; }
.btn.danger:hover { background: rgba(239, 68, 68, 0.2); }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.ghost:hover { background: var(--glass); }
.btn.small { padding: 4px 11px; height: 32px; font-size: 12.5px; border-radius: var(--r-xs); }

/* ---------- نوار ابزار و جستجوی کارت‌ها ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar select { width: auto; min-width: 150px; }
.toolbar .search {
  position: relative;
  flex: 1 1 240px;
  display: flex;
  align-items: center;
}
.toolbar .search svg.ico {
  position: absolute;
  inset-inline-start: 12px;
  width: 16px; height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.toolbar .search input { width: 100%; padding-inline-start: 36px !important; }
.toolbar-count { font-size: 12.5px; font-variant-numeric: tabular-nums; margin-inline-start: auto; }
.toolbar .search input::-webkit-search-cancel-button { filter: grayscale(1) opacity(0.6); }
.btn.block { width: 100%; }
.btn, input, select, textarea { font-family: inherit; }
input, select, textarea {
  height: 40px;
  box-sizing: border-box;
  border-radius: var(--r-s) !important;
  border: 1px solid var(--border) !important;
  background: color-mix(in srgb, var(--card) 80%, transparent) !important;
  color: var(--text) !important;
  padding: 0 12px !important;
  font-size: 13.5px !important;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(56, 189, 248, 0.6) !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.13) !important;
}
input[type="checkbox"] { height: auto; width: auto; accent-color: var(--accent); }
textarea { height: auto; padding: 10px 12px !important; line-height: 1.7; resize: vertical; }
select { cursor: pointer; appearance: none; padding-inline-start: 32px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aabc4' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: left 11px center !important;
}

.iconbtn {
  width: 38px; height: 38px;
  flex: 0 0 38px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text);
  cursor: pointer;
  transition: background var(--t), border-color var(--t), transform 0.1s var(--ease);
}
.iconbtn svg.ico { width: 19px; height: 19px; }
.iconbtn:hover { background: var(--glass-2); border-color: var(--border-2); }
.iconbtn:active { transform: scale(0.94); }

/* ---------- ۴) تیتر صفحه ---------- */
.pagehead {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  animation: rise 0.34s var(--ease) both;
}
.pagehead h1 {
  margin: 0;
  flex: 1;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.pagehead .sub { flex-basis: 100%; color: var(--muted); font-size: 12.5px; margin-top: -6px; }

/* ---------- ۵) کارت‌ها ---------- */
.card {
  position: relative;
  background: var(--card);
  backdrop-filter: blur(10px) saturate(130%);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  margin-bottom: 16px;
  text-align: right;
  box-shadow: var(--sh-2);
  animation: rise 0.36s var(--ease) both;
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.card:hover { border-color: var(--border-2); }
.card h2, .card h3 {
  margin: 0 0 14px;
  font-size: 15.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h2 + .hint, .card h3 + .hint { margin-top: -8px; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- ۶) آمار ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 13px;
  margin-bottom: 20px;
}
.stat {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "ico num" "ico lbl";
  align-items: center;
  column-gap: 12px;
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 13px 15px 14px;
  box-shadow: var(--sh-2);
  animation: rise 0.36s var(--ease) both;
  transition: transform var(--t), border-color var(--t), box-shadow var(--t);
}
.stat::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--grad-accent);
  opacity: 0.85;
}
.stat .s-ico {
  grid-area: ico;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--glass);
  border: 1px solid var(--border);
  color: var(--accent);
}
.stat .s-ico svg.ico { width: 19px; height: 19px; }
.stat:hover { transform: translateY(-3px); border-color: var(--border-2); box-shadow: var(--sh-3); }
.stat .num {
  grid-area: num;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, var(--text), var(--text-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat .lbl {
  grid-area: lbl;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin-top: -2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat.critical::before { background: var(--grad-warn); }
.stat.critical .s-ico { background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.35); color: #fbbf24; }
.stat.critical .num { background: linear-gradient(180deg, #fde68a, #f59e0b); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat.expired::before { background: var(--grad-danger); }
.stat.expired .s-ico { background: rgba(239, 68, 68, 0.14); border-color: rgba(239, 68, 68, 0.35); color: #f87171; }
.stat.expired .num { background: linear-gradient(180deg, #fecaca, #ef4444); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat.ok-a::before { background: linear-gradient(90deg, #34d399, #22c55e); }
.stat.ok-a .s-ico { background: rgba(34, 197, 94, 0.13); border-color: rgba(34, 197, 94, 0.32); color: #4ade80; }
.stat.done-a::before { background: linear-gradient(90deg, #a78bfa, #8b5cf6); }
.stat.done-a .s-ico { background: rgba(139, 92, 246, 0.14); border-color: rgba(139, 92, 246, 0.32); color: #a78bfa; }

/* آیکون سرتیتر کارت‌ها — یکدست با آیکون‌های خطی */
.card h2, .card h3 { display: flex; align-items: center; gap: 9px; }
.card h2 svg.ico, .card h3 svg.ico { width: 17px; height: 17px; color: var(--accent); flex: 0 0 auto; }
.state-chip .sdot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
  display: inline-block;
  margin-inline-end: 6px;
  vertical-align: 1px;
  box-shadow: 0 0 8px currentColor;
}
.empty .big svg.ico { width: 40px; height: 40px; color: var(--accent); }

/* ---------- اسکلت بارگذاری (Skeleton) ---------- */
.sk {
  display: block;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--glass) 0%, var(--border-2) 45%, var(--glass) 90%);
  background-size: 220% 100%;
  animation: shimmer 1.25s linear infinite;
}
.sk-t { width: 190px; height: 20px; }
.sk-b { width: 120px; height: 12px; display: inline-block; margin-top: 4px; }
.sk-n { width: 46px; height: 26px; }
.sk-l { width: 74px; height: 11px; margin-top: 7px; }
.sk-row { width: 100%; height: 58px; border-radius: var(--r); margin-bottom: 10px; }
.stat.sk-card { display: grid; gap: 4px; align-content: center; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }

/* ---------- انتقال نرم بین نماها (View Transitions) ---------- */
#main { view-transition-name: main-pane; }
::view-transition-old(main-pane) { animation: 0.16s ease both vtOut; }
::view-transition-new(main-pane) { animation: 0.3s var(--ease) both vtIn; }
@keyframes vtOut { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vtIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------- ۷) ردیف مهلت ---------- */
.deadline-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: linear-gradient(90deg, var(--glass), transparent 65%);
  margin-bottom: 10px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--t), transform var(--t), background var(--t);
}
.deadline-row::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0.9;
}
.deadline-row.s-soon::before { background: var(--warn); }
.deadline-row.s-today::before { background: #f97316; }
.deadline-row.s-expired::before { background: var(--danger); }
.deadline-row.s-unknown::before { background: var(--muted); }
.deadline-row:hover { border-color: rgba(56, 189, 248, 0.4); transform: translateX(-3px); background: linear-gradient(90deg, rgba(56, 189, 248, 0.1), transparent 70%); }
.deadline-row .state-chip { margin-inline-end: auto; }
.deadline-row .d-date { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.deadline-row .d-main { min-width: 0; flex: 1 1 auto; }
.deadline-row .d-meta { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
/* شناسه‌های لاتین (کلاسه/شماره ابلاغیه) — همیشه چپ‌به‌راست و یکدست */
.ltr, .mono-id {
  direction: ltr;
  unicode-bidi: isolate;
  font-family: "Consolas", "SFMono-Regular", ui-monospace, monospace;
  letter-spacing: 0.2px;
  font-size: 1.12em;
  font-weight: 700;
}

/* ---------- ۸) چیپ وضعیت ---------- */
.state-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
  font-variant-numeric: tabular-nums;
}
.state-chip.ok { background: rgba(34, 197, 94, 0.14); color: #86efac; border-color: rgba(34, 197, 94, 0.38); }
.state-chip.soon { background: rgba(245, 158, 11, 0.15); color: #fcd34d; border-color: rgba(245, 158, 11, 0.42); }
.state-chip.today { background: rgba(249, 115, 22, 0.2); color: #fdba74; border-color: rgba(249, 115, 22, 0.5); }
.state-chip.expired { background: rgba(239, 68, 68, 0.22); color: #fecaca; border-color: rgba(239, 68, 68, 0.55); }
.state-chip.unknown { background: rgba(135, 152, 179, 0.13); color: var(--muted); border-color: var(--border); }
.state-chip.case-status { font-size: 11.5px; padding: 3px 9px; }
.state-chip.case-status.open { background: rgba(56, 189, 248, 0.13); color: #7dd3fc; border-color: rgba(56, 189, 248, 0.38); }
html[data-theme="light"] .state-chip.ok { color: #15803d; }
html[data-theme="light"] .state-chip.soon { color: #b45309; }
html[data-theme="light"] .state-chip.today { color: #c2410c; }
html[data-theme="light"] .state-chip.expired { color: #b91c1c; }

/* ---------- ۹) جدول ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--border); background: var(--glass); }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { padding: 12px 14px; text-align: right; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
th {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  background: rgba(10, 17, 32, 0.72);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
}
html[data-theme="light"] th { background: rgba(238, 242, 249, 0.9); }
tr:last-child td { border-bottom: none; }
tbody tr { cursor: pointer; transition: background 0.14s var(--ease), box-shadow 0.14s var(--ease); }
tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.014); }
tbody tr:hover { background: rgba(56, 189, 248, 0.08); box-shadow: inset 3px 0 0 var(--accent); }
td .num-ir { font-variant-numeric: tabular-nums; }

/* ---------- ۱۰) فرم‌ها ---------- */
label.f { display: block; margin-bottom: 6px; color: var(--text-2); font-size: 13px; font-weight: 600; }
input[type="text"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  width: 100%;
  background: rgba(6, 10, 19, 0.6);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
  -webkit-appearance: none;
  appearance: none;
}
html[data-theme="light"] input, html[data-theme="light"] select, html[data-theme="light"] textarea { background: rgba(255, 255, 255, 0.85); }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:hover, select:hover, textarea:hover { border-color: var(--border-2); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
  background: rgba(6, 10, 19, 0.85);
}
html[data-theme="light"] input:focus, html[data-theme="light"] select:focus, html[data-theme="light"] textarea:focus { background: #fff; }
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(0% + 16px) calc(50% + 2px), calc(0% + 21px) calc(50% + 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-inline-start: 34px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.95; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 17px; height: 17px; }

.fieldrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-bottom: 14px; }
.field { margin-bottom: 14px; }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.8; }

/* ---------- کارت «جواب بر اساس ابلاغیه» ---------- */
.card.answer { border-color: rgba(56, 189, 248, 0.35); background: linear-gradient(180deg, rgba(56, 189, 248, 0.07), transparent 70%); }
.ans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin: 6px 0 12px; }
.ans-row { display: flex; flex-direction: column; gap: 4px; background: var(--card-2, rgba(255, 255, 255, 0.03)); border: 1px solid var(--border); border-radius: 12px; padding: 9px 12px; }
.ans-k { color: var(--muted); font-size: 12px; }
.ans-v { font-size: 14px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ans-v.strong { font-weight: 700; color: var(--accent); }
.ans-v.ltr { direction: ltr; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.ans-warns { display: grid; gap: 7px; margin-bottom: 8px; }
.ans-warn { display: flex; gap: 8px; align-items: flex-start; background: rgba(245, 158, 11, 0.1); border: 1px solid rgba(245, 158, 11, 0.32); border-radius: 11px; padding: 8px 11px; font-size: 13px; line-height: 1.85; }
.ans-warn svg.ico { width: 15px; height: 15px; color: #fcd34d; flex: 0 0 auto; margin-top: 4px; }
.ans-ok { display: flex; gap: 8px; align-items: center; color: #86efac; font-size: 13px; margin-bottom: 8px; }
.ans-ok svg.ico { width: 15px; height: 15px; }
.suggest {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px dashed rgba(56, 189, 248, 0.45);
  color: var(--accent);
  padding: 3px 10px;
  border-radius: var(--r-xs);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  margin-inline-start: 8px;
  transition: background var(--t), border-color var(--t);
}
.suggest:hover { background: rgba(56, 189, 248, 0.18); border-color: var(--accent); }

label.fix {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  transition: border-color var(--t), background var(--t);
}
label.fix:hover { border-color: var(--border-2); }

/* ---------- ۱۱) دراپ‌زون ---------- */
.dropzone {
  position: relative;
  border: 2px dashed rgba(56, 189, 248, 0.35);
  border-radius: var(--r-lg);
  padding: 38px 20px;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
  background: radial-gradient(600px 200px at 50% 0%, rgba(56, 189, 248, 0.08), transparent 70%);
  transition: border-color var(--t), background var(--t), color var(--t), transform var(--t);
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--accent);
  background: radial-gradient(600px 220px at 50% 0%, rgba(56, 189, 248, 0.16), transparent 72%);
  color: var(--text);
  transform: translateY(-2px);
}
.dropzone .big { font-size: 38px; line-height: 1; margin-bottom: 10px; }

/* ---------- ۱۲) تب‌ها ---------- */
.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--r);
  background: var(--glass);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.tab {
  padding: 8px 16px;
  border-radius: var(--r-sm);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  transition: background var(--t), color var(--t);
}
.tab:hover { color: var(--text); background: var(--glass-2); }
.tab.active { background: var(--grad-accent); color: var(--accent-ink); font-weight: 800; box-shadow: 0 8px 20px -12px rgba(56, 189, 248, 0.9); }

/* ---------- ۱۳) مودال ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(3, 6, 12, 0.72);
  backdrop-filter: blur(6px);
  animation: fade 0.2s var(--ease) both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 800px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px 22px 26px;
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--border-2);
  box-shadow: var(--sh-3);
  animation: pop 0.26s var(--ease) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal h2 { margin: 0 0 16px; font-size: 19px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.modal .modal-foot { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ---------- ۱۴) کلید/مقدار و پیوست ---------- */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kv > div {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 13px;
  transition: border-color var(--t), background var(--t);
}
.kv > div:hover { border-color: var(--border-2); background: var(--glass-2); }
.kv .k { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.kv .v { font-size: 14px; font-weight: 600; margin-top: 3px; word-break: break-word; }

.attach-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--glass);
  font-size: 13px;
  margin-bottom: 8px;
  transition: border-color var(--t), background var(--t);
}
.attach-row:hover { border-color: var(--border-2); background: var(--glass-2); }

.checklist label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 4px;
  cursor: pointer;
  border-bottom: 1px dashed var(--border);
  font-size: 13.5px;
  line-height: 1.8;
}
.checklist label:last-child { border-bottom: none; }
.checklist label:hover { color: var(--accent); }
.checklist input { width: auto; margin-top: 5px; flex: 0 0 auto; }

/* ---------- ۱۵) جدول قواعد ---------- */
.rules-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px 18px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.rules-row:last-child { border-bottom: none; }
.rules-row input, .rules-row div { font-size: 13.5px; }
.rr-title b { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.rr-title .rr-statute { color: var(--muted); font-size: 12px; margin-top: 4px; }
.rr-title .hint { margin-top: 7px; font-size: 12px; }
.rr-nums { display: flex; gap: 16px; }
.rr-num { display: grid; gap: 5px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.rr-num input { width: 88px; text-align: center; font-variant-numeric: tabular-nums; }
@media (max-width: 860px) {
  .rules-row { grid-template-columns: minmax(0, 1fr) auto; }
  .rr-nums { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .rules-row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .rules-row > .btn { justify-self: start; }
  .rr-nums { gap: 10px; }
  .rr-num { flex: 1; }
  .rr-num input { width: 100%; }
}

/* ---------- ۱۶) آژیر و توست ---------- */
.siren-banner {
  position: fixed;
  top: 12px;
  inset-inline: 12px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--r-lg);
  background: var(--grad-danger);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 20px 45px -18px rgba(239, 68, 68, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  animation: pulse 1.15s ease-in-out infinite;
}
.siren-banner button {
  margin-inline-start: auto;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.55);
  color: #fff;
  padding: 6px 14px;
  border-radius: var(--r-xs);
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.72; } }

#toasts {
  position: fixed;
  bottom: 22px;
  inset-inline-start: 22px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: min(360px, calc(100vw - 32px));
}
.toast {
  position: relative;
  padding: 12px 16px 12px 18px;
  border-radius: var(--r);
  background: var(--card-solid);
  border: 1px solid var(--border-2);
  box-shadow: var(--sh-3);
  font-size: 13.5px;
  font-weight: 600;
  animation: slidein 0.28s var(--ease) both;
  overflow: hidden;
}
.toast::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.toast.tg-ok { border-color: rgba(34, 197, 94, 0.45); }
.toast.tg-ok::before { background: var(--ok); }
.toast.tg-err { border-color: rgba(239, 68, 68, 0.5); }
.toast.tg-err::before { background: var(--danger); }
@keyframes slidein { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- ۱۷) پرچم‌های پرونده ---------- */
.flag-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  background: var(--glass);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.pill.accent { background: rgba(56, 189, 248, 0.14); border-color: rgba(56, 189, 248, 0.35); color: var(--accent); }
.pill.warn { background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.4); color: #fcd34d; }
.pill.danger { background: rgba(239, 68, 68, 0.16); border-color: rgba(239, 68, 68, 0.45); color: #fca5a5; }
.pill.ok { background: rgba(34, 197, 94, 0.14); border-color: rgba(34, 197, 94, 0.38); color: #86efac; }

.progress { height: 8px; border-radius: 99px; background: var(--glass-2); overflow: hidden; border: 1px solid var(--border); }
.progress > i { display: block; height: 100%; background: var(--grad-accent); border-radius: 99px; transition: width 0.5s var(--ease); box-shadow: 0 0 12px -2px rgba(56, 189, 248, 0.7); }
.progress.warn > i { background: var(--grad-warn); box-shadow: 0 0 12px -2px rgba(245, 158, 11, 0.7); }
.progress.danger > i { background: var(--grad-danger); box-shadow: 0 0 12px -2px rgba(239, 68, 68, 0.7); }
/* کپشن نوار پیشرفت — یک‌ردیفی و بدون شکستگی */
.progress-cap { display: flex; align-items: center; justify-content: flex-start; text-align: right; gap: 6px; margin-top: 6px; font-size: 11px; color: var(--muted); flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
.progress-cap .pct { font-weight: 700; font-variant-numeric: tabular-nums; }

.divider { height: 1px; background: var(--border); margin: 16px 0; border: 0; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .big { font-size: 34px; display: block; margin-bottom: 8px; opacity: 0.8; }

/* ---------- ۱۸) نوار پایین موبایل ---------- */
.bottomnav {
  display: none;
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  z-index: 50;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  gap: 3px;
  background: rgba(7, 12, 22, 0.9);
  backdrop-filter: blur(18px) saturate(150%);
  border-top: 1px solid var(--border);
}
html[data-theme="light"] .bottomnav { background: rgba(255, 255, 255, 0.92); }
.bottomnav .nav-item {
  flex: 1;
  flex-direction: column;
  gap: 3px;
  padding: 7px 3px 6px;
  font-size: 10.5px;
  text-align: center;
  border-radius: var(--r-sm);
  color: var(--muted);
}
.bottomnav .nav-item > span:first-child { width: 26px; height: 26px; flex: 0 0 26px; font-size: 14px; background: transparent; border: none; }
.bottomnav .nav-item.active { color: var(--accent); background: rgba(56, 189, 248, 0.1); border-color: transparent; }
.bottomnav .nav-item.active > span:first-child { background: transparent; color: var(--accent); }
.bottomnav .nav-item.active::after { display: none; }
.bottomnav .nav-item .caption { font-size: 10.5px; font-weight: 700; }

/* ---------- ۱۹) فوتر ---------- */
footer.credit {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 26px 0 10px;
  letter-spacing: 0.1px;
}
footer.credit b { color: var(--accent); font-weight: 800; }
footer.credit .sep { opacity: 0.45; margin: 0 6px; }

/* ---------- ۲۰) کمکی‌ها ---------- */
.muted { color: var(--muted); }
.center { text-align: center; }
.spacer { flex: 1; }
.rowflex { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mb0 { margin-bottom: 0; }
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.nowrap { white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- ۲۱) ریسپانسیو ---------- */
@media (max-width: 1000px) {
  .sidebar { display: none; }
  .appbar { display: flex; }
  .bottomnav { display: flex; }
  .main { padding: 16px 16px calc(108px + env(safe-area-inset-bottom)); }
}

@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stats .stat:last-child { grid-column: 1 / -1; grid-template-columns: auto 1fr auto; grid-template-areas: "ico lbl num"; }
  .stats .stat:last-child .lbl { font-size: 12.5px; }
  .stat { padding: 12px 13px 13px; }
  .stat .num { font-size: 29px; }
  .fieldrow { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .pagehead h1 { font-size: 18.5px; }
  .deadline-row { flex-wrap: wrap; gap: 8px; }
  .deadline-row .d-main { flex: 1 1 100%; }
  .deadline-row .state-chip { margin-inline-end: auto; }
  .deadline-row .d-date { order: 1; }
  .card { padding: 15px; border-radius: var(--r); }
  .modal { padding: 18px 16px 22px; border-radius: var(--r-lg); max-height: 92vh; }
  .tabs { width: 100%; }
  .tab { flex: 1; text-align: center; padding: 8px 10px; }
  #toasts { inset-inline: 14px; bottom: calc(80px + env(safe-area-inset-bottom)); max-width: none; }
  .siren-banner { flex-wrap: wrap; font-size: 13.5px; }
  .siren-banner button { margin-inline-start: 0; width: 100%; }
  footer.credit { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  /* لمس‌پذیری موبایل: دکمه‌های اکشن تمام‌عرض، بدون دستهٔ تغییر اندازه */
  #parse-btn, #save-btn, .btn.mobile-full { width: 100%; height: 44px; font-size: 14px; }
  textarea { resize: none; }
  .btn, input, select { min-height: 42px; }
  .bottomnav .nav-item { font-size: 10.5px; }
  .bottomnav .nav-item > span:first-child { width: 26px; height: 26px; flex-basis: 26px; }
  .d-date { font-size: 11.5px; }
  .toolbar { gap: 8px; }
  .toolbar .search { flex: 1 1 100%; }
  .toolbar select { flex: 1 1 auto; }
  .toolbar-count { margin-inline-start: 0; flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

@media print {
  .sidebar, .bottomnav, .appbar, footer.credit, #toasts { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* ---------- ۲۲) ارتقای UX موبایل و دسترس‌پذیری ---------- */

/* خوانایی: هیچ متنی زیر ۱۲px نماند */
.brand .brand-txt small { font-size: 12px; }
.bottomnav .nav-item .caption { font-size: 11.5px; }
.state-chip.case-status { font-size: 12px; }

/* هدف لمسی استاندارد ۴۴px برای ردیف‌های تنظیمات */
label.fix { min-height: 44px; padding: 10px 13px; cursor: pointer; }
label.fix input[type="checkbox"] { width: 19px; height: 19px; flex: 0 0 19px; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; }

/* جدول پرونده‌ها در موبایل: کارت عمودی به‌جای اسکرول افقی */
@media (max-width: 760px) {
  .table-wrap { border: 0; background: none; overflow: visible; }
  table { min-width: 0; width: 100%; display: block; }
  thead { display: none; }
  tbody { display: block; }
  tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
    align-items: center;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 12px 14px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm, none);
  }
  tbody tr:nth-child(even) { background: var(--glass); }
  tbody tr:hover { box-shadow: none; }
  tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 0;
    padding: 2px 0;
    font-size: 13.5px;
    min-width: 0;
  }
  tbody td::before {
    content: attr(data-l);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    flex: 0 0 auto;
  }
  tbody td.c-id {
    grid-column: 1 / -1;
    font-size: 17px;
    font-weight: 800;
    padding-bottom: 6px;
    margin-bottom: 4px;
    border-bottom: 1px dashed var(--border);
  }
  tbody td.c-id::before { content: none; }
  tbody td:last-child { grid-column: 1 / -1; justify-content: flex-start; }
  tbody td:last-child::before { content: none; }
}

/* ورودی‌ها در موبایل ۱۶px تا iOS زوم نکند */
@media (max-width: 1000px) {
  input, select, textarea { font-size: 16px; }
  .search input { font-size: 16px; }
}

/* ۱۶px روی موبایل لازم است تا Safari زوم نکند؛ !important چون قاعدهٔ پایه دارد */
@media (max-width: 1000px) {
  input, select, textarea { font-size: 16px !important; }
  input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; }
}

/* ---------- ۲۳) حالت‌های تعاملی: بارگذاری، دکمهٔ غیرفعال، نوار ذخیرهٔ چسبان ---------- */

/* دکمهٔ غیرفعال: نباید شبیه دکمهٔ فعال دیده شود */
.btn[disabled], .btn:disabled, button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  filter: saturate(0.6);
  transform: none !important;
  box-shadow: none !important;
}

/* دراپ‌زون در حال خواندن فایل */
.dropzone.busy {
  cursor: progress;
  border-style: solid;
  border-color: rgba(56, 189, 248, 0.55);
  color: var(--text);
  background: radial-gradient(600px 220px at 50% 0%, rgba(56, 189, 248, 0.18), transparent 72%);
  transform: none;
}
.dropzone.busy .spin { display: inline-flex; animation: spin 1.15s linear infinite; }
.dropzone.busy .spin .ico { width: 38px; height: 38px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* دکمهٔ اصلی ذخیره در موبایل همیشه در دسترس بماند */
@media (max-width: 760px) {
  #save-btn {
    position: sticky;
    bottom: calc(78px + env(safe-area-inset-bottom));
    z-index: 6;
    box-shadow: 0 14px 30px -12px rgba(34, 211, 238, 0.55), 0 0 0 1px rgba(56, 189, 248, 0.25);
  }
}

/* ناحیهٔ توست: اعلام وضعیت برای صفحه‌خوان‌ها */
#toasts { position: fixed; }

/* ۲۴) کارت پاسخ: پایهٔ اکشن‌ها */
.ans-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.ans-foot .hint { margin: 0; flex: 1 1 240px; }
.ans-foot .btn { flex: 0 0 auto; }
@media (max-width: 560px) {
  .ans-foot { flex-direction: column; align-items: stretch; }
  .ans-foot .btn { width: 100%; justify-content: center; }
}

/* ۲۵) شروع کار (Onboarding) */
.card.onboarding { border-color: color-mix(in srgb, var(--accent) 34%, var(--border)); }
.ob-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 6px 0 16px;
}
.ob-step {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-md, 12px);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}
.ob-step b { font-size: 13.5px; }
.ob-step .hint { margin-top: 4px; font-size: 12px; line-height: 1.7; }
.ob-n {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: var(--accent);
}

/* ۲۶) نوار حالت بدون اتصال */
#offline-bar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  font-size: 12.5px;
  font-weight: 700;
  color: #3a2400;
  background: linear-gradient(90deg, #ffd479, #ffb648);
  border-bottom: 1px solid rgba(0, 0, 0, .12);
}
#offline-bar svg.ico { width: 17px; height: 17px; flex: 0 0 auto; }

/* ۲۷) فهرست‌های تنظیمات: پشتیبان و تعطیلات */
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md, 12px);
  margin-bottom: 8px;
  background: color-mix(in srgb, var(--foreground) 2%, transparent);
}
.list-row .lr-main { flex: 1 1 auto; min-width: 0; }
.list-row .lr-main b { font-size: 12.5px; word-break: break-all; }
.list-row .btn { flex: 0 0 auto; }

.hol-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.hol-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.hol-chip b { font-weight: 700; }
.hol-chip .mono-id { font-size: 11.5px; }
.hol-x {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
}
.hol-x:hover { color: #fff; background: var(--danger, #d9534f); }
.hol-x svg.ico { width: 13px; height: 13px; }

.btn.danger { background: var(--danger, #d9534f); color: #fff; border-color: transparent; }

/* ۲۸) دکمه‌های هر قاعده + چیدمان موبایل */
.rr-actions { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .rules-row { grid-template-columns: 1fr !important; gap: 10px; }
  .rr-actions { justify-content: flex-start; }
  .rr-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* ۲۹) اصلاح اندازه‌های ریز (نتیجهٔ ممیزی موبایل) */
.progress-cap, .progress-cap .pct { font-size: 12px !important; }
.hol-chip { padding: 5px 7px 5px 10px; }
.hol-x { width: 30px; height: 30px; }
.hol-x svg.ico { width: 14px; height: 14px; }
.hol-x { width: 34px; height: 34px; }

/* ۳۰) زنگولهٔ یادآوری و پنل بازشو */
.bell-dot {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e5484d;
  color: #fff;
  font-size: 11.5px;
  font-style: normal;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg, #060a13);
}
.iconbtn { position: relative; }

.popover {
  position: fixed;
  bottom: 72px;
  inset-inline-start: 18px;
  z-index: 70;
  width: min(360px, calc(100vw - 32px));
  max-height: min(60vh, 440px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .38);
  overflow: hidden;
}
@media (max-width: 760px) {
  .popover { bottom: 84px; inset-inline: 8px auto; width: calc(100vw - 16px); }
}
.pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.pop-x {
  border: 0;
  background: transparent;
  color: var(--muted-foreground);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 7px;
}
.pop-x:hover { background: color-mix(in srgb, var(--foreground) 8%, transparent); color: var(--foreground); }
.pop-list { overflow-y: auto; padding: 6px; }
.pop-item {
  padding: 8px 9px;
  border-radius: 10px;
}
.pop-item + .pop-item { border-top: 1px solid var(--border); }
.pi-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pi-top b { font-size: 12.5px; }
.pi-top .muted { font-size: 10.5px; white-space: nowrap; }
.pi-body {
  font-size: 11.5px;
  color: var(--muted-foreground);
  margin-top: 3px;
  line-height: 1.7;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.pop-empty { padding: 16px 12px; text-align: center; font-size: 12.5px; color: var(--muted-foreground); }

/* ۳۱) جست‌وجوی سراسری (Ctrl+K) */
[hidden] { display: none !important; }

.search-modal {
  max-width: 660px;
  max-height: 74vh;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted-foreground);
}
.search-row .ico { width: 18px; height: 18px; flex: 0 0 auto; }
.search-row input {
  flex: 1 1 auto;
  border: 0;
  background: transparent;
  color: var(--foreground);
  font: inherit;
  font-size: 15px;
  outline: none;
  min-width: 0;
}
.kbd {
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  background: color-mix(in srgb, var(--foreground) 6%, transparent);
  font-family: inherit;
}
.search-results { overflow-y: auto; padding: 6px; min-height: 64px; }
.sr-count { font-size: 11px; color: var(--muted-foreground); padding: 6px 10px 2px; }
.sr-hint { padding: 18px 14px; font-size: 12.5px; color: var(--muted-foreground); line-height: 1.9; }
.sr-item {
  display: flex;
  gap: 10px;
  width: 100%;
  text-align: start;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.sr-item:hover, .sr-item.sel { background: color-mix(in srgb, var(--accent, #38bdf8) 14%, transparent); }
.sr-item:focus-visible { outline: 2px solid var(--accent, #38bdf8); outline-offset: -2px; }
.sr-ico {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: color-mix(in srgb, var(--foreground) 7%, transparent);
}
.sr-ico .ico { width: 15px; height: 15px; }
.sr-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sr-main b { font-size: 13px; font-weight: 700; }
.sr-kind {
  font-size: 10px;
  color: var(--accent, #38bdf8);
  font-weight: 700;
}
.sr-snip {
  font-size: 11.5px;
  color: var(--muted-foreground);
  line-height: 1.7;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.search-foot {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  font-size: 10.5px;
}
@media (max-width: 560px) {
  #search-ov { padding: 8px !important; padding-top: 6vh !important; }
  .search-modal { max-height: 84vh; }
  .search-foot { display: none; }
  .kbd { display: none; }
  .search-row input { font-size: 16px; }
}

/* ۳۲) سوابق پرونده در مودال */
.tl-note { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; }
.tl-note textarea {
  flex: 1 1 auto;
  min-height: 44px;
  resize: vertical;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--foreground) 4%, transparent);
  color: var(--foreground);
  font: inherit;
  font-size: 13px;
  line-height: 1.8;
}
.tl-note textarea:focus { outline: 2px solid var(--accent, #38bdf8); outline-offset: -1px; }
.tl-list { display: flex; flex-direction: column; gap: 2px; }
.tl-item { display: flex; gap: 10px; padding: 7px 0; }
.tl-dot {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--foreground) 8%, transparent);
  color: var(--muted-foreground);
}
.tl-dot .ico { width: 13px; height: 13px; }
.tl-item.k-reminder .tl-dot { color: #f4b740; background: rgba(244, 183, 64, .14); }
.tl-item.k-note .tl-dot { color: #38bdf8; background: rgba(56, 189, 248, .14); }
.tl-item.k-hearing .tl-dot { color: #a78bfa; background: rgba(167, 139, 250, .14); }
.tl-item.k-deadline .tl-dot { color: #fb7185; background: rgba(251, 113, 133, .14); }
.tl-body { min-width: 0; flex: 1 1 auto; }
.tl-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tl-top b { font-size: 12.5px; font-weight: 700; }
.tl-top .muted { font-size: 10.5px; white-space: nowrap; }
.tl-txt { font-size: 11.5px; line-height: 1.8; margin-top: 1px; }
#tl-more { margin-top: 6px; }

/* ۳۳) خوانایی تاریخ‌های ریز در مودال/پنل */
.tl-top .muted,
.pi-top .muted { font-size: 11.5px; }
@media (max-width: 560px) {
  .tl-top .muted,
  .pi-top .muted { font-size: 12px; }
  .tl-top { flex-wrap: wrap; gap: 2px 8px; }
  .sr-snip { -webkit-line-clamp: 3; }
}

/* ۳۴) سرستون‌های مرتب‌ساز */
#tbl thead th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
#tbl thead th[data-sort]:hover { color: var(--foreground); }
#tbl thead th[data-sort]:focus-visible { outline: 2px solid var(--accent, #38bdf8); outline-offset: -3px; border-radius: 6px; }
#tbl thead th.sorted { color: var(--accent, #38bdf8); }
.sort-i { font-size: 10px; margin-inline-start: 3px; opacity: .85; }

/* ۳۵) کارت‌های آماری کلیک‌پذیر */
.stat.click { cursor: pointer; transition: transform .16s var(--ease, ease), box-shadow .18s var(--ease, ease); }
.stat.click:hover { transform: translateY(-2px); box-shadow: var(--sh-2, 0 10px 26px rgba(0,0,0,.28)); }
.stat.click:focus-visible { outline: 2px solid var(--accent, #38bdf8); outline-offset: 2px; }
.stat.click:active { transform: translateY(0); }

/* ۳۶) ردیف پیوست‌ها */
.attach-row { align-items: center; gap: 8px; }
.att-ico {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--foreground) 7%, transparent);
  color: var(--muted-foreground);
}
.att-ico .ico { width: 14px; height: 14px; }
.att-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
}
.att-size { font-size: 11px; white-space: nowrap; }
.attach-row .btn.small { padding: 5px 9px; font-size: 11.5px; display: inline-flex; align-items: center; gap: 4px; }
.attach-row .btn.small .ico { width: 13px; height: 13px; }
@media (max-width: 620px) {
  .attach-row { flex-wrap: wrap; }
  .att-name { flex: 1 1 100%; order: -1; }
  .att-size { order: 0; }
  .attach-row .spacer { display: none; }
  .attach-row .btn.small { flex: 1 1 auto; justify-content: center; min-height: 38px; }
}

/* ۳۷) برجسته‌سازی نتیجه و دکمهٔ ریز */
.sr-snip mark, .sr-main mark { background: color-mix(in srgb, var(--accent, #38bdf8) 30%, transparent); color: inherit; border-radius: 4px; padding: 0 2px; }
.btn.tiny { padding: 3px 6px; font-size: 11px; line-height: 1; min-height: 24px; }
.btn.tiny .ico { width: 12px; height: 12px; }
.btn.tiny { font-size: 12px; min-width: 32px; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; }

/* ۳۸) نشان «دست‌کاری‌شده» در جدول مهلت‌ها */
.chip-over {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #f4b740;
  background: rgba(244, 183, 64, .14);
  border: 1px solid rgba(244, 183, 64, .32);
  vertical-align: middle;
}

/* ۳۹) راهنمای میان‌برها */
.sc-list { display: flex; flex-direction: column; gap: 2px; }
.sc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 2px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.sc-row:last-child { border-bottom: 0; }
.sc-row .kbd { white-space: nowrap; font-size: 11.5px; padding: 3px 8px; }

/* ۴۰) نوار پیش‌نویس فرم */
.draft-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 12.5px;
  color: #7dd3fc;
  background: rgba(56, 189, 248, .1);
  border: 1px solid rgba(56, 189, 248, .28);
}
.draft-bar .ico { width: 15px; height: 15px; }
.draft-bar .btn.tiny { margin-inline-start: auto; }

/* ۴۱) تغییر سریع وضعیت پرونده در مودال */
.status-quick { display: flex; gap: 6px; flex-wrap: wrap; margin: -6px 0 14px; }
.sq-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--foreground) 4%, transparent);
  color: var(--muted-foreground);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s var(--ease, ease);
  min-height: 32px;
}
.sq-btn:hover { color: var(--foreground); border-color: color-mix(in srgb, var(--accent, #38bdf8) 45%, var(--border)); }
.sq-btn.on {
  color: var(--accent-ink, #04121f);
  background: var(--accent, #38bdf8);
  border-color: var(--accent, #38bdf8);
  font-weight: 800;
}
.sq-btn:focus-visible { outline: 2px solid var(--accent, #38bdf8); outline-offset: 2px; }

/* ۴۲) ردیف دکمه‌های فرم ابلاغیه */
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.form-actions .btn.primary { flex: 1 1 260px; justify-content: center; }
.form-actions .btn.ghost { flex: 0 0 auto; }
@media (max-width: 560px) { .form-actions .btn.ghost { flex: 1 1 100%; justify-content: center; } }

/* ۴۳) جست‌وجوهای اخیر در پالت */
.sr-recent-wrap { padding: 4px 6px 10px; }
.sr-recent-head { font-size: 12px; color: var(--muted-foreground); margin: 0 6px 8px; }
.sr-recent { display: flex; gap: 8px; flex-wrap: wrap; }
.sr-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px; border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--foreground) 4%, transparent);
  color: var(--muted-foreground); font: inherit; font-size: 12.5px;
  cursor: pointer; min-height: 34px;
}
.sr-chip .ico { width: 13px; height: 13px; opacity: .7; }
.sr-chip:hover { color: var(--foreground); border-color: color-mix(in srgb, var(--accent, #38bdf8) 45%, var(--border)); }
.sr-chip:focus-visible { outline: 2px solid var(--accent, #38bdf8); outline-offset: 2px; }

/* ۴۴) دکمه‌های کارت جواب */
.ans-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ans-foot { flex-wrap: wrap; gap: 10px; }
@media (max-width: 560px) {
  .ans-acts { width: 100%; }
  .ans-acts .btn { flex: 1 1 auto; justify-content: center; }
}

/* ۴۵) کادر بررسی بدون ارسال */
.dry-box {
  margin-top: 10px; padding: 10px 12px; border-radius: 12px;
  font-size: 12.5px; line-height: 1.9;
  background: color-mix(in srgb, var(--accent, #38bdf8) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent, #38bdf8) 26%, var(--border));
  color: var(--foreground);
}
.dry-box b { display: block; margin-bottom: 4px; color: var(--accent, #38bdf8); }

/* ۴۶) لینک پرش به محتوا (دسترس‌پذیری کیبورد) */
.skip-link {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translate(-50%, -160%);
  z-index: 200;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--accent, #38bdf8);
  color: var(--accent-ink, #04121f);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition: transform .18s ease;
}
.skip-link:focus-visible, .skip-link:focus {
  transform: translate(-50%, 0);
  outline: 3px solid color-mix(in srgb, var(--accent, #38bdf8) 55%, #000);
  outline-offset: 2px;
}
#main:focus { outline: none; }

/* ۴۷) نبض هفته در داشبورد */
.week-strip { margin: 0 0 16px; }
.wk-cap { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted-foreground); margin-bottom: 8px; }
.wk-cap .ico { width: 14px; height: 14px; }
.wk-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.wk {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 4px 8px; border-radius: 12px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--foreground) 3%, transparent);
}
.wk-wd { font-size: 11.5px; color: var(--muted-foreground); }
.wk-n { font-size: 18px; font-weight: 800; line-height: 1.15; color: var(--muted-foreground); }
.wk-d { font-size: 11.5px; color: color-mix(in srgb, var(--muted-foreground) 80%, transparent); }
.wk.today { border-color: color-mix(in srgb, var(--accent, #38bdf8) 55%, var(--border)); background: color-mix(in srgb, var(--accent, #38bdf8) 10%, transparent); }
.wk.today .wk-wd, .wk.today .wk-n { color: var(--accent, #38bdf8); }
.wk.has { border-color: color-mix(in srgb, #f4b740 45%, var(--border)); }
.wk.has .wk-n { color: #f4b740; }
@media (max-width: 560px) {
  .wk-row { gap: 5px; }
  .wk { padding: 7px 2px 6px; border-radius: 10px; }
  .wk-wd, .wk-d { font-size: 11.5px; }
  .wk-n { font-size: 14px; }
}

/* ۴۸) قفل اسکرول پشت مودال‌ها (جلوگیری از scroll chaining روی موبایل) */
html.no-scroll, body.no-scroll { overflow: hidden !important; overscroll-behavior: none; }

/* ۴۹) اسپینر داخل دکمه‌ها */
.btn .spin {
  display: inline-block; width: 13px; height: 13px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  margin-inline-end: 6px;
  vertical-align: -2px;
  animation: spin 0.9s linear infinite;
}
@media (prefers-reduced-motion: reduce) { .btn .spin { animation-duration: 2.4s; } }

/* ۵۰) هدف‌های لمسی کوچک در مودال و پنل‌ها */
.btn.small { min-height: 36px; }
#ov .btn.small { min-height: 38px; }
#e-copy-num { min-width: 40px; min-height: 38px; }
#bell-clear { min-height: 36px; padding: 6px 12px; }

/* ۵۱) جلوگیری از سرریز چیپ وضعیت در تیتر مودال */
#ov .modal h2 { flex-wrap: wrap; gap: 4px 8px; }
#ov .modal h2 .state-chip { max-width: 100%; }
@media (max-width: 480px) { #ov .modal h2 .state-chip { margin-inline-start: 0; } }

/* ---------- ۵۲) ورود گروهی ابلاغیه‌ها ---------- */
.bulk-modal {
  width: min(720px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.bulk-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bulk-top h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16.5px; }
.bulk-grid { display: grid; gap: 10px; }
.bulk-hint { font-size: 12.5px; margin: 0; line-height: 1.7; }
.bulk-acts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }
.bulk-preview { display: grid; gap: 8px; }
.bulk-sum {
  font-size: 13px;
  padding: 9px 12px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text-2);
}
.bulk-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--glass);
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  transition: border-color .15s ease, background .15s ease;
}
.bulk-row:hover { border-color: var(--border-2); }
.bulk-row:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.bulk-row input[type="checkbox"] {
  width: 18px; height: 18px; flex: 0 0 18px;
  accent-color: var(--accent); cursor: pointer; margin: 0;
}
.bulk-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.bulk-num { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulk-sub, .bulk-dates {
  font-size: 12.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bulk-tag {
  flex: 0 0 auto; font-size: 12px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.bulk-tag.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.bulk-tag.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.bulk-tag.err { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.bulk-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  position: sticky; bottom: 0; padding: 10px 0 2px; background: var(--card-solid);
}
.bulk-foot[hidden] { display: none; }
.bulk-result { display: grid; gap: 8px; }
.bulk-done { padding: 10px 12px; border-radius: 11px; font-size: 13.5px; border: 1px solid var(--border); }
.bulk-done.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.bulk-done.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.bulk-errs { margin: 0; padding-inline-start: 18px; font-size: 12.5px; color: var(--text-2); line-height: 1.9; }
@media (max-width: 560px) {
  .bulk-modal { width: 96vw; max-height: 92vh; padding: 14px; }
  .bulk-row { flex-wrap: wrap; }
  .bulk-tag { order: 3; margin-inline-start: 28px; }
  .bulk-foot { flex-direction: column; align-items: stretch; }
  .bulk-foot .btn { width: 100%; }
}
.bulk-opt {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-2); cursor: pointer; user-select: none;
}
.bulk-opt input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }

/* ===== §۵۳ ورودی فایل گروهی و پیوست اصل ابلاغیه ===== */
.attach-note{
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;
  margin-top:10px;padding:9px 12px;border-radius:10px;
  border:1px solid var(--border);background:var(--card);
  font-size:12.5px;color:var(--muted-foreground);
}
.attach-note svg{width:15px;height:15px;flex:none;stroke:currentColor}
.attach-note b{color:var(--foreground);font-weight:600}
.attach-note .linklike{margin-inline-start:auto}
.add-bulk{display:flex;justify-content:flex-end;margin-top:10px}
.linklike{
  background:none;border:0;padding:2px 4px;font:inherit;font-size:12.5px;
  color:var(--muted-foreground);text-decoration:underline;text-underline-offset:3px;cursor:pointer;
}
.linklike:hover{color:var(--foreground)}
.bulk-modal.dropping{outline:2px dashed var(--accent);outline-offset:-8px}
@media(max-width:560px){.add-bulk{justify-content:stretch}.add-bulk .btn{width:100%}}

/* ===== §۵۴ حذف گروهی، بنر مهلت، اعتبار توسعه‌دهنده ===== */
th.c-sel, td.c-sel{width:52px;padding-inline-end:0;text-align:center}
th.c-sel label, td.c-sel span.hit{display:inline-flex;align-items:center;justify-content:center}
/* چک‌باکس ۳۶px با تیک سفارشی — هم هدف لمسی استاندارد، هم هم‌اندازه با ردیف */
td.c-sel input[type=checkbox], #sel-all{
  appearance:none;-webkit-appearance:none;width:36px!important;height:36px!important;
  min-width:36px;margin:0;padding:0!important;
  border-radius:10px!important;border:1.5px solid var(--border)!important;
  background:transparent!important;
  cursor:pointer;position:relative;display:inline-block;vertical-align:middle;
  transition:background .15s var(--ease),border-color .15s var(--ease);
}
td.c-sel input[type=checkbox]:hover, #sel-all:hover{border-color:var(--accent)!important}
td.c-sel input[type=checkbox]:checked, #sel-all:checked,
td.c-sel input[type=checkbox]:indeterminate, #sel-all:indeterminate{
  background:var(--accent)!important;border-color:var(--accent)!important;
}
td.c-sel input[type=checkbox]:checked::after, #sel-all:checked::after{
  content:"";position:absolute;inset-inline-start:11px;top:6px;width:9px;height:16px;
  border:solid #fff;border-width:0 2.5px 2.5px 0;transform:rotate(45deg);
}
#sel-all:indeterminate::after{
  content:"";position:absolute;inset-inline-start:8px;top:15px;width:16px;height:3px;
  background:#fff!important;border-radius:2px;
}
.bulk-opt{display:inline-flex;align-items:center;gap:7px;min-height:36px;padding:4px 8px;border-radius:9px}
.bulk-opt:hover{background:color-mix(in srgb, var(--accent) 12%, transparent)}
.bulk-opt input{width:17px;height:17px;accent-color:var(--accent);cursor:pointer}
#bulk-del[hidden]{display:none}
.dl-banner{
  display:flex;align-items:center;gap:14px;flex-wrap:wrap;justify-content:space-between;
  margin:2px 0 14px;padding:12px 16px;border-radius:12px;
  border:1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background:color-mix(in srgb, var(--accent) 12%, transparent);
}
.dl-banner.late{border-color:color-mix(in srgb, #ef4444 45%, transparent);background:color-mix(in srgb, #ef4444 14%, transparent)}
.dl-banner-main{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap}
.dl-banner .k{font-size:12px;color:var(--muted-foreground)}
.dl-banner-date{font-size:22px;font-weight:800;letter-spacing:.5px}
.dl-banner-sub{display:inline-flex;align-items:center;gap:5px;font-size:12.5px;font-weight:600;color:var(--muted-foreground)}
.dl-banner.late .dl-banner-sub{color:#f87171}
.dl-banner svg{width:15px;height:15px;stroke:currentColor}
.kv .v.clamp{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;line-height:1.7;cursor:help}
#ov .fieldrow > div{flex:1 1 220px}
#ov .fieldrow select,#ov .fieldrow input{width:100%}
.dev-line{
  margin:0 4px 12px;padding:7px 10px;border-radius:9px;text-align:center;
  font-size:12px;color:var(--muted-foreground);
  background:color-mix(in srgb, var(--accent) 11%, transparent);
  border:1px solid color-mix(in srgb, var(--accent) 26%, transparent);
}
.dev-line b{color:var(--accent);font-weight:800;letter-spacing:.3px}
footer.credit b.dev{color:var(--accent);font-weight:800}
@media(max-width:760px){.dev-line{display:none}}

/* ===== §۵۵ راهنمای تلگرام ===== */
details.tg-guide summary{
  display:flex;align-items:center;gap:7px;min-height:36px;cursor:pointer;
  font-size:13px;color:var(--muted-foreground);list-style:none;
}
details.tg-guide summary::-webkit-details-marker{display:none}
details.tg-guide summary:hover{color:var(--foreground)}
details.tg-guide svg{width:15px;height:15px;stroke:currentColor;flex:none}
details.tg-guide ol{margin:8px 0 0;padding-inline-start:20px;font-size:12.8px;line-height:2}
details.tg-guide code{font-size:12px;background:var(--glass);padding:1px 5px;border-radius:6px;direction:ltr;display:inline-block}

/* ── §۵۶ هوش مصنوعی: کارت تحلیل و لایحه ───────────────────────────── */
#ai-box{margin-top:16px;border:1px solid var(--border);border-radius:14px;background:var(--card);
  padding:14px 16px 16px}
#ai-box[hidden]{display:none}
.ai-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-weight:700;margin-bottom:10px}
.ai-head svg{width:18px;height:18px;color:var(--accent)}
.ai-badge{display:inline-flex;align-items:center;gap:5px;font-size:11.5px;font-weight:600;
  color:var(--accent);border:1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius:999px;padding:3px 10px;line-height:1.7;background:color-mix(in srgb, var(--accent) 10%, transparent)}
.ai-badge svg{width:13px;height:13px}
.ai-x{margin-inline-start:auto;background:transparent;border:1px solid var(--border);border-radius:9px;
  width:32px;height:32px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;
  color:var(--muted-foreground)}
.ai-x:hover{color:var(--foreground);border-color:var(--accent)}
.ai-x svg{width:15px;height:15px}
.ai-text{font-size:13.5px;line-height:2;margin:0 0 12px;max-height:420px;overflow:auto;
  padding-inline-end:4px;color:var(--foreground)}
.ai-text p{margin:0 0 8px;text-align:start}
.ai-text b{color:var(--foreground);font-weight:700}
.ai-text code{font-family:inherit;background:color-mix(in srgb, var(--foreground) 8%, transparent);
  border-radius:6px;padding:1px 5px;direction:ltr;display:inline-block}
.ai-sec{margin:14px 0 6px;font-size:13.5px;color:var(--accent);font-weight:700}
.ai-sec:first-child{margin-top:0}
.ai-list{margin:0 0 10px;padding-inline-start:18px;list-style:disc}
.ai-list li{padding-inline-start:2px}
ol.ai-list{list-style:decimal}
.ai-table-wrap{overflow-x:auto;margin:6px 0 12px;border:1px solid var(--border);border-radius:10px}
.ai-table{border-collapse:collapse;width:100%;font-size:12.5px}
.ai-table th,.ai-table td{padding:6px 10px;text-align:start;border-bottom:1px solid var(--border)}
.ai-table th{background:color-mix(in srgb, var(--foreground) 6%, transparent);font-weight:700;font-size:12px}
.ai-table tr:last-child td{border-bottom:0}
.ai-list li{margin-bottom:5px}
.ai-item{display:flex;gap:7px;margin:0 0 7px;align-items:flex-start}
.ai-n{min-width:20px;color:var(--accent);font-weight:700;flex:0 0 auto}
.ai-warn{color:#f59e0b;font-weight:600}
.ai-actions{margin-top:2px;gap:8px}
.ai-load{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--muted-foreground);padding:6px 0}
.ai-load svg{width:18px;height:18px;animation:spin 1.1s linear infinite}
.ai-load.err{color:#f87171}
@media (max-width:640px){ .ai-text{max-height:320px;font-size:13px} .ai-head{font-size:13.5px} }

/* دکمه‌های سریع هوش مصنوعی در بالای پنجرهٔ پرونده */
.ai-quick{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0 6px}
.ai-quick .btn{min-height:40px}
.modal-x{margin-inline-start:auto;background:transparent;border:1px solid var(--border);border-radius:10px;
  width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;
  color:var(--muted-foreground);flex:0 0 auto}
.modal-x:hover{color:var(--foreground);border-color:var(--accent)}
.modal-x svg{width:16px;height:16px}

/* ── اطلاع‌رسانی به طرف پرونده ───────────────────────────────── */
.party-box{border:1px solid var(--border);border-radius:12px;margin:12px 0 4px;background:color-mix(in oklab,var(--card) 70%,transparent)}
.party-box>summary{cursor:pointer;padding:10px 12px;font-weight:700;font-size:13px;display:flex;align-items:center;gap:8px;list-style:none}
.party-box>summary::-webkit-details-marker{display:none}
.party-box>summary svg{width:15px;height:15px}
.party-inner{padding:0 12px 12px}
.party-list{display:flex;flex-direction:column;gap:6px;margin-top:10px}
.party-row{display:flex;align-items:center;gap:8px;padding:7px 10px;border:1px solid var(--border);border-radius:10px;font-size:12.5px}
.party-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.party-actions{display:flex;gap:2px;flex:0 0 auto}
.party-badge{font-size:10.5px;padding:2px 8px;border-radius:999px;border:1px solid var(--border);flex:0 0 auto}
.party-badge.ok{border-color:color-mix(in oklab,var(--accent) 60%,transparent);color:var(--accent)}
.party-badge.pending{color:var(--muted-foreground)}
.party-meta{font-size:10.5px;color:var(--muted-foreground);flex:0 0 auto;white-space:nowrap;font-variant-numeric:tabular-nums}
.party-note{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:12.5px;padding:8px 10px;border:1px dashed color-mix(in oklab,var(--warn,#d97706) 50%,transparent);border-radius:10px;color:var(--muted-foreground);background:color-mix(in oklab,var(--warn,#d97706) 7%,transparent)}
.party-note svg{width:15px;height:15px;flex:0 0 auto;color:var(--warn,#d97706)}
@media (max-width:560px){
  .party-row{flex-wrap:wrap}
  .party-name{white-space:normal;flex:1 1 100%}
  .party-meta{order:3;flex:1 1 100%;font-size:10px}
}
