/* ================================================================
   اتوماسیون اداری — دیزاین‌سیستم نسخهٔ ۳ (Enterprise Premium)
   Vazirmatn + RTL + پالت سرمه‌ای/آبی/فیروزه‌ای
   ================================================================ */
:root {
  --navy-900: #0b1f38;
  --navy-800: #10294a;
  --navy-700: #16375f;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-50:  #eff6ff;
  --teal-500: #0d9488;
  --teal-50:  #f0fdfa;
  --green-600:#059669;
  --green-100:#d1fae5;
  --red-600:  #dc2626;
  --red-100:  #fee2e2;
  --amber-100:#fef3c7;
  --amber-700:#b45309;
  --slate-900:#0f172a;
  --slate-700:#334155;
  --slate-500:#64748b;
  --slate-400:#94a3b8;
  --slate-200:#e2e8f0;
  --slate-100:#f1f5f9;
  --bg:       #f3f6fb;
  --card:     #ffffff;
  --radius:   14px;
  --shadow:   0 1px 2px rgba(15,23,42,.05), 0 6px 18px rgba(15,23,42,.06);
  --shadow-lg:0 14px 40px rgba(11,31,56,.16);
  --ring:     0 0 0 3px rgba(59,130,246,.22);
  --ease:     cubic-bezier(.4,0,.2,1);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: Vazirmatn, Tahoma, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--slate-900);
  margin: 0;
  font-size: 13.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(59,130,246,.22); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }

/* ---------- Layout: sidebar + main ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px; flex-shrink: 0;
  background:
    radial-gradient(420px 320px at 120% -5%, rgba(37,99,235,.25), transparent 60%),
    radial-gradient(380px 300px at -20% 105%, rgba(13,148,136,.18), transparent 55%),
    linear-gradient(180deg, #0a1c33 0%, var(--navy-800) 55%, #123257 100%);
  background-color: var(--navy-800);
  color: #c4d4ea;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sb-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: 11px;
}
.sb-logo .logo-ic {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--blue-500), var(--teal-500));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(37,99,235,.45), inset 0 1px 0 rgba(255,255,255,.35);
}
.sb-logo .t1 { color: #fff; font-weight: 800; font-size: 14.5px; line-height: 1.4; }
.sb-logo .t2 { color: #7f9cc0; font-size: 10.5px; }

.sb-nav { flex: 1; padding: 12px 12px; overflow-y: auto; }
.sb-nav::-webkit-scrollbar { width: 5px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }
.sb-sec {
  display: flex; align-items: center; gap: 8px;
  color: #56769e; font-size: 10px; font-weight: 700;
  letter-spacing: 1px; padding: 14px 12px 6px;
}
.sb-sec::after { content: ""; flex: 1; height: 1px; background: rgba(255,255,255,.08); }
.sb-nav a {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 2px;
  color: #b7c8de; text-decoration: none;
  border-radius: 10px; font-size: 13px;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.sb-nav a svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; transition: opacity .18s, transform .18s var(--ease); }
.sb-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sb-nav a:hover svg { opacity: 1; transform: translateX(-1px); }
.sb-nav a.act {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
  color: #fff;
  box-shadow: 0 6px 16px rgba(37,99,235,.42), inset 0 1px 0 rgba(255,255,255,.25);
}
.sb-nav a.act svg { opacity: 1; }
.sb-nav a.act::after {
  content: ""; position: absolute; inset-inline-end: -12px; top: 50%;
  transform: translateY(-50%); width: 3px; height: 55%;
  background: var(--blue-500); border-radius: 3px 0 0 3px;
}

.sb-user {
  margin: 12px; padding: 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 14px;
  display: flex; align-items: center; gap: 10px;
  backdrop-filter: blur(6px);
}
.sb-user .avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--teal-500), var(--blue-500));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 4px 12px rgba(13,148,136,.4);
}
.sb-user .nm { color: #fff; font-size: 12.5px; font-weight: 700; line-height: 1.3; }
.sb-user .ps { color: #7f9cc0; font-size: 10.5px; }
.sb-user a.logout { color: #f87171; font-size: 11px; text-decoration: none; display: inline-block; margin-top: 2px; }
.sb-user a.logout:hover { text-decoration: underline; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226,232,240,.9);
  padding: 12px 28px;
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { margin: 0; font-size: 16.5px; font-weight: 800; color: var(--navy-900); }
.topbar h1::after { content: ""; display: block; width: 26px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--blue-500), var(--teal-500)); margin-top: 3px; }
.topbar .left { display: flex; align-items: center; gap: 10px; }
.chip-date {
  background: #fff; border: 1px solid var(--slate-200);
  border-radius: 20px; padding: 4px 14px; font-size: 12px; color: var(--slate-700);
  box-shadow: var(--shadow);
}

.content {
  padding: 20px 28px; flex: 1;
  position: relative;
}
.content::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(37,99,235,.06) 1px, transparent 1.3px);
  background-size: 24px 24px;
}
.content > * { position: relative; }

/* ---------- Components ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 16px;
  border: 1px solid rgba(226,232,240,.7);
}
.card h3 { margin: 0 0 12px; color: var(--navy-900); font-size: 14px; font-weight: 800; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--card); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow); border: 1px solid rgba(226,232,240,.7);
  display: flex; align-items: center; gap: 12px;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.stat:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(15,23,42,.10); }
.stat .ic {
  width: 46px; height: 46px; border-radius: 13px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  background: linear-gradient(135deg, var(--blue-50), var(--teal-50));
}
.stat .v { font-size: 23px; font-weight: 800; line-height: 1.2; color: var(--navy-900); }
.stat .l { font-size: 11.5px; color: var(--slate-500); }

/* ---------- table ---------- */
table.tbl {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid rgba(226,232,240,.7);
}
table.tbl th {
  background: #f7f9fd; padding: 11px 12px; font-size: 11px; color: var(--slate-500);
  text-align: right; font-weight: 700; white-space: nowrap;
  border-bottom: 1px solid var(--slate-200);
  position: sticky; top: 57px; z-index: 5;
  letter-spacing: .2px;
}
table.tbl th:first-child { border-start-start-radius: var(--radius); }
table.tbl th:last-child { border-start-end-radius: var(--radius); }
table.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--slate-100); font-size: 13px; vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: background .15s var(--ease); }
table.tbl tbody tr:hover td { background: var(--blue-50); }
table.tbl tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--blue-500); }
.clamp {
  max-width: 320px; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; line-height: 1.55;
}
td.clamp a { color: var(--slate-900); font-weight: 600; }
td.clamp a:hover { color: var(--blue-600); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2.5px 11px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.b1 { background: var(--blue-50); color: var(--blue-600); }
.b2 { background: var(--green-100); color: var(--green-600); }
.b3 { background: var(--red-100); color: var(--red-600); }
.b4 { background: var(--amber-100); color: var(--amber-700); }
.b5 { background: var(--slate-100); color: var(--slate-700); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-500)); color: #fff !important; text-decoration: none !important;
  padding: 8px 18px; border-radius: 10px; font-size: 13px; font-family: inherit;
  border: none; cursor: pointer;
  box-shadow: 0 2px 8px rgba(37,99,235,.3), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), filter .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(37,99,235,.4); }
.btn:active { transform: translateY(0); }
.btn.green { background: linear-gradient(135deg, var(--green-600), #10b981); box-shadow: 0 2px 8px rgba(5,150,105,.3); }
.btn.red { background: linear-gradient(135deg, var(--red-600), #ef4444); box-shadow: 0 2px 8px rgba(220,38,38,.3); }
.btn.gray { background: linear-gradient(135deg, var(--slate-500), var(--slate-400)); box-shadow: none; }
.btn.ghost { background: #fff; color: var(--slate-700) !important; box-shadow: var(--shadow); border: 1px solid var(--slate-200); }
.btn.ghost:hover { background: var(--slate-50, #f8fafc); }
.btn.sm { padding: 4px 12px; font-size: 12px; border-radius: 8px; }
.btn.lg { padding: 11px 34px; font-size: 14px; }

/* ---------- alerts ---------- */
.alert { border-radius: 12px; padding: 11px 18px; margin: 0 0 14px; font-size: 13px; }
.alert.ok   { background: var(--green-100); color: var(--green-600); border: 1px solid #a7f3d0; }
.alert.error{ background: var(--red-100); color: var(--red-600); border: 1px solid #fecaca; }

/* ---------- filterbar ---------- */
.filterbar {
  background: var(--card); border-radius: var(--radius); padding: 13px 18px;
  margin-bottom: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  box-shadow: var(--shadow); border: 1px solid rgba(226,232,240,.7);
}
.filterbar input, .filterbar select {
  padding: 8px 12px; border: 1px solid var(--slate-200); border-radius: 9px;
  font-family: inherit; font-size: 13px; background: #fff; color: var(--slate-900);
  transition: border-color .15s, box-shadow .15s;
}
.filterbar input:focus, .filterbar select:focus { outline: none; border-color: var(--blue-500); box-shadow: var(--ring); }

/* ---------- forms ---------- */
.form label { display: block; margin: 12px 0 5px; font-weight: 700; color: var(--slate-700); font-size: 12px; }
.form input[type=text], .form input[type=password], .form input[type=date], .form textarea, .form select, .form input[type=file] {
  width: 100%; padding: 9px 12px; border: 1px solid var(--slate-200); border-radius: 10px;
  font-family: inherit; font-size: 13px; background: #fff; color: var(--slate-900);
  transition: border-color .15s, box-shadow .15s;
}
.form input:focus, .form textarea:focus, .form select:focus { outline: none; border-color: var(--blue-500); box-shadow: var(--ring); }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 20px; }
.sec-title { border-top: 1px solid var(--slate-200); margin: 18px 0 4px; padding-top: 14px; font-weight: 800; color: var(--navy-800); font-size: 13px; display: flex; align-items: center; gap: 8px; }

.req { color: var(--red-600); }
.small, .muted { font-size: 11.5px; color: var(--slate-500); }
a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- cartable hero banner ---------- */
.cartable-hero {
  position: relative; border-radius: 18px; overflow: hidden;
  min-height: 116px; margin-bottom: 34px;
  box-shadow: var(--shadow-lg);
}
.cartable-hero .ch-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center;
}
.cartable-hero .ch-shade {
  position: absolute; inset: 0;
  background: linear-gradient(to left, rgba(11,31,56,.75) 0%, rgba(11,31,56,.30) 55%, rgba(11,31,56,.05) 100%);
}
.cartable-hero .ch-content {
  position: relative; z-index: 2; padding: 20px 26px; color: #fff;
  display: flex; align-items: center; justify-content: flex-start; gap: 16px;
  min-height: 116px;
}
.cartable-hero h3 { margin: 0 0 4px; font-size: 18px; font-weight: 800; }
.cartable-hero p { margin: 0; font-size: 12px; color: rgba(255,255,255,.8); }
.cartable-hero .ch-date {
  margin-inline-start: auto; text-align: center;
  background: rgba(255,255,255,.14); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.22); border-radius: 14px;
  padding: 8px 18px; font-size: 12.5px; font-weight: 700;
}
.cartable-hero + .folder-pills { margin-top: -30px; }

/* ---------- folder pills (stat cards) ---------- */
.folder-pills { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.folder-pill {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--slate-200); border-radius: 15px;
  padding: 14px 18px; text-decoration: none !important; color: var(--slate-700);
  display: flex; align-items: center; gap: 14px;
  box-shadow: 0 6px 18px rgba(15,23,42,.08);
  min-width: 185px;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s;
}
.folder-pill::after {
  content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0;
  width: 4px; background: var(--accent, var(--blue-500));
}
.folder-pill:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(15,23,42,.13); }
.folder-pill .ic {
  width: 44px; height: 44px; border-radius: 13px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent, var(--blue-500)) 12%, #fff);
  color: var(--accent, var(--blue-500));
}
.folder-pill .ic svg { width: 21px; height: 21px; }
.folder-pill .lbl { display: block; font-size: 11.5px; color: var(--slate-500); font-weight: 600; line-height: 1.4; }
.folder-pill .n { display: block; font-weight: 800; font-size: 22px; color: var(--navy-900); line-height: 1.25; }
.folder-pill.fp-blue  { --accent: var(--blue-500); }
.folder-pill.fp-teal  { --accent: var(--teal-500); }
.folder-pill.fp-slate { --accent: var(--slate-400); }
.folder-pill.act { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent), 0 8px 22px rgba(15,23,42,.10); }
.folder-pill.act .lbl, .folder-pill.act .n { color: var(--accent); }

/* ---------- login (split layout) — تأییدشده، دست‌نخورده ---------- */
.login-split { display: flex; min-height: 100vh; }
.login-formside {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(13,148,136,.08), transparent 60%),
    radial-gradient(800px 500px at 10% 110%, rgba(37,99,235,.09), transparent 55%),
    #f4f7fc;
  position: relative; overflow: hidden;
}
.login-formside::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(37,99,235,.10) 1px, transparent 1.4px);
  background-size: 22px 22px; opacity: .35; pointer-events: none;
}
.login-card {
  position: relative; z-index: 2;
  width: min(420px, 92vw); background: #fff; border-radius: 22px;
  box-shadow: 0 18px 60px rgba(11,36,71,.16), 0 4px 14px rgba(11,36,71,.08);
  padding: 38px 40px; text-align: center;
  border: 1px solid rgba(255,255,255,.7);
}
.login-card .logo-ic-lg {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px;
  background: linear-gradient(135deg, var(--blue-500), var(--teal-500));
  display: flex; align-items: center; justify-content: center; font-size: 30px;
  box-shadow: 0 8px 24px rgba(37,99,235,.35);
}
.login-card h2 { margin: 0 0 2px; color: var(--navy-900); font-size: 19px; }
.login-card .sub { color: var(--slate-500); font-size: 12px; margin-bottom: 24px; }
.login-card .form { text-align: right; }
.login-card .btn { width: 100%; padding: 11px; font-size: 14px; margin-top: 18px; }
.login-foot { margin-top: 20px; color: var(--slate-400); font-size: 11px; }

.login-hero {
  flex: 1.15; position: relative; overflow: hidden;
  min-height: 100vh;
}
.hero-art {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center;
}
.hero-shade {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(11,36,71,.82) 0%, rgba(11,36,71,.35) 42%, rgba(11,36,71,.05) 75%);
}
.hero-brand {
  position: absolute; inset-inline: 0; bottom: 0; z-index: 2;
  padding: 40px 44px; color: #fff;
}
.hb-badge {
  width: 54px; height: 54px; border-radius: 15px; margin-bottom: 14px;
  background: rgba(255,255,255,.14); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.hero-brand h1 { margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -.3px; }
.hero-brand p { margin: 0 0 22px; font-size: 13px; color: rgba(255,255,255,.82); }
.hero-feats { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hero-feats li {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.10); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.16); border-radius: 12px;
  padding: 10px 14px; font-size: 12.5px; font-weight: 600; color: #eef4ff;
}
.hero-feats li span { font-size: 17px; }
@media (max-width: 900px) {
  .login-hero { display: none; }
  .login-formside {
    background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 45%, var(--blue-600) 100%);
  }
  .login-formside::before { opacity: .18; }
}

/* ---------- detail grid ---------- */
.meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 20px; font-size: 13px; }
.meta-grid > div { background: var(--slate-100); border-radius: 10px; padding: 8px 14px; }
.meta-grid b { color: var(--slate-500); font-weight: 600; font-size: 11.5px; display: block; }
.ref-item { background: var(--slate-100); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; font-size: 13px; border-right: 3px solid var(--blue-500); }

/* ---------- empty state ---------- */
.empty-state { text-align: center; padding: 52px 30px; }
.empty-state .es-ic {
  width: 74px; height: 74px; margin: 0 auto 16px; border-radius: 22px;
  background: linear-gradient(135deg, var(--blue-50), var(--teal-50));
  display: flex; align-items: center; justify-content: center;
  color: var(--blue-500);
  box-shadow: inset 0 1px 0 #fff;
}
.empty-state .es-ic svg { width: 34px; height: 34px; }
.empty-state h4 { margin: 0 0 6px; color: var(--navy-900); font-size: 15px; font-weight: 800; }
.empty-state p { margin: 0 auto 20px; color: var(--slate-500); font-size: 12.5px; max-width: 380px; }
.empty-state .es-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

@media (max-width: 1100px) {
  .sidebar { width: 214px; }
  .meta-grid { grid-template-columns: 1fr 1fr; }
}
