/* ==========================================================================
   CAKRA MOBILE FIELD EDITION & PWA STYLESHEET
   Optimized for mobile field engineering, spotty connections & touch devices
   ========================================================================== */

/* ─── 1. PWA INSTALL BANNER ─────────────────────────────────────────────── */
.pwa-install-banner {
  position: fixed;
  top: 60px;
  left: 12px;
  right: 12px;
  background: var(--bg-surface, #1e293b);
  border: 1px solid var(--brand-primary, #0ea5e9);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  z-index: 1100;
  animation: slideDownBanner 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDownBanner {
  from { transform: translateY(-20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.pwa-banner-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pwa-banner-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
}

.pwa-banner-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-primary, #f8fafc);
  margin-bottom: 2px;
}

.pwa-banner-desc {
  font-size: 0.72rem;
  color: var(--text-muted, #94a3b8);
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ─── 2. THUMB-FRIENDLY MOBILE BOTTOM NAVIGATION BAR (DOCK) ─────────────── */
.mobile-bottom-nav {
  display: none; /* Desktop default: hidden */
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bg-surface, #0f172a);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
  }

  /* Ruang ekstra di bawah konten agar tidak tertutup dock navigasi */
  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 48px;
    background: transparent;
    border: none;
    color: var(--text-muted, #94a3b8);
    font-size: 0.68rem;
    font-weight: 600;
    gap: 3px;
    cursor: pointer;
    position: relative;
    transition: color 0.15s ease, transform 0.1s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav-item:active {
    transform: scale(0.92);
  }

  .mobile-nav-item svg {
    width: 19px;
    height: 19px;
    stroke: currentColor;
    transition: stroke 0.15s ease, transform 0.15s ease;
  }

  .mobile-nav-item.active {
    color: var(--brand-primary, #0ea5e9);
  }

  .mobile-nav-item.active svg {
    stroke: var(--brand-primary, #0ea5e9);
    transform: translateY(-1px);
  }

  .mobile-nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    width: 24px;
    height: 3px;
    background: var(--brand-primary, #0ea5e9);
    border-radius: 0 0 3px 3px;
    box-shadow: 0 1px 6px var(--brand-primary, #0ea5e9);
  }

  /* Alert Badge counter on Insiden tab */
  .mobile-nav-badge {
    position: absolute;
    top: 5px;
    right: calc(50% - 18px);
    background: #ef4444;
    color: #ffffff;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 999px;
    min-width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    animation: pulseBadge 1.5s infinite;
  }
}

@keyframes pulseBadge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ─── 3. TOPOLOGY VIEW MODE SWITCHER (CANVAS vs MODE LAPANGAN) ─────────── */
.topology-view-switcher {
  display: inline-flex;
  align-items: center;
  background: var(--bg-hover, rgba(255, 255, 255, 0.08));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.15));
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}

.view-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted, #94a3b8);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 28px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.view-switch-btn svg {
  width: 13px;
  height: 13px;
}

.view-switch-btn.active {
  background: var(--brand-primary, #0ea5e9);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(14, 165, 233, 0.4);
}

@media (max-width: 768px) {
  .topology-toolbar {
    top: 8px !important;
    left: 8px !important;
    right: 8px !important;
    max-width: calc(100vw - 16px) !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    flex-wrap: nowrap !important;
    z-index: 100 !important;
  }
  .topology-toolbar::-webkit-scrollbar {
    display: none !important;
  }
}

/* ─── 4. MODE LAPANGAN (TOPOLOGY FIELD VIEW CONTAINER) ───────────────────── */
#topology-field-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 68px 12px 30px 12px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  height: 100%;
  -webkit-overflow-scrolling: touch;
}

/* Field Header Card: Site Info & Status Counters */
.field-site-header {
  background: var(--bg-surface, #1e293b);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.field-site-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.field-site-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary, #f8fafc);
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-site-code {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.72rem;
  font-weight: 700;
}

.field-site-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.field-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
}

.field-chip-total {
  background: var(--bg-hover, rgba(255, 255, 255, 0.06));
  color: var(--text-primary, #f8fafc);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.field-chip-up {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.field-chip-down {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
  animation: pulseChip 1.5s infinite;
}

@keyframes pulseChip {
  0%, 100% { border-color: rgba(239, 68, 68, 0.35); }
  50% { border-color: rgba(239, 68, 68, 0.8); box-shadow: 0 0 8px rgba(239, 68, 68, 0.3); }
}

.field-chip-warn {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Field WAN Gateway Strip */
.field-wan-strip {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.08) 0%, rgba(30, 41, 59, 0.6) 100%);
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.field-wan-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-wan-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted, #94a3b8);
  letter-spacing: 0.5px;
}

.field-wan-ip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary, #f8fafc);
}

.field-wan-metrics {
  display: flex;
  align-items: center;
  gap: 12px;
}

.field-wan-metric-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.field-wan-metric-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: #38bdf8;
}

.field-wan-metric-sub {
  font-size: 0.65rem;
  color: var(--text-muted, #94a3b8);
}

/* Field Filter & Search Controls */
.field-controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.field-search-input {
  flex: 1;
  min-width: 140px;
  min-height: 38px;
  background: var(--bg-surface, #1e293b);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.82rem;
  color: var(--text-primary, #f8fafc);
  outline: none;
}

.field-search-input:focus {
  border-color: var(--brand-primary, #0ea5e9);
}

.field-filter-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}

.field-filter-btn {
  background: var(--bg-surface, #1e293b);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  min-height: 38px;
  transition: all 0.15s ease;
}

.field-filter-btn.active {
  background: var(--brand-primary, #0ea5e9);
  color: #ffffff;
  border-color: var(--brand-primary, #0ea5e9);
}

/* ─── 5. DEVICE HEALTH CARDS (LIST) ──────────────────────────────────────── */
.field-devices-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
}

@media (max-width: 600px) {
  .field-devices-list {
    grid-template-columns: 1fr; /* Single stacked column on phones */
  }
}

.field-device-card {
  background: var(--bg-surface, #1e293b);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}

/* Status Stripe on left border */
.field-device-card::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
}

.field-device-card.status-up::before { background: #10b981; }
.field-device-card.status-down::before { background: #ef4444; }
.field-device-card.status-warning::before { background: #f59e0b; }
.field-device-card.status-unknown::before { background: #64748b; }

.field-device-card.status-down {
  border-color: rgba(239, 68, 68, 0.4);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.06) 0%, var(--bg-surface, #1e293b) 100%);
}

.field-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.field-card-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.field-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--bg-hover, rgba(255, 255, 255, 0.06));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-primary, #0ea5e9);
  flex-shrink: 0;
}

.field-card-names {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.field-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary, #f8fafc);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field-card-subarea {
  font-size: 0.7rem;
  color: var(--text-muted, #94a3b8);
}

.field-card-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  text-transform: uppercase;
}

.field-card-badge.up { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.field-card-badge.down { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.field-card-badge.warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

/* IP row with 1-Tap Copy */
.field-card-ip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-hover, rgba(0, 0, 0, 0.2));
  border-radius: 6px;
  padding: 5px 10px;
  margin-top: 2px;
}

.field-card-ip-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary, #f8fafc);
}

.field-card-copy-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #94a3b8);
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
  min-height: 28px;
}

.field-card-copy-btn:hover, .field-card-copy-btn:active {
  background: rgba(255, 255, 255, 0.1);
  color: #38bdf8;
}

/* Card Metrics Strip */
.field-card-metrics {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.72rem;
  color: var(--text-muted, #94a3b8);
}

.field-metric-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.field-metric-highlight {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--text-primary, #f8fafc);
}

/* Card Actions */
.field-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.05));
}

.field-action-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  background: var(--bg-hover, rgba(255, 255, 255, 0.05));
  color: var(--text-primary, #f8fafc);
  cursor: pointer;
  min-height: 36px;
  transition: all 0.15s ease;
}

.field-action-btn:active {
  transform: scale(0.96);
}

.field-action-btn.btn-primary-action {
  background: rgba(14, 165, 233, 0.15);
  border-color: rgba(14, 165, 233, 0.4);
  color: #38bdf8;
}

/* ─── 6. MOBILE BOTTOM SHEET FOR NODE DRAWER ─────────────────────────────── */
@media (max-width: 768px) {
  #node-drawer.node-drawer {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 82vh !important;
    border-radius: 20px 20px 0 0 !important;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.15)) !important;
    border-left: none !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6) !important;
    transform: translateY(100%) !important;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
    z-index: 1200 !important;
    overflow-y: auto !important;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
  }

  #node-drawer.node-drawer.open {
    transform: translateY(0) !important;
  }

  /* Sheet Drag Handle Pill */
  #node-drawer::before {
    content: '';
    display: block;
    width: 44px;
    height: 4px;
    border-radius: 2px;
    background: var(--text-muted, #64748b);
    opacity: 0.4;
    margin: 8px auto 4px auto;
  }
}

/* ─── 7. OFFLINE BANNER (PWA FIELD RESILIENCE) ──────────────────────────── */
.cakra-offline-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(90deg, #991b1b, #dc2626);
  color: #ffffff;
  padding: 8px 16px;
  z-index: 2000;
  font-size: 0.78rem;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: slideDownIndicator 0.25s ease-out;
}

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

.offline-content {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 900px;
  width: 100%;
}

.offline-content svg {
  flex-shrink: 0;
}

/* ─── 8. FLOATING TOAST NOTIFICATIONS ───────────────────────────────────── */
.cakra-floating-toast {
  position: fixed;
  bottom: 74px; /* di atas mobile bottom dock */
  right: 16px;
  background: var(--bg-surface, #1e293b);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  border-left: 4px solid var(--brand-primary, #0ea5e9);
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
  z-index: 2100;
  max-width: 340px;
  animation: toastSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

@media (max-width: 480px) {
  .cakra-floating-toast {
    left: 12px;
    right: 12px;
    max-width: none;
  }
}

.cakra-floating-toast.toast-success {
  border-left-color: #10b981;
}

.cakra-floating-toast.toast-error {
  border-left-color: #ef4444;
}

.cakra-floating-toast.toast-info {
  border-left-color: #38bdf8;
}

.toast-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.78rem;
  color: var(--text-primary, #f8fafc);
}

.toast-body strong {
  font-size: 0.82rem;
  color: var(--text-primary, #f8fafc);
}

.toast-body span {
  color: var(--text-muted, #94a3b8);
}

.cakra-floating-toast.fade-out {
  opacity: 0;
  transform: translateY(10px);
}

@keyframes toastSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── 9. DEDICATED SITE ROUTER TERMINAL (PER-SITE SCOPED CONSOLE) ────────── */
.site-terminal-backdrop {
  z-index: 2500;
  background: rgba(4, 7, 14, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.site-terminal-backdrop.open {
  display: flex;
}

/* ─── LIGHT THEME VARIABLES (DEFAULT TERANG) ────────────────────────────── */
.site-terminal-modal,
.site-terminal-modal.theme-light {
  --st-bg-modal: #ffffff;
  --st-border-modal: #cbd5e1;
  --st-shadow-modal: 0 20px 50px rgba(0, 0, 0, 0.2), 0 0 15px rgba(2, 132, 199, 0.08);
  --st-bg-header: #f8fafc;
  --st-border-header: #e2e8f0;
  --st-text-title: #0f172a;
  --st-bg-site-badge: #f0f9ff;
  --st-border-site-badge: #bae6fd;
  --st-text-site-badge: #0369a1;
  --st-dot-color: #10b981;
  --st-bg-router-box: #ffffff;
  --st-border-router-box: #cbd5e1;
  --st-text-router-lbl: #475569;
  --st-bg-select: #ffffff;
  --st-border-select: #cbd5e1;
  --st-text-select: #0f172a;
  --st-bg-single-badge: #f0fdf4;
  --st-border-single-badge: #bbf7d0;
  --st-text-single-name: #15803d;
  --st-text-single-ip: #64748b;
  --st-bg-vendor: #e0f2fe;
  --st-text-vendor: #0284c7;
  --st-bg-btn: #ffffff;
  --st-border-btn: #cbd5e1;
  --st-text-btn: #334155;
  --st-bg-btn-hover: #f1f5f9;
  --st-text-btn-hover: #0f172a;
  --st-bg-quick-bar: #f8fafc;
  --st-border-quick-bar: #e2e8f0;
  --st-bg-chip: #ffffff;
  --st-border-chip: #cbd5e1;
  --st-text-chip: #0284c7;
  --st-bg-chip-hover: #e0f2fe;
  --st-border-chip-hover: #38bdf8;
  --st-text-chip-hover: #0369a1;
  --st-bg-screen: #ffffff;
  --st-text-output: #0f172a;
  --st-text-info: #0284c7;
  --st-text-success: #15803d;
  --st-text-warn: #b45309;
  --st-text-error: #dc2626;
  --st-text-switch: #7c3aed;
  --st-text-echo-prompt: #059669;
  --st-text-echo-cmd: #0f172a;
  --st-text-banner: #0284c7;
  --st-text-banner-hint: #64748b;
  --st-bg-input-bar: #f8fafc;
  --st-border-input-bar: #e2e8f0;
  --st-text-prompt: #059669;
  --st-text-input: #0f172a;
  --st-placeholder-input: #94a3b8;
  --st-scrollbar-thumb: #cbd5e1;
  --st-close-color: #64748b;
  --st-close-hover: #0f172a;
  --st-close-bg-hover: #e2e8f0;
}

/* ─── DARK THEME VARIABLES (GELAP) ───────────────────────────────────────── */
.site-terminal-modal.theme-dark {
  --st-bg-modal: #090d16;
  --st-border-modal: rgba(56, 189, 248, 0.28);
  --st-shadow-modal: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 20px rgba(14, 165, 233, 0.15);
  --st-bg-header: #0c1322;
  --st-border-header: rgba(255, 255, 255, 0.08);
  --st-text-title: #f8fafc;
  --st-bg-site-badge: rgba(14, 165, 233, 0.12);
  --st-border-site-badge: rgba(14, 165, 233, 0.3);
  --st-text-site-badge: #38bdf8;
  --st-dot-color: #10b981;
  --st-bg-router-box: rgba(255, 255, 255, 0.04);
  --st-border-router-box: rgba(255, 255, 255, 0.14);
  --st-text-router-lbl: #94a3b8;
  --st-bg-select: #0f172a;
  --st-border-select: #1e293b;
  --st-text-select: #38bdf8;
  --st-bg-single-badge: rgba(16, 185, 129, 0.08);
  --st-border-single-badge: rgba(16, 185, 129, 0.25);
  --st-text-single-name: #f1f5f9;
  --st-text-single-ip: #94a3b8;
  --st-bg-vendor: rgba(56, 189, 248, 0.15);
  --st-text-vendor: #38bdf8;
  --st-bg-btn: rgba(255, 255, 255, 0.05);
  --st-border-btn: rgba(255, 255, 255, 0.12);
  --st-text-btn: #cbd5e1;
  --st-bg-btn-hover: rgba(255, 255, 255, 0.1);
  --st-text-btn-hover: #f8fafc;
  --st-bg-quick-bar: #070a12;
  --st-border-quick-bar: rgba(255, 255, 255, 0.05);
  --st-bg-chip: rgba(56, 189, 248, 0.06);
  --st-border-chip: rgba(56, 189, 248, 0.2);
  --st-text-chip: #93c5fd;
  --st-bg-chip-hover: rgba(56, 189, 248, 0.16);
  --st-border-chip-hover: #38bdf8;
  --st-text-chip-hover: #ffffff;
  --st-bg-screen: #080c14;
  --st-text-output: #f1f5f9;
  --st-text-info: #38bdf8;
  --st-text-success: #4ade80;
  --st-text-warn: #fbbf24;
  --st-text-error: #f87171;
  --st-text-switch: #a78bfa;
  --st-text-echo-prompt: #34d399;
  --st-text-echo-cmd: #f8fafc;
  --st-text-banner: #38bdf8;
  --st-text-banner-hint: #94a3b8;
  --st-bg-input-bar: #090e18;
  --st-border-input-bar: rgba(255, 255, 255, 0.08);
  --st-text-prompt: #34d399;
  --st-text-input: #f8fafc;
  --st-placeholder-input: #475569;
  --st-scrollbar-thumb: rgba(255, 255, 255, 0.15);
  --st-close-color: #94a3b8;
  --st-close-hover: #f8fafc;
  --st-close-bg-hover: rgba(255, 255, 255, 0.08);
}

.site-terminal-modal {
  width: 100%;
  max-width: 940px;
  height: 82vh;
  max-height: 850px;
  background: var(--st-bg-modal);
  border: 1px solid var(--st-border-modal);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--st-shadow-modal);
  overflow: hidden;
  animation: modalScaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transition: background 0.2s ease, border-color 0.2s ease;
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Header */
.site-terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: var(--st-bg-header);
  border-bottom: 1px solid var(--st-border-header);
  flex-shrink: 0;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.site-terminal-header-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.site-terminal-site-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--st-bg-site-badge);
  border: 1px solid var(--st-border-site-badge);
  padding: 5px 12px;
  border-radius: 20px;
}

.site-terminal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--st-dot-color);
  box-shadow: 0 0 8px var(--st-dot-color);
  flex-shrink: 0;
}

.st-site-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--st-text-title);
  white-space: nowrap;
}

/* Router Selector */
.st-router-select-container {
  display: flex;
  align-items: center;
}

.st-router-dropdown-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--st-bg-router-box);
  border: 1px solid var(--st-border-router-box);
  padding: 3px 8px;
  border-radius: 8px;
}

.st-router-select-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--st-text-router-lbl);
  cursor: pointer;
  white-space: nowrap;
}

.st-router-select {
  background: var(--st-bg-select);
  color: var(--st-text-select);
  border: 1px solid var(--st-border-select);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease;
  max-width: 320px;
}

.st-router-select:focus {
  border-color: #0284c7;
}

.st-router-badge.single {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--st-bg-single-badge);
  border: 1px solid var(--st-border-single-badge);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
}

.st-router-badge .st-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
}

.st-r-name {
  color: var(--st-text-single-name);
}

.st-r-ip {
  color: var(--st-text-single-ip);
  font-family: monospace;
  font-size: 0.75rem;
}

.st-r-vendor {
  background: var(--st-bg-vendor);
  color: var(--st-text-vendor);
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 4px;
}

/* Header Action Buttons */
.site-terminal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.site-terminal-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--st-bg-btn);
  border: 1px solid var(--st-border-btn);
  color: var(--st-text-btn);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 32px;
}

.site-terminal-action-btn:hover {
  background: var(--st-bg-btn-hover);
  color: var(--st-text-btn-hover);
  border-color: var(--st-border-btn);
}

.site-terminal-action-btn.st-btn-theme {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Segmented Theme Switcher: Terang (default) / Gelap */
.st-theme-switch-group {
  display: inline-flex;
  align-items: center;
  background: var(--st-bg-btn);
  border: 1px solid var(--st-border-btn);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.st-theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  color: var(--st-text-btn);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 28px;
  line-height: 1;
}

.st-theme-toggle-btn svg {
  flex-shrink: 0;
}

.st-theme-toggle-btn:hover {
  color: var(--st-text-btn-hover);
}

.st-theme-toggle-btn.active {
  background: #ffffff;
  color: #0284c7;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.site-terminal-modal.theme-dark .st-theme-toggle-btn.active {
  background: #1e293b;
  color: #38bdf8;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.site-terminal-action-btn.st-btn-stop {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.site-terminal-action-btn.st-btn-stop:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #dc2626;
}

.site-terminal-close-btn {
  background: transparent;
  border: none;
  color: var(--st-close-color);
  font-size: 1.5rem;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
}

.site-terminal-close-btn:hover {
  color: var(--st-close-hover);
  background: var(--st-close-bg-hover);
}

/* Quick Command Chips Bar */
.site-terminal-quick-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--st-bg-quick-bar);
  border-bottom: 1px solid var(--st-border-quick-bar);
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.site-terminal-quick-bar::-webkit-scrollbar {
  display: none;
}

.st-quick-chip {
  display: inline-flex;
  align-items: center;
  background: var(--st-bg-chip);
  border: 1px solid var(--st-border-chip);
  color: var(--st-text-chip);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.74rem;
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
  flex-shrink: 0;
  min-height: 30px;
}

.st-quick-chip:hover {
  background: var(--st-bg-chip-hover);
  border-color: var(--st-border-chip-hover);
  color: var(--st-text-chip-hover);
  transform: translateY(-1px);
}

.st-quick-chip:active {
  transform: translateY(0);
}

/* Terminal Screen */
.site-terminal-screen {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  background: var(--st-bg-screen);
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 0.83rem;
  line-height: 1.55;
  color: var(--st-text-output);
  white-space: pre-wrap;
  word-break: break-all;
  outline: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.site-terminal-screen::-webkit-scrollbar {
  width: 6px;
}

.site-terminal-screen::-webkit-scrollbar-thumb {
  background: var(--st-scrollbar-thumb);
  border-radius: 4px;
}

.st-line {
  margin-bottom: 2px;
}

.st-line.st-output {
  color: var(--st-text-output);
}

.st-line.st-info {
  color: var(--st-text-info);
  font-weight: 600;
}

.st-line.st-success {
  color: var(--st-text-success);
  font-weight: 600;
}

.st-line.st-warn {
  color: var(--st-text-warn);
}

.st-line.st-error {
  color: var(--st-text-error);
  font-weight: 600;
}

.st-line.st-switch-notice {
  color: var(--st-text-switch);
  font-style: italic;
  padding: 4px 0;
}

.st-line.st-prompt-echo {
  color: var(--st-text-echo-cmd);
  font-weight: 700;
  margin-top: 8px;
  margin-bottom: 4px;
}

.st-echo-prompt {
  color: var(--st-text-echo-prompt);
}

.st-echo-cmd {
  color: var(--st-text-echo-cmd);
}

/* Banner */
.st-banner {
  color: var(--st-text-banner);
  margin-bottom: 12px;
  font-weight: 500;
}

.st-banner-line.title {
  color: var(--st-text-banner);
  font-weight: 700;
}

.st-banner-hint {
  color: var(--st-text-banner-hint);
  font-size: 0.78rem;
  margin-top: 6px;
}

/* Command Input Bar */
.site-terminal-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--st-bg-input-bar);
  border-top: 1px solid var(--st-border-input-bar);
  flex-shrink: 0;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.site-terminal-prompt {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--st-text-prompt);
  white-space: nowrap;
  user-select: none;
}

.site-terminal-input {
  flex: 1 1 auto;
  background: transparent;
  border: none;
  outline: none;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  color: var(--st-text-input);
  padding: 6px 0;
}

.site-terminal-input::placeholder {
  color: var(--st-placeholder-input);
}

.site-terminal-send-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.site-terminal-send-btn:hover {
  background: #0369a1;
  transform: scale(1.04);
}

.site-terminal-send-btn:active {
  transform: scale(0.96);
}

/* ─── MOBILE VIEW ENHANCEMENT FOR SITE TERMINAL (PHONE & TABLET) ─────────── */
@media (max-width: 768px) {
  .site-terminal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .site-terminal-modal {
    max-width: 100vw;
    width: 100%;
    height: 94vh;
    height: 94dvh;
    max-height: none;
    border-radius: 18px 18px 0 0;
    border-bottom: none;
    border-left: none;
    border-right: none;
  }

  .site-terminal-header {
    padding: 10px 14px;
  }

  .site-terminal-header-main {
    gap: 8px;
  }

  .st-site-title {
    font-size: 0.82rem;
  }

  .st-router-select {
    max-width: 180px;
    font-size: 0.76rem;
  }

  .st-quick-chip {
    padding: 8px 12px;
    font-size: 0.76rem;
    min-height: 38px; /* Touch target */
  }

  .site-terminal-screen {
    font-size: 0.78rem;
    padding: 12px;
  }

  .site-terminal-input-bar {
    padding: 8px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .site-terminal-prompt {
    font-size: 0.78rem;
  }

  .site-terminal-input {
    font-size: 0.82rem;
  }

  .site-terminal-send-btn {
    width: 42px;
    height: 42px; /* Touch target */
  }

  .site-terminal-close-btn {
    width: 40px;
    height: 40px; /* Touch target */
    font-size: 1.6rem;
  }
}



