/* ==========================================================================
   NYROX CLOUD CONSOLE — Midnight Cyber-Obsidian Theme & Fluid Responsive Engine
   Optimized for Mobile Phones, Tablets, and Desktop / Laptop Screens
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Midnight Cyber-Indigo & Sapphire Palette */
  --bg-app: #080A10;
  --bg-sidebar: #0C0F17;
  --bg-surface: #121624;
  --bg-subtle: #181E30;
  --bg-muted: #20273F;
  --bg-hover: #293250;

  --border-light: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  --border-active: rgba(99, 102, 241, 0.4);

  --text-main: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --primary: #6366F1;
  --primary-hover: #4F46E5;
  --primary-gradient: linear-gradient(135deg, #6366F1 0%, #4F46E5 100%);
  --primary-text: #FFFFFF;
  --glow-primary: 0 0 20px rgba(99, 102, 241, 0.35);

  --accent-cyan: #38BDF8;
  --accent-cyan-light: rgba(56, 189, 248, 0.12);

  --accent-indigo: #818CF8;
  --accent-indigo-light: rgba(129, 140, 248, 0.12);

  --accent-purple: #A855F7;
  --accent-purple-light: rgba(168, 85, 247, 0.12);

  --accent-emerald: #10B981;
  --accent-emerald-light: rgba(16, 185, 129, 0.12);
  --accent-emerald-text: #34D399;

  --accent-amber: #F59E0B;
  --accent-amber-light: rgba(245, 158, 11, 0.12);

  --accent-rose: #F43F5E;
  --accent-rose-light: rgba(244, 63, 94, 0.15);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.65);
  --shadow-lg: 0 20px 48px -10px rgba(0, 0, 0, 0.85);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --sidebar-width: 250px;
  --header-height: 58px;
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 1-Click Accent Theme Variations */
[data-theme="cyan"] {
  --primary: #06B6D4;
  --primary-hover: #0891B2;
  --primary-gradient: linear-gradient(135deg, #06B6D4 0%, #0284C7 100%);
  --glow-primary: 0 0 20px rgba(6, 182, 212, 0.35);
  --border-focus: rgba(6, 182, 212, 0.5);
  --border-active: rgba(6, 182, 212, 0.4);
}

[data-theme="violet"] {
  --primary: #8B5CF6;
  --primary-hover: #7C3AED;
  --primary-gradient: linear-gradient(135deg, #A855F7 0%, #7C3AED 100%);
  --glow-primary: 0 0 20px rgba(139, 92, 246, 0.35);
  --border-focus: rgba(139, 92, 246, 0.5);
  --border-active: rgba(139, 92, 246, 0.4);
}

[data-theme="emerald"] {
  --primary: #10B981;
  --primary-hover: #059669;
  --primary-gradient: linear-gradient(135deg, #10B981 0%, #047857 100%);
  --glow-primary: 0 0 20px rgba(16, 185, 129, 0.35);
  --border-focus: rgba(16, 185, 129, 0.5);
  --border-active: rgba(16, 185, 129, 0.4);
}

.theme-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  padding: 4px 8px;
  border-radius: var(--radius-full);
}

.theme-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
  padding: 0;
  outline: none;
}

.theme-dot:hover {
  transform: scale(1.2);
}

.theme-dot.active {
  border-color: #FFFFFF;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
  transform: scale(1.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(14px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes liveGlow {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.8); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes liveFlash {
  0% { background-color: rgba(99, 102, 241, 0.35); box-shadow: 0 0 25px rgba(99, 102, 241, 0.5); }
  100% { background-color: transparent; box-shadow: none; }
}

@keyframes shimmerSweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes pulseGlow {
  0% { transform: scale(0.96); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.5); }
  70% { transform: scale(1.02); box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
  100% { transform: scale(0.96); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

@keyframes radarWave {
  0% { transform: scale(0.8); opacity: 0.9; }
  100% { transform: scale(2.8); opacity: 0; }
}

@keyframes countTick {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.6)); }
  100% { transform: scale(1); }
}

@keyframes borderGlowPulse {
  0%, 100% { border-color: rgba(255, 255, 255, 0.08); }
  50% { border-color: rgba(99, 102, 241, 0.4); box-shadow: 0 0 20px rgba(99, 102, 241, 0.15); }
}

.animate-fade { animation: fadeIn var(--transition-base) forwards; }
.animate-slide { animation: slideUp var(--transition-base) forwards; }
.animate-flash { animation: liveFlash 1s ease-out; }
.animate-tick { animation: countTick 0.35s ease-out; }

/* ==========================================================================
   TOP HEADER (Mobile + Desktop Responsive)
   ========================================================================== */
.top-header {
  height: var(--header-height);
  background: rgba(12, 15, 23, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mobile-menu-btn {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: 1.15rem;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.brand-logo-img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.35);
  border: 1px solid rgba(99, 102, 241, 0.4);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.brand-logo-img:hover {
  transform: scale(1.05);
}

.login-logo-wrap {
  width: 76px;
  height: 76px;
  margin: 0 auto 1.25rem;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #121624;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent-emerald-light);
  border: 1px solid rgba(0, 245, 155, 0.3);
  color: var(--accent-emerald-text);
  font-size: 0.725rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background-color: var(--accent-emerald);
  border-radius: 50%;
  animation: liveGlow 2s infinite;
}

/* ==========================================================================
   CONSOLE LAYOUT (Sidebar + Workspace)
   ========================================================================== */
.console-layout {
  display: flex;
  min-height: calc(100vh - var(--header-height));
  position: relative;
}

/* Sidebar Drawer */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform var(--transition-base);
}

.sidebar-header-mobile {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-project-box {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-light);
}

.project-select-label {
  font-size: 0.685rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  display: flex;
  justify-content: space-between;
}

.project-select {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.65rem;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

.sidebar-nav {
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: var(--transition-fast);
}

.sidebar-item:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

.sidebar-item.active {
  color: #FFFFFF;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.16) 0%, transparent 100%);
  border-left: 3px solid var(--primary);
  box-shadow: inset 0 0 15px rgba(99, 102, 241, 0.08);
}

.sidebar-icon {
  font-size: 0.95rem;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.725rem;
  color: var(--text-muted);
}

/* Mobile Backdrop Overlay */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 45;
}

/* Main Workspace */
.workspace-content {
  flex: 1;
  padding: 1.5rem;
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
}

/* Panel Header */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.panel-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.panel-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

/* Cards (Cyber Glassmorphism & Ambient Glow) */
.card {
  background: rgba(18, 22, 36, 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.35), transparent);
  pointer-events: none;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.card-interactive:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 10px 30px -4px rgba(99, 102, 241, 0.18);
  transform: translateY(-2px);
}

/* Executive Project Header (Minimalist & Crisp) */
.project-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 1.25rem 0;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.project-info-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.project-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px rgba(0, 245, 155, 0.7);
  flex-shrink: 0;
}

.project-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.project-title-main {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.2;
}

.project-id-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.project-actions-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Minimalist 4-Column Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
  position: relative;
}

.metric-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-2px);
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.metric-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.metric-icon {
  font-size: 0.9rem;
  opacity: 0.75;
}

.metric-number {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.2;
}

.metric-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.45rem;
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 0.55rem;
}

.metric-progress-fill {
  height: 100%;
  background: var(--accent-emerald);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.825rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
  outline: none;
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary-gradient);
  color: var(--primary-text);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4F46E5 0%, #4338CA 100%);
  box-shadow: 0 4px 18px rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: var(--bg-muted);
  border-color: var(--border-focus);
}

.btn-emerald {
  background: linear-gradient(135deg, #059669 0%, #10B981 100%);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.25);
}

.btn-emerald:hover { 
  background: linear-gradient(135deg, #047857 0%, #059669 100%);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #E11D48 0%, #F43F5E 100%);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.25);
}

.btn-danger:hover { 
  background: linear-gradient(135deg, #BE123C 0%, #E11D48 100%);
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.4);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.28rem 0.6rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

/* Forms & Inputs */
.input-group { margin-bottom: 0.95rem; }

.input-label {
  display: block;
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.3rem;
}

.input-text, .input-select, .input-textarea {
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.8rem;
  font-size: 0.85rem;
  color: var(--text-main);
  outline: none;
  font-family: inherit;
}

.input-text:focus, .input-select:focus, .input-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.input-code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
}

/* Data Tables */
.data-table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.825rem;
}

.data-table th {
  background: var(--bg-subtle);
  padding: 0.65rem 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  white-space: nowrap;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-subtle); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
}

.badge-active { background: var(--accent-emerald-light); color: var(--accent-emerald-text); }
.badge-inactive { background: var(--bg-muted); color: var(--text-muted); }
.badge-banned { background: var(--accent-rose-light); color: #FF4D6D; }
.badge-indigo { background: var(--accent-indigo-light); color: var(--accent-indigo); }

/* Tree Node Canvas */
.tree-node-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  gap: 0.5rem;
}

.tree-node-row:hover { background: var(--bg-hover); }

.tree-node-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.825rem;
  word-break: break-all;
}

.tree-key { color: var(--accent-indigo); font-weight: 600; cursor: pointer; }
.tree-val-str { color: var(--accent-emerald-text); }
.tree-val-num { color: var(--accent-amber); }
.tree-val-bool { color: #A78BFA; }

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  animation: fadeIn var(--transition-fast) forwards;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 500px;
  overflow: hidden;
  animation: slideUp var(--transition-base) forwards;
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 1.25rem;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  background: var(--bg-subtle);
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-width: 90vw;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.825rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
}

.toast-emerald {
  border-color: rgba(0, 245, 155, 0.4);
  background: rgba(0, 245, 155, 0.15);
  color: var(--accent-emerald-text);
}

/* Login Screen */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, var(--bg-subtle), var(--bg-app));
  padding: 1.25rem;
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 380px;
  padding: 2.25rem;
  text-align: center;
  animation: slideUp var(--transition-base) forwards;
}

.login-logo-wrap {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.25rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: var(--bg-surface);
}

.login-logo-img {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  object-fit: cover;
  display: block;
}

.login-alert {
  padding: 0.65rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  margin-bottom: 1rem;
  display: none;
}

.login-alert.show { display: block; }
.login-alert.error {
  background: var(--accent-rose-light);
  color: #FF4D6D;
  border: 1px solid rgba(255, 77, 109, 0.3);
}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE ENGINE (PHONE + LAPTOP SAME OPTIMIZATION)
   ========================================================================== */
@media (max-width: 860px) {
  .mobile-menu-btn {
    display: inline-flex;
  }

  .sidebar-header-mobile {
    display: flex;
  }

  /* Off-canvas mobile navigation drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    bottom: 0;
    width: 280px;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    background: var(--bg-sidebar);
  }

  .sidebar.open {
    transform: translateX(280px);
  }

  .sidebar-backdrop {
    display: none;
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .workspace-content {
    padding: 1rem;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel-title {
    font-size: 1.15rem;
  }

  /* 2 columns on phones */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
  }

  /* Stacking overview quick cards */
  div[style*="grid-template-columns: 1fr 1fr;"] {
    grid-template-columns: 1fr !important;
  }

  #topbar-project-name {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .btn-sm {
    padding: 0.35rem 0.65rem;
  }

  #topbar-download-btn {
    font-size: 0.72rem;
    padding: 0.25rem 0.5rem;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .brand-title span {
    display: none;
  }

  .login-card {
    padding: 1.5rem;
  }
}
