:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0f766e;
  --brand-dark: #0b4f4a;
  --accent: #2563eb;
  --wa: #128c7e;
  --danger: #dc2626;
  --ok: #059669;
  --warn: #d97706;
  --sidebar: #0b1220;
  --sidebar-2: #111827;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 12px 32px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background: var(--bg);
  font-family: "Estedad", "Vazirmatn", Tahoma, sans-serif;
  font-size: 14.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; }

.shell {
  display: grid;
  grid-template-columns: 272px 1fr;
  min-height: 100vh;
}

.sidebar {
  background:
    radial-gradient(circle at top right, rgba(18, 140, 126, 0.18), transparent 40%),
    linear-gradient(180deg, var(--sidebar-2), var(--sidebar));
  color: #cbd5e1;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  border-left: 1px solid rgba(255,255,255,0.04);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 22px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  margin-bottom: 18px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #14b8a6, #0f766e);
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.04em;
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.35);
}

.brand {
  margin: 0;
  color: #f8fafc;
  font-size: 1.05rem;
  font-weight: 700;
}

.brand-sub {
  margin: 2px 0 0;
  color: #94a3b8;
  font-size: 0.78rem;
}

.nav-group {
  margin: 0 0 16px;
}

.nav-label {
  display: block;
  padding: 0 12px 8px;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  margin-bottom: 3px;
  color: #cbd5e1;
  transition: 0.15s ease;
}

.nav a .ico {
  width: 18px;
  text-align: center;
  opacity: 0.85;
}

.nav a:hover {
  background: rgba(255,255,255,0.05);
  color: #fff;
}

.nav a.active {
  background: rgba(20, 184, 166, 0.16);
  color: #5eead4;
  box-shadow: inset 3px 0 0 #14b8a6;
}

.content {
  padding: 28px 32px 40px;
  max-width: 1400px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.topbar .sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.user-chip .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #0f766e;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}

.panel-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, var(--surface-2));
}

.panel-hd h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
}

.panel-bd { padding: 18px; }

.stats {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.stat {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
}

.stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--brand);
}

.stat.danger::before { background: var(--danger); }
.stat.warn::before { background: var(--warn); }
.stat.info::before { background: var(--accent); }

.stat .label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.stat .value {
  margin-top: 8px;
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--ink);
}

.stat .hint {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 650;
  transition: 0.15s ease;
}

.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: #334155; }
.btn.secondary:hover { background: #1e293b; }
.btn.danger { background: var(--danger); }
.btn.ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.ghost:hover { background: var(--surface-2); }
.btn.wa { background: var(--wa); }
.btn.sm { padding: 6px 10px; font-size: 0.82rem; }

.table-wrap { overflow: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: right;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  background: var(--surface-2);
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

tbody tr:hover { background: #f8fafc; }
td.phone, .ltr { direction: ltr; text-align: left; unicode-bidi: plaintext; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #e2e8f0;
  color: #334155;
  white-space: nowrap;
}

.badge.ok { background: #d1fae5; color: #065f46; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.err { background: #fee2e2; color: #991b1b; }
.badge.info { background: #dbeafe; color: #1e40af; }
.badge.wa { background: #d1fae5; color: #065f46; }

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.86rem;
  font-weight: 600;
  color: #334155;
}

input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(15, 118, 110, 0.2);
  border-color: #14b8a6;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
}

.checks label {
  flex-direction: row;
  align-items: center;
  font-weight: 500;
}

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}

.alert.success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert.error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

.muted { color: var(--muted); }
.stack { display: grid; gap: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.split {
  display: grid;
  gap: 18px;
  grid-template-columns: 1.35fr 1fr;
}

.qr {
  width: 260px;
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: #0b1220;
}

.login-visual {
  position: relative;
  background:
    linear-gradient(145deg, rgba(11, 18, 32, 0.55), rgba(15, 118, 110, 0.55)),
    url('/images/login-bg.jpg') center/cover no-repeat;
  min-height: 100vh;
  padding: 48px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.login-visual h2 {
  margin: 0 0 10px;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  max-width: 520px;
}

.login-visual p {
  margin: 0;
  max-width: 460px;
  color: rgba(255,255,255,0.86);
  font-size: 1rem;
}

.login-side {
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at top left, rgba(20, 184, 166, 0.08), transparent 35%),
    #f8fafc;
}

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 1.45rem;
  font-weight: 800;
}

.account-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.account-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: linear-gradient(180deg, #fff, #f8fafc);
}

.account-card .head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.account-card h4 {
  margin: 0;
  font-size: 1rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-item:last-child { border-bottom: 0; }

.empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
}

.pagination {
  display: flex;
  gap: 6px;
  list-style: none;
  padding: 14px 18px;
  margin: 0;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
}

.pagination .page-link {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.pagination .active .page-link {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { height: auto; position: static; }
  .login-page { grid-template-columns: 1fr; }
  .login-visual { min-height: 280px; }
  .content { padding: 18px; }
}
