/* GAG 2 Hub — Fleet Controller v4
   Subject: Roblox GAG2 automation fleet controller
   Palette: void #06090f, surface #0c1220, surface-2 #111a2e, surface-3 #182240,
            indigo #818cf8, gold #fbbf24, emerald #34d399, coral #fb923c, red #f87171
   Type: Space Grotesk (display), DM Sans (body), JetBrains Mono (data)
   Signature: Animated fleet vitals bar with live pulse
*/

:root {
  --void: #06090f;
  --surface: #0c1220;
  --surface-2: #111a2e;
  --surface-3: #182240;
  --surface-4: #1e2d50;
  --indigo: #818cf8;
  --indigo-50: rgba(129,140,248,0.08);
  --indigo-100: rgba(129,140,248,0.15);
  --indigo-200: rgba(129,140,248,0.25);
  --gold: #fbbf24;
  --gold-50: rgba(251,191,36,0.08);
  --emerald: #34d399;
  --emerald-50: rgba(52,211,153,0.08);
  --coral: #fb923c;
  --red: #f87171;
  --text: #e8ecf4;
  --text-2: #8896b0;
  --text-3: #4a5a78;
  --border: #1a2540;
  --border-2: #243352;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --r: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font-body); background: var(--void); color: var(--text); min-height: 100vh; line-height: 1.55; overflow-x: hidden; }
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(129,140,248,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(52,211,153,0.03) 0%, transparent 50%);
}
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }

.screen { display: none; position: relative; z-index: 1; }
.screen:not(.active) { display: none !important; }
.screen.active { display: block; }

/* ═══════════════════════════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════════════════════════ */
#login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-wrap { position: relative; }
.login-glow {
  position: absolute; inset: -120px; pointer-events: none;
  background: radial-gradient(circle at 50% 30%, var(--indigo-100) 0%, transparent 55%);
}
.login-card {
  position: relative; width: 360px; padding: 44px 36px 36px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
}
.login-mark { margin-bottom: 24px; }
.login-title {
  font-family: var(--font-display); font-size: 26px; font-weight: 700;
  letter-spacing: -0.5px; margin-bottom: 4px;
}
.login-sub { color: var(--text-2); font-size: 14px; margin-bottom: 32px; }

.field { margin-bottom: 18px; }
.field label {
  display: block; font-size: 11px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.7px; margin-bottom: 7px;
}
.field input {
  width: 100%; padding: 11px 14px; background: var(--void); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); font-family: var(--font-mono); font-size: 13px;
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-50); }
.field-error { color: var(--red); font-size: 12px; min-height: 16px; margin-top: 6px; }

.btn-submit {
  width: 100%; padding: 12px; background: var(--indigo); color: var(--void);
  border: none; border-radius: var(--r); font-family: var(--font-display);
  font-size: 14px; font-weight: 600; cursor: pointer; transition: opacity 0.15s, transform 0.1s;
  margin-top: 4px;
}
.btn-submit:hover { opacity: 0.88; }
.btn-submit:active { transform: scale(0.98); }

.login-docs {
  display: block; text-align: center; margin-top: 24px;
  color: var(--text-3); font-size: 12px; text-decoration: none; transition: color 0.15s;
}
.login-docs:hover { color: var(--indigo); }

/* ═══════════════════════════════════════════════════════════════════
   TOP BAR
   ═══════════════════════════════════════════════════════════════════ */
.topbar {
  display: flex; align-items: center; gap: 20px; padding: 0 28px; height: 52px;
  background: rgba(12,18,32,0.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-name {
  font-family: var(--font-display); font-size: 15px; font-weight: 700;
  letter-spacing: -0.3px;
}
.topbar-name span { color: var(--indigo); }
.topbar-nav { display: flex; gap: 2px; margin-left: 24px; }
.nav-btn {
  padding: 7px 16px; background: none; border: none; border-radius: var(--r);
  color: var(--text-3); font-family: var(--font-body); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.15s; position: relative;
}
.nav-btn:hover { color: var(--text-2); background: var(--surface-2); }
.nav-btn.active { color: var(--indigo); background: var(--indigo-50); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.user-pill {
  font-family: var(--font-mono); font-size: 11px; color: var(--indigo);
  background: var(--indigo-50); padding: 4px 12px; border-radius: 20px;
  border: 1px solid var(--indigo-100);
}
.btn-ghost-sm {
  padding: 6px 14px; background: none; border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text-3); font-family: var(--font-body);
  font-size: 12px; cursor: pointer; transition: all 0.15s;
}
.btn-ghost-sm:hover { color: var(--text); border-color: var(--text-3); }

/* ═══════════════════════════════════════════════════════════════════
   FLEET VITALS BAR (signature element)
   ═══════════════════════════════════════════════════════════════════ */
.vitals-bar {
  position: relative; margin: 24px 28px 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; height: 60px;
}
.vitals-fill {
  position: absolute; top: 0; left: 0; bottom: 0; width: 0%;
  background: linear-gradient(90deg, var(--emerald-50) 0%, transparent 100%);
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}
.vitals-fill::after {
  content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 2px;
  background: var(--emerald); opacity: 0.6;
  box-shadow: 0 0 12px var(--emerald), 0 0 24px rgba(52,211,153,0.3);
  transition: opacity 0.3s;
}
.vitals-content {
  position: relative; display: flex; align-items: center; height: 100%; padding: 0 28px; gap: 0;
}
.vitals-item { display: flex; flex-direction: column; gap: 2px; min-width: 120px; }
.vitals-label {
  font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.6px;
  font-weight: 500;
}
.vitals-value { font-family: var(--font-mono); font-size: 16px; font-weight: 600; letter-spacing: -0.3px; }
.vitals-value.gold { color: var(--gold); }
.vitals-value.emerald { color: var(--emerald); }
.vitals-divider { width: 1px; height: 32px; background: var(--border); margin: 0 28px; }

/* ═══════════════════════════════════════════════════════════════════
   VIEWS
   ═══════════════════════════════════════════════════════════════════ */
.view { display: none; padding: 24px 28px 48px; }
.view.active { display: block; }

.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 100px 20px; text-align: center;
}
.empty-icon { margin-bottom: 20px; opacity: 0.3; }
.empty-state h3 {
  font-family: var(--font-display); font-size: 18px; color: var(--text-2);
  margin-bottom: 8px; font-weight: 600;
}
.empty-state p { color: var(--text-3); font-size: 14px; max-width: 380px; }
.link-subtle { color: var(--indigo); font-size: 13px; text-decoration: none; margin-top: 16px; display: inline-block; }
.link-subtle:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════
   FLEET GRID
   ═══════════════════════════════════════════════════════════════════ */
.fleet-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px;
}

/* Account card */
.acard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 20px; cursor: default; transition: border-color 0.2s, box-shadow 0.2s;
  position: relative; overflow: hidden;
}
.acard::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--surface-3); transition: background 0.3s;
}
.acard.online::before { background: var(--emerald); box-shadow: 0 0 12px rgba(52,211,153,0.4); }
.acard.warning::before { background: var(--coral); }
.acard.offline::before { background: var(--text-3); }
.acard:hover { border-color: var(--border-2); box-shadow: var(--shadow); }

.acard-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.acard-identity { display: flex; align-items: center; gap: 12px; }
.acard-avatar {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 14px; font-weight: 700; color: var(--indigo);
}
.acard-name { font-family: var(--font-display); font-size: 14px; font-weight: 600; }
.acard-user { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); margin-top: 1px; }

.status-pill {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 4px 10px; border-radius: 20px;
}
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.status-pill.online { color: var(--emerald); background: var(--emerald-50); }
.status-pill.online .dot { background: var(--emerald); box-shadow: 0 0 8px var(--emerald); animation: pulse 2s ease-in-out infinite; }
.status-pill.warning { color: var(--coral); background: rgba(251,146,60,0.08); }
.status-pill.warning .dot { background: var(--coral); }
.status-pill.offline { color: var(--text-3); background: var(--surface-2); }
.status-pill.offline .dot { background: var(--text-3); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 4px var(--emerald); }
  50% { box-shadow: 0 0 12px var(--emerald), 0 0 20px rgba(52,211,153,0.3); }
}

.acard-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.metric {
  background: var(--void); border: 1px solid var(--border); border-radius: var(--r);
  padding: 10px 12px;
}
.metric-label {
  font-size: 9px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 2px; font-weight: 500;
}
.metric-val { font-family: var(--font-mono); font-size: 15px; font-weight: 600; letter-spacing: -0.3px; }
.metric-val.gold { color: var(--gold); }
.metric-val.emerald { color: var(--emerald); }

.acard-action {
  font-size: 12px; color: var(--text-2); margin-bottom: 14px;
  padding: 8px 12px; background: var(--void); border: 1px solid var(--border);
  border-radius: var(--r); font-family: var(--font-mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.acard-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; }
.flag {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  padding: 3px 8px; border-radius: 4px;
  background: var(--surface-2); color: var(--text-3); border: 1px solid transparent;
}
.flag.on { background: var(--indigo-50); color: var(--indigo); border-color: var(--indigo-100); }

.acard-btns { display: flex; gap: 8px; }
.acard-btn {
  flex: 1; padding: 9px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text-2); font-size: 12px; font-family: var(--font-body);
  font-weight: 500; cursor: pointer; transition: all 0.15s; text-align: center;
}
.acard-btn:hover { color: var(--text); border-color: var(--border-2); background: var(--surface-3); }
.acard-btn.primary { background: var(--indigo-50); color: var(--indigo); border-color: var(--indigo-100); }
.acard-btn.primary:hover { background: var(--indigo-100); }
.acard-btn.del { color: var(--text-3); font-size: 11px; flex: 0.5; }
.acard-btn.del:hover { color: var(--red); border-color: rgba(248,113,113,0.3); background: rgba(248,113,113,0.08); }

/* ═══════════════════════════════════════════════════════════════════
   CONTROL LAYOUT
   ═══════════════════════════════════════════════════════════════════ */
.control-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; }
.sidebar {
  position: sticky; top: 76px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 18px; max-height: calc(100vh - 130px); overflow-y: auto;
}
.sidebar-title {
  font-family: var(--font-display); font-size: 11px; font-weight: 600;
  color: var(--text-3); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 12px;
}
.target-list { display: flex; flex-direction: column; gap: 4px; }
.target-btn {
  padding: 10px 12px; background: none; border: 1px solid transparent;
  border-radius: var(--r); color: var(--text-2); font-size: 13px; font-family: var(--font-body);
  text-align: left; cursor: pointer; transition: all 0.15s; font-weight: 400;
}
.target-btn:hover { background: var(--surface-2); color: var(--text); }
.target-btn.active {
  background: var(--indigo-50); border-color: var(--indigo-100);
  color: var(--indigo); font-weight: 500;
}

.panels { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; align-content: start; }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden;
}
.panel-head {
  padding: 14px 18px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  font-family: var(--font-display); font-size: 14px; font-weight: 600;
}
.panel-body { padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; }
.ctrl-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ctrl-row label { font-size: 13px; color: var(--text-2); white-space: nowrap; }

/* Toggle */
.tog {
  min-width: 48px; padding: 4px 12px; background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 20px; font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  color: var(--text-3); cursor: pointer; transition: all 0.2s; text-align: center;
}
.tog.on {
  background: var(--indigo-100); border-color: rgba(129,140,248,0.35);
  color: var(--indigo); box-shadow: 0 0 12px var(--indigo-50);
}

/* Slider */
.slider-wrap { display: flex; align-items: center; gap: 10px; flex: 1; max-width: 200px; }
input[type=range] {
  flex: 1; -webkit-appearance: none; height: 4px; background: var(--surface-3);
  border-radius: 2px; outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--indigo); cursor: pointer; border: 2px solid var(--surface);
  box-shadow: 0 0 8px var(--indigo-200);
}
.slider-val {
  font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  color: var(--indigo); min-width: 55px; text-align: right;
}

/* Text input */
.txt-input {
  width: 150px; padding: 6px 10px; background: var(--void); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); font-family: var(--font-mono);
  font-size: 12px; outline: none; transition: border-color 0.15s;
}
.txt-input:focus { border-color: var(--indigo); }

/* ═══════════════════════════════════════════════════════════════════
   SETTINGS
   ═══════════════════════════════════════════════════════════════════ */
.settings-wrap { max-width: 560px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 24px;
}
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.card-head h4 { font-family: var(--font-display); font-size: 16px; font-weight: 600; }
.badge {
  font-size: 10px; font-weight: 600; color: var(--indigo);
  background: var(--indigo-50); padding: 3px 10px; border-radius: 12px;
  border: 1px solid var(--indigo-100);
}
.card-desc { font-size: 13px; color: var(--text-2); margin-bottom: 16px; line-height: 1.6; }
.card-desc code {
  font-family: var(--font-mono); font-size: 11px; color: var(--indigo);
  background: var(--void); padding: 2px 6px; border-radius: 4px;
  border: 1px solid var(--border);
}
.key-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--void); border: 1px solid var(--border); border-radius: var(--r);
  padding: 12px 16px;
}
.key-value { flex: 1; font-family: var(--font-mono); font-size: 13px; color: var(--indigo); word-break: break-all; }

/* ═══════════════════════════════════════════════════════════════════
   DIALOG
   ═══════════════════════════════════════════════════════════════════ */
dialog {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: 0; width: 560px; max-width: 92vw; max-height: 82vh;
  color: var(--text); box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(0,0,0,0.65); backdrop-filter: blur(6px); }
.dialog-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
}
.dialog-head h3 { font-family: var(--font-display); font-size: 16px; font-weight: 600; }
.dialog-close {
  background: none; border: none; color: var(--text-3); font-size: 20px;
  cursor: pointer; padding: 4px 8px; border-radius: var(--r); transition: all 0.15s;
}
.dialog-close:hover { color: var(--text); background: var(--surface-2); }
.dialog-body { padding: 20px 24px; overflow-y: auto; max-height: calc(82vh - 60px); }

/* Inventory table */
.inv-tbl { width: 100%; border-collapse: collapse; }
.inv-tbl th {
  text-align: left; font-size: 10px; color: var(--text-3); text-transform: uppercase;
  letter-spacing: 0.5px; padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 600;
}
.inv-tbl td { padding: 8px 10px; font-size: 13px; border-bottom: 1px solid var(--border); }
.inv-tbl tr:last-child td { border-bottom: none; }
.inv-gold { color: var(--gold); font-family: var(--font-mono); font-weight: 600; }
.mut-gold { color: var(--gold); }
.mut-rainbow { color: #a78bfa; }
.mut-shocked { color: var(--indigo); }

/* ═══════════════════════════════════════════════════════════════════
   TOASTS
   ═══════════════════════════════════════════════════════════════════ */
.toast-stack { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 16px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); font-size: 13px; color: var(--text); max-width: 320px;
  box-shadow: var(--shadow); animation: toastIn 0.25s ease-out;
}
.toast.ok { border-color: var(--emerald); background: rgba(52,211,153,0.08); }
.toast.err { border-color: var(--red); background: rgba(248,113,113,0.08); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .topbar { gap: 10px; padding: 0 14px; }
  .topbar-brand { display: none; }
  .topbar-nav { margin-left: 0; }
  .vitals-bar { margin: 14px 14px 0; }
  .vitals-content { padding: 0 16px; }
  .vitals-divider { margin: 0 16px; }
  .view { padding: 14px; }
  .fleet-grid { grid-template-columns: 1fr; }
  .control-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .panels { grid-template-columns: 1fr; }
}
