:root {
  --bg: #0b1220;
  --bg2: #111a2e;
  --card: #16233b;
  --line: rgba(255,255,255,.08);
  --text: #e8eefc;
  --muted: #93a0bd;
  --accent: #4f8cff;
  --accent2: #22c3a6;
  --warn: #f0b429;
  --danger: #ef5b6b;
  --ok: #3dd68c;
  --shadow: 0 18px 50px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Vazirmatn, Tahoma, sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, #1b2c55 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input {
  font: inherit;
}
.login-body {
  display: grid;
  place-items: center;
}
.login-wrap { width: min(420px, 92vw); }
.login-card, .panel, .modal-card {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.login-card { padding: 28px; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.logo {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #061018;
}
.login-card h1 { margin: 0; font-size: 22px; }
.login-card p, .sidebar span { color: var(--muted); font-size: 13px; }
label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 13px; }
input, select {
  width: 100%;
  background: #0d1628;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}
input:focus { border-color: var(--accent); }
button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  background: #223454;
  color: var(--text);
}
button.primary, .login-card button {
  width: 100%;
  margin-top: 16px;
  background: linear-gradient(135deg, var(--accent), #6aa4ff);
  color: #061018;
  font-weight: 700;
}
button.ghost { background: transparent; border: 1px solid var(--line); }
button.danger { background: var(--danger); color: #fff; }
.alert {
  background: rgba(239,91,107,.15);
  color: #ffd2d7;
  border: 1px solid rgba(239,91,107,.35);
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
}
body:not(.login-body) {
  display: grid;
  grid-template-columns: 240px 1fr;
}
.sidebar {
  background: rgba(10,16,30,.8);
  border-left: 1px solid var(--line);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 8px; }
.nav-btn {
  text-align: right;
  background: transparent;
  color: var(--muted);
}
.nav-btn.active, .nav-btn:hover {
  background: #1a2946;
  color: var(--text);
}
.logout { margin-top: auto; color: #ffb4bc; font-size: 14px; }
.main { padding: 22px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.topbar h2 { margin: 0; }
.clock { color: var(--muted); font-size: 13px; }
.tab { display: none; }
.tab.active { display: block; }
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.card b { display: block; font-size: 26px; margin-top: 6px; }
.card span { color: var(--muted); font-size: 13px; }
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.panel { padding: 16px; }
.panel h3 { margin: 0 0 12px; font-size: 16px; }
.panel h3 small { color: var(--muted); font-weight: 400; }
.toolbar { display: flex; gap: 10px; margin-bottom: 12px; }
.toolbar input { max-width: 360px; }
.toolbar .primary { width: auto; margin: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: right; font-size: 14px; }
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
}
.badge.ok { background: rgba(61,214,140,.15); color: var(--ok); }
.badge.warn { background: rgba(240,180,41,.15); color: var(--warn); }
.feed { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow: auto; }
.feed-item {
  background: #12203a;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.feed-item strong { display: block; }
.feed-item em { color: var(--muted); font-style: normal; font-size: 12px; }
.top-list { display: grid; gap: 8px; }
.top-item { display: flex; justify-content: space-between; background: #12203a; padding: 10px 12px; border-radius: 12px; }
.pager { display: flex; gap: 8px; margin-top: 12px; }
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: grid; place-items: center;
  padding: 16px;
}
.modal[hidden] { display: none; }
.modal-card { width: min(560px, 96vw); padding: 18px; background: #13213b; }
.modal-actions { display: flex; gap: 8px; margin-top: 12px; }
.modal-actions button { flex: 1; margin: 0; }
.extra { margin-top: 16px; }
.row-actions { display: flex; gap: 6px; }
.row-actions button { padding: 7px 10px; }
@media (max-width: 980px) {
  body:not(.login-body) { grid-template-columns: 1fr; }
  .cards, .grid-2 { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; overflow: auto; }
  .logout { margin: 0; }
}
