:root {
  --bg: #eef0fa;
  --surface: #ffffff;
  --surface-2: #f4f5fc;
  --ink: #23264b;
  --muted: #8b90b3;
  --line: #e6e8f4;
  --brand: #5b50ee;
  --brand-2: #7a6cf6;
  --brand-soft: #ecebff;
  --accent: #ffd60a;
  --ok: #16a34a;
  --danger: #e11d48;
  --radius: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Vazirmatn, ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }

::selection { background: var(--brand); color: #fff; }

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 40%, transparent);
  border-radius: 999px;
  border: 3px solid var(--bg);
}

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-end: 0;
  width: 256px;
  background: var(--surface);
  border-inline-start: 1px solid var(--line);
  padding: 18px 14px;
  overflow-y: auto;
  z-index: 40;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 18px;
}
.brand .logo {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 800;
}
.brand b { font-size: 15px; }
.brand span { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }

.nav-group { margin-bottom: 14px; }
.nav-group > .title {
  font-size: 11px; color: var(--muted); font-weight: 700;
  padding: 6px 10px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  font-weight: 700; font-size: 13px; color: var(--ink);
  transition: .18s;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: 0 8px 18px -8px var(--brand); }
.nav-item .ic { width: 18px; height: 18px; flex: none; }

.main { flex: 1; min-width: 0; margin-inline-end: 256px; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 24px;
  background: rgba(251, 251, 254, .9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.topbar .hello b { font-size: 13px; }
.topbar .hello div { font-size: 11px; color: var(--muted); }
.userchip {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 12px; padding: 6px 12px 6px 6px;
}
.userchip .av {
  width: 34px; height: 34px; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); font-weight: 800;
}
.userchip small { color: var(--muted); font-size: 10px; display: block; }

.content { padding: 20px 24px 40px; display: grid; gap: 18px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(35, 38, 75, .04);
}
.card > .head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.card > .head h3 { margin: 0; font-size: 14px; font-weight: 800; }
.card > .body { padding: 16px; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat { padding: 16px; }
.stat .ic {
  width: 48px; height: 48px; border-radius: 16px;
  display: grid; place-items: center; background: var(--brand-soft); color: var(--brand);
}
.stat .label { font-size: 12px; color: var(--muted); font-weight: 700; margin-top: 14px; }
.stat .val { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.stat .sub { font-size: 11px; color: var(--muted); margin-top: 6px; }
.stat .sub b { color: var(--ok); }

.banner {
  position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(225deg, #ecebfe, #dfdef9);
  padding: 22px;
}
.banner h2 { margin: 0; font-size: 20px; font-weight: 800; }
.banner p { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.banner ul { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; font-size: 12px; font-weight: 700; }
.banner li { display: flex; align-items: center; gap: 8px; }
.banner li i {
  width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .8); color: var(--brand); font-style: normal;
}

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: right; font-size: 11px; color: var(--muted); font-weight: 800;
  padding: 12px 14px; background: var(--surface-2); white-space: nowrap;
}
table.tbl td { padding: 12px 14px; border-top: 1px solid var(--line); white-space: nowrap; }
table.tbl tbody tr:hover { background: var(--surface-2); }
.empty { padding: 32px; text-align: center; color: var(--muted); font-size: 13px; }

.badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 800;
  background: var(--brand-soft); color: var(--brand);
}
.badge.ok { background: rgba(22, 163, 74, .12); color: var(--ok); }
.badge.warn { background: rgba(245, 196, 0, .18); color: #8a6d00; }
.badge.danger { background: rgba(225, 29, 72, .1); color: var(--danger); }
.badge.muted { background: var(--surface-2); color: var(--muted); }

/* ---------- forms ---------- */
label.f { display: block; font-size: 12px; font-weight: 700; margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; font: inherit; font-size: 13px;
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 12px; padding: 10px 12px; color: var(--ink);
  outline: none; transition: .18s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91, 80, 238, .15); background: var(--surface); }
textarea.input { min-height: 90px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font: inherit; font-size: 13px; font-weight: 800; cursor: pointer;
  border-radius: 12px; padding: 10px 16px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: .18s;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { background: transparent; border-color: rgba(225, 29, 72, .3); color: var(--danger); }
.btn.danger:hover { background: rgba(225, 29, 72, .08); }
.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 10px; }

.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }

.alert {
  border-radius: 12px; padding: 12px 14px; font-size: 13px; font-weight: 700;
  background: rgba(22, 163, 74, .1); color: var(--ok);
  border: 1px solid rgba(22, 163, 74, .2);
}
.alert.err { background: rgba(225, 29, 72, .08); color: var(--danger); border-color: rgba(225, 29, 72, .2); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-head h1 { margin: 0; font-size: 19px; font-weight: 800; }
.page-head p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

/* ---------- chart ---------- */
.chart { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding-top: 10px; }
.chart .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.chart .bar i {
  display: block; width: 100%; border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  min-height: 4px;
}
.chart .bar span { font-size: 10px; color: var(--muted); }

/* ---------- auth / install ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; }
.install-card { width: 100%; max-width: 720px; }
.steps { display: flex; gap: 8px; margin-bottom: 18px; }
.steps div {
  flex: 1; text-align: center; font-size: 11px; font-weight: 800;
  padding: 8px; border-radius: 10px; background: var(--surface-2); color: var(--muted);
}
.steps div.on { background: var(--brand); color: #fff; }

@media (max-width: 1024px) {
  .sidebar { transform: translateX(100%); transition: .25s; }
  .sidebar.open { transform: none; }
  .main { margin-inline-end: 0; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g2 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .g4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .content, .topbar { padding-inline: 14px; }
}
