@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-VF.woff2') format('woff2-variations'),
       url('../fonts/Vazirmatn-VF.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #070a17;
  --bg-2: #0b1024;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-2: rgba(255, 255, 255, 0.075);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.17);
  --text: #e8ebf8;
  --muted: #8f97bb;
  --dim: #5c6487;
  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --blue: #60a5fa;
  --rose: #f472b6;
  --green: #34d399;
  --red: #fb7185;
  --amber: #fbbf24;
  --grad: linear-gradient(135deg, #a78bfa 0%, #60a5fa 55%, #22d3ee 100%);
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.7);
  --glow: 0 0 0 1px rgba(139, 92, 246, 0.45), 0 0 46px -10px rgba(139, 92, 246, 0.65);
  --font: 'Vazirmatn', 'Segoe UI', Tahoma, Arial, sans-serif;
  --sidebar-w: 276px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--cyan); }
code { font-family: ui-monospace, Consolas, Menlo, monospace; font-size: 0.92em; background: rgba(255,255,255,0.08); padding: 2px 6px; border-radius: 6px; direction: ltr; unicode-bidi: embed; }
pre { margin: 0; }
button { font-family: inherit; }
::selection { background: rgba(139, 92, 246, 0.45); }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: 0.3px; }
.ok { color: var(--green); }

/* ---------- Backdrop: stars + nebula ---------- */
canvas#stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.nebula {
  position: fixed; inset: -10%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(55% 45% at 84% 8%, rgba(139, 92, 246, 0.30), transparent 62%),
    radial-gradient(45% 40% at 8% 22%, rgba(34, 211, 238, 0.14), transparent 60%),
    radial-gradient(50% 50% at 72% 92%, rgba(244, 114, 182, 0.16), transparent 62%),
    radial-gradient(38% 38% at 22% 88%, rgba(96, 165, 250, 0.13), transparent 60%);
  animation: nebula-drift 36s ease-in-out infinite alternate;
}
@keyframes nebula-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-2%, 1.5%, 0) scale(1.05); }
}

/* ---------- App layout ---------- */
.layout {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 22px 16px;
  background: rgba(7, 10, 23, 0.55);
  border-inline-end: 1px solid var(--border);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 20px; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 46px; height: 46px; flex: none; border-radius: 15px;
  background: var(--grad); color: #0b1024;
  display: grid; place-items: center;
  box-shadow: 0 14px 34px -10px rgba(139, 92, 246, 0.75);
}
.brand-mark.big { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px; }
.brand-text strong { display: block; font-size: 16px; font-weight: 800; line-height: 1.3; }
.brand-text small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14.5px;
  transition: background 0.2s, color 0.2s;
}
.nav a svg { flex: none; opacity: 0.85; }
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.24), rgba(34, 211, 238, 0.10));
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.35);
}

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.key-status {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 16px; text-decoration: none; color: var(--text);
  background: var(--panel); border: 1px solid var(--border);
}
.key-status .dot, .dot-mini { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.key-status.ok .dot, .dot-mini.ok { background: var(--green); box-shadow: 0 0 12px var(--green); }
.key-status.warn .dot, .dot-mini.warn { background: var(--amber); box-shadow: 0 0 12px var(--amber); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
.key-status-text strong { display: block; font-size: 13.5px; }
.key-status-text small { display: block; color: var(--muted); font-size: 11.5px; }
.user-box { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); color: var(--muted); flex: none; }
.user-name { flex: 1; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: right; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--panel); color: var(--muted); display: inline-grid; place-items: center;
  cursor: pointer; transition: 0.2s; text-decoration: none; flex: none;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn.danger:hover { color: var(--red); border-color: rgba(251, 113, 133, 0.5); }

.main { padding: 30px 34px 56px; min-width: 0; }
.topbar-mobile { display: none; align-items: center; gap: 12px; margin-bottom: 18px; }
.topbar-title { flex: 1; font-weight: 700; }
.sidebar-backdrop { display: none; }

/* ---------- Page header & stats ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h2 { margin: 0; font-size: 27px; font-weight: 800; line-height: 1.4; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.stats-inline { display: flex; gap: 10px; flex-wrap: wrap; }
.stat {
  display: flex; flex-direction: column; align-items: center; min-width: 108px;
  padding: 10px 16px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--border);
}
.stat .n { font-size: 22px; font-weight: 800; line-height: 1.2; }
.stat .l { font-size: 12px; color: var(--muted); }

/* ---------- Alerts ---------- */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-radius: 14px; margin-bottom: 18px;
  border: 1px solid var(--border); background: var(--panel); font-size: 14px;
}
.alert svg { flex: none; margin-top: 4px; }
.alert.error { border-color: rgba(251, 113, 133, 0.4); background: rgba(251, 113, 133, 0.1); color: #fecdd3; }
.alert.success { border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.1); color: #bbf7d0; }
.alert.warn { border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.1); color: #fde68a; }
.alert.warn a { color: #fef3c7; }
.alert.info { border-color: rgba(96, 165, 250, 0.4); background: rgba(96, 165, 250, 0.1); color: #dbeafe; }

/* ---------- Service picker ---------- */
.services {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px;
  margin-bottom: 22px;
}
.svc {
  position: relative; overflow: hidden; text-align: start;
  padding: 16px 14px 14px; border-radius: 18px;
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  cursor: pointer; transition: border-color 0.2s, background 0.2s, box-shadow 0.25s;
}
.svc::before { content: ""; position: absolute; inset: 0; background: var(--grad); opacity: 0; transition: opacity 0.25s; }
.svc:hover { border-color: var(--border-strong); background: var(--panel-2); }
.svc:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.svc.active { border-color: transparent; box-shadow: var(--glow); }
.svc.active::before { opacity: 0.13; }
.svc .ico {
  position: relative; width: 42px; height: 42px; border-radius: 13px; margin-bottom: 12px;
  display: grid; place-items: center; background: rgba(255, 255, 255, 0.07); color: var(--text);
  transition: 0.25s;
}
.svc.active .ico { background: var(--grad); color: #0b1024; }
.svc .t { position: relative; display: block; font-weight: 700; font-size: 14px; line-height: 1.5; margin-bottom: 3px; }
.svc .d { position: relative; display: block; color: var(--muted); font-size: 12px; line-height: 1.55; }

/* ---------- Panels ---------- */
.panel {
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  border: 1px solid var(--border);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}
.panel-head { padding: 22px 24px 0; }
.panel-head h3 { margin: 0; font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.panel-head h3 svg { color: var(--cyan); }
.panel-head p { margin: 6px 0 0; font-size: 13.5px; }
.panel-body { padding: 18px 24px 24px; }
.workspace { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.grid-2.tight { gap: 0 16px; margin-bottom: 4px; }
.section-title { margin: 22px 0 8px; font-size: 15px; font-weight: 800; color: #c9cfe8; }
.note { font-size: 13px; color: var(--muted); padding: 10px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px dashed var(--border); margin: 0 0 16px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; color: #c9cfe8; margin-bottom: 7px; }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.6; }
.field .warn-msg { font-size: 12.5px; color: var(--amber); margin-top: 6px; display: none; }
.field .err { font-size: 12.5px; color: var(--red); margin-top: 6px; display: none; }
.field.invalid .err { display: block; }
.field.invalid .input { border-color: rgba(251, 113, 133, 0.65); }
.field.warned .warn-msg { display: block; }
.input {
  width: 100%; padding: 12px 15px; border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: rgba(5, 8, 22, 0.62); color: var(--text);
  font: inherit; font-size: 15px;
  direction: ltr; text-align: left; font-variant-numeric: tabular-nums;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input::placeholder { color: var(--dim); }
.input:focus { outline: none; border-color: rgba(139, 92, 246, 0.85); box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.18); }
.input.rtl { direction: rtl; text-align: right; }
select.input { appearance: none; -webkit-appearance: none; padding-inline-end: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238f97bb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 14px center; cursor: pointer; }
select.input option { background: #0b1024; color: var(--text); }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.input-group .icon-btn { width: 48px; height: auto; }

.switch {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03);
  cursor: pointer; user-select: none;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .sw-text strong { display: block; font-size: 14px; font-weight: 600; }
.switch .sw-text small { display: block; font-size: 12px; color: var(--muted); }
.switch .track { position: relative; width: 46px; height: 26px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); flex: none; transition: 0.2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.switch input:checked + .track { background: var(--grad); }
.switch input:checked + .track::after { transform: translateX(-20px); }
.switch input:focus-visible + .track { outline: 2px solid var(--cyan); outline-offset: 2px; }

.segment {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  border-radius: 14px; background: rgba(5, 8, 22, 0.6); border: 1px solid var(--border);
  margin-bottom: 14px;
}
.segment button {
  border: 0; background: transparent; color: var(--muted);
  padding: 10px 8px; border-radius: 11px; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: 0.2s;
}
.segment button.active { background: var(--grad); color: #0b1024; }
.segment button:focus-visible { outline: 2px solid var(--cyan); }

.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.form-actions .btn-primary { flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 14px; border: 1px solid transparent;
  font: inherit; font-size: 14.5px; font-weight: 700; cursor: pointer; text-decoration: none;
  transition: filter 0.2s, background 0.2s, border-color 0.2s, opacity 0.2s;
}
.btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.btn-primary { background: var(--grad); color: #0b1024; box-shadow: 0 14px 34px -14px rgba(139, 92, 246, 0.9); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; filter: none; }
.btn-ghost { background: rgba(255, 255, 255, 0.05); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--border-strong); background: rgba(255, 255, 255, 0.08); }
.btn-danger { background: rgba(251, 113, 133, 0.12); border-color: rgba(251, 113, 133, 0.35); color: #fda4af; }
.btn-danger:hover { background: rgba(251, 113, 133, 0.2); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.disabled { opacity: 0.4; pointer-events: none; }
.btn .spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(11, 16, 36, 0.3); border-top-color: #0b1024; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Result panel ---------- */
.result-panel { min-height: 420px; display: flex; flex-direction: column; }
.result-empty { padding: 64px 24px; text-align: center; color: var(--muted); margin: auto; }
.result-empty h4 { margin: 0 0 6px; color: var(--text); font-size: 16px; }
.result-empty p { margin: 0; font-size: 13.5px; }
.orb {
  position: relative; width: 92px; height: 92px; margin: 0 auto 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, rgba(199, 180, 255, 0.95), rgba(139, 92, 246, 0.75) 45%, rgba(34, 211, 238, 0.28) 72%, transparent 76%);
  box-shadow: 0 0 70px -12px rgba(139, 92, 246, 0.8);
}
.orb::after { content: ""; position: absolute; inset: -16px; border-radius: 50%; border: 1px dashed rgba(255, 255, 255, 0.28); animation: spin 18s linear infinite; }

.loading { padding: 70px 24px; text-align: center; color: var(--muted); margin: auto; }
.orbit { position: relative; width: 96px; height: 96px; margin: 0 auto 22px; }
.orbit .planet { position: absolute; inset: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 32%, #c4b5fd, #7c3aed 60%, #312e81); box-shadow: 0 0 40px -6px rgba(139, 92, 246, 0.9); }
.orbit .ring { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.22); animation: spin 1.6s linear infinite; }
.orbit .ring::after { content: ""; position: absolute; top: -5px; left: 50%; width: 11px; height: 11px; margin-left: -5px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 14px var(--cyan); }

.result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 0; }
.result-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.result-body { padding: 18px 24px 22px; }
.verdict { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 18px 10px 20px; }
.verdict .ico { width: 86px; height: 86px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 14px; }
.verdict.ok .ico { background: rgba(52, 211, 153, 0.14); color: var(--green); box-shadow: 0 0 54px -8px rgba(52, 211, 153, 0.75); }
.verdict.fail .ico { background: rgba(251, 113, 133, 0.14); color: var(--red); box-shadow: 0 0 54px -8px rgba(251, 113, 133, 0.75); }
.verdict.err .ico { background: rgba(251, 191, 36, 0.14); color: var(--amber); box-shadow: 0 0 54px -8px rgba(251, 191, 36, 0.6); }
.verdict h3 { margin: 0; font-size: 22px; font-weight: 800; }
.verdict p { margin: 6px 0 0; color: var(--muted); font-size: 14px; max-width: 46ch; }
.verdict.err p { color: #fde68a; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); font-size: 13px; }
.chip span { color: var(--muted); }
.chip strong { font-weight: 600; direction: ltr; unicode-bidi: embed; font-variant-numeric: tabular-nums; }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kv { padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); min-width: 0; }
.kv span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.kv strong { display: block; font-size: 15px; font-weight: 700; word-break: break-all; font-variant-numeric: tabular-nums; }
.kv strong.copy-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kv strong.copy-row .icon-btn { width: 30px; height: 30px; border-radius: 9px; }
.kv.wide { grid-column: 1 / -1; }

.bankcard {
  position: relative; overflow: hidden; border-radius: 20px; padding: 22px 24px; margin-bottom: 16px;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 45%, #0e7490 100%);
  border: 1px solid rgba(255, 255, 255, 0.16); box-shadow: var(--shadow);
}
.bankcard::before { content: ""; position: absolute; width: 280px; height: 280px; border-radius: 50%; top: -130px; inset-inline-end: -90px; background: radial-gradient(circle, rgba(255, 255, 255, 0.2), transparent 65%); }
.bankcard::after { content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%; bottom: -100px; inset-inline-start: -50px; background: radial-gradient(circle, rgba(34, 211, 238, 0.35), transparent 65%); }
.bankcard > * { position: relative; }
.bankcard .bank-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: rgba(255, 255, 255, 0.85); }
.bankcard .chip-ic { width: 38px; height: 28px; border-radius: 6px; background: linear-gradient(135deg, #fde68a, #d97706); opacity: 0.9; }
.bankcard .pan { font-size: 23px; letter-spacing: 3px; direction: ltr; text-align: left; font-weight: 700; margin: 20px 0 12px; font-variant-numeric: tabular-nums; }
.bankcard .holder { font-size: 16px; font-weight: 700; }
.bankcard .holder small { display: block; font-size: 11.5px; color: rgba(255, 255, 255, 0.7); font-weight: 400; }

.result-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.result-meta .link { background: none; border: 0; color: var(--cyan); cursor: pointer; font: inherit; font-size: 12.5px; padding: 0; margin-inline-start: auto; }
.json { margin-top: 12px; padding: 14px; border-radius: 12px; background: rgba(5, 8, 22, 0.7); border: 1px solid var(--border); direction: ltr; text-align: left; font-family: ui-monospace, Consolas, Menlo, monospace; font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; color: #c9cfe8; max-height: 340px; overflow: auto; }

/* ---------- API key card ---------- */
.key-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 20px; border-radius: 18px; background: rgba(52, 211, 153, 0.07); border: 1px solid rgba(52, 211, 153, 0.3); margin-bottom: 14px; }
.key-card-main { display: flex; align-items: center; gap: 14px; }
.key-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: rgba(52, 211, 153, 0.14); color: var(--green); flex: none; }
.key-mask { font-family: ui-monospace, Consolas, Menlo, monospace; font-size: 15px; letter-spacing: 1px; color: #c9cfe8; margin: 2px 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 13px 16px; text-align: start; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: rgba(255, 255, 255, 0.045); color: var(--muted); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
.badge { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.ok { background: rgba(52, 211, 153, 0.14); color: var(--green); }
.badge.fail { background: rgba(251, 113, 133, 0.14); color: var(--red); }
.badge.info { background: rgba(96, 165, 250, 0.14); color: var(--blue); }
.filters { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; padding: 18px 20px 4px; margin-bottom: 18px; }
.filters .field { margin-bottom: 14px; min-width: 180px; }
.filters .field.grow { flex: 1; min-width: 220px; }
.filters .field.actions { min-width: 0; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px; border-top: 1px solid var(--border); }

/* ---------- Toasts & modal ---------- */
.toasts { position: fixed; bottom: 22px; inset-inline-start: 22px; z-index: 60; display: flex; flex-direction: column; gap: 10px; max-width: min(92vw, 420px); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: rgba(11, 16, 36, 0.92); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: 14px; animation: toast-in 0.25s ease-out; backdrop-filter: blur(12px); }
.toast.success { border-color: rgba(52, 211, 153, 0.5); }
.toast.error { border-color: rgba(251, 113, 133, 0.5); }
.toast.warn { border-color: rgba(251, 191, 36, 0.5); }
.toast .t-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--blue); }
.toast.success .t-dot { background: var(--green); box-shadow: 0 0 10px var(--green); }
.toast.error .t-dot { background: var(--red); box-shadow: 0 0 10px var(--red); }
.toast.warn .t-dot { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; background: rgba(3, 5, 14, 0.7); backdrop-filter: blur(6px); animation: fade 0.2s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal-card { width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; border-radius: var(--radius); padding: 26px 26px 22px; background: linear-gradient(160deg, #141a36, #0b1024); border: 1px solid var(--border-strong); box-shadow: var(--shadow); }
.modal-card.wide { max-width: 760px; }
.modal-card h3 { margin: 0 0 8px; font-size: 18px; font-weight: 800; }
.modal-card p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-start; margin-top: 18px; }
.modal-section { margin-top: 14px; }
.modal-section h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; }

/* ---------- Auth / installer pages ---------- */
.auth { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 28px 18px; }
.auth-card { width: 100%; max-width: 430px; padding: 36px 32px 30px; border-radius: 26px; background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)); border: 1px solid var(--border-strong); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: var(--shadow); }
.auth.wide .auth-card { max-width: 680px; }
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand h1 { margin: 0; font-size: 22px; font-weight: 800; }
.auth-brand p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.checks { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.checks li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); font-size: 14px; }
.checks li strong { display: block; font-size: 14px; }
.checks li small { display: block; color: var(--muted); font-size: 12px; }
.checks .mark { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.checks li.ok .mark { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.checks li.fail .mark { background: rgba(251, 113, 133, 0.15); color: var(--red); }
.checks li.warn .mark { background: rgba(251, 191, 36, 0.15); color: var(--amber); }

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
  .services { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .workspace { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .result-panel { min-height: 0; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; bottom: 0; right: 0; left: auto; width: min(300px, 86vw); z-index: 50; transform: translateX(100%); transition: transform 0.28s ease; box-shadow: none; border-inline-end: 0; border-inline-start: 1px solid var(--border); }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(3, 5, 14, 0.6); opacity: 0; pointer-events: none; transition: opacity 0.25s; }
  .sidebar-backdrop.show { display: block; opacity: 1; pointer-events: auto; }
  .main { padding: 18px 16px 48px; }
  .topbar-mobile { display: flex; }
  .page-head h2 { font-size: 22px; }
  .stats-inline { width: 100%; }
  .stat { flex: 1; min-width: 0; padding: 8px 10px; }
  .panel-head { padding: 18px 18px 0; }
  .panel-body { padding: 16px 18px 20px; }
  .result-head { padding: 18px 18px 0; }
  .result-body { padding: 16px 18px 20px; }
  .auth-card { padding: 28px 22px 24px; }
  .grid-2.tight { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .services { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .svc { padding: 14px 12px 12px; }
  .svc .d { display: none; }
  .form-actions { flex-direction: column; }
  .bankcard .pan { font-size: 19px; letter-spacing: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; }
  .nebula { animation: none; }
}
