:root {
  --bg: #0b0f19;
  --bg-soft: #111826;
  --panel: #151d2e;
  --panel-border: #232d43;
  --text: #e7ecf7;
  --text-dim: #93a0bd;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --good: #2ecc71;
  --bad: #ff5c7a;
  --warn: #f5a623;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 80% -10%, rgba(124,92,255,.20), transparent),
              radial-gradient(900px 500px at -10% 20%, rgba(34,211,238,.12), transparent),
              var(--bg);
  color: var(--text);
  font-family: 'Vazirmatn', system-ui, sans-serif;
}

/* ---------- Login ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo h1 { margin: 12px 0 4px; font-size: 22px; }
.login-logo p { margin: 0; color: var(--text-dim); font-size: 13px; }

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  border-radius: 16px;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px rgba(124,92,255,.35);
}

.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-dim); }
.login-form input {
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.login-form input:focus { border-color: var(--accent); }

.login-form button {
  margin-top: 4px;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform .12s, opacity .12s;
}
.login-form button:hover { transform: translateY(-1px); }
.hint { text-align: center; color: var(--text-dim); font-size: 12px; margin: 0; }

.alert { padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }
.alert-error { background: rgba(255,92,122,.12); color: var(--bad); border: 1px solid rgba(255,92,122,.3); }

/* ---------- App shell ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(17,24,38,.6);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand h1 { margin: 0; font-size: 18px; }
.brand .sub { color: var(--text-dim); font-size: 12px; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.xray-badge {
  font-size: 12px;
  color: var(--text-dim);
  border: 1px solid var(--panel-border);
  padding: 7px 14px;
  border-radius: 10px;
  white-space: nowrap;
}

.btn-sm { padding: 8px 14px; font-size: 12px; }

.cycle-info { margin-top: 6px; font-size: 12px; color: var(--text-dim); }

.row-action-btn {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.row-action-btn:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.row-action-btn:disabled { opacity: .5; cursor: not-allowed; }

.tested-at { font-size: 11px; color: var(--text-dim); white-space: nowrap; }

.logout-btn {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  border: 1px solid var(--panel-border);
  padding: 8px 16px;
  border-radius: 10px;
  transition: color .15s, border-color .15s;
}
.logout-btn:hover { color: var(--text); border-color: var(--accent); }

.container { max-width: 1280px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.input-row { display: flex; gap: 10px; flex-wrap: wrap; }
.input-row input {
  flex: 1;
  min-width: 240px;
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}
.input-row input:focus { border-color: var(--accent); }

.btn {
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: transform .12s, opacity .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:not(:disabled):hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--accent), #5b8cff); color: #fff; }
.btn-accent { background: linear-gradient(135deg, var(--good), var(--accent-2)); color: #04261b; }
.btn-ghost { background: transparent; border: 1px solid var(--panel-border); color: var(--text); }

.status-line { margin-top: 12px; font-size: 13px; color: var(--text-dim); min-height: 18px; }
.status-line.error { color: var(--bad); }
.status-line.ok { color: var(--good); }

.stats-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.stat-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.stat-value { font-size: 24px; font-weight: 800; }
.stat-label { font-size: 12px; color: var(--text-dim); }
.stat-good .stat-value { color: var(--good); }
.stat-bad .stat-value { color: var(--bad); }

.table-toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.table-toolbar input, .table-toolbar select {
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.table-toolbar input { flex: 1; min-width: 200px; }

.table-scroll { overflow-x: auto; border-radius: 10px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 900px; }
thead th {
  text-align: right;
  color: var(--text-dim);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--panel-border);
  position: sticky;
  top: 0;
  background: var(--panel);
}
tbody td { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,.04); }
tbody tr:hover { background: rgba(255,255,255,.02); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge-pending { background: rgba(147,160,189,.15); color: var(--text-dim); }
.badge-testing { background: rgba(245,166,35,.15); color: var(--warn); }
.badge-ok { background: rgba(46,204,113,.15); color: var(--good); }
.badge-bad { background: rgba(255,92,122,.15); color: var(--bad); }
.badge-warn { background: rgba(245,166,35,.15); color: var(--warn); }
.badge-strong { font-weight: 800; box-shadow: 0 0 0 1px currentColor inset; }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.spinner {
  width: 12px; height: 12px;
  border: 2px solid rgba(245,166,35,.3);
  border-top-color: var(--warn);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.disclaimer { color: var(--text-dim); font-size: 11.5px; margin: 14px 2px 0; line-height: 1.9; }

@media (max-width: 720px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 14px 16px; }
  .container { padding: 14px; }
}
