@font-face {
  font-family: "Vazirmatn";
  src: url("Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #14161a;
  --side: #0f1114;
  --surface: #1a1d23;
  --surface-2: #22262e;
  --line: #292d36;
  --line-strong: #373c48;
  --fg: #eceef2;
  --muted: #8f98a8;
  --accent: #ff7a1a;
  --accent-hi: #ff9a4d;
  --accent-dark: #e8650a;
  --accent-soft: rgba(255, 122, 26, .13);
  --on-accent: #1a0d03;
  --ok: #4fd1a5;
  --ok-soft: rgba(79, 209, 165, .14);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, .14);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.85;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

/* قالب اصلی: منوی کناری + محتوا */
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.app-bare { display: block; }
.main { padding: 28px clamp(16px, 3vw, 40px) 64px; width: 100%; max-width: 1180px; }
.app-bare .main { max-width: none; padding: 0 16px; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--side);
  border-left: 1px solid var(--line);
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; color: var(--fg); text-decoration: none; font-weight: 800; font-size: 17px; }
.brand:hover { color: var(--fg); }
.brand-mark { width: 32px; height: 32px; flex: none; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { margin: 16px 12px 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.side-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: #b9c1ce; text-decoration: none; font-size: 15px; font-weight: 500;
}
.side-nav a:hover { background: var(--surface); color: var(--fg); }
.side-nav a.is-active { background: var(--accent-soft); color: var(--accent-hi); box-shadow: inset -3px 0 0 var(--accent); }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.side-user { margin-top: auto; border-top: 1px solid var(--line); padding-top: 14px; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; flex: none; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  display: grid; place-items: center; font-weight: 700; color: var(--accent-hi);
}
.side-user > a { color: var(--fg); text-decoration: none; font-size: 14.5px; font-weight: 600; line-height: 1.4; min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { margin: 0; padding: 8px; background: none; color: var(--muted); border-radius: var(--radius-sm); line-height: 0; }
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }

/* کارت‌ها و عنوان‌ها */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-top: 18px; }
.main > .card:first-child { margin-top: 0; }
.card h1 { margin: 0 0 6px; font-size: 24px; font-weight: 800; }
.card h2 { margin: 0 0 8px; font-size: 18px; font-weight: 700; }
.card > form { max-width: 30rem; }

a { color: var(--accent-hi); }
a:hover { color: #ffbb85; }
form.inline { display: inline; margin: 0; }

/* فرم‌ها */
label { display: block; margin-top: 14px; font-weight: 600; font-size: 14.5px; color: #cfd5df; }
input[type=text], input[type=password], input[type=tel], input[type=email],
input[type=number], select, textarea {
  width: 100%; margin-top: 4px; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font-size: 16px; font-family: inherit; background: var(--bg); color: var(--fg);
}
input::placeholder, textarea::placeholder { color: #667085; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(255, 122, 26, .32); outline-offset: 1px; border-color: var(--accent);
}
#id_username, #id_password, #id_phone, #id_date_from, #id_date_to, input[type=number] { direction: ltr; text-align: left; }

button, .btn {
  display: inline-block; margin-top: 16px; padding: 10px 22px; border: 0;
  border-radius: var(--radius-sm); background: var(--accent); color: var(--on-accent);
  font-size: 16px; font-weight: 700; font-family: inherit; cursor: pointer; text-decoration: none;
}
button:hover, .btn:hover { background: var(--accent-hi); color: var(--on-accent); }
.btn-link { background: none; color: var(--accent-hi); padding: 0; margin: 0; text-decoration: underline; font-weight: 400; }
.btn-link:hover { background: none; color: #ffbb85; }
.btn-small { margin: 0; padding: 4px 12px; font-size: 14px; }
.btn-danger { background: #e5484d; color: #fff; }
.btn-danger:hover { background: #f05e62; color: #fff; }
.helptext { color: var(--muted); font-size: 14px; }
.errorlist { color: var(--danger); padding: 0; list-style: none; margin: 4px 0; font-size: 14.5px; }

/* پیام‌ها */
.messages { list-style: none; padding: 0; margin: 0 0 18px; }
.messages li { padding: 11px 14px; border-radius: var(--radius-sm); background: var(--ok-soft); color: #8ee6c6; border: 1px solid rgba(79, 209, 165, .28); margin-top: 8px; }
.messages li.error { background: var(--danger-soft); color: #ffa3a3; border-color: rgba(255, 107, 107, .3); }
.messages li.warning { background: rgba(245, 196, 81, .12); color: #f7d88a; border-color: rgba(245, 196, 81, .28); }

/* جدول‌ها */
.table-wrap { overflow-x: auto; margin: 14px 0 4px; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-size: 15px; }
th { background: var(--surface-2); color: #c4cbd8; font-weight: 600; font-size: 14px; }
tbody tr:hover { background: rgba(255, 255, 255, .025); }
tbody tr:last-child td { border-bottom: 0; }
tfoot th { background: var(--surface-2); border-top: 2px solid var(--line-strong); }

.status { display: inline-block; padding: 2px 11px; border-radius: 999px; font-size: 13.5px; font-weight: 600; }
.status-pending { background: var(--accent-soft); color: var(--accent-hi); }
.status-approved { background: var(--ok-soft); color: #8ee6c6; }
.status-rejected { background: var(--danger-soft); color: #ffa3a3; }

.reject-form { display: inline-flex; gap: 6px; align-items: center; margin-right: 8px; }
.reject-form input[type=text] { width: 160px; padding: 4px 8px; font-size: 14px; margin: 0; }
small { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); }

/* صفحه ورود */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 0; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 34px 30px; }
.auth-logo { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.auth-logo .icon { width: 30px; height: 30px; stroke-width: 2.2; }
.auth-card h1 { margin: 0; text-align: center; font-size: 24px; font-weight: 800; }
.auth-card .auth-sub { margin: 4px 0 18px; text-align: center; color: var(--muted); font-size: 14px; }
.auth-card button { width: 100%; margin-top: 22px; padding: 12px; font-size: 17px; }

/* کاشی‌های صفحه اصلی فعلی (در قدم بعد جایگزین می‌شود) */
.hero { margin-top: 0; }
.hero h1 { margin: 0; font-size: 28px; font-weight: 800; }
.hero p { margin: 4px 0 0; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 18px; }
.tile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--fg); }
.tile:hover { border-color: var(--accent); color: var(--fg); }
.tile .tile-icon { font-size: 24px; line-height: 1; display: block; margin-bottom: 10px; }
.tile .tile-title { font-weight: 700; font-size: 17px; display: block; }
.tile .tile-desc { color: var(--muted); font-size: 14px; display: block; margin-top: 2px; }
.section-title { margin: 26px 0 0; font-size: 14px; color: var(--muted); font-weight: 600; }

/* موبایل و تبلت */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; height: auto; z-index: 20; flex-direction: row; align-items: center; gap: 8px; padding: 8px 12px; border-left: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .brand span { display: none; }
  .side-nav { flex-direction: row; flex: 1; overflow-x: auto; gap: 4px; }
  .side-nav a { white-space: nowrap; padding: 7px 10px; font-size: 14px; }
  .side-nav a .icon { display: none; }
  .side-nav a.is-active { box-shadow: none; }
  .nav-label, .side-user > a, .avatar { display: none; }
  .side-user { margin: 0; border: 0; padding: 0; }
  .main { padding: 18px 14px 48px; }
  .card { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* صفحه اصلی: کارت وضعیت حضور */
.page-head h1 { margin: 0; font-size: 26px; font-weight: 800; }
.page-head p { margin: 2px 0 0; color: var(--muted); }

.status-hero {
  position: relative; overflow: hidden;
  margin-top: 20px;
  display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: 32px clamp(20px, 4vw, 44px);
}
.status-hero::before {
  content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 5px;
  background: var(--line-strong);
}
.status-hero.is-in { border-color: rgba(79, 209, 165, .35); }
.status-hero.is-in::before { background: var(--ok); }

.status-badge { display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 600; color: var(--muted); }
.status-badge::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.is-in .status-badge { color: #8ee6c6; }
.is-in .status-badge::before { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }

.status-time { font-size: clamp(44px, 8vw, 72px); font-weight: 800; line-height: 1.2; margin-top: 6px; }
.status-time-idle { font-size: clamp(28px, 5vw, 40px); color: var(--muted); }
.status-sub { margin: 6px 0 0; color: var(--muted); }

.btn-hero { margin: 0; min-width: 210px; padding: 18px 44px; font-size: 20px; font-weight: 800; border-radius: 16px; }
.btn-hero.is-out { background: transparent; color: var(--fg); border: 2px solid var(--line-strong); }
.btn-hero.is-out:hover { background: var(--surface-2); border-color: var(--accent); color: var(--fg); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.stat-label { color: var(--muted); font-size: 14.5px; font-weight: 600; }
.stat-value { font-size: 34px; font-weight: 800; line-height: 1.3; margin-top: 2px; }
.stat-meta { display: flex; flex-direction: column; margin-top: 8px; color: var(--muted); font-size: 14px; }

@media (max-width: 600px) {
  .status-hero { padding: 24px 18px; }
  .status-hero form { width: 100%; }
  .btn-hero { width: 100%; }
}
/* صفحه ورود گوهرشاد */
.app-bare .main { padding: 0; }
.login {
  position: relative; overflow: hidden; min-height: 100vh;
  display: grid; grid-template-columns: minmax(380px, 480px) 1fr;
  background: #07080b;
}
.login-bg { position: absolute; inset: 0; }
.login-bg svg { width: 100%; height: 100%; display: block; }
.login-bg .horizon {
  position: absolute; left: 6%; right: 6%; bottom: 24%; height: 2px;
  background: linear-gradient(90deg, transparent, #ff9a4d, transparent);
  box-shadow: 0 0 44px 8px rgba(255, 122, 26, .42);
}
.login-bg .floor {
  position: absolute; left: 0; right: 0; bottom: 0; height: 24%;
  background: linear-gradient(to bottom, rgba(255, 122, 26, .10), transparent 70%);
}
.login-bg .dots {
  position: absolute; left: 12%; top: 18%; width: 3px; height: 3px; border-radius: 50%;
  background: #ffb36b;
  box-shadow: 40px 190px 0 #ffb36b, 210px 60px 0 #ff8a3d, 330px 330px 0 #ffb36b,
    120px 420px 0 #ff8a3d, 470px 120px 0 #ffb36b, 540px 460px 0 #ff8a3d, 60px 330px 0 #ffb36b;
  animation: dots 5s ease-in-out infinite;
}

.login-form, .login-art { position: relative; z-index: 1; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px 24px; }

.login-card {
  width: 100%; max-width: 400px; padding: 30px 28px; border-radius: 24px;
  background: rgba(18, 20, 24, .78);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 138, 61, .45);
  box-shadow: 0 0 0 1px rgba(255, 138, 61, .06), 0 0 50px rgba(255, 122, 26, .16);
}
.login-card h1 { margin: 0; font-size: 26px; font-weight: 800; }
.login-sub { margin: 4px 0 18px; color: var(--muted); font-size: 15px; }
.field { position: relative; }
.field > .icon { position: absolute; right: 14px; bottom: 11px; color: var(--muted); pointer-events: none; }
.field input { padding-right: 46px; background: rgba(7, 8, 11, .7); }
.login-card button { width: 100%; margin-top: 24px; padding: 13px; font-size: 17px; }
.login-help { margin: 16px 0 0; text-align: center; color: var(--muted); font-size: 13.5px; }

.login-art { display: grid; place-items: center; padding: 24px; }
.ring {
  position: relative; display: grid; place-items: center;
  width: min(560px, 82%); aspect-ratio: 1; border-radius: 50%;
  border: 2px solid rgba(255, 138, 61, .45);
  box-shadow: 0 0 70px rgba(255, 122, 26, .22), inset 0 0 90px rgba(255, 122, 26, .10);
}
.ring::after {
  content: ""; position: absolute; inset: -2px; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 72%, rgba(255, 170, 100, .95) 88%, transparent 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  animation: ring-spin 14s linear infinite;
}
.logo { height: min(52vh, 360px); width: auto; filter: drop-shadow(0 0 26px rgba(255, 138, 61, .28)); }

@keyframes ring-spin { to { transform: rotate(360deg); } }
@keyframes dots { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-art { order: -1; padding: 28px 16px 0; }
  .ring { width: auto; aspect-ratio: auto; border: 0; box-shadow: none; }
  .ring::after { display: none; }
  .logo { height: 150px; }
  .login-form { padding: 20px 16px 40px; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .ring::after, .login-bg .dots { animation: none !important; }
}
/* برند در منوی کناری */
.brand img.brand-mark { width: auto; height: 34px; }
.brand span { display: flex; flex-direction: column; line-height: 1.3; }
.brand small { font-size: 12px; font-weight: 500; color: var(--muted); }

/* صفحه حضور من */
.stat-sub { color: var(--muted); font-size: 13.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.note { margin: 12px 4px 0; color: var(--muted); font-size: 13.5px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card-head span { color: var(--muted); font-size: 14px; }
.cell-sub { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }

/* نسخه فشرده کارت‌ها برای صفحه‌های داخلی */
.status-hero.compact { margin-top: 16px; padding: 14px clamp(16px, 3vw, 24px); border-radius: 16px; gap: 14px; }
.status-hero.compact .status-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 16px; }
.status-hero.compact .status-time { margin: 0; font-size: 30px; }
.status-hero.compact .status-time-idle { font-size: 19px; }
.status-hero.compact .status-sub { margin: 0; font-size: 14px; }
.status-hero.compact .btn-hero { min-width: 0; padding: 10px 26px; font-size: 16px; border-radius: 12px; }

.stat-row.compact { gap: 12px; margin-top: 12px; }
.stat-row.compact .stat { padding: 12px 16px; }
.stat-row.compact .stat-value { font-size: 26px; line-height: 1.4; margin: 0; }
.stat-row.compact .chips { margin-top: 8px; }

/* صفحه‌های گزارش و بررسی */
.page-head + .card, .page-head + .stat-row { margin-top: 16px; }
.filters-card { padding: 16px 18px; }
.card > form.filters {
  max-width: none; display: grid; align-items: end; gap: 12px 14px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}
.filters p { margin: 0; }
.filters label { margin-top: 0; }
.filters button { margin: 0; padding: 10px 22px; }

.result-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; }
.result-meta { color: var(--muted); font-size: 14.5px; line-height: 1.8; }
.result-meta strong { color: var(--fg); }
.result-bar + .stat-row { margin-top: 14px; }

.btn-ghost { margin: 0; padding: 9px 18px; font-size: 15px; font-weight: 600; background: transparent; color: var(--fg); border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--accent); color: var(--fg); }

.status-open { background: transparent; border: 1px solid var(--accent); color: var(--accent-hi); }
.count-badge { display: inline-block; margin-inline-start: 10px; padding: 0 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-hi); font-size: 15px; font-weight: 700; vertical-align: middle; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions .reject-form { margin-right: 0; }

/* دکمه‌های کوچک جدول‌ها */
.row-actions { white-space: nowrap; }
.row-actions form { display: inline; margin: 0 6px 0 0; }
.btn-sm {
  display: inline-block;
  padding: 5px 14px;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.4;
  color: inherit;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-sm:hover {
  background: rgba(255, 140, 0, 0.16);
  border-color: #ff8c00;
  color: #ffb066;
}
.btn-sm-danger { color: #ff9b8a; border-color: rgba(255, 120, 100, 0.45); }
.btn-sm-danger:hover {
  background: rgba(255, 90, 70, 0.18);
  border-color: #ff6b57;
  color: #ffb4a8;
}