@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* =========================================================
   UNIFIED MDT THEME - BCSO Style Dark Theme
   Matching the BCSO MDT terminal design
   ========================================================= */

:root {
  /* BCSO-style dark backgrounds */
  --bg-dark: #050505;
  --bg-main: #080808;
  --bg-section: #0d0d0d;
  --bg-panel: #111111;
  --bg-panel-soft: #151515;
  --bg-input: #050505;

  /* Borders */
  --border: #242424;
  --border-light: #333333;
  --border-soft: #191919;

  /* Text colors */
  --text: #d7d7d7;
  --text-bright: #ffffff;
  --text-muted: #8a8a8a;
  --text-faint: #5f5f5f;

  /* Accent colors */
  --accent: #58a6ff;
  --accent-strong: #1f6feb;
  --accent-soft: rgba(88, 166, 255, 0.12);

  /* Status colors */
  --success: #3fb950;
  --success-soft: rgba(63, 185, 80, 0.14);
  --danger: #f85149;
  --danger-soft: rgba(248, 81, 73, 0.14);
  --warning: #d29922;
  --warning-soft: rgba(210, 153, 34, 0.14);
  --purple: #a371f7;

  /* Layout */
  --sidebar: 220px;
  --rightbar: 280px;
  --topbar: 52px;
  --gap: 10px;

  /* Border radius - minimal like BCSO */
  --radius-sm: 3px;
  --radius-md: 4px;
  --radius-lg: 6px;

  /* Fonts */
  --font-main: 'Inter', Arial, Helvetica, sans-serif;
  --font-mono: Consolas, Monaco, monospace;

  /* Shadows */
  --shadow-soft: 0 4px 18px rgba(0, 0, 0, 0.35);
  --shadow-modal: 0 20px 70px rgba(0, 0, 0, 0.9);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--bg-dark);
  color: var(--text);
  font-family: var(--font-main);
  font-size: 12px;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  user-select: none;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

::selection {
  background: var(--accent);
  color: #fff;
}

/* =========================================================
   DASHBOARD SHELL
   ========================================================= */

.dashboard-shell {
  position: relative;
  z-index: 1;
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--rightbar);
  grid-template-rows: var(--topbar) minmax(0, 1fr);
  overflow: hidden;
  background: var(--bg-main);
}

/* =========================================================
   SIDEBAR
   ========================================================= */

.sidebar {
  grid-column: 1;
  grid-row: 1 / 3;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 10px;
  background: linear-gradient(180deg, #101010 0%, var(--bg-dark) 100%);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
}

.brand {
  height: 90px;
  margin: -2px -10px 10px;
  display: grid;
  place-items: center;
  border-bottom: 1px solid var(--border);
}

.brand img {
  max-width: 140px;
  max-height: 75px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(88, 166, 255, 0.2));
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  flex: 0 0 auto;
}

.nav-item {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-item span {
  width: 16px;
  text-align: center;
  color: var(--text-faint);
}

.nav-item:hover {
  background: var(--bg-panel);
  border-color: var(--border);
  color: var(--text);
}

.nav-item:hover span {
  color: var(--text-muted);
}

.nav-item.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text-bright);
}

.nav-item.active span {
  color: var(--accent);
}

/* Side Cards */
.side-card,
.right-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 10px;
  flex: 0 0 auto;
}

.section-title {
  min-height: 32px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.profile-row {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-row img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  object-fit: cover;
  box-shadow: 0 0 12px rgba(88, 166, 255, 0.2);
}

.profile-row strong,
.profile-row small,
.profile-row em {
  display: block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-row strong {
  font-size: 12px;
  color: var(--text-bright);
}

.profile-row small {
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 9px;
}

.profile-row em {
  width: fit-content;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid rgba(248, 81, 73, 0.3);
  color: var(--danger);
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
  text-transform: uppercase;
}

.role-wrap {
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-section);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
}

.role-pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 6px rgba(210, 153, 34, 0.6);
}

.alert-card {
  max-height: 120px;
}

.alert-box {
  max-height: 70px;
  overflow: hidden;
  padding: 10px 12px;
  color: var(--text-faint);
  font-size: 10px;
  line-height: 1.5;
}

.side-brand-bottom {
  margin-top: auto;
  padding-top: 10px;
  text-align: center;
}

.side-brand-bottom img {
  width: 110px;
  max-height: 60px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(88, 166, 255, 0.15));
}

.side-brand-bottom strong,
.side-brand-bottom span {
  display: block;
}

.side-brand-bottom strong {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text);
}

.side-brand-bottom span {
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 9px;
}

/* =========================================================
   TOPBAR
   ========================================================= */

.topbar {
  grid-column: 2 / 4;
  grid-row: 1;
  height: var(--topbar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: linear-gradient(180deg, #101010 0%, var(--bg-dark) 100%);
  border-bottom: 1px solid var(--border);
}

.top-left,
.top-right,
.user-chip {
  display: flex;
  align-items: center;
}

.top-left {
  gap: 12px;
}

.menu-button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.menu-button:hover {
  border-color: var(--border-light);
  background: var(--bg-panel-soft);
  color: var(--text);
}

.top-left strong,
.top-left span {
  display: block;
}

.top-left strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: 0.5px;
}

.top-left span {
  margin-top: 1px;
  color: var(--text-faint);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.top-right {
  gap: 8px;
}

.top-chip {
  height: 28px;
  padding: 0 12px;
  border: 1px solid rgba(63, 185, 80, 0.3);
  border-radius: var(--radius-sm);
  background: var(--success-soft);
  color: var(--success);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.top-chip:hover {
  background: rgba(63, 185, 80, 0.2);
  border-color: var(--success);
}

.user-chip {
  height: 32px;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-panel);
  cursor: pointer;
  transition: all 0.15s ease;
}

.user-chip:hover {
  border-color: var(--accent);
  background: var(--bg-panel-soft);
}

.user-chip img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--accent);
}

.user-chip span {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}

.logout {
  height: 28px;
  padding: 0 12px;
  border: 1px solid rgba(248, 81, 73, 0.3);
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.logout:hover {
  background: rgba(248, 81, 73, 0.2);
  border-color: var(--danger);
}

/* =========================================================
   MAIN CONTENT
   ========================================================= */

.main {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  padding: var(--gap);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: var(--gap);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-main);
}

/* Hero Card */
.hero-card {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(88, 166, 255, 0.05) 0%, transparent 50%);
  pointer-events: none;
}

.hero-text {
  position: relative;
  z-index: 2;
  min-width: 0;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hero-text h1 {
  margin: 0;
  max-width: 500px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-bright);
}

.hero-text p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.hero-pills span {
  height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-section);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.hero-pills span:hover {
  border-color: var(--accent);
  color: var(--text);
}

.hero-logo {
  position: relative;
  z-index: 1;
  flex: 0 0 160px;
  display: grid;
  place-items: center;
  border-left: 1px solid var(--border);
  min-height: 80px;
  padding-left: 20px;
}

.hero-logo img {
  width: 130px;
  max-height: 75px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(88, 166, 255, 0.2));
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
}

.stat-card {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all 0.15s ease;
}

.stat-card:hover {
  border-color: var(--border-light);
  background: var(--bg-panel-soft);
}

.stat-card span {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--bg-section);
  font-size: 16px;
}

.stat-card strong {
  display: block;
  font-size: 20px;
  line-height: 1;
  font-weight: 800;
  color: var(--text-bright);
}

.stat-card small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card.blue span { color: var(--accent); background: var(--accent-soft); }
.stat-card.cyan span { color: #00cfff; background: rgba(0, 207, 255, 0.12); }
.stat-card.amber span { color: var(--warning); background: var(--warning-soft); }
.stat-card.red span { color: var(--danger); background: var(--danger-soft); }
.stat-card.purple span { color: var(--purple); background: rgba(163, 113, 247, 0.12); }
.stat-card.green span { color: var(--success); background: var(--success-soft); }

/* Systems Panel */
.systems-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.panel-header {
  height: 40px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-section);
}

.panel-header h2 {
  margin: 0;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.panel-header button {
  height: 22px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  color: var(--text-faint);
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.panel-header button:hover {
  background: var(--bg-panel-soft);
  border-color: var(--accent);
  color: var(--text);
}

.systems-grid {
  flex: 1 1 auto;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  grid-auto-rows: min-content;
  gap: 10px;
  overflow-y: auto;
  align-content: start;
}

.system-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 16px 12px;
  text-align: center;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.15s ease;
}

.system-card:hover {
  border-color: var(--accent);
  background: var(--bg-panel-soft);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.system-card:active {
  transform: translateY(1px);
}

.system-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border: 1px solid rgba(88, 166, 255, 0.2);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  transition: all 0.15s ease;
}

.system-card:hover .system-icon {
  background: rgba(88, 166, 255, 0.18);
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(88, 166, 255, 0.2);
}

.system-icon img {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.system-icon.purple { color: var(--purple); background: rgba(163, 113, 247, 0.12); border-color: rgba(163, 113, 247, 0.2); }
.system-icon.amber { color: var(--warning); background: var(--warning-soft); border-color: rgba(210, 153, 34, 0.2); }

.system-card h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

.system-card p {
  margin: 0;
  color: var(--text-faint);
  font-size: 10px;
  line-height: 1.3;
}

/* Callsign Badge */
.callsign {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  margin-top: 4px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.callsign.blue { background: var(--accent-soft); border: 1px solid var(--accent); color: var(--accent); }
.callsign.amber { background: var(--warning-soft); border: 1px solid var(--warning); color: var(--warning); }
.callsign.red { background: var(--danger-soft); border: 1px solid var(--danger); color: var(--danger); }
.callsign.green { background: var(--success-soft); border: 1px solid var(--success); color: var(--success); }

/* =========================================================
   RIGHTBAR
   ========================================================= */

.rightbar {
  grid-column: 3;
  grid-row: 2;
  min-height: 0;
  padding: var(--gap) var(--gap) var(--gap) 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  overflow-y: auto;
  overflow-x: hidden;
}

.right-card {
  overflow: hidden;
  flex: 0 0 auto;
}

.status-list {
  padding: 10px 12px;
}

.status-item {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--bg-section);
  border: 1px solid var(--border-soft);
  margin-bottom: 8px;
}

.status-item:last-child {
  margin-bottom: 0;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.red {
  background: var(--danger);
  box-shadow: 0 0 10px rgba(248, 81, 73, 0.6);
}

.dot.green {
  background: var(--success);
  box-shadow: 0 0 10px rgba(63, 185, 80, 0.6);
  animation: pulse-green 2s ease-in-out infinite;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 10px rgba(63, 185, 80, 0.6); }
  50% { box-shadow: 0 0 16px rgba(63, 185, 80, 0.9); }
}

.status-item strong,
.status-item span {
  display: block;
}

.status-item strong {
  font-size: 11px;
  color: var(--text);
}

.status-item span {
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 9px;
}

.activity-line {
  margin: 10px 12px;
  height: 36px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-radius: var(--radius-md);
  background: var(--bg-dark);
  border: 1px solid var(--border-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  overflow: hidden;
  white-space: nowrap;
}

.admin-actions {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-actions button,
.danger-full {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-section);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.admin-actions button:hover {
  border-color: var(--border-light);
  background: var(--bg-panel-soft);
}

.admin-actions button.primary {
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.admin-actions button.primary:hover {
  background: rgba(88, 166, 255, 0.2);
}

.danger-full {
  width: calc(100% - 24px);
  margin: 10px 12px;
  border: 1px solid var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.danger-full:hover {
  background: rgba(248, 81, 73, 0.2);
}

/* =========================================================
   MODALS
   ========================================================= */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}

.modal.active {
  display: flex;
}

.modal-card {
  width: min(96vw, 600px);
  max-height: 86vh;
  overflow: hidden;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
}

.modal-card.modal-wide {
  width: min(96vw, 900px);
}

.modal-head {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-section);
}

.modal-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-bright);
}

.modal-head button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.modal-head button:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.modal-body {
  max-height: calc(86vh - 48px);
  overflow: auto;
  padding: 16px;
  color: var(--text-muted);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1400px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1280px) {
  :root {
    --sidebar: 200px;
    --rightbar: 250px;
  }

  .hero-logo {
    flex-basis: 140px;
  }

  .hero-logo img {
    width: 110px;
  }
}

@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-logo {
    display: none;
  }
}

@media (max-width: 920px) {
  html,
  body {
    overflow: auto;
  }

  .dashboard-shell {
    height: auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  .sidebar,
  .topbar,
  .main,
  .rightbar {
    width: 100%;
    padding: 10px;
  }

  .sidebar {
    min-height: auto;
  }

  .brand {
    height: 70px;
  }

  .main {
    grid-template-rows: auto auto auto;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .systems-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-card {
    padding: 16px;
  }

  .topbar {
    height: auto;
    gap: 8px;
    flex-wrap: wrap;
  }
}

/* =========================================================
   SCROLLBARS - BCSO Style
   ========================================================= */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-faint);
}

/* =========================================================
   LOGIN PAGE STYLES - BCSO Theme
   ========================================================= */

#glob-bg-art {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 20% 80%, rgba(88, 166, 255, 0.04), transparent 50%),
    radial-gradient(ellipse 60% 50% at 80% 20%, rgba(88, 166, 255, 0.03), transparent 50%);
}

#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 5, 0.95);
  backdrop-filter: blur(8px);
}

#loading-overlay.active {
  display: flex;
}

#loading-overlay .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-dark);
  overflow: auto;
}

.login-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 800px;
  min-height: 480px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 30px;
  background: linear-gradient(135deg, var(--bg-section) 0%, var(--bg-dark) 100%);
  border-right: 1px solid var(--border);
  text-align: center;
}

.login-logo {
  width: 120px;
  height: auto;
  max-height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 0 20px rgba(88, 166, 255, 0.25));
  margin-bottom: 20px;
}

.login-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text-bright);
}

.login-dept {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--accent);
  text-transform: uppercase;
}

.login-divider {
  width: 50px;
  height: 2px;
  margin: 24px 0;
  background: var(--border-light);
  border-radius: 1px;
}

.login-system {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.login-system-sub {
  margin: 4px 0 0;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1px;
  color: var(--text-faint);
  text-transform: uppercase;
}

.login-form {
  display: flex;
  flex-direction: column;
  padding: 40px 30px;
  background: var(--bg-main);
}

.login-form-header {
  margin-bottom: 24px;
  text-align: center;
}

.login-form-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-bright);
}

.login-form-header p {
  margin: 6px 0 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint);
}

.login-beta-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  margin-bottom: 20px;
  background: var(--warning-soft);
  border: 1px solid rgba(210, 153, 34, 0.3);
  border-radius: var(--radius-md);
}

.beta-tag {
  flex-shrink: 0;
  padding: 3px 8px;
  background: var(--warning);
  border-radius: var(--radius-sm);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #000;
}

.beta-text {
  font-size: 10px;
  line-height: 1.5;
  color: var(--warning);
}

.login-btn-pro {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 44px;
  margin-bottom: 16px;
  padding: 0 20px;
  background: #5865f2;
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.login-btn-pro:hover {
  background: #6875f5;
  box-shadow: 0 4px 20px rgba(88, 101, 242, 0.4);
}

.login-btn-pro:active {
  transform: translateY(1px);
}

.login-btn-pro svg {
  flex-shrink: 0;
}

.login-notice {
  padding: 12px;
  margin-bottom: 16px;
  background: var(--accent-soft);
  border: 1px solid rgba(88, 166, 255, 0.2);
  border-radius: var(--radius-md);
  text-align: center;
}

.login-notice p {
  margin: 0;
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.5;
}

.login-notice p:first-child {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.login-status-mini {
  margin-top: auto;
  padding: 12px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.status-mini-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-mini-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-faint);
}

.status-mini-dots {
  display: flex;
  gap: 5px;
}

.mini-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.mini-dot.online,
.mini-dot.ok {
  background: var(--success);
  box-shadow: 0 0 8px rgba(63, 185, 80, 0.6);
}

.mini-dot.offline,
.mini-dot.error {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(248, 81, 73, 0.6);
}

.status-mini-text {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
}

.login-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 9px;
  color: var(--text-faint);
}

.login-credit {
  margin-top: 8px;
  text-align: center;
  font-size: 9px;
  color: var(--text-faint);
}

.login-credit strong {
  color: var(--accent);
}

/* Responsive Login */
@media (max-width: 768px) {
  .login-panel {
    grid-template-columns: 1fr;
    max-width: 380px;
    min-height: auto;
  }

  .login-brand {
    padding: 30px 20px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .login-logo {
    width: 90px;
    margin-bottom: 16px;
  }

  .login-title {
    font-size: 18px;
  }

  .login-divider {
    margin: 16px 0;
  }

  .login-form {
    padding: 30px 20px;
  }
}
