@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('fonts/Vazirmatn-ExtraBold.woff2') format('woff2');
  font-weight: 900; font-style: normal; font-display: swap;
}

:root {
  --navy: #101c38;
  --navy-2: #1a2a52;
  --navy-3: #243763;
  --gold: #c9a24d;
  --gold-2: #e6c87a;
  --gold-dark: #a37f2c;
  --ink: #1d2438;
  --muted: #6f7690;
  --line: #e3e7f0;
  --bg: #eef1f7;
  --card: #ffffff;
  --green: #2e7d32;
  --green-bg: #e3f2e4;
  --amber: #8a5d00;
  --amber-bg: #fdf0cd;
  --red: #b3261e;
  --red-bg: #fbe9e7;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16,28,56,.05), 0 8px 24px -12px rgba(16,28,56,.18);
  --shadow-lg: 0 2px 4px rgba(16,28,56,.06), 0 20px 44px -16px rgba(16,28,56,.28);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  background: var(--bg);
  background-image: radial-gradient(1100px 480px at 85% -10%, rgba(201,162,77,.10), transparent 60%),
                    radial-gradient(900px 500px at 0% 0%, rgba(26,42,82,.08), transparent 55%);
  color: var(--ink);
  margin: 0;
  direction: rtl;
  line-height: 1.7;
  min-height: 100vh;
}
::selection { background: rgba(201,162,77,.35); }
a { color: var(--gold-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- نوار بالا ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 55%, var(--navy-3) 100%);
  color: #fff;
  padding: 12px 20px;
  display: flex; flex-wrap: wrap; gap: 10px 16px;
  align-items: center; justify-content: space-between;
  box-shadow: 0 6px 24px -8px rgba(16,28,56,.55);
  border-bottom: 2px solid rgba(201,162,77,.55);
}
.topbar .brand {
  font-weight: 900; font-size: 19px; color: #fff;
  display: flex; align-items: center; gap: 9px; letter-spacing: -.2px;
}
.topbar .brand::first-letter { color: var(--gold-2); }
.topbar nav { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.topbar nav a {
  color: #cfd8ef; padding: 7px 13px; border-radius: 99px;
  font-size: 13.5px; font-weight: 500; white-space: nowrap;
  transition: background .18s ease, color .18s ease;
}
.topbar nav a:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.topbar nav a.active { background: var(--gold); color: var(--navy); font-weight: 700; }
.topbar nav a.active:hover { background: var(--gold-2); }

/* ---------- بدنه ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 26px 16px 56px; }
h1.page {
  font-size: 23px; font-weight: 900; color: var(--navy);
  margin: 2px 0 20px; padding-bottom: 10px; position: relative;
}
h1.page::after {
  content: ''; position: absolute; bottom: 0; right: 0;
  width: 64px; height: 4px; border-radius: 99px;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
}

/* ---------- کارت‌ها ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card h2, .card h3 { margin: 0 0 12px; color: var(--navy); font-weight: 800; font-size: 17px; }
.card p { margin: 8px 0; }
.card p + p { border-top: 1px dashed var(--line); padding-top: 10px; }

/* ---------- آمار داشبورد ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: linear-gradient(150deg, var(--navy-2), var(--navy) 70%);
  color: #fff; border-radius: var(--radius);
  padding: 20px 14px 16px; text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.06);
  position: relative; overflow: hidden;
}
.stat::before {
  content: ''; position: absolute; inset-inline: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.stat .num { font-size: 34px; font-weight: 900; color: var(--gold-2); line-height: 1.25; }
.stat .lbl { font-size: 13px; opacity: .88; font-weight: 500; }

/* ---------- جدول‌ها ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
th, td { padding: 10px 10px; text-align: right; vertical-align: top; border-bottom: 1px solid var(--line); }
thead th, tr:first-child th {
  color: var(--navy); font-size: 13px; font-weight: 800;
  background: #f4f6fb; border-bottom: 2px solid var(--line);
}
tbody tr:nth-child(even) td, table tr:nth-child(even) td { background: #fafbfe; }
tbody tr:hover td, table tr:hover td { background: #f2f5fd; }

/* ---------- فرم‌ها ---------- */
input, select, textarea {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid #ccd3e2; border-radius: 11px;
  font-family: inherit; font-size: 14.5px; background: #fcfdff; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold); background: #fff;
  box-shadow: 0 0 0 4px rgba(201,162,77,.18);
}
textarea { min-height: 78px; resize: vertical; }
label { display: block; font-size: 13.5px; font-weight: 700; margin: 13px 0 5px; color: #37415f; }
input[type="checkbox"], input[type="radio"] { width: auto; }

.btn {
  display: inline-block;
  background: linear-gradient(160deg, var(--gold-2), var(--gold) 55%, var(--gold-dark));
  color: #221a05; border: none; padding: 10px 22px; border-radius: 11px;
  font-family: inherit; font-size: 14.5px; font-weight: 800; cursor: pointer;
  box-shadow: 0 6px 16px -6px rgba(163,127,44,.65);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn.dark { background: linear-gradient(160deg, var(--navy-3), var(--navy)); color: #fff; box-shadow: 0 6px 16px -6px rgba(16,28,56,.6); }
.btn.danger { background: linear-gradient(160deg, #d84a41, #a52a23); color: #fff; box-shadow: 0 6px 16px -6px rgba(165,42,35,.55); }
.btn.small { padding: 6px 13px; font-size: 13px; border-radius: 9px; }

/* ---------- پیام‌ها و نشان‌ها ---------- */
.flash, .error {
  padding: 12px 16px; border-radius: 12px; margin-bottom: 16px;
  font-size: 14.5px; font-weight: 500; border: 1px solid;
}
.flash { background: var(--green-bg); border-color: #a9d3ab; color: var(--green); border-inline-start: 5px solid var(--green); }
.error { background: var(--red-bg); border-color: #efb3ae; color: var(--red); border-inline-start: 5px solid var(--red); }

.progress { background: #e8ecf4; border-radius: 99px; height: 13px; overflow: hidden; box-shadow: inset 0 1px 3px rgba(16,28,56,.12); }
.progress > div { background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-2)); height: 100%; border-radius: 99px; transition: width .4s ease; }

.badge {
  display: inline-block; padding: 3px 11px; border-radius: 99px;
  font-size: 12px; font-weight: 700; background: #eceff6; color: #4a5470;
  border: 1px solid var(--line); white-space: nowrap;
}
.badge.done { background: var(--green-bg); color: var(--green); border-color: #a9d3ab; }
.badge.doing { background: var(--amber-bg); color: var(--amber); border-color: #ecd28a; }

.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }
hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- ورود و راه‌اندازی ---------- */
.loginbox {
  max-width: 430px; margin: 7vh auto 0; padding: 30px 30px 24px;
  border-radius: 20px; box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.loginbox::before {
  content: ''; position: absolute; inset-inline: 0; top: 0; height: 5px;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-2), var(--gold-dark));
}
.loginbox h2 { text-align: center; font-size: 19px; margin-bottom: 6px; }
.loginbox h2::before { content: '⚖️'; display: block; font-size: 34px; margin-bottom: 8px; }
.loginbox .muted { text-align: center; }
.loginbox .btn { width: 100%; padding: 12px; font-size: 15.5px; margin-top: 6px; }

/* ---------- موبایل ---------- */
@media (max-width: 700px) {
  .topbar { padding: 10px 12px; }
  .topbar .brand { font-size: 17px; }
  .topbar nav {
    flex-wrap: nowrap; overflow-x: auto; width: 100%;
    padding-bottom: 4px; scrollbar-width: none;
  }
  .topbar nav::-webkit-scrollbar { display: none; }
  .wrap { padding: 18px 10px 44px; }
  .card { padding: 16px 14px; border-radius: 14px; }
  table { display: block; overflow-x: auto; white-space: nowrap; font-size: 13px; }
  .stat .num { font-size: 26px; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
  h1.page { font-size: 20px; }
  .loginbox { margin-top: 4vh; padding: 24px 18px 18px; }
}

a.stat { display: block; text-decoration: none; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
a.stat:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-lg); }
a.stat:active { transform: translateY(-1px); }
