:root {
  --bg: #081120;
  --bg-soft: #0d1728;
  --panel: rgba(11, 24, 41, 0.78);
  --panel-strong: rgba(10, 21, 35, 0.94);
  --line: rgba(148, 163, 184, 0.16);
  --line-strong: rgba(148, 163, 184, 0.28);
  --text: #e5eefb;
  --muted: #8ca0bf;
  --primary: #5b8cff;
  --primary-2: #78a6ff;
  --success: #2dd4bf;
  --warning: #fbbf24;
  --danger: #fb7185;
  --purple: #a78bfa;
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.22);
  --radius: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --font: 'Inter', 'Noto Sans KR', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(circle at top left, rgba(91,140,255,0.22), transparent 28%),
    radial-gradient(circle at right, rgba(45,212,191,0.14), transparent 24%),
    linear-gradient(180deg, #07101d 0%, #091320 45%, #081120 100%);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }

.gs88-theme { position: relative; }
.gs88-theme::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent 85%);
}

.app-shell { width: min(1400px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 40px; }
.page-main { display: flex; flex-direction: column; gap: 24px; }
.glass-panel, .glass-card, .form-card, .dashboard-section, .stat-card, .route-list-panel, .route-edit-panel, .qr-list-container, .monitoring-map-panel, .monitoring-user-panel, .alert-log-section {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius);
}
.eyebrow { font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.eyebrow.accent { color: var(--primary-2); }
.inline-link { display: inline-flex; align-items: center; gap: 8px; color: var(--primary-2); font-weight: 600; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head h3 { font-size: 28px; font-weight: 800; }
.section-head.compact h3 { font-size: 22px; }

.site-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  margin-bottom: 24px;
}
.brand-wrap { display: flex; align-items: center; gap: 16px; }
.brand-wrap h1 { font-size: 24px; font-weight: 800; }
.brand-mark {
  width: 54px; height: 54px; border-radius: 18px;
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, rgba(91,140,255,0.28), rgba(45,212,191,0.18));
  border: 1px solid rgba(120,166,255,0.25);
}
.topbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar-select-wrap, .ghost-action {
  display: inline-flex; align-items: center; gap: 10px; min-height: 46px;
  padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.04); color: var(--text);
}
.topbar-select-wrap select { background: transparent; color: var(--text); border: 0; outline: 0; }
.topbar-select-wrap option { color: #111827; }
.ghost-action { font-weight: 600; }

.hero-panel {
  display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px;
  padding: 32px; overflow: hidden; position: relative;
}
.hero-panel::after {
  content: ''; position: absolute; inset: auto -120px -120px auto; width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(91,140,255,0.24), transparent 70%);
}
.hero-copy h2 { font-size: clamp(32px, 4vw, 54px); line-height: 1.15; margin: 10px 0 16px; font-weight: 800; }
.hero-desc { color: var(--muted); line-height: 1.7; max-width: 700px; }
.hero-side { display: grid; gap: 18px; align-content: center; }
.hero-metric-card {
  padding: 22px; border-radius: 22px; background: rgba(255,255,255,0.05); border: 1px solid var(--line);
  display: grid; gap: 10px;
}
.hero-metric-card strong { font-size: 34px; letter-spacing: 0.08em; }
.hero-metric-card small { color: var(--muted); }
.hero-orbit { position: relative; min-height: 220px; border-radius: 26px; border: 1px solid var(--line); background: radial-gradient(circle, rgba(120,166,255,0.14), transparent 60%); }
.orbit-core {
  position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%);
  width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #88b0ff); color: white; font-size: 28px; box-shadow: 0 18px 40px rgba(91,140,255,0.35);
}
.orbit-chip {
  position: absolute; padding: 10px 14px; border-radius: 999px; font-weight: 700; font-size: 12px;
  background: rgba(255,255,255,0.08); border: 1px solid var(--line-strong);
}
.chip-a { top: 18%; left: 12%; }
.chip-b { top: 24%; right: 12%; }
.chip-c { bottom: 18%; left: 50%; transform: translateX(-50%); }

.status-banner {
  margin-top: 24px; display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: 999px; font-weight: 600; border: 1px solid transparent;
}
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 6px rgba(255,255,255,0.06); }
.status-normal { color: #8ff0cf; background: rgba(45,212,191,0.1); border-color: rgba(45,212,191,0.24); }
.status-warning { color: #ffd56a; background: rgba(251,191,36,0.1); border-color: rgba(251,191,36,0.24); }
.status-danger { color: #ff9aaa; background: rgba(251,113,133,0.1); border-color: rgba(251,113,133,0.24); }
.fire-badge { padding: 6px 10px; border-radius: 999px; background: rgba(251,113,133,0.18); color: #ffd7de; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.main-card {
  position: relative; display: flex; gap: 16px; align-items: flex-start; min-height: 180px;
  padding: 22px; border-radius: 24px; border: 1px solid var(--line); background: rgba(255,255,255,0.04);
  overflow: hidden; transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.main-card:hover { transform: translateY(-6px); border-color: rgba(120,166,255,0.4); box-shadow: var(--shadow-lg); }
.card-glow { position: absolute; inset: auto -40px -40px auto; width: 140px; height: 140px; border-radius: 50%; filter: blur(4px); opacity: .5; }
.card-icon {
  width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; font-size: 22px; flex-shrink: 0;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.08);
}
.card-content { display: grid; gap: 8px; }
.card-content h2 { font-size: 22px; font-weight: 800; }
.card-content p { color: var(--muted); line-height: 1.65; }
.card-arrow { margin-left: auto; opacity: .7; }
.qr-card .card-glow { background: rgba(91,140,255,0.35); }
.transfer-card .card-glow { background: rgba(96,165,250,0.32); }
.exit-card .card-glow { background: rgba(45,212,191,0.28); }
.evacuation-card .card-glow { background: rgba(251,191,36,0.3); }
.accessible-card .card-glow { background: rgba(167,139,250,0.3); }
.fire-card .card-glow { background: rgba(251,113,133,0.28); }

.info-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) 360px; gap: 20px; }
.station-info-section, .insight-panel { padding: 24px; }
.station-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.loading-spinner, .no-data-msg { color: var(--muted); text-align: center; padding: 28px 18px; }
.feature-list { list-style: none; display: grid; gap: 14px; margin-top: 18px; }
.feature-list li { display: flex; gap: 12px; color: var(--text); align-items: center; }
.feature-list i { color: var(--success); }
.main-footer { text-align: center; padding: 26px 0 8px; color: var(--muted); font-size: 13px; display: grid; gap: 6px; }

.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-overlay { position: absolute; inset: 0; background: rgba(2,6,23,0.72); }
.modal-content {
  position: relative; width: min(560px, calc(100% - 24px)); border-radius: 26px; background: var(--panel-strong);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal-header, .modal-body { padding: 22px 24px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal-header h2 { font-size: 22px; }
.modal-close { background: transparent; color: var(--muted); font-size: 28px; }
.fire-modal-header { padding: 24px; background: linear-gradient(135deg, rgba(251,113,133,0.18), rgba(255,255,255,0.04)); display: flex; align-items: center; gap: 14px; }
.fire-modal-header i { font-size: 26px; color: var(--danger); }
.fire-actions, .modal-actions, .form-actions, .popup-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.form-group { display: grid; gap: 8px; margin-bottom: 14px; }
.form-group label { font-weight: 600; color: #c7d7ee; }
.form-group input, .form-group textarea, .form-group select, select, input, textarea {
  width: 100%; background: rgba(255,255,255,0.05); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; outline: none;
}
.hint { color: var(--muted); font-size: 13px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.form-row > * { flex: 1; }

.btn-save, .btn-test, .btn-login, .btn-upload, .btn-analyze, .btn-save-map, .btn-generate, .btn-print, .btn-primary, .btn-update-route, .btn-preview-guide, .btn-evacuate, .btn-fire-trigger {
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: white; padding: 12px 18px; border-radius: 14px; font-weight: 700;
}
.btn-close-modal, .btn-close-popup, .btn-delete, .btn-fire-clear, .btn-cancel {
  background: rgba(255,255,255,0.08); color: var(--text); padding: 12px 18px; border-radius: 14px; font-weight: 600;
}
.btn-add, .btn-sm, .btn-generate-desc, .quick-btn, .btn-update, .btn-tts, .btn-evacuate-now, .btn-test {
  background: rgba(91,140,255,0.16); color: #dbe7ff; padding: 10px 16px; border-radius: 12px; font-weight: 700;
}
.btn-delete, .btn-fire-trigger { background: linear-gradient(135deg, #ef476f, #fb7185); }
.btn-fire-clear { color: #8fe7ce; }
.btn-print { background: linear-gradient(135deg, #22324c, #3b4d6b); }
.btn-generate { background: linear-gradient(135deg, #ffb84d, #f59e0b); }
.btn-analyze { background: linear-gradient(135deg, #8b5cf6, #6366f1); }
.btn-upload { display: inline-flex; align-items: center; gap: 8px; }

.popup-overlay { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(2,6,23,0.74); z-index: 1100; }
.popup-card { width: min(420px, calc(100% - 24px)); background: var(--panel-strong); border-radius: 26px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); padding: 28px; text-align: center; }
.popup-emoji { font-size: 54px; margin-bottom: 10px; }
.popup-card p { color: var(--muted); line-height: 1.7; }
.fire-popup { border-color: rgba(251,113,133,0.35); }
.fire-warning { color: #ffd5dc !important; }

.toggle-switch { position: relative; display: inline-block; width: 54px; height: 30px; }
.toggle-switch input { display: none; }
.toggle-slider { position: absolute; inset: 0; border-radius: 999px; background: rgba(255,255,255,0.14); transition: .2s; }
.toggle-slider::before { content: ''; position: absolute; width: 24px; height: 24px; border-radius: 50%; top: 3px; left: 3px; background: white; transition: .2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(24px); }

.login-error { color: #ffb4c0; background: rgba(251,113,133,0.12); border: 1px solid rgba(251,113,133,0.22); padding: 10px 12px; border-radius: 12px; }

@media (max-width: 1100px) {
  .hero-panel, .info-layout, .card-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .app-shell { width: min(100% - 20px, 1400px); padding-top: 16px; }
  .site-topbar, .hero-panel, .station-info-section, .insight-panel, .form-card, .dashboard-section, .tab-content { padding: 18px; }
  .site-topbar { flex-direction: column; align-items: stretch; }
  .brand-wrap { align-items: flex-start; }
  .topbar-actions { justify-content: space-between; }
  .card-content h2 { font-size: 19px; }
}
@media (max-width: 560px) {
  .main-card { flex-direction: column; min-height: auto; }
  .card-arrow { position: absolute; right: 18px; top: 18px; }
}