:root {
  --bg: #0d1117;
  --bg2: #11161d;
  --card: #161d27;
  --card2: #1c2531;
  --border: #2a3442;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #2f81f7;
  --accent2: #1f6feb;
  --green: #3fb950;
  --red: #f85149;
  --yellow: #d29922;
  --orange: #db6d28;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Tahoma, "Segoe UI", Vazirmatn, sans-serif;
  font-size: 14px;
  line-height: 1.8;
}
.hidden { display: none !important; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.login-card { width: 100%; max-width: 380px; }
.logo { font-size: 20px; font-weight: bold; text-align: center; margin-bottom: 4px; }
label { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
input, select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
input:focus, select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.btn {
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.btn.primary:hover { background: var(--accent); }
.btn.danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn.danger:hover { background: rgba(248,81,73,.12); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; margin-top: 16px; }
.btn:disabled { opacity: .5; cursor: default; }
.error {
  background: rgba(248,81,73,.12);
  border: 1px solid rgba(248,81,73,.4);
  color: #ff9a94;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 12px 0;
}
.ok {
  background: rgba(63,185,80,.12);
  border: 1px solid rgba(63,185,80,.4);
  color: #7ee2a0;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 12px 0;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: bold; font-size: 16px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.tabs {
  display: flex;
  gap: 4px;
  padding: 12px 20px 0;
}
.tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  padding: 8px 16px;
  cursor: pointer;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
main { padding: 16px 20px 40px; max-width: 1100px; margin: 0 auto; }
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .grid.two { grid-template-columns: 1fr; } }
.stat { text-align: center; padding: 16px 8px; }
.stat .num { font-size: 26px; font-weight: bold; direction: ltr; }
.stat .lbl { color: var(--muted); font-size: 13px; }
.bar-wrap { margin: 10px 0; }
.bar-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.bar { height: 10px; background: var(--bg2); border-radius: 6px; overflow: hidden; margin-top: 4px; }
.bar > div { height: 100%; background: var(--accent); border-radius: 6px; }
.bar > div.warn { background: var(--yellow); }
.bar > div.bad { background: var(--red); }
.list .row {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.list .row:last-child { border-bottom: none; }
.tag {
  display: inline-block;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
  margin: 2px;
  font-size: 12px;
  direction: ltr;
}
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; }
.toolbar input { flex: 1; min-width: 180px; }
.toolbar select { width: auto; min-width: 140px; }
.table-wrap { overflow-x: auto; margin-top: 14px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.tbl th { color: var(--muted); font-size: 13px; }
.tbl tr:hover td { background: var(--card2); }
.tbl tr { cursor: pointer; }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px;
}
.badge.active { background: rgba(63,185,80,.15); color: #7ee2a0; }
.badge.disabled { background: rgba(139,152,169,.15); color: #b7c2cf; }
.badge.expired { background: rgba(248,81,73,.15); color: #ff9a94; }
.badge.limited { background: rgba(210,153,34,.15); color: #e8b93e; }
.badge.on_hold { background: rgba(219,109,40,.15); color: #f0a35e; }
.usage { min-width: 140px; }
.usage .bar { margin-top: 2px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 14px; }
.form-card { max-width: 560px; }
.checklist label {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; margin: 6px 0; cursor: pointer;
  color: var(--text);
}
.checklist input { width: auto; margin-top: 5px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.kv .item { background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.kv .k { color: var(--muted); font-size: 12px; }
.kv .v { font-size: 14px; word-break: break-all; }
.kv .v.ltr { direction: ltr; text-align: left; }
.mono { font-family: "Courier New", monospace; direction: ltr; text-align: left; }
.cfg-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; margin: 6px 0;
}
.cfg-row .val { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
h3 { margin: 0 0 12px; font-size: 16px; }
h4 { margin: 18px 0 8px; font-size: 14px; color: var(--muted); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.inline-form .field { flex: 1; min-width: 140px; }
