/* ============================================================
   TUNO DEPLOY - Docker PaaS Panel
   Premium Dark Admin Dashboard
   Version 1.0.0
   ============================================================ */

/* ------------------------------------------------------------
   1. RESET & BASE STYLES
   ------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---- Dark theme (default) ---- */
[data-theme="dark"],
:root {
  --bg-deep: #0a0e1a;
  --bg-dark: #0d1117;
  --bg-surface: #121626;
  --bg-elevated: #161b2b;
  --bg-hover: #1a2035;
  --bg-active: #1f2542;
  --glass-bg: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-hover-bg: rgba(255, 255, 255, 0.06);
  --glass-hover-border: rgba(255, 255, 255, 0.10);
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.12);
  --primary-glow: rgba(99, 102, 241, 0.25);
  --success: #22c55e;
  --success-light: rgba(34, 197, 94, 0.12);
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.12);
  --info: #3b82f6;
  --info-light: rgba(59, 130, 246, 0.12);
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0a0e1a;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.04);
  --sidebar-bg: #0d1117;
  --sidebar-border: rgba(255, 255, 255, 0.06);
  --header-bg: rgba(13, 17, 23, 0.85);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow-primary: 0 0 20px rgba(99, 102, 241, 0.15);
  --shadow-glow-success: 0 0 20px rgba(34, 197, 94, 0.15);
  --shadow-glow-danger: 0 0 20px rgba(239, 68, 68, 0.15);
  --glass-blur: 20px;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 0px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Source Code Pro', Consolas, monospace;
  --z-sidebar: 100;
  --z-header: 200;
  --z-dropdown: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-toast: 600;
  --z-tooltip: 700;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
}

/* ---- Light theme ---- */
[data-theme="light"] {
  --bg-deep: #f0f2f5;
  --bg-dark: #f8f9fb;
  --bg-surface: #ffffff;
  --bg-elevated: #ffffff;
  --bg-hover: #eef0f4;
  --bg-active: #e2e5eb;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-hover-bg: rgba(255, 255, 255, 0.9);
  --glass-hover-border: rgba(0, 0, 0, 0.12);
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.10);
  --primary-glow: rgba(99, 102, 241, 0.20);
  --success: #16a34a;
  --success-light: rgba(22, 163, 74, 0.10);
  --warning: #d97706;
  --warning-light: rgba(217, 119, 6, 0.10);
  --danger: #dc2626;
  --danger-light: rgba(220, 38, 38, 0.10);
  --info: #2563eb;
  --info-light: rgba(37, 99, 235, 0.10);
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-inverse: #f8f9fb;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-subtle: rgba(0, 0, 0, 0.04);
  --sidebar-bg: #ffffff;
  --sidebar-border: rgba(0, 0, 0, 0.06);
  --header-bg: rgba(255, 255, 255, 0.85);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-glow-primary: 0 0 20px rgba(99, 102, 241, 0.12);
  --shadow-glow-success: 0 0 20px rgba(22, 163, 74, 0.12);
  --shadow-glow-danger: 0 0 20px rgba(220, 38, 38, 0.12);
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  background: linear-gradient(135deg, var(--bg-deep) 0%, var(--bg-surface) 100%);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

/* ------------------------------------------------------------
   2. SCROLLBAR STYLING (Thin, Dark)
   ------------------------------------------------------------ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.10) transparent;
}

/* ------------------------------------------------------------
   3. LOGIN PAGE
   ------------------------------------------------------------ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-deep) 0%, #0f1535 50%, var(--bg-surface) 100%);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 20%, rgba(99, 102, 241, 0.06) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(59, 130, 246, 0.04) 0%, transparent 60%);
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl) var(--space-xl);
  box-shadow: var(--shadow-lg), var(--shadow-glow-primary);
  position: relative;
  z-index: 1;
}

.login-card__logo {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.login-card__logo img {
  height: 48px;
  display: inline-block;
}

.login-card__logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: var(--space-md);
  background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-card__subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: var(--space-xl);
}

.login-card .form-group {
  margin-bottom: var(--space-lg);
}

.login-card .form-label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  margin-bottom: var(--space-sm);
}

.login-card .form-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.login-card .form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.login-card .form-input::placeholder {
  color: var(--text-muted);
}

.login-card .btn-primary {
  width: 100%;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.login-card .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--primary-glow);
}

.login-card .btn-primary:active {
  transform: translateY(0);
}

.login-card__footer {
  text-align: center;
  margin-top: var(--space-lg);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.login-card__footer a {
  color: var(--primary);
  font-weight: 500;
}

.login-card__divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-lg) 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.login-card__divider::before,
.login-card__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.login-card .remember-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.login-card .remember-row label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
}

.login-card .remember-row input[type="checkbox"] {
  accent-color: var(--primary);
}

.login-card .forgot-link {
  font-size: 0.8125rem;
  color: var(--primary);
}

/* ------------------------------------------------------------
   4. APP SHELL LAYOUT (Sidebar + Content)
   ------------------------------------------------------------ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-base);
  overflow-y: auto;
  overflow-x: hidden;
}

.app-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin var(--transition-base);
}

.app-main {
  flex: 1;
  padding: var(--space-xl);
  padding-top: calc(var(--header-height) + var(--space-xl));
}

/* ------------------------------------------------------------
   5. SIDEBAR STYLES
   ------------------------------------------------------------ */
.sidebar-header {
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  border-bottom: 1px solid var(--sidebar-border);
  min-height: var(--header-height);
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.125rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-brand {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.sidebar-brand span {
  color: var(--primary);
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-md) var(--space-sm);
}

.sidebar-section {
  margin-bottom: var(--space-md);
}

.sidebar-section__title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-xs);
}

.sidebar-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  position: relative;
}

.sidebar-menu-item:hover {
  background: var(--glass-bg);
  color: var(--text-primary);
}

.sidebar-menu-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

.sidebar-menu-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.sidebar-menu-item .menu-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.125rem;
}

.sidebar-menu-item .menu-icon svg {
  width: 20px;
  height: 20px;
}

.sidebar-menu-item .menu-badge {
  margin-left: auto;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
}

.sidebar-menu-item .menu-badge.danger {
  background: var(--danger-light);
  color: var(--danger);
}

.sidebar-menu-item .menu-badge.success {
  background: var(--success-light);
  color: var(--success);
}

.sidebar-menu-item .chevron {
  margin-left: auto;
  transition: transform var(--transition-fast);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sidebar-menu-item .chevron.open {
  transform: rotate(90deg);
}

.sidebar-submenu {
  padding-left: var(--space-xl);
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-base);
}

.sidebar-submenu.open {
  max-height: 500px;
}

.sidebar-submenu .sidebar-menu-item {
  padding: 8px 16px;
  font-size: 0.8125rem;
}

.sidebar-footer {
  padding: var(--space-md) var(--space-sm);
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-footer .sidebar-menu-item {
  padding: 10px 16px;
}

/* ------------------------------------------------------------
   6. TOP HEADER BAR
   ------------------------------------------------------------ */
.app-header {
  position: fixed;
  top: 0;
  right: 0;
  left: var(--sidebar-width);
  height: var(--header-height);
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-xl);
  transition: left var(--transition-base);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-left .sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.header-left .sidebar-toggle:hover {
  color: var(--text-primary);
  background: var(--glass-bg);
}

.header-search {
  position: relative;
  width: 320px;
}

.header-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.875rem;
  pointer-events: none;
}

.header-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.header-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.header-search input::placeholder {
  color: var(--text-muted);
}

.header-search .shortcut-hint {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.6875rem;
  color: var(--text-muted);
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  pointer-events: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-action-btn {
  position: relative;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 1.125rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.header-action-btn:hover {
  background: var(--glass-bg);
  border-color: var(--glass-border);
  color: var(--text-primary);
}

.header-action-btn .notification-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--bg-dark);
}

.header-action-btn .notification-dot.warning {
  background: var(--warning);
}

.header-action-btn .notification-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-dark);
}

.header-divider {
  width: 1px;
  height: 28px;
  background: var(--border-color);
  margin: 0 var(--space-sm);
}

.header-user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
}

.header-user:hover {
  background: var(--glass-bg);
}

.header-user .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.header-user .avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.header-user .user-info {
  display: flex;
  flex-direction: column;
}

.header-user .user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.header-user .user-role {
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.2;
}

/* Status indicator */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.status-indicator .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: relative;
}

.status-indicator .status-dot.online {
  background: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.status-indicator .status-dot.offline {
  background: var(--text-muted);
}

.status-indicator .status-dot.warning {
  background: var(--warning);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.status-indicator .status-dot.error {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

.status-indicator .status-dot.pulse::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  animation: status-pulse 2s infinite;
}

.status-indicator .status-dot.pulse.online::after {
  background: rgba(34, 197, 94, 0.3);
}

.status-indicator .status-dot.pulse.error::after {
  background: rgba(239, 68, 68, 0.3);
}

@keyframes status-pulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* ---- Notification Dropdown ---- */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  overflow: hidden;
  display: none;
}
.notif-dropdown.open { display: block; }
.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
}
.notif-dropdown-header h4 { font-size: 0.875rem; font-weight: 600; }
.notif-dropdown-header button { background: none; border: none; color: var(--primary); font-size: 0.75rem; cursor: pointer; }
.notif-dropdown-body { overflow-y: auto; max-height: 340px; }
.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: var(--primary-light); }
.notif-item-icon {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8125rem;
}
.notif-item-content { flex: 1; min-width: 0; }
.notif-item-title { font-size: 0.8125rem; font-weight: 500; color: var(--text-primary); }
.notif-item-desc { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }
.notif-item-time { font-size: 0.6875rem; color: var(--text-muted); margin-top: 4px; }
.notif-dropdown-footer {
  padding: 10px 18px;
  text-align: center;
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ---- Empty State ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}
.empty-state-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.empty-state h3 { font-size: 1.125rem; font-weight: 600; margin-bottom: 8px; }
.empty-state p { font-size: 0.875rem; color: var(--text-secondary); max-width: 360px; margin-bottom: 20px; line-height: 1.6; }

/* ---- 404 Page ---- */
.page-404 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 40px 20px;
}
.page-404-code {
  font-size: 6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 16px;
}
.page-404 h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 8px; }
.page-404 p { font-size: 0.9375rem; color: var(--text-secondary); max-width: 400px; margin-bottom: 28px; line-height: 1.6; }

/* ---- Forgot Password Page ---- */
.forgot-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-deep) 0%, #0f1535 50%, var(--bg-surface) 100%);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
}
.forgot-card {
  width: 100%;
  max-width: 420px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl) var(--space-xl);
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}
.forgot-card h2 { font-size: 1.375rem; font-weight: 700; margin-bottom: 8px; text-align: center; }
.forgot-card p.subtitle { font-size: 0.875rem; color: var(--text-secondary); text-align: center; margin-bottom: 24px; }
.forgot-card .form-group { margin-bottom: 16px; }
.forgot-card .back-link { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 20px; font-size: 0.8125rem; color: var(--primary); cursor: pointer; background: none; border: none; width: 100%; font-family: inherit; }

/* ---- Form Validation ---- */
.form-input.error,
.form-select.error {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px var(--danger-light) !important;
}
.form-input.success,
.form-select.success {
  border-color: var(--success) !important;
  box-shadow: 0 0 0 3px var(--success-light) !important;
}
.form-error-text {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}
.form-error-text.visible { display: flex; align-items: center; gap: 4px; }
.form-help { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* ------------------------------------------------------------
   7. STAT CARDS (Glassmorphism)
   ------------------------------------------------------------ */
.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.stat-card:hover {
  background: var(--glass-hover-bg);
  border-color: var(--glass-hover-border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card.primary::before { background: linear-gradient(90deg, var(--primary), #818cf8); }
.stat-card.success::before { background: linear-gradient(90deg, var(--success), #4ade80); }
.stat-card.warning::before { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.stat-card.danger::before { background: linear-gradient(90deg, var(--danger), #f87171); }
.stat-card.info::before { background: linear-gradient(90deg, var(--info), #60a5fa); }

.stat-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.stat-card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.stat-card.primary .stat-card__icon {
  background: var(--primary-light);
  color: var(--primary);
}

.stat-card.success .stat-card__icon {
  background: var(--success-light);
  color: var(--success);
}

.stat-card.warning .stat-card__icon {
  background: var(--warning-light);
  color: var(--warning);
}

.stat-card.danger .stat-card__icon {
  background: var(--danger-light);
  color: var(--danger);
}

.stat-card.info .stat-card__icon {
  background: var(--info-light);
  color: var(--info);
}

.stat-card__label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: var(--space-xs);
}

.stat-card__value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-card__trend {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: var(--space-sm);
}

.stat-card__trend.up {
  color: var(--success);
}

.stat-card__trend.down {
  color: var(--danger);
}

.stat-card__trend.neutral {
  color: var(--text-muted);
}

.stat-card__footer {
  margin-top: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  padding-top: var(--space-md);
}

/* Mini stat card */
.stat-card-mini {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  text-align: center;
  transition: all var(--transition-fast);
}

.stat-card-mini:hover {
  border-color: var(--glass-hover-border);
  background: var(--glass-hover-bg);
}

.stat-card-mini__value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-card-mini__label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* ------------------------------------------------------------
   8. DASHBOARD GRID
   ------------------------------------------------------------ */
.dashboard-grid {
  display: grid;
  gap: var(--space-lg);
}

.dashboard-grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.dashboard-grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.dashboard-grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.dashboard-grid-cols-2-1 {
  grid-template-columns: 2fr 1fr;
}

.dashboard-grid-cols-1-2 {
  grid-template-columns: 1fr 2fr;
}

.dashboard-grid-cols-3-1 {
  grid-template-columns: 3fr 1fr;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.section-header__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.section-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ------------------------------------------------------------
   9. TABLES
   ------------------------------------------------------------ */
.table-container {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-container .table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-color);
}

.table-container .table-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.table-container .table-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-align: left;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.035);
}

tbody td {
  padding: 14px 16px;
  font-size: 0.875rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  justify-content: flex-end;
}

/* ------------------------------------------------------------
   10. CARDS (App Cards, Grid Layout)
   ------------------------------------------------------------ */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base);
  overflow: hidden;
}

.card:hover {
  background: var(--glass-hover-bg);
  border-color: var(--glass-hover-border);
  box-shadow: var(--shadow-md);
}

.card__header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card__header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.card__body {
  padding: var(--space-lg);
}

.card__footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
}

/* ------------------------------------------------------------
   11. FORM ELEMENTS
   ------------------------------------------------------------ */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-help {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
  outline: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-light);
}

.form-input.success,
.form-select.success,
.form-textarea.success {
  border-color: var(--success);
  box-shadow: 0 0 0 3px var(--success-light);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-select option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
}

/* Checkbox / Toggle */
.form-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.form-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  user-select: none;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle__slider {
  position: relative;
  width: 44px;
  height: 24px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.toggle__slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.toggle input:checked + .toggle__slider {
  background: var(--primary);
}

.toggle input:checked + .toggle__slider::after {
  left: 23px;
  background: #fff;
}

.toggle input:focus-visible + .toggle__slider {
  box-shadow: 0 0 0 3px var(--primary-light);
}

.toggle__label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #fff;
  border-color: transparent;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--glass-hover-border);
}

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: transparent;
}

.btn-success:hover {
  background: #16a34a;
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
}

.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.btn-warning {
  background: var(--warning);
  color: #fff;
  border-color: transparent;
}

.btn-warning:hover {
  background: #d97706;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

.btn-info {
  background: var(--info);
  color: #fff;
  border-color: transparent;
}

.btn-info:hover {
  background: #2563eb;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--glass-bg);
  color: var(--text-primary);
}

.btn-link {
  background: transparent;
  color: var(--primary);
  border-color: transparent;
  padding: 0;
}

.btn-link:hover {
  color: var(--primary-hover);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon.btn-sm {
  width: 32px;
  height: 32px;
}

.btn-icon.btn-lg {
  width: 46px;
  height: 46px;
}

.btn-group {
  display: inline-flex;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.btn-group .btn {
  border-radius: 0;
  border: none;
  border-right: 1px solid var(--border-color);
}

.btn-group .btn:last-child {
  border-right: none;
}

.btn-group .btn.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* ------------------------------------------------------------
   12. BADGES & STATUS INDICATORS
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 3px 10px;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
  line-height: 1.4;
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.badge-info {
  background: var(--info-light);
  color: var(--info);
}

.badge-neutral {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.badge-dot.badge-primary { background: var(--primary); }
.badge-dot.badge-success { background: var(--success); }
.badge-dot.badge-warning { background: var(--warning); }
.badge-dot.badge-danger { background: var(--danger); }
.badge-dot.badge-info { background: var(--info); }
.badge-dot.badge-neutral { background: var(--text-muted); }

.badge-outline {
  background: transparent;
  border: 1px solid;
}

.badge-outline.badge-primary {
  border-color: rgba(99, 102, 241, 0.3);
  color: var(--primary);
}

.badge-outline.badge-success {
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--success);
}

.badge-outline.badge-warning {
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--warning);
}

.badge-outline.badge-danger {
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

/* Status pills for deployment states */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
}

.status-pill.running {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.status-pill.stopped {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-muted);
}

.status-pill.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.status-pill.deploying {
  background: rgba(59, 130, 246, 0.1);
  color: var(--info);
}

.status-pill.pending {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.status-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-pill.running .dot { background: var(--success); }
.status-pill.stopped .dot { background: var(--text-muted); }
.status-pill.error .dot { background: var(--danger); }
.status-pill.deploying .dot { background: var(--info); animation: pulse 1.5s infinite; }
.status-pill.pending .dot { background: var(--warning); }

/* ------------------------------------------------------------
   13. MODAL DIALOGS (Glassmorphism)
   ------------------------------------------------------------ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal-backdrop);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-base);
}

.modal.show .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-header .modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.modal-header .modal-close:hover {
  background: var(--glass-bg);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* Modal sizes */
.modal-sm .modal-content {
  max-width: 400px;
}

.modal-lg .modal-content {
  max-width: 720px;
}

.modal-xl .modal-content {
  max-width: 960px;
}

.modal-full .modal-content {
  max-width: calc(100vw - 64px);
  max-height: calc(100vh - 64px);
}

/* Confirm dialog */
.modal-confirm .modal-content {
  text-align: center;
}

.modal-confirm .modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto var(--space-lg);
}

.modal-confirm .modal-icon.danger {
  background: var(--danger-light);
  color: var(--danger);
}

.modal-confirm .modal-icon.warning {
  background: var(--warning-light);
  color: var(--warning);
}

.modal-confirm .modal-icon.info {
  background: var(--info-light);
  color: var(--info);
}

/* ------------------------------------------------------------
   14. TOAST NOTIFICATIONS
   ------------------------------------------------------------ */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-width: 400px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: toast-slide-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 320px;
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

.toast.success::before { background: var(--success); }
.toast.error::before { background: var(--danger); }
.toast.warning::before { background: var(--warning); }
.toast.info::before { background: var(--info); }

.toast.toast-leaving {
  animation: toast-slide-out 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast__icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast.success .toast__icon { background: var(--success-light); color: var(--success); }
.toast.error .toast__icon { background: var(--danger-light); color: var(--danger); }
.toast.warning .toast__icon { background: var(--warning-light); color: var(--warning); }
.toast.info .toast__icon { background: var(--info-light); color: var(--info); }

.toast__body {
  flex: 1;
  min-width: 0;
}

.toast__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.toast__message {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.toast__close {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.toast__close:hover {
  background: var(--glass-bg);
  color: var(--text-primary);
}

/* Toast progress bar */
.toast__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  animation: toast-progress 4s linear forwards;
}

.toast.success .toast__progress { background: var(--success); }
.toast.error .toast__progress { background: var(--danger); }
.toast.warning .toast__progress { background: var(--warning); }
.toast.info .toast__progress { background: var(--info); }

@keyframes toast-slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toast-slide-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

@keyframes toast-progress {
  from { width: 100%; }
  to { width: 0%; }
}

/* ------------------------------------------------------------
   15. LOG VIEWER (Terminal Style)
   ------------------------------------------------------------ */
.log-viewer {
  background: #0a0e1a;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-family: var(--font-mono);
}

.log-viewer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.log-viewer__title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: var(--font-sans);
}

.log-viewer__title .dot-group {
  display: flex;
  gap: 6px;
}

.log-viewer__title .dot-group span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.log-viewer__title .dot-group .red { background: #ff5f56; }
.log-viewer__title .dot-group .yellow { background: #ffbd2e; }
.log-viewer__title .dot-group .green { background: #27c93f; }

.log-viewer__actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.log-viewer__actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
}

.log-viewer__actions button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.log-viewer__body {
  padding: var(--space-md);
  max-height: 480px;
  overflow-y: auto;
  font-size: 0.8125rem;
  line-height: 1.7;
  color: #a8d8a8;
}

.log-viewer__body .log-line {
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 1.4em;
}

.log-viewer__body .log-line:hover {
  background: rgba(255, 255, 255, 0.03);
}

.log-viewer__body .log-line .timestamp {
  color: var(--text-muted);
  margin-right: var(--space-sm);
}

.log-viewer__body .log-line .level-info {
  color: #60a5fa;
}

.log-viewer__body .log-line .level-warn {
  color: var(--warning);
}

.log-viewer__body .log-line .level-error {
  color: var(--danger);
}

.log-viewer__body .log-line .level-debug {
  color: var(--text-muted);
}

.log-viewer__body .log-line .level-success {
  color: var(--success);
}

.log-viewer--fullscreen {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  border-radius: 0;
}

.log-viewer--fullscreen .log-viewer__body {
  max-height: calc(100vh - 100px);
}

/* Terminal alternative (darker, green-on-black) */
.terminal {
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  padding: var(--space-md);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: #22c55e;
  overflow-x: auto;
}

.terminal .prompt {
  color: var(--primary);
}

.terminal .output {
  color: #a8d8a8;
}

.terminal .error {
  color: var(--danger);
}

/* ------------------------------------------------------------
   16. TABS
   ------------------------------------------------------------ */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tabs::-webkit-scrollbar {
  height: 0;
}



/* ------------------------------------------------------------
   17. DROPDOWN MENUS
   ------------------------------------------------------------ */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-sm);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: all var(--transition-fast);
  z-index: var(--z-dropdown);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-sans);
}

.dropdown-item:hover {
  background: var(--glass-bg);
  color: var(--text-primary);
}

.dropdown-item.danger {
  color: var(--danger);
}

.dropdown-item.danger:hover {
  background: var(--danger-light);
}

.dropdown-item .dropdown-icon {
  width: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9375rem;
  flex-shrink: 0;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: var(--space-xs) 0;
}

.dropdown-header {
  padding: 8px 12px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* ------------------------------------------------------------
   18. PAGINATION
   ------------------------------------------------------------ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-lg) 0;
}

.pagination__item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.pagination__item:hover {
  background: var(--glass-bg);
  border-color: var(--glass-border);
  color: var(--text-primary);
}

.pagination__item.active {
  background: var(--primary-light);
  border-color: transparent;
  color: var(--primary);
  font-weight: 600;
}

.pagination__item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.pagination__ellipsis {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  color: var(--text-muted);
  font-size: 0.8125rem;
  user-select: none;
}

.pagination__info {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0 var(--space-md);
}

/* ------------------------------------------------------------
   19. RESPONSIVE (Mobile sidebar collapses, bottom nav)
   ------------------------------------------------------------ */

/* Bottom navigation (mobile) */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--bg-dark);
  border-top: 1px solid var(--border-color);
  z-index: var(--z-sidebar);
  padding: 0 var(--space-sm);
  align-items: center;
  justify-content: space-around;
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-xs) var(--space-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.625rem;
  font-weight: 500;
  transition: color var(--transition-fast);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-sans);
}

.bottom-nav__item .bottom-nav__icon {
  font-size: 1.25rem;
  line-height: 1;
}

.bottom-nav__item.active {
  color: var(--primary);
}

.bottom-nav__item:hover {
  color: var(--text-secondary);
}

/* Tablet: 768px-1024px */
@media (max-width: 1024px) {
  .dashboard-grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid-cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid-cols-2-1,
  .dashboard-grid-cols-1-2,
  .dashboard-grid-cols-3-1 {
    grid-template-columns: 1fr;
  }

  .header-search {
    width: 240px;
  }
}

/* Mobile: <768px */
@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  /* Sidebar overlay */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-sidebar) - 1);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .app-content {
    margin-left: 0;
  }

  .app-header {
    left: 0;
  }

  .header-left .sidebar-toggle {
    display: flex;
  }

  .header-search {
    width: 180px;
  }

  .header-search .shortcut-hint {
    display: none;
  }

  .app-main {
    padding: var(--space-md);
    padding-top: calc(var(--header-height) + var(--space-md));
    padding-bottom: calc(64px + var(--space-md)); /* room for bottom nav */
  }

  .dashboard-grid-cols-2,
  .dashboard-grid-cols-3,
  .dashboard-grid-cols-4 {
    grid-template-columns: 1fr;
  }

  .bottom-nav {
    display: flex;
  }

  .stat-card__value {
    font-size: 1.375rem;
  }

  .apps-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: var(--space-md);
    align-items: flex-end;
  }

  .modal-content {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 90vh;
  }

  .toast-container {
    left: var(--space-md);
    right: var(--space-md);
    max-width: none;
  }

  .toast {
    min-width: 0;
  }

  .table-container {
    border-radius: var(--radius-md);
  }

  .table-container .table-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .pagination__item {
    min-width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }

  .pagination__info {
    display: none;
  }

  .tabs {
    gap: 0;
  }

  .tab-item {
    padding: 10px 14px;
    font-size: 0.8125rem;
  }

  .header-right .header-divider {
    display: none;
  }

  .header-user .user-info {
    display: none;
  }
}

/* Small mobile: <480px */
@media (max-width: 480px) {
  .header-search {
    width: 140px;
  }

  .header-search input {
    font-size: 0.75rem;
  }

  .header-right .header-action-btn:nth-child(2) {
    display: none;
  }

  .login-card {
    padding: var(--space-xl) var(--space-lg);
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .stat-card {
    padding: var(--space-md);
  }

  .card__body,
  .card__header,
  .card__footer {
    padding: var(--space-md);
  }
}

/* ------------------------------------------------------------
   20. ANIMATIONS
   ------------------------------------------------------------ */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in-down {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in-left {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fade-in-right {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes slide-down {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes ping {
  0% { transform: scale(1); opacity: 1; }
  75% { transform: scale(2); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Animation utility classes */
.animate-fade-in {
  animation: fade-in var(--transition-base) ease forwards;
}

.animate-fade-in-up {
  animation: fade-in-up var(--transition-base) ease forwards;
}

.animate-fade-in-down {
  animation: fade-in-down var(--transition-base) ease forwards;
}

.animate-scale-in {
  animation: scale-in var(--transition-base) ease forwards;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

/* Staggered animations */
.stagger-children > * {
  opacity: 0;
  animation: fade-in-up 0.4s ease forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 60ms; }
.stagger-children > *:nth-child(3) { animation-delay: 120ms; }
.stagger-children > *:nth-child(4) { animation-delay: 180ms; }
.stagger-children > *:nth-child(5) { animation-delay: 240ms; }
.stagger-children > *:nth-child(6) { animation-delay: 300ms; }
.stagger-children > *:nth-child(7) { animation-delay: 360ms; }
.stagger-children > *:nth-child(8) { animation-delay: 420ms; }
.stagger-children > *:nth-child(9) { animation-delay: 480ms; }
.stagger-children > *:nth-child(10) { animation-delay: 540ms; }

/* ------------------------------------------------------------
   21. PROGRESS BARS
   ------------------------------------------------------------ */
.progress {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-bar.primary { background: linear-gradient(90deg, var(--primary), #818cf8); }
.progress-bar.success { background: linear-gradient(90deg, var(--success), #4ade80); }
.progress-bar.warning { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.progress-bar.danger { background: linear-gradient(90deg, var(--danger), #f87171); }
.progress-bar.info { background: linear-gradient(90deg, var(--info), #60a5fa); }

.progress-bar.striped {
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.1) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.1) 75%,
    transparent 75%,
    transparent
  );
  background-size: 20px 20px;
}

.progress-bar.animated {
  animation: progress-stripes 1s linear infinite;
}

@keyframes progress-stripes {
  0% { background-position: 0 0; }
  100% { background-position: 40px 0; }
}

.progress-indeterminate {
  position: relative;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-indeterminate::after {
  content: '';
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  border-radius: var(--radius-full);
  animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
  0% { left: -40%; }
  100% { left: 100%; }
}

.progress-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.progress-label .progress-value {
  font-weight: 600;
  color: var(--text-primary);
}

/* ------------------------------------------------------------
   22. CHARTS & STAT NUMBERS
   ------------------------------------------------------------ */
.chart-container {
  position: relative;
  width: 100%;
  padding: var(--space-md) 0;
}

.chart-container canvas {
  max-width: 100%;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-top: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

.chart-legend__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.chart-legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* Big stat number in hero position */
.stat-hero {
  text-align: center;
  padding: var(--space-xl) 0;
}

.stat-hero__value {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.stat-hero__label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: var(--space-sm);
}

.stat-hero__change {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
  font-size: 0.8125rem;
  font-weight: 600;
}

.stat-hero__change.up { color: var(--success); }
.stat-hero__change.down { color: var(--danger); }

/* Simple bar chart / sparkline replacement */
.sparkline-bar {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 48px;
}

.sparkline-bar__item {
  flex: 1;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  transition: height var(--transition-base);
  opacity: 0.5;
}

.sparkline-bar__item:nth-child(even) {
  background: var(--primary-hover);
}

.sparkline-bar__item:hover {
  opacity: 1;
}

/* Metric row */
.metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-md);
}

.metric-item {
  text-align: center;
  padding: var(--space-md);
}

.metric-item__value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-item__label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.metric-item__trend {
  font-size: 0.6875rem;
  font-weight: 600;
  margin-top: var(--space-xs);
}

.metric-item__trend.up { color: var(--success); }
.metric-item__trend.down { color: var(--danger); }

/* ------------------------------------------------------------
   23. DANGER ZONE AREA
   ------------------------------------------------------------ */
.danger-zone {
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  position: relative;
  background: rgba(239, 68, 68, 0.03);
}

.danger-zone::before {
  content: 'Danger Zone';
  position: absolute;
  top: -10px;
  left: var(--space-lg);
  background: var(--bg-surface);
  padding: 0 var(--space-sm);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--danger);
}

.danger-zone__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--danger);
  margin-bottom: var(--space-sm);
}

.danger-zone__description {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.danger-zone .btn-danger {
  box-shadow: var(--shadow-glow-danger);
}

.danger-zone--subtle {
  border-color: var(--border-color);
  background: transparent;
}

.danger-zone--subtle::before {
  display: none;
}

/* ------------------------------------------------------------
   24. CODE BLOCKS
   ------------------------------------------------------------ */
code {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  color: var(--primary);
}

pre {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  background: #0a0e1a;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  overflow-x: auto;
  color: #e2e8f0;
  position: relative;
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

pre .token.comment { color: #6b7280; }
pre .token.string { color: #22c55e; }
pre .token.number { color: #f59e0b; }
pre .token.keyword { color: #818cf8; }
pre .token.function { color: #60a5fa; }
pre .token.operator { color: #f472b6; }
pre .token.tag { color: #f87171; }
pre .token.attr-name { color: #fbbf24; }

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.code-header + pre {
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.code-header .copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
}

.code-header .copy-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

/* Inline code in docs */
code-block {
  display: block;
  margin: var(--space-md) 0;
}

/* ------------------------------------------------------------
   25. LOADING SPINNER
   ------------------------------------------------------------ */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

.spinner-primary {
  border-top-color: var(--primary);
}

.spinner-success {
  border-top-color: var(--success);
}

.spinner-warning {
  border-top-color: var(--warning);
}

.spinner-danger {
  border-top-color: var(--danger);
}

.spinner-white {
  border-color: rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
}

/* Full-page spinner overlay */
.spinner-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 26, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  gap: var(--space-lg);
}

.spinner-overlay__text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Inline loading state */
.loading-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: loading-dots 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0.32s; }

@keyframes loading-dots {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 25%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(255, 255, 255, 0.03) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: var(--space-sm);
  width: 100%;
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-title {
  height: 20px;
  width: 40%;
  margin-bottom: var(--space-md);
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius-lg);
}

/* ------------------------------------------------------------
   26. GLASSMORPHISM ACCENT PANELS
   ------------------------------------------------------------ */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-base);
}

.glass-panel:hover {
  background: var(--glass-hover-bg);
  border-color: var(--glass-hover-border);
}

.glass-panel--primary {
  background: rgba(99, 102, 241, 0.05);
  border-color: rgba(99, 102, 241, 0.12);
}

.glass-panel--primary:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: rgba(99, 102, 241, 0.18);
}

.glass-panel--success {
  background: rgba(34, 197, 94, 0.05);
  border-color: rgba(34, 197, 94, 0.12);
}

.glass-panel--success:hover {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.18);
}

.glass-panel--warning {
  background: rgba(245, 158, 11, 0.05);
  border-color: rgba(245, 158, 11, 0.12);
}

.glass-panel--warning:hover {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.18);
}

.glass-panel--danger {
  background: rgba(239, 68, 68, 0.05);
  border-color: rgba(239, 68, 68, 0.12);
}

.glass-panel--danger:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.18);
}

.glass-panel--info {
  background: rgba(59, 130, 246, 0.05);
  border-color: rgba(59, 130, 246, 0.12);
}

.glass-panel--info:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.18);
}

.glass-panel--glow {
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.05);
}

.glass-panel--glow-primary {
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.08);
}

.glass-panel--glow-success {
  box-shadow: 0 0 30px rgba(34, 197, 94, 0.08);
}

.glass-panel--glow-danger {
  box-shadow: 0 0 30px rgba(239, 68, 68, 0.08);
}

/* Glass accent bar (thin decorative element) */
.glass-accent {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.glass-accent__icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.glass-accent__icon.primary { background: var(--primary-light); color: var(--primary); }
.glass-accent__icon.success { background: var(--success-light); color: var(--success); }
.glass-accent__icon.warning { background: var(--warning-light); color: var(--warning); }
.glass-accent__icon.danger { background: var(--danger-light); color: var(--danger); }
.glass-accent__icon.info { background: var(--info-light); color: var(--info); }

/* ------------------------------------------------------------
   UTILITY CLASSES
   ------------------------------------------------------------ */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-info { color: var(--info) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }

.bg-primary-light { background: var(--primary-light) !important; }
.bg-success-light { background: var(--success-light) !important; }
.bg-warning-light { background: var(--warning-light) !important; }
.bg-danger-light { background: var(--danger-light) !important; }
.bg-info-light { background: var(--info-light) !important; }

.font-mono { font-family: var(--font-mono) !important; }
.font-sans { font-family: var(--font-sans) !important; }

.text-xs { font-size: 0.75rem !important; }
.text-sm { font-size: 0.8125rem !important; }
.text-base { font-size: 0.875rem !important; }
.text-lg { font-size: 1rem !important; }
.text-xl { font-size: 1.125rem !important; }
.text-2xl { font-size: 1.5rem !important; }

.font-normal { font-weight: 400 !important; }
.font-medium { font-weight: 500 !important; }
.font-semibold { font-weight: 600 !important; }
.font-bold { font-weight: 700 !important; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flex { display: flex !important; }
.flex-col { flex-direction: column !important; }
.items-center { align-items: center !important; }
.justify-center { justify-content: center !important; }
.justify-between { justify-content: space-between !important; }
.gap-xs { gap: var(--space-xs) !important; }
.gap-sm { gap: var(--space-sm) !important; }
.gap-md { gap: var(--space-md) !important; }
.gap-lg { gap: var(--space-lg) !important; }

.mt-sm { margin-top: var(--space-sm) !important; }
.mt-md { margin-top: var(--space-md) !important; }
.mt-lg { margin-top: var(--space-lg) !important; }
.mb-sm { margin-bottom: var(--space-sm) !important; }
.mb-md { margin-bottom: var(--space-md) !important; }
.mb-lg { margin-bottom: var(--space-lg) !important; }
.ml-auto { margin-left: auto !important; }

.p-sm { padding: var(--space-sm) !important; }
.p-md { padding: var(--space-md) !important; }
.p-lg { padding: var(--space-lg) !important; }

.w-full { width: 100% !important; }

.hidden { display: none !important; }

@media (max-width: 768px) {
  .hidden-mobile { display: none !important; }
}

@media (min-width: 769px) {
  .hidden-desktop { display: none !important; }
}

.rounded-sm { border-radius: var(--radius-sm) !important; }
.rounded-md { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-full { border-radius: var(--radius-full) !important; }

.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

.cursor-pointer { cursor: pointer !important; }
.select-none { user-select: none !important; }

.no-wrap { white-space: nowrap !important; }

.break-all { word-break: break-all !important; }

.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: var(--space-lg);
  opacity: 0.3;
  color: var(--text-muted);
}

.empty-state__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.empty-state__description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto var(--space-lg);
}

/* Selection color */
::selection {
  background: var(--primary-light);
  color: var(--text-primary);
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .app-sidebar,
  .app-header,
  .bottom-nav {
    display: none !important;
  }

  .app-content {
    margin-left: 0 !important;
  }

  .card,
  .glass-panel,
  .stat-card {
    border: 1px solid #ccc !important;
    background: #fff !important;
    color: #000 !important;
    backdrop-filter: none !important;
  }
}

/* ── Premium Applications Page ─────────────────────────────────────── */
.apps-page { padding: 24px; max-width: 1400px; margin: 0 auto; }
.apps-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:28px; flex-wrap:wrap; gap:16px; }
.apps-header-left { display:flex; align-items:center; gap:16px; }
.apps-header-icon { width:52px; height:52px; border-radius:14px; background:var(--primary-light); display:flex; align-items:center; justify-content:center; font-size:22px; color:var(--primary); border:1px solid var(--primary-light); }
.apps-header-title { font-size:26px; font-weight:700; color:var(--text-primary); letter-spacing:-0.3px; }
.apps-header-subtitle { font-size:13px; color:var(--text-muted); margin-top:2px; }
.apps-header-right { display:flex; align-items:center; gap:12px; }

/* Search */
.apps-search { position:relative; width:320px; max-width:100%; }
.apps-search-icon { position:absolute; left:14px; top:50%; transform:translateY(-50%); color:var(--text-muted); font-size:14px; pointer-events:none; }
.apps-search-input { width:100%; padding:10px 14px 10px 40px; border-radius:10px; border:1px solid var(--glass-border); background:var(--glass-bg); color:var(--text-primary); font-size:13px; outline:none; transition:all 0.2s; backdrop-filter:blur(8px); }
.apps-search-input:focus { border-color:var(--primary-glow); box-shadow:0 0 0 3px var(--primary-light); background:var(--glass-hover-bg); }
.apps-search-input::placeholder { color:var(--text-muted); }

/* Resource Cards */
.apps-resource-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; margin-bottom:28px; }
.apps-resource-card { background:var(--glass-bg); border-radius:14px; border:1px solid var(--glass-border); padding:20px; backdrop-filter:blur(12px); transition:all 0.25s; }
.apps-resource-card:hover { border-color:var(--primary-light); transform:translateY(-1px); box-shadow:0 8px 24px rgba(0,0,0,0.15); }
.apps-resource-top { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.apps-resource-left { display:flex; align-items:center; gap:10px; }
.apps-resource-icon { width:36px; height:36px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:15px; }
.apps-resource-icon.cpu { background:var(--primary-light); color:var(--primary); }
.apps-resource-icon.memory { background:rgba(168,85,247,0.15); color:#a78bfa; }
.apps-resource-icon.storage { background:rgba(34,197,94,0.15); color:#4ade80; }
.apps-resource-label { font-size:13px; font-weight:500; color:var(--text-secondary); }
.apps-resource-value { font-size:22px; font-weight:700; color:var(--text-primary); letter-spacing:-0.3px; }
.apps-resource-detail { font-size:12px; color:var(--text-muted); margin-top:4px; }
.apps-resource-progress { height:4px; background:var(--border-color); border-radius:4px; margin-top:14px; overflow:hidden; }
.apps-resource-progress-bar { height:100%; border-radius:4px; transition:width 0.6s ease; }
.apps-resource-progress-bar.cpu { background:linear-gradient(90deg,var(--primary),var(--primary-hover)); }
.apps-resource-progress-bar.memory { background:linear-gradient(90deg,#a855f7,#c084fc); }
.apps-resource-progress-bar.storage { background:linear-gradient(90deg,#22c55e,#4ade80); }

/* App Cards Grid */
.apps-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(360px,1fr)); gap:16px; margin-bottom:24px; }
.app-card { background:var(--glass-bg); border-radius:14px; border:1px solid var(--glass-border); padding:20px; backdrop-filter:blur(12px); transition:all 0.25s; }
.app-card:hover { border-color:var(--primary-light); transform:translateY(-2px); box-shadow:0 12px 32px rgba(0,0,0,0.2); }
.app-card-header { display:flex; align-items:flex-start; gap:14px; margin-bottom:16px; }
.app-card-avatar { width:42px; height:42px; border-radius:12px; background:var(--primary-light); display:flex; align-items:center; justify-content:center; font-size:14px; font-weight:700; color:var(--primary); border:1px solid var(--primary-light); flex-shrink:0; }
.app-card-info { flex:1; min-width:0; }
.app-card-name { font-size:15px; font-weight:600; color:var(--text-primary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.app-card-domain { font-size:12px; color:var(--text-muted); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.app-card-badge { display:inline-flex; align-items:center; gap:4px; padding:3px 10px; border-radius:9999px; font-size:11px; font-weight:600; flex-shrink:0; }
.app-card-badge.routed { background:var(--success-light); color:var(--success); }
.app-card-badge.pending { background:var(--warning-light); color:var(--warning); }
.app-card-badge.error { background:var(--danger-light); color:var(--danger); }
.app-card-badge.stopped { background:rgba(100,116,139,0.12); color:var(--text-muted); }

/* Meta Row */
.app-card-meta { display:flex; gap:16px; margin-bottom:16px; flex-wrap:wrap; }
.app-card-meta-item { display:flex; align-items:center; gap:5px; font-size:12px; color:var(--text-muted); }
.app-card-meta-item i { font-size:12px; width:14px; text-align:center; }
.app-card-meta-item span { color:var(--text-secondary); }

/* Action Buttons */
.app-card-actions { display:flex; gap:8px; flex-wrap:wrap; }
.app-card-actions .btn { padding:6px 14px; border-radius:8px; font-size:12px; font-weight:600; display:inline-flex; align-items:center; gap:6px; border:none; cursor:pointer; transition:all 0.2s; }
.app-card-actions .btn:disabled { opacity:0.5; cursor:not-allowed; }
.app-card-actions .btn-start { background:var(--success-light); color:var(--success); border:1px solid var(--success-light); }
.app-card-actions .btn-start:hover:not(:disabled) { background:rgba(34,197,94,0.2); }
.app-card-actions .btn-stop { background:var(--warning-light); color:var(--warning); border:1px solid var(--warning-light); }
.app-card-actions .btn-stop:hover:not(:disabled) { background:rgba(245,158,11,0.2); }
.app-card-actions .btn-redeploy { background:rgba(6,182,212,0.12); color:#22d3ee; border:1px solid rgba(6,182,212,0.2); }
.app-card-actions .btn-redeploy:hover:not(:disabled) { background:rgba(6,182,212,0.2); }
.app-card-actions .btn-delete { background:var(--danger-light); color:var(--danger); border:1px solid var(--danger-light); }
.app-card-actions .btn-delete:hover:not(:disabled) { background:rgba(239,68,68,0.25); }

/* Pagination */
.apps-pagination { display:flex; align-items:center; justify-content:space-between; padding:16px 0; flex-wrap:wrap; gap:12px; }
.apps-pagination-left { display:flex; align-items:center; gap:10px; font-size:13px; color:var(--text-muted); }
.apps-pagination-left select { padding:6px 10px; border-radius:8px; border:1px solid var(--glass-border); background:var(--glass-bg); color:var(--text-primary); font-size:13px; outline:none; cursor:pointer; }
.apps-pagination-controls { display:flex; align-items:center; gap:4px; }
.apps-pagination-controls button { min-width:34px; height:34px; border-radius:8px; border:1px solid var(--glass-border); background:var(--glass-bg); color:var(--text-secondary); font-size:13px; display:flex; align-items:center; justify-content:center; cursor:pointer; transition:all 0.2s; }
.apps-pagination-controls button:hover:not(:disabled) { border-color:var(--primary-light); color:var(--text-primary); }
.apps-pagination-controls button:disabled { opacity:0.4; cursor:not-allowed; }
.apps-pagination-controls button.active { background:var(--primary-light); border-color:var(--primary-light); color:var(--primary); font-weight:600; }

/* Empty & Error States */
.apps-empty-state, .apps-error-state { text-align:center; padding:80px 20px; }
.apps-empty-state-icon, .apps-error-state-icon { font-size:48px; margin-bottom:16px; opacity:0.5; }
.apps-empty-state h3, .apps-error-state h3 { font-size:18px; font-weight:600; color:var(--text-primary); margin-bottom:8px; }
.apps-empty-state p, .apps-error-state p { font-size:13px; color:var(--text-muted); max-width:400px; margin:0 auto 24px; }

/* Confirmation Modal Override */
.apps-modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.6); display:flex; align-items:center; justify-content:center; z-index:1000; backdrop-filter:blur(4px); }
.apps-modal { background:var(--bg-elevated); border-radius:16px; border:1px solid var(--glass-border); padding:28px; width:400px; max-width:90vw; backdrop-filter:blur(16px); }
.apps-modal h3 { font-size:17px; font-weight:600; color:var(--text-primary); margin-bottom:8px; }
.apps-modal p { font-size:13px; color:var(--text-secondary); margin-bottom:24px; }
.apps-modal-actions { display:flex; gap:10px; justify-content:flex-end; }
.apps-modal-actions button { padding:8px 20px; border-radius:8px; font-size:13px; font-weight:600; border:none; cursor:pointer; transition:all 0.2s; }
.apps-modal-cancel { background:var(--glass-bg); color:var(--text-secondary); }
.apps-modal-cancel:hover { background:var(--glass-hover-bg); }
.apps-modal-confirm { background:var(--danger-light); color:var(--danger); border:1px solid var(--danger-light); }
.apps-modal-confirm:hover { background:rgba(239,68,68,0.25); }

/* Loading skeleton for apps */
.apps-loading-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(360px,1fr)); gap:16px; }
.apps-loading-card { height:180px; border-radius:14px; background:var(--glass-bg); border:1px solid var(--glass-border); animation:pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:0.5} 50%{opacity:1} }

/* Responsive */
@media(max-width:1024px){.apps-resource-grid{grid-template-columns:repeat(3,1fr);gap:12px;}}
@media(max-width:768px){
  .apps-page{padding:16px;}
  .apps-header{flex-direction:column;align-items:stretch;}
  .apps-search{width:100%;}
  .apps-resource-grid{grid-template-columns:1fr;gap:12px;}
  .apps-grid{grid-template-columns:1fr;}
  .app-card-actions{flex-wrap:wrap;}
  .app-card-actions .btn{flex:1;justify-content:center;}
  .apps-pagination{flex-direction:column;align-items:stretch;text-align:center;}
  .apps-pagination-controls{justify-content:center;}
}

/* Pagination info text */
.apps-pagination-info { font-size:13px; color:var(--text-muted); margin-left:8px; }

/* Glow border effect on app cards */
.app-card:hover { border-color:var(--primary-light); transform:translateY(-2px); box-shadow:0 0 20px var(--primary-glow), 0 12px 32px rgba(0,0,0,0.2); }
.app-card:focus-within { border-color:var(--primary-glow); box-shadow:0 0 30px var(--primary-glow), 0 12px 32px rgba(0,0,0,0.2); }
.apps-resource-card:hover { border-color:var(--primary-light); transform:translateY(-1px); box-shadow:0 0 16px var(--primary-light), 0 8px 24px rgba(0,0,0,0.15); }

/* ---- Input Group ---- */
.input-group {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.input-group .form-input {
  flex: 1;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.input-group .btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  white-space: nowrap;
}
