:root {
  --bg0: #07111f;
  --bg1: #0d1b31;
  --card: rgba(16, 32, 58, 0.88);
  --line: rgba(180, 198, 224, 0.18);
  --text: #e8eef7;
  --muted: #8fa0b8;
  --accent: #3d7eff;
  --accent2: #2b63d9;
  --ok: #2ecc71;
  --danger: #e74c3c;
  --warn: #f0b429;
  --silver: #c5cdd8;
  --radius: 14px;
  --font: "Segoe UI", system-ui, sans-serif;
  --mono: Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(ellipse at 15% 0%, #1a3358 0%, transparent 45%),
    radial-gradient(ellipse at 100% 100%, #0a1c38 0%, transparent 40%),
    linear-gradient(165deg, var(--bg0), #040a14 75%);
}

a { color: #8eb6ff; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 18px 48px; }

.brand {
  display: flex; align-items: center; gap: 14px; margin-bottom: 18px;
}
.brand img { width: 56px; height: 56px; object-fit: contain; filter: drop-shadow(0 6px 14px rgba(0,0,0,.4)); }
.brand h1 { margin: 0; font-size: 1.35rem; letter-spacing: .1em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }

.brand-login {
  flex-direction: column;
  justify-content: center;
  text-align: center;
  gap: 12px;
  margin-bottom: 22px;
}
.brand-login img {
  width: 128px;
  height: 128px;
  margin: 0 auto;
}
.brand-login h1 {
  letter-spacing: 0.14em;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  backdrop-filter: blur(8px);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.section-head h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}
.section-head-actions { display: flex; gap: 6px; align-items: center; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.help-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(61,126,255,.45);
  background: rgba(61,126,255,.12);
  color: #9ec0ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .12s ease, transform .12s ease;
}
.help-btn:hover { background: rgba(61,126,255,.28); }
.help-btn:active { transform: scale(0.96); }
.help-btn svg { width: 18px; height: 18px; display: block; }

.help-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 16px;
}
.help-modal.show { display: flex; }
.help-modal-box {
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  width: min(520px, 100%);
  max-height: min(80vh, 640px);
  overflow: auto;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
}
.help-modal-box h3 {
  margin: 0;
  font-size: 1rem;
  color: #9ec0ff;
  letter-spacing: 0.04em;
}
.help-modal-box ol {
  margin: 8px 0 0;
  padding-left: 1.2rem;
  color: var(--silver);
}
.help-modal-box li {
  margin: 6px 0;
  font-size: .9rem;
  line-height: 1.45;
}
.quick-list {
  margin: 8px 0 0;
  padding-left: 1.2rem;
  color: var(--silver);
}
.quick-list li { margin: 6px 0; }

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 160px; }
.field label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.field .hint { font-size: .75rem; color: var(--muted); text-transform: none; letter-spacing: 0; }
input, select {
  background: #0a1528;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: .95rem;
}
input:focus { outline: 1px solid var(--accent); }

button, .btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  font-size: .9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button svg.icon,
.tab svg.icon,
.btn svg.icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.btn-primary { background: linear-gradient(180deg, var(--accent), var(--accent2)); color: #fff; }
.btn-ghost { background: transparent; color: var(--silver); border: 1px solid var(--line); }
.btn-danger { background: rgba(231,76,60,.18); color: #ffb4ab; border: 1px solid rgba(231,76,60,.35); }
.btn-ok { background: rgba(46,204,113,.16); color: #8dffb8; border: 1px solid rgba(46,204,113,.35); }

.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px;
}
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tab {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 8px 14px; cursor: pointer; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
}
.tab.active { background: rgba(61,126,255,.2); color: #fff; border-color: rgba(61,126,255,.5); }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.mono { font-family: var(--mono); font-size: .82rem; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }

.toast {
  position: fixed; right: 16px; bottom: 16px; max-width: 360px;
  background: #132848; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; display: none; z-index: 50;
}
.toast.show { display: block; }
.toast.err { border-color: rgba(231,76,60,.5); }
.toast.ok { border-color: rgba(46,204,113,.5); }

.login-box { max-width: 420px; margin: 8vh auto; }
.panel { display: none; }
.panel.active { display: block; }

.qr-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: none; align-items: center; justify-content: center; z-index: 40; padding: 16px;
}
.qr-modal.show { display: flex; }
.qr-box {
  background: var(--bg1); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px; text-align: center; max-width: 380px; width: 100%;
}
.qr-box img { width: 280px; height: 280px; background: #fff; border-radius: 8px; }
.muted { color: var(--muted); font-size: .85rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
  th.hide-sm, td.hide-sm { display: none; }
}
