:root {
  --bg: #06080d;
  --surface: rgba(14, 18, 28, 0.72);
  --surface-solid: #0e121c;
  --surface2: rgba(22, 28, 42, 0.85);
  --surface-hover: rgba(30, 38, 58, 0.9);
  --border: rgba(255, 255, 255, 0.07);
  --border-bright: rgba(110, 231, 168, 0.25);
  --text: #eef2ff;
  --muted: #8b95ab;
  --accent: #6ee7a8;
  --accent-dim: #34d399;
  --accent-glow: rgba(52, 211, 153, 0.35);
  --cyan: #22d3ee;
  --cyan-glow: rgba(34, 211, 238, 0.25);
  --danger: #f87171;
  --danger-glow: rgba(248, 113, 113, 0.2);
  --warn: #fbbf24;
  --discord: #5865f2;
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Outfit", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --glass: blur(16px) saturate(140%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Ambient background ── */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  animation: float 18s ease-in-out infinite;
}
.orb-1 {
  width: 520px; height: 520px;
  background: radial-gradient(circle, #059669 0%, transparent 70%);
  top: -180px; left: -120px;
}
.orb-2 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, #0891b2 0%, transparent 70%);
  bottom: -100px; right: -80px;
  animation-delay: -6s;
}
.orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #7c3aed 0%, transparent 70%);
  top: 40%; left: 55%;
  animation-delay: -12s;
  opacity: 0.25;
}
.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 80%);
}
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 15px) scale(0.95); }
}

/* ── Login ── */
.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}
.login-card {
  background: var(--surface);
  backdrop-filter: var(--glass);
  border: 1px solid var(--border-bright);
  border-radius: 24px;
  padding: 2.75rem 2.5rem;
  width: min(420px, 92vw);
  text-align: center;
  box-shadow: var(--shadow), 0 0 60px var(--accent-glow);
  animation: fadeUp 0.5s ease-out;
}
.brand-icon {
  display: inline-grid;
  place-items: center;
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--accent-dim), var(--cyan));
  border-radius: 16px;
  font-size: 1.5rem;
  color: #052e16;
  margin-bottom: 0.75rem;
  box-shadow: 0 0 24px var(--accent-glow);
}
.brand h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.03em; }
.brand p, .login-note { color: var(--muted); font-size: 0.92rem; margin-top: 0.4rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.1rem;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.78rem; border-radius: 8px; }
.btn.full { width: 100%; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-dim) 0%, #10b981 100%);
  color: #022c22;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:hover { box-shadow: 0 6px 24px var(--accent-glow); }
.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  box-shadow: 0 4px 16px var(--danger-glow);
}
.btn-ghost {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: rgba(255,255,255,0.15); background: var(--surface-hover); }
.btn-glow { position: relative; overflow: hidden; }
.btn-discord {
  background: linear-gradient(135deg, #5865f2, #4752c4);
  color: white;
  width: 100%;
  margin-top: 1.75rem;
  padding: 0.85rem;
  font-size: 0.95rem;
  box-shadow: 0 8px 28px rgba(88, 101, 242, 0.35);
}

/* ── Topbar ── */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: rgba(10, 14, 22, 0.75);
  backdrop-filter: var(--glass);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand-sm {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  white-space: nowrap;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent-dim), var(--cyan));
  border-radius: 10px;
  color: #022c22;
  font-size: 0.9rem;
  font-weight: 800;
  box-shadow: 0 0 16px var(--accent-glow);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; font-size: 0.95rem; letter-spacing: -0.02em; }
.brand-tag { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

.topbar-stats {
  flex: 1;
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: center;
}
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--muted);
  transition: border-color 0.2s;
}
.stat-pill:hover { border-color: var(--border-bright); }
.stat-pill strong { color: var(--accent); font-weight: 700; }
.stat-pill.live strong { color: var(--cyan); }
.stat-pill.live::before {
  content: "";
  width: 7px; height: 7px;
  background: var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--cyan);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.topbar-user { display: flex; align-items: center; gap: 0.65rem; font-size: 0.85rem; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.65rem 0.3rem 0.4rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
}
.user-avatar {
  width: 22px; height: 22px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 50%;
  font-size: 0.5rem;
  color: white;
}

.auth-expired-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #422006;
  border-bottom: 1px solid var(--warn);
  color: var(--warn);
  padding: 0.65rem 1.25rem;
  text-align: center;
  font-size: 0.9rem;
}
.auth-expired-banner a { color: var(--text); font-weight: 600; }

/* ── Layout ── */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 62px);
  position: relative;
  z-index: 1;
}

.sidebar {
  background: rgba(10, 14, 22, 0.6);
  backdrop-filter: var(--glass);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.category-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.cat-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--muted);
  padding: 0.7rem 0.85rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.cat-btn:hover { background: var(--surface2); color: var(--text); transform: translateX(2px); }
.cat-btn.active {
  background: linear-gradient(135deg, rgba(52,211,153,0.12), rgba(34,211,238,0.08));
  border-color: var(--border-bright);
  color: var(--text);
  box-shadow: inset 0 0 20px rgba(52,211,153,0.05);
}
.cat-icon { font-size: 1.15rem; line-height: 1; }

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0.85rem 0.65rem;
}
.sidebar-head h2 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 600; }

.account-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.35rem 0.65rem 0.65rem;
}
.account-list::-webkit-scrollbar { width: 5px; }
.account-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.account-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.7rem;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 0.3rem;
  transition: all 0.2s;
  font-family: inherit;
}
.account-item:hover { background: var(--surface2); border-color: var(--border); }
.account-item.active {
  background: linear-gradient(135deg, rgba(52,211,153,0.1), rgba(34,211,238,0.06));
  border-color: var(--border-bright);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.account-avatar {
  width: 36px; height: 36px;
  display: grid;
  place-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.account-item.active .account-avatar {
  border-color: var(--border-bright);
  box-shadow: 0 0 12px var(--accent-glow);
}
.account-item .name { font-weight: 600; font-size: 0.88rem; }
.account-item .meta { font-size: 0.72rem; color: var(--muted); margin-top: 0.15rem; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.dot.on { background: var(--accent); box-shadow: 0 0 6px var(--accent); animation: pulse 2.5s infinite; }
.dot.off { background: var(--danger); opacity: 0.7; }

.sidebar-foot { padding: 0.75rem; border-top: 1px solid var(--border); }
.sidebar-accounts { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.sidebar-accounts.hidden { display: none; }
.empty-mini {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 2rem 1rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  margin: 0.5rem;
}

/* ── Main content ── */
.main {
  padding: 1.5rem 1.75rem 2rem;
  overflow-y: auto;
}
.main::-webkit-scrollbar { width: 8px; }
.main::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 99px; }

.page-wrap { /* static layout — no enter animation on refresh */ }

.page-wrap.enter,
.empty-state.enter {
  animation: fadeUp 0.4s ease-out;
}

.page-hero {
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, rgba(52,211,153,0.08) 0%, rgba(34,211,238,0.05) 50%, rgba(124,58,237,0.06) 100%);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 200px; height: 200px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  pointer-events: none;
}
.page-hero h2 {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.page-hero p { color: var(--muted); font-size: 0.9rem; margin-top: 0.25rem; }

.empty-state {
  color: var(--muted);
  padding: 4rem 2rem;
  text-align: center;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.empty-state h2 { color: var(--text); margin-bottom: 0.5rem; font-weight: 700; }
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.6; }
.loading-state .loader-ring {
  width: 44px; height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 1.25rem;
  animation: msa-spin 0.9s linear infinite;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.panel-header h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }

.badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
}
.badge-online { background: rgba(52,211,153,0.12); color: var(--accent); border-color: rgba(52,211,153,0.3); }
.badge-offline { background: rgba(248,113,113,0.1); color: var(--danger); border-color: rgba(248,113,113,0.25); }
.badge-loop { background: rgba(34,211,238,0.1); color: var(--cyan); border-color: rgba(34,211,238,0.25); }
.badge-stop { background: var(--surface2); color: var(--muted); }
.badge-method { background: rgba(124,58,237,0.12); color: #c4b5fd; border-color: rgba(124,58,237,0.25); }

/* ── Cards ── */
.card {
  background: var(--surface);
  backdrop-filter: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.card:hover { border-color: rgba(255,255,255,0.1); }
.card h3 {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 0.85rem;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.dash-card {
  position: relative;
  overflow: hidden;
}
.dash-card::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--card-accent, var(--accent)), transparent);
  opacity: 0.7;
}
.dash-card.accent-green { --card-accent: var(--accent); }
.dash-card.accent-cyan { --card-accent: var(--cyan); }
.dash-card.accent-purple { --card-accent: #a78bfa; }
.dash-card.accent-gold { --card-accent: var(--warn); }

.dash-card-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.dash-card-icon { font-size: 1.25rem; }
.dash-card-head h3 { margin: 0; font-size: 0.8rem; }

.dash-stats { display: grid; gap: 0.75rem; }
.dash-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.dash-stat-row:last-child { border-bottom: none; }
.dash-stat-row span { color: var(--muted); font-size: 0.82rem; }
.dash-stat-row strong { font-size: 1.1rem; font-weight: 700; color: var(--accent); }

.category-pills {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.category-pill {
  flex: 1;
  min-width: 180px;
  padding: 1rem 1.15rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: transform 0.2s, border-color 0.2s;
}
.category-pill:hover { transform: translateY(-2px); border-color: var(--border-bright); }
.category-pill-icon { font-size: 1.75rem; }
.category-pill strong { display: block; font-size: 1.1rem; color: var(--text); }
.category-pill span { font-size: 0.78rem; color: var(--muted); }

.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th, .data-table td { text-align: left; padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--border); }
.data-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(0,0,0,0.2);
}
.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.status-dot.on { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.status-dot.off { background: var(--danger); }

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ── Controls ── */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.control-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding-right: 0.75rem;
  border-right: 1px solid var(--border);
}
.control-group:last-child { border-right: none; padding-right: 0; }
.control-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  margin-right: 0.25rem;
}

.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.85rem; }
.kv {
  padding: 0.65rem 0.75rem;
  background: rgba(0,0,0,0.25);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.kv label { display: block; font-size: 0.65rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 0; }
.kv div { font-size: 0.92rem; margin-top: 0.2rem; font-weight: 500; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
  font-size: 0.85rem;
}
.stat-cell {
  padding: 0.55rem 0.65rem;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.stat-cell span { display: block; color: var(--muted); font-size: 0.68rem; text-transform: uppercase; margin-bottom: 0.15rem; }
.stat-cell strong { font-size: 1rem; color: var(--accent); font-weight: 700; }

label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.85rem; font-weight: 500; }
input, select, textarea {
  width: 100%;
  margin-top: 0.4rem;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.6rem 0.75rem;
  font: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--border-bright);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea { resize: vertical; font-family: var(--mono); font-size: 0.8rem; }
.sign-lines { display: grid; gap: 0.5rem; }
.sign-lines input { font-family: var(--mono); text-align: center; letter-spacing: 0.05em; }

.proxy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }
.hint { font-size: 0.78rem; color: var(--muted); margin-bottom: 0.65rem; line-height: 1.45; }
.hint code { background: rgba(0,0,0,0.35); padding: 0.15rem 0.4rem; border-radius: 5px; font-family: var(--mono); font-size: 0.85em; color: var(--cyan); }

.feed {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  height: 240px;
  overflow-y: auto;
  padding: 0.65rem;
  font-family: var(--mono);
  font-size: 0.73rem;
  line-height: 1.5;
}
.feed-line { margin-bottom: 0.3rem; word-break: break-word; padding: 0.15rem 0; }
.feed-line.in { color: #7dd3fc; }
.feed-line.out { color: var(--accent); }
.feed-line.sys { color: var(--muted); }

.chat-input { display: flex; gap: 0.5rem; margin-top: 0.65rem; }
.chat-input input { flex: 1; margin: 0; font-family: var(--mono); font-size: 0.82rem; }

/* ── Screenshot mode ── */
.screenshot-btn.active {
  background: rgba(251, 191, 36, 0.12);
  border-color: var(--warn);
  color: var(--warn);
}
body.screenshot-mode .sensitive-feed .feed-line { color: var(--muted); font-style: italic; }
body.screenshot-mode .msa-box,
body.screenshot-mode .msa-card { display: none; }
body.screenshot-mode input.sensitive-input,
body.screenshot-mode textarea.sensitive-input {
  color: transparent;
  text-shadow: 0 0 8px var(--text);
  caret-color: transparent;
}
body.screenshot-mode input.sensitive-input::placeholder,
body.screenshot-mode textarea.sensitive-input::placeholder {
  color: var(--muted);
  text-shadow: none;
}

/* ── Modal ── */
dialog.modal {
  position: fixed;
  inset: 0;
  width: min(440px, 92vw);
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 2rem);
  height: fit-content;
  margin: auto;
  padding: 0;
  border: none;
  background: transparent;
  overflow: visible;
}
.modal {
  border: 1px solid var(--border-bright);
  border-radius: 20px;
  background: var(--surface-solid);
  color: var(--text);
  padding: 1.5rem;
  width: 100%;
  box-shadow: var(--shadow), 0 0 80px rgba(52,211,153,0.08);
}
.modal-wide { width: min(500px, 94vw); }
dialog.modal::backdrop {
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
}
.modal-head { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 1.25rem; }
.modal-icon { font-size: 1.5rem; }
.modal h3 { font-size: 1.15rem; font-weight: 700; margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.25rem; }
.hidden { display: none !important; }

.msa-intro {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  background: linear-gradient(135deg, rgba(23,37,84,0.8), rgba(30,41,59,0.8));
  border: 1px solid rgba(37,99,235,0.4);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}
.msa-intro-icon { font-size: 1.75rem; color: #60a5fa; }
.msa-intro strong { display: block; margin-bottom: 0.2rem; color: var(--text); }
.msa-intro p { color: var(--muted); margin: 0; line-height: 1.45; }

.msa-card {
  background: linear-gradient(160deg, #0f172a 0%, #172554 55%, #1e1b4b 100%);
  border: 1px solid #3b82f6;
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 8px 32px rgba(37, 99, 235, 0.15);
}
.msa-card-compact { margin-bottom: 1rem; }
.msa-card-head { display: flex; gap: 0.85rem; align-items: center; margin-bottom: 1.1rem; }
.msa-logo {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border-radius: 10px;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
}
.msa-card-head strong { font-size: 1.05rem; display: block; }
.msa-card-head p { color: #94a3b8; font-size: 0.82rem; margin: 0.15rem 0 0; }
.msa-code-display {
  font-family: var(--mono);
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 0.22em;
  text-align: center;
  color: #fbbf24;
  background: rgba(0, 0, 0, 0.35);
  border: 2px dashed #475569;
  border-radius: 12px;
  padding: 1rem 0.75rem;
  margin-bottom: 1rem;
  user-select: all;
}
.msa-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.msa-actions .btn { flex: 1; min-width: 140px; }
.msa-waiting { display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin-top: 1rem; font-size: 0.82rem; color: #94a3b8; }
.msa-spinner {
  width: 14px; height: 14px;
  border: 2px solid #334155;
  border-top-color: #60a5fa;
  border-radius: 50%;
  animation: msa-spin 0.8s linear infinite;
}
@keyframes msa-spin { to { transform: rotate(360deg); } }
.msa-loading { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.msa-loading .msa-spinner { width: 28px; height: 28px; margin: 0 auto 1rem; display: block; }
.msa-error {
  background: rgba(69, 10, 10, 0.6);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  color: #fecaca;
  font-size: 0.85rem;
  margin-top: 1rem;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--surface-solid);
  border: 1px solid var(--border-bright);
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  z-index: 200;
  max-width: 360px;
  box-shadow: var(--shadow), 0 0 24px var(--accent-glow);
  animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.msa-box {
  background: #172554;
  border: 1px solid #1d4ed8;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.card-spaced { margin-top: 1rem; }

@media (max-width: 900px) {
  .panel-grid { grid-template-columns: 1fr; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { max-height: 280px; border-right: none; border-bottom: 1px solid var(--border); }
  .control-group { border-right: none; padding-right: 0; }
  .topbar { flex-wrap: wrap; }
  .topbar-stats { order: 3; width: 100%; justify-content: flex-start; }
}

@media (max-width: 600px) {
  .main { padding: 1rem; }
  .proxy-grid { grid-template-columns: 1fr; }
}
