/* ═══════════════════════════════════════════════════════════
   SSH Manager — iOS Ultra-Glass Theme
   Inspired by iOS 18 / visionOS glassmorphism
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Deep space background */
  --bg-void:        #050814;
  --bg-deep:        #070b14;
  --bg-space:       #0a0f1e;

  /* Ultra-light glass surfaces */
  --glass-00:       rgba(255, 255, 255, 0.03);
  --glass-01:       rgba(255, 255, 255, 0.05);
  --glass-02:       rgba(255, 255, 255, 0.07);
  --glass-03:       rgba(255, 255, 255, 0.09);
  --glass-04:       rgba(255, 255, 255, 0.12);

  /* Subtle luminous borders */
  --border-glass:   rgba(255, 255, 255, 0.07);
  --border-bright:  rgba(255, 255, 255, 0.12);
  --border-active: rgba(129, 140, 248, 0.4);

  /* iOS luminous text colors */
  --text-primary:  rgba(255, 255, 255, 0.95);
  --text-secondary:rgba(255, 255, 255, 0.65);
  --text-muted:    rgba(255, 255, 255, 0.35);
  --text-dim:      rgba(255, 255, 255, 0.22);

  /* iOS Signature Colors */
  --indigo:        #6366f1;
  --indigo-soft:   rgba(99, 102, 241, 0.2);
  --indigo-glow:   rgba(99, 102, 241, 0.35);
  --indigo-bright: #818cf8;

  --green:         #22c55e;
  --green-soft:    rgba(34, 197, 94, 0.2);
  --green-glow:    rgba(34, 197, 94, 0.4);

  --red:           #ef4444;
  --red-soft:      rgba(239, 68, 68, 0.2);
  --red-glow:      rgba(239, 68, 68, 0.4);

  --yellow:        #f59e0b;
  --yellow-soft:   rgba(245, 158, 11, 0.2);

  --blue:          #3b82f6;
  --blue-soft:     rgba(59, 130, 246, 0.2);

  --purple:        #a855f7;
  --purple-soft:   rgba(168, 85, 247, 0.2);

  /* iOS Radii */
  --r-xs:  6px;
  --r-sm:  9px;
  --r-md:  14px;
  --r-lg:  20px;
  --r-xl:  28px;
  --r-2xl: 36px;
  --r-full: 9999px;

  /* iOS Blur presets */
  --blur-xxs: blur(6px) saturate(140%);
  --blur-xs:  blur(10px) saturate(150%);
  --blur-sm:  blur(16px) saturate(160%);
  --blur-md:  blur(24px) saturate(180%);
  --blur-lg:  blur(40px) saturate(200%);

  /* Spatial */
  --sidebar-w: 272px;
  --topbar-h:  60px;

  /* Motion: iOS spring curves */
  --t-snap:   cubic-bezier(.33, 1, .68, 1);
  --t-spring: cubic-bezier(.34, 1.56, .64, 1);
  --t-smooth: cubic-bezier(.4, 0, .2, 1);
  --t-out:    cubic-bezier(0, 0, .2, 1);

  --dur-fast: 150ms;
  --dur-base: 250ms;
  --dur-slow: 400ms;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont,
               'SF Pro Display', 'SF Pro Text', 'Segoe UI', sans-serif;
  background: radial-gradient(ellipse 80% 60% at 50% -20%, #1a1f4e 0%, #0a0f1e 50%, #050814 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkitmoz-osx-font-smoothing: grayscale;
  overflow-x: auto; /* allow pinch-zoom */
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea, select { font-family: inherit; }
img, svg { display: block; }

/* ── App Layout ───────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100dvh;
  overflow: visible;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: rgba(10, 15, 30, 0.55);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border-right: 0.5px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0;
  height: 100dvh;
  z-index: 200;
  transition: transform var(--dur-base) var(--t-smooth),
              box-shadow var(--dur-base) var(--t-smooth);
  box-shadow: 2px 0 40px rgba(0,0,0,0.5);
}

/* Sidebar glass shine at top */
.sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255,255,255,0.12) 30%,
    rgba(255,255,255,0.08) 70%,
    transparent 100%
  );
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 0.5px solid var(--border-glass);
  flex-shrink: 0;
}

.sidebar-logo-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--indigo) 0%, var(--indigo-bright) 100%);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.1),
    0 4px 16px var(--indigo-glow),
    inset 0 1px 0 rgba(255,255,255,0.2);
  transition: box-shadow var(--dur-base) var(--t-smooth);
}

.sidebar-logo-icon:hover {
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.15),
    0 6px 24px var(--indigo-glow),
    inset 0 1px 0 rgba(255,255,255,0.25);
}

.sidebar-logo-icon svg { width: 22px; height: 22px; color: #fff; }

.sidebar-logo-title { font-size: .95rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; letter-spacing: -.01em; }
.sidebar-logo-sub   { font-size: .7rem; color: var(--text-muted); margin-top: 2px; font-weight: 500; }

.sidebar-nav {
  flex: 1;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-radius: var(--r-md);
  color: var(--text-secondary);
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--dur-base) var(--t-smooth);
  position: relative;
  overflow: hidden;
}

/* iOS nav hover fill */
.nav-link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--glass-02);
  border-radius: var(--r-md);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--t-out);
}
.nav-link:hover::before { opacity: 1; }
.nav-link:hover { color: var(--text-primary); }

.nav-link svg {
  width: 20px; height: 20px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: transform var(--dur-base) var(--t-spring);
}
.nav-link:hover svg { transform: scale(1.1); }

/* Active nav: iOS pill style */
.nav-link.active {
  background: var(--glass-02);
  color: #fff;
}
.nav-link.active::before { display: none; }
.nav-link.active::after {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 24px;
  background: linear-gradient(180deg, var(--indigo) 0%, var(--indigo-bright) 100%);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 12px var(--indigo-glow);
}

.sidebar-footer {
  padding: 16px;
  border-top: 0.5px solid var(--border-glass);
  font-size: .7rem;
  color: var(--text-dim);
  text-align: center;
  flex-shrink: 0;
  letter-spacing: .02em;
}

/* ── Sidebar Overlay ───────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 20, 0.7);
  backdrop-filter: var(--blur-xxs);
  -webkit-backdrop-filter: var(--blur-xxs);
  z-index: 190;
}

/* ── Main Area ─────────────────────────────────────────────── */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  margin-left: var(--sidebar-w);
  overflow: visible;
  min-width: 0;
  transition: margin-left var(--dur-base) var(--t-smooth);
}

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: rgba(10, 15, 30, 0.4);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  border-bottom: 0.5px solid var(--border-glass);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

/* Topbar subtle top shine */
.topbar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 0.5px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255,255,255,0.08) 50%,
    transparent 100%
  );
}

.topbar-menu-btn {
  display: none;
  background: var(--glass-01);
  border: 0.5px solid var(--border-glass);
  color: var(--text-secondary);
  padding: 8px;
  border-radius: var(--r-sm);
  transition: all var(--dur-fast) var(--t-out);
}
.topbar-menu-btn:hover {
  background: var(--glass-02);
  color: var(--text-primary);
  border-color: var(--border-bright);
}
.topbar-menu-btn:active { transform: scale(.94); }
.topbar-menu-btn svg { width: 22px; height: 22px; }

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  letter-spacing: -.02em;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: var(--r-full);
  background: var(--green);
  box-shadow: 0 0 10px var(--green-glow), 0 0 4px var(--green);
  animation: pulse-glow 2.5s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .75; transform: scale(.88); }
}

/* ── Page Content ─────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 28px 24px;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  min-width: 0;
}

/* ── Cards (Glass) ────────────────────────────────────────── */
.card {
  background: var(--glass-01);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  border: 0.5px solid var(--border-glass);
  border-radius: var(--r-xl);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.45),
    0 2px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  width: 100%;
  overflow: visible;
  position: relative;
  transition: box-shadow var(--dur-base) var(--t-smooth),
              transform var(--dur-base) var(--t-smooth),
              border-color var(--dur-base) var(--t-smooth);
}

/* Card glass highlight */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 0.5px;
  background: linear-gradient(90deg,
    transparent,
    rgba(255,255,255,0.1) 30%,
    rgba(255,255,255,0.06) 70%,
    transparent
  );
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}

.card:hover {
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.5),
    0 4px 16px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  border-color: var(--border-bright);
}

.card-header {
  padding: 18px 22px;
  border-bottom: 0.5px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  backdrop-filter: var(--blur-xxs);
  -webkit-backdrop-filter: var(--blur-xxs);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}

.card-title {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .1em;
}

.card-body { padding: 22px; }

/* ── Stat Cards ────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--glass-01);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  border: 0.5px solid var(--border-glass);
  border-radius: var(--r-xl);
  padding: 22px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255,255,255,0.04);
  transition: all var(--dur-base) var(--t-spring);
  cursor: default;
  position: relative;
  overflow: hidden;
}

/* Stat card shimmer */
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent,
    rgba(255,255,255,0.03),
    transparent
  );
  transition: left .6s var(--t-smooth);
}
.stat-card:hover::after { left: 150%; }

.stat-card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow:
    0 20px 48px rgba(0,0,0,0.5),
    0 6px 20px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.06);
  border-color: var(--border-bright);
}

.stat-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.04em;
}

.stat-value.green  {
  color: var(--green);
  text-shadow: 0 0 30px var(--green-glow), 0 0 60px rgba(34,197,94,0.2);
}
.stat-value.red    {
  color: var(--red);
  text-shadow: 0 0 30px var(--red-glow), 0 0 60px rgba(239,68,68,0.2);
}
.stat-value.white  { color: var(--text-primary); }

/* ── Dashboard grid ────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  align-items: start;
}

/* ── Table ─────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
}

table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

thead th {
  text-align: left;
  padding: 11px 16px;
  font-size: .68rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .1em;
  border-bottom: 0.5px solid var(--border-glass);
  white-space: nowrap;
  background: rgba(0,0,0,0.15);
}

tbody tr {
  border-bottom: 0.5px solid rgba(255,255,255,0.03);
  transition: background var(--dur-fast) var(--t-out);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--glass-02); }

tbody td {
  padding: 13px 16px;
  color: var(--text-secondary);
  vertical-align: middle;
  white-space: nowrap;
}

tbody td:first-child { color: var(--text-primary); font-weight: 600; }

.table-empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-dim);
}

.table-empty svg {
  width: 48px; height: 48px;
  color: var(--text-dim);
  margin: 0 auto 14px;
  opacity: .5;
}

.table-empty p { font-weight: 500; margin-bottom: 4px; color: var(--text-muted); }
.table-empty span { font-size: .82rem; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: var(--r-full);
  font-size: .7rem;
  font-weight: 600;
  white-space: nowrap;
  border: 0.5px solid transparent;
  backdrop-filter: var(--blur-xxs);
  -webkit-backdrop-filter: var(--blur-xxs);
  transition: all var(--dur-fast) var(--t-out);
}

.badge-green  { background: var(--green-soft); color: var(--green); border-color: rgba(34,197,94,0.2); }
.badge-red    { background: var(--red-soft);    color: var(--red);   border-color: rgba(239,68,68,0.2); }
.badge-muted  { background: rgba(255,255,255,0.05); color: var(--text-muted); border-color: var(--border-glass); }
.badge-blue   { background: var(--blue-soft);   color: var(--blue);   border-color: rgba(59,130,246,0.2); }
.badge-purple { background: var(--purple-soft); color: var(--purple); border-color: rgba(168,85,247,0.2); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: var(--r-md);
  font-size: .875rem;
  font-weight: 600;
  border: 0.5px solid transparent;
  transition: all var(--dur-fast) var(--t-snap);
  white-space: nowrap;
  line-height: 1;
  position: relative;
  overflow: hidden;
}

/* iOS press effect */
.btn:active { transform: scale(.96); }

.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:disabled:active { transform: none; }

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 100%);
  opacity: 0;
  transition: opacity var(--dur-fast);
}
.btn:hover:not(:disabled)::before { opacity: 1; }

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--indigo-bright) 100%);
  color: #fff;
  border-color: rgba(255,255,255,0.12);
  box-shadow:
    0 4px 14px var(--indigo-glow),
    0 2px 6px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--indigo) 0%, #9195f9 100%);
  box-shadow:
    0 6px 24px var(--indigo-glow),
    0 3px 10px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.2);
  transform: translateY(-1px);
}

.btn-ghost {
  background: var(--glass-02);
  color: var(--text-secondary);
  border-color: var(--border-glass);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--glass-03);
  color: var(--text-primary);
  border-color: var(--border-bright);
}

.btn-danger {
  background: var(--red-soft);
  color: var(--red);
  border-color: rgba(239,68,68,0.2);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(239,68,68,0.3);
  color: #fff;
}

.btn-sm { padding: 7px 14px; font-size: .8rem; border-radius: var(--r-sm); }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label { font-size: .8rem; font-weight: 500; color: var(--text-secondary); }
.form-label span { color: var(--red); }

.form-input, .form-textarea {
  background: rgba(10, 15, 30, 0.5);
  border: 0.5px solid var(--border-glass);
  border-radius: var(--r-md);
  padding: 11px 15px;
  color: var(--text-primary);
  font-size: .875rem;
  width: 100%;
  transition: all var(--dur-fast) var(--t-out);
  outline: none;
  backdrop-filter: var(--blur-xxs);
  -webkit-backdrop-filter: var(--blur-xxs);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-dim); }
.form-input:focus, .form-textarea:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--indigo-soft), 0 0 20px rgba(99,102,241,0.1);
  background: rgba(99,102,241,0.04);
}

.form-textarea { resize: vertical; font-family: 'SF Mono', 'Fira Code', monospace; font-size: .8rem; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Auth Toggle ───────────────────────────────────────────── */
.auth-toggle {
  display: flex;
  border: 0.5px solid var(--border-glass);
  border-radius: var(--r-md);
  overflow: hidden;
  background: rgba(0,0,0,0.2);
}

.auth-toggle input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }

.auth-toggle-label {
  flex: 1;
  text-align: center;
  padding: 10px 14px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: all var(--dur-fast) var(--t-smooth);
  user-select: none;
  backdrop-filter: var(--blur-xxs);
}

.auth-toggle input[type="radio"]:checked + .auth-toggle-label {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--indigo-bright) 100%);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 20, 0.65);
  backdrop-filter: var(--blur-sm) saturate(150%);
  -webkit-backdrop-filter: var(--blur-sm) saturate(150%);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-base) var(--t-smooth),
              visibility var(--dur-base) var(--t-smooth);
}
.modal-backdrop.open { opacity: 1; visibility: visible; }

.modal {
  background: rgba(15, 22, 44, 0.8);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  border: 0.5px solid var(--border-bright);
  border-radius: var(--r-2xl);
  width: 100%;
  max-width: 540px;
  max-height: 88dvh;
  overflow-y: auto;
  box-shadow:
    0 32px 80px rgba(0,0,0,0.65),
    0 8px 32px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.06);
  transform: translateY(24px) scale(.96);
  transition: transform var(--dur-slow) var(--t-spring);
}
.modal-backdrop.open .modal { transform: translateY(0) scale(1); }

/* Modal top shine */
.modal::before {
  content: '';
  position: fixed;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 40%;
  height: 0.5px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 18px;
  border-bottom: 0.5px solid var(--border-glass);
  position: sticky;
  top: 0;
  background: rgba(15, 22, 44, 0.7);
  backdrop-filter: var(--blur-xs);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  z-index: 1;
}

.modal-title { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); letter-spacing: -.02em; }

.modal-close {
  background: var(--glass-01);
  border: 0.5px solid var(--border-glass);
  color: var(--text-muted);
  width: 30px; height: 30px;
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--dur-fast) var(--t-out);
}
.modal-close:hover {
  background: var(--glass-03);
  color: var(--text-primary);
  border-color: var(--border-bright);
}
.modal-close:active { transform: scale(.9); }
.modal-close svg { width: 16px; height: 16px; }

.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.modal-footer { display: flex; gap: 10px; padding: 0 22px 22px; }
.modal-footer .btn { flex: 1; }

/* ── Spinner ───────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { animation: spin .7s linear infinite; }

/* ── SweetAlert2 Glass ─────────────────────────────────────── */
.swal2-popup {
  background: rgba(15, 22, 44, 0.85) !important;
  backdrop-filter: var(--blur-lg) !important;
  -webkit-backdrop-filter: var(--blur-lg) !important;
  color: var(--text-primary) !important;
  border: 0.5px solid var(--border-bright) !important;
  border-radius: var(--r-2xl) !important;
  font-family: 'Inter', -apple-system, sans-serif !important;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6) !important;
}
.swal2-title   { color: var(--text-primary) !important; font-size: 1.1rem !important; font-weight: 700 !important; letter-spacing: -.02em; }
.swal2-html-container { color: var(--text-secondary) !important; font-size: .9rem !important; }
.swal2-confirm {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--indigo-bright) 100%) !important;
  border-radius: var(--r-md) !important;
  font-weight: 600 !important;
  font-size: .875rem !important;
  border: 0.5px solid rgba(255,255,255,0.12) !important;
  box-shadow: 0 4px 14px var(--indigo-glow) !important;
}
.swal2-confirm:hover { background: linear-gradient(135deg, var(--indigo) 0%, #9195f9 100%) !important; }
.swal2-cancel {
  background: var(--glass-02) !important;
  color: var(--text-secondary) !important;
  border: 0.5px solid var(--border-glass) !important;
  border-radius: var(--r-md) !important;
  font-weight: 600 !important;
  font-size: .875rem !important;
}
.swal2-cancel:hover { background: var(--glass-03) !important; color: var(--text-primary) !important; }
.swal2-timer-progress-bar {
  background: linear-gradient(90deg, var(--indigo), var(--indigo-bright)) !important;
  border-radius: var(--r-full) !important;
}
.swal2-icon.swal2-success { border-color: var(--green) !important; color: var(--green) !important; }
.swal2-icon.swal2-success [class^='swal2-success-line'] { background: var(--green) !important; }
.swal2-icon.swal2-success .swal2-success-ring { border-color: rgba(34,197,94,.3) !important; }
.swal2-icon.swal2-error { border-color: var(--red) !important; color: var(--red) !important; }
.swal2-icon.swal2-error [class^='swal2-x-mark-line'] { background: var(--red) !important; }
.swal2-icon.swal2-warning { border-color: var(--yellow) !important; color: var(--yellow) !important; }
.swal2-loader { border-color: var(--indigo) transparent var(--indigo) transparent !important; }

/* ── Wizard ────────────────────────────────────────────────── */
.wizard-steps { display: flex; align-items: center; gap: 0; margin-bottom: 24px; padding: 0 4px; }
.wizard-step { display: flex; align-items: center; gap: 8px; flex: 1; }
.wizard-step-num {
  width: 30px; height: 30px;
  border-radius: var(--r-full);
  background: var(--glass-01);
  border: 0.5px solid var(--border-glass);
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--dur-base) var(--t-smooth);
}
.wizard-step-label { font-size: .72rem; font-weight: 500; color: var(--text-muted); white-space: nowrap; transition: color var(--dur-fast); }
.wizard-step-line { flex: 1; height: 1.5px; background: var(--border-glass); margin: 0 6px; transition: background var(--dur-base); }

.wizard-step.active .wizard-step-num {
  background: linear-gradient(135deg, var(--indigo) 0%, var(--indigo-bright) 100%);
  border-color: var(--indigo);
  color: #fff;
  box-shadow: 0 0 16px var(--indigo-glow);
}
.wizard-step.active .wizard-step-label { color: var(--text-primary); }
.wizard-step.done .wizard-step-num { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.wizard-step.done .wizard-step-label { color: var(--green); }
.wizard-step.done + .wizard-step-line { background: var(--green); }

/* Type Cards */
.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.type-card {
  background: var(--glass-01);
  border: 0.5px solid var(--border-glass);
  border-radius: var(--r-lg);
  padding: 22px 12px;
  text-align: center;
  cursor: pointer;
  transition: all var(--dur-base) var(--t-smooth);
  backdrop-filter: var(--blur-xxs);
}
.type-card:hover {
  border-color: rgba(99,102,241,0.3);
  background: var(--glass-02);
  box-shadow: 0 0 24px rgba(99,102,241,0.1);
  transform: translateY(-2px);
}
.type-card.selected {
  border-color: var(--indigo);
  background: var(--indigo-soft);
  box-shadow: 0 0 0 3px var(--indigo-soft), 0 8px 24px rgba(99,102,241,0.2);
}
.type-card-icon { font-size: 2rem; margin-bottom: 10px; }
.type-card-label { font-size: .82rem; font-weight: 600; color: var(--text-primary); }
.type-card-sub   { font-size: .7rem; color: var(--text-muted); margin-top: 3px; }

/* Unit List */
.unit-search-wrap { position: relative; margin-bottom: 10px; }
.unit-search-wrap svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-dim); pointer-events: none; }
.unit-search { padding-left: 38px !important; }
.unit-list { max-height: 220px; overflow-y: auto; border: 0.5px solid var(--border-glass); border-radius: var(--r-md); background: rgba(0,0,0,0.3); }
.unit-list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 15px; cursor: pointer;
  border-bottom: 0.5px solid rgba(255,255,255,0.03);
  transition: background var(--dur-fast);
}
.unit-list-item:last-child { border-bottom: none; }
.unit-list-item:hover { background: var(--glass-02); }
.unit-list-item.selected { background: var(--indigo-soft); }
.unit-list-name { font-size: .82rem; color: var(--text-primary); font-weight: 500; flex: 1; }
.unit-list-sub  { font-size: .72rem; color: var(--text-muted); }
.unit-list-check { width: 16px; height: 16px; color: var(--indigo); flex-shrink: 0; opacity: 0; transition: opacity var(--dur-fast); }
.unit-list-item.selected .unit-list-check { opacity: 1; }

/* Chips */
.chips-wrap { display: flex; flex-wrap: wrap; gap: 8px; min-height: 36px; padding: 6px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--indigo-soft);
  border: 0.5px solid rgba(99,102,241,0.3);
  color: var(--text-primary);
  border-radius: var(--r-full);
  padding: 5px 12px 5px 14px;
  font-size: .78rem; font-weight: 500;
  backdrop-filter: var(--blur-xxs);
  transition: all var(--dur-fast);
}
.chip:hover { border-color: var(--indigo); background: rgba(99,102,241,0.25); }
.chip-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; padding: 0; transition: color var(--dur-fast); }
.chip-remove:hover { color: var(--red); }
.chip-remove svg { width: 14px; height: 14px; }

/* File Browser */
.file-browser { border: 0.5px solid var(--border-glass); border-radius: var(--r-md); background: rgba(0,0,0,0.3); overflow: hidden; }
.file-browser-path { background: rgba(255,255,255,0.02); padding: 9px 14px; font-size: .75rem; color: var(--text-muted); font-family: 'SF Mono', monospace; border-bottom: 0.5px solid var(--border-glass); }
.file-browser-list { max-height: 240px; overflow-y: auto; }
.file-entry { display: flex; align-items: center; gap: 10px; padding: 10px 15px; cursor: pointer; border-bottom: 0.5px solid rgba(255,255,255,0.03); transition: background var(--dur-fast); }
.file-entry:last-child { border-bottom: none; }
.file-entry:hover { background: var(--glass-02); }
.file-entry.selected { background: var(--indigo-soft); }
.file-entry-icon { font-size: 1rem; flex-shrink: 0; }
.file-entry-name { font-size: .82rem; color: var(--text-primary); flex: 1; font-family: 'SF Mono', monospace; }
.file-entry-nav  { font-size: .72rem; color: var(--indigo); }

/* Service Action Buttons */
.action-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.btn-start   { background: var(--green-soft); color: var(--green); border-color: rgba(34,197,94,0.2); }
.btn-start:hover   { background: rgba(34,197,94,0.3); color: #fff; }
.btn-stop    { background: var(--red-soft);    color: var(--red);   border-color: rgba(239,68,68,0.2); }
.btn-stop:hover    { background: rgba(239,68,68,0.3);  color: #fff; }
.btn-restart { background: var(--yellow-soft);  color: var(--yellow); border-color: rgba(245,158,11,0.2); }
.btn-restart:hover { background: rgba(245,158,11,0.3); color: #fff; }

/* ── Dropdown ──────────────────────────────────────────────── */
.dropdown-wrap { position: relative; }
.dropdown-menu {
  display: none;
  position: absolute; right: 0; top: calc(100% + 8px);
  background: rgba(15, 22, 44, 0.9);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border: 0.5px solid var(--border-bright);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 48px rgba(0,0,0,0.55);
  min-width: 170px;
  z-index: 150; overflow: hidden;
  animation: dropIn var(--dur-base) var(--t-spring);
}
.dropdown-menu.open { display: block; }
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.dropdown-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 11px 15px; background: none; border: none; color: var(--text-secondary); font-size: .85rem; font-weight: 500; text-align: left; cursor: pointer; transition: all var(--dur-fast); }
.dropdown-item:hover    { background: var(--glass-02); color: var(--text-primary); }
.dropdown-start:hover   { color: var(--green); }
.dropdown-stop:hover    { color: var(--red); }
.dropdown-restart:hover { color: var(--yellow); }
.dropdown-danger        { color: var(--red) !important; }
.dropdown-danger:hover  { background: var(--red-soft) !important; color: #fff !important; }
.dropdown-divider       { height: 0.5px; background: var(--border-glass); margin: 4px 0; }

/* ── Helpers ───────────────────────────────────────────────── */
.hide-on-mobile  { }
.show-on-mobile  { display: none !important; }
.update-chip {
  font-size: .72rem; color: var(--text-dim);
  background: rgba(255,255,255,0.03);
  padding: 4px 12px; border-radius: var(--r-full);
  border: 0.5px solid var(--border-glass);
  backdrop-filter: var(--blur-xxs);
}

/* ── Responsive: tablet ─────────────────────────────────────── */
@media (max-width: 1024px) { .dashboard-grid { grid-template-columns: 1fr; } }
@media (max-width: 768px)  { .stat-grid { grid-template-columns: 1fr 1fr; } .stat-grid > *:last-child { grid-column: 1 / -1; } }

/* ── Responsive: mobile ────────────────────────────────────── */
@media (max-width: 640px) {
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 40px rgba(0,0,0,0.5); }
  .sidebar-overlay.open { display: block; }
  .main-area { margin-left: 0; }
  .topbar-menu-btn { display: flex; }

  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-grid > *:last-child { grid-column: auto; }
  .stat-value { font-size: 1.9rem; }
  .stat-card { padding: 16px; }

  .page-content { padding: 16px 14px; }
  .form-grid-2 { grid-template-columns: 1fr; }

  /* Bottom sheet modal */
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: 100%; border-radius: var(--r-2xl) var(--r-2xl) 0 0; transform: translateY(100%); }
  .modal-backdrop.open .modal { transform: translateY(0); }
  .modal-header { border-radius: var(--r-2xl) var(--r-2xl) 0 0; }

  .table-wrap { border-radius: 0 0 var(--r-lg) var(--r-lg); }
  .hide-mobile { display: none; }
  .topbar-title { font-size: .9rem; }
  .card-header { padding: 14px 16px; }
  .card-body   { padding: 14px 16px; }
  .card { border-radius: var(--r-lg); }
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

/* ── Focus ──────────────────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; border-radius: var(--r-xs); }

/* ── Scroll reveal animation ────────────────────────────────── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card, .stat-card { animation: slideUp var(--dur-slow) var(--t-out); }
.stat-card:nth-child(2) { animation-delay: 60ms; }
.stat-card:nth-child(3) { animation-delay: 120ms; }