/* ==========================================================================
   HOSTINGER-INSPIRED MODERN VPS DASHBOARD STYLES
   Colors: Deep Slate, Hostinger Violet (#673de6), Emerald (#10b981)
   ========================================================================== */

:root {
  --bg-main: #0c0e17;
  --bg-card: #131724;
  --bg-card-hover: #191e30;
  --bg-card-subtle: #171b2b;
  --bg-input: #1b2033;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #673de6;

  --accent-primary: #673de6;
  --accent-primary-hover: #542cc7;
  --accent-primary-glow: rgba(103, 61, 230, 0.25);
  --accent-secondary: #7047eb;

  --status-success: #10b981;
  --status-success-bg: rgba(16, 185, 129, 0.12);
  --status-warning: #f59e0b;
  --status-warning-bg: rgba(245, 158, 11, 0.12);
  --status-danger: #ef4444;
  --status-danger-bg: rgba(239, 68, 68, 0.12);
  --status-info: #38bdf8;
  --status-info-bg: rgba(56, 189, 248, 0.12);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(103, 61, 230, 0.35);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #252c42;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #343e5c;
}

/* Common Utilities */
.hidden {
  display: none !important;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-success {
  background: var(--status-success-bg);
  color: var(--status-success);
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.badge-warning {
  background: var(--status-warning-bg);
  color: var(--status-warning);
  border: 1px solid rgba(245, 158, 11, 0.25);
}
.badge-danger {
  background: var(--status-danger-bg);
  color: var(--status-danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.badge-info {
  background: var(--status-info-bg);
  color: var(--status-info);
  border: 1px solid rgba(56, 189, 248, 0.25);
}
.badge-primary {
  background: var(--accent-primary-glow);
  color: #a78bfa;
  border: 1px solid rgba(103, 61, 230, 0.35);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--status-success);
  box-shadow: 0 0 8px var(--status-success);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
  font-family: inherit;
}
.btn-primary {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(103, 61, 230, 0.35);
}
.btn-primary:hover {
  background: var(--accent-primary-hover);
  box-shadow: 0 4px 12px rgba(103, 61, 230, 0.5);
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
}
.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
  background: var(--status-danger);
  color: #ffffff;
}
.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}
.btn-icon {
  padding: 8px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.btn-icon:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

/* ==========================================================================
   AUTHENTICATION VIEW (Telegram 2FA)
   ========================================================================== */

.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: radial-gradient(circle at 50% 20%, #1c1836 0%, #0c0e17 70%);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #673de6, #38bdf8, #673de6);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  background: rgba(103, 61, 230, 0.15);
  border: 1px solid rgba(103, 61, 230, 0.3);
  border-radius: var(--radius-lg);
  color: #a78bfa;
  margin-bottom: 16px;
}

.auth-logo svg {
  width: 30px;
  height: 30px;
}

.auth-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(103, 61, 230, 0.25);
  background: #1e243a;
}

.otp-input-field {
  text-align: center;
  letter-spacing: 0.5em;
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 10px;
}

.telegram-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 20px;
  font-size: 0.82rem;
  color: #bae6fd;
}
.telegram-notice svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: #38bdf8;
  margin-top: 2px;
}

.dev-fallback-alert {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fde68a;
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 0.82rem;
  margin-bottom: 16px;
}

/* ==========================================================================
   MAIN DASHBOARD LAYOUT
   ========================================================================== */

.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: all var(--transition-normal);
  z-index: 50;
}

.sidebar-header {
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(103, 61, 230, 0.4);
}

.sidebar-brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-nav {
  padding: 18px 12px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.nav-item svg {
  width: 19px;
  height: 19px;
  transition: color var(--transition-fast);
}

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

.nav-item.active {
  background: rgba(103, 61, 230, 0.15);
  color: #ffffff;
  border-color: rgba(103, 61, 230, 0.35);
  font-weight: 600;
}
.nav-item.active svg {
  color: #a78bfa;
}

.sidebar-footer {
  padding: 16px 14px;
  border-top: 1px solid var(--border-color);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Main Content Area */
.main-wrapper {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
}

/* Top Navbar */
.topbar {
  height: 64px;
  background: rgba(19, 23, 36, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.server-badge-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.server-name-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Content Container */
.content-area {
  padding: 28px;
  flex-grow: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ==========================================================================
   CARDS & GRIDS
   ========================================================================== */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

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

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

.metric-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.metric-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--bg-card-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}
.metric-icon.ram { color: #a78bfa; background: rgba(167, 139, 250, 0.12); }
.metric-icon.cpu { color: #38bdf8; background: rgba(56, 189, 248, 0.12); }
.metric-icon.disk { color: #f59e0b; background: rgba(245, 158, 11, 0.12); }
.metric-icon.net { color: #10b981; background: rgba(16, 185, 129, 0.12); }

.metric-value-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.metric-value {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-family: var(--font-sans);
}

.metric-unit {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Progress bar */
.progress-bar-container {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.4s ease;
}
.bg-purple { background: linear-gradient(90deg, #673de6, #8b5cf6); }
.bg-blue { background: linear-gradient(90deg, #0284c7, #38bdf8); }
.bg-amber { background: linear-gradient(90deg, #d97706, #f59e0b); }
.bg-emerald { background: linear-gradient(90deg, #059669, #10b981); }

.metric-subtext {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Dashboard 2-column or Multi-card Layout */
.dashboard-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 1024px) {
  .dashboard-row {
    grid-template-columns: 1fr;
  }
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
}

.panel-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.panel-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Specs Table */
.specs-table {
  width: 100%;
  border-collapse: collapse;
}

.specs-table tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.specs-table tr:last-child {
  border-bottom: none;
}

.specs-table td {
  padding: 10px 0;
  font-size: 0.85rem;
}

.specs-label {
  color: var(--text-secondary);
  width: 38%;
}

.specs-value {
  color: var(--text-primary);
  font-weight: 500;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

/* Sparkline SVG Chart */
.chart-container {
  width: 100%;
  height: 140px;
  position: relative;
}

.sparkline-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* ==========================================================================
   DATA TABLES (Projects, Processes, Ports)
   ========================================================================== */

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

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

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

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  white-space: nowrap;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ==========================================================================
   FILE MANAGER
   ========================================================================== */

.fm-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  background: var(--bg-card);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
  font-family: var(--font-mono);
}

.crumb-item {
  color: #a78bfa;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.crumb-item:hover {
  background: rgba(103, 61, 230, 0.15);
  text-decoration: underline;
}

.fm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.fm-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.fm-item-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(103, 61, 230, 0.4);
  transform: translateY(-2px);
}

.fm-item-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a78bfa;
}
.fm-item-icon.folder {
  color: #f59e0b;
}

.fm-item-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fm-item-size {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 15, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-dialog.large {
  max-width: 900px;
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
}

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

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--bg-card-subtle);
}

.code-editor-area {
  width: 100%;
  height: 420px;
  background: #0b0d14;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.6;
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  resize: vertical;
  outline: none;
}
.code-editor-area:focus {
  border-color: var(--accent-primary);
}

/* Terminal Area */
.terminal-window {
  background: #080a0f;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.terminal-header {
  background: #10141f;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
}

.term-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}
.term-dot.red { background: #ef4444; }
.term-dot.yellow { background: #f59e0b; }
.term-dot.green { background: #10b981; }

.terminal-output {
  padding: 18px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #38bdf8;
  height: 340px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.terminal-input-bar {
  display: flex;
  align-items: center;
  background: #0e121d;
  padding: 10px 16px;
  border-top: 1px solid var(--border-color);
}

.term-prompt {
  color: #10b981;
  font-family: var(--font-mono);
  font-weight: 700;
  margin-right: 10px;
}

.term-input {
  flex-grow: 1;
  background: transparent;
  border: none;
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  outline: none;
}

/* Toast Alerts */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  color: var(--text-primary);
  font-size: 0.86rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.success { border-left-color: var(--status-success); }
.toast.error { border-left-color: var(--status-danger); }
.toast.warning { border-left-color: var(--status-warning); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   MOBILE RESPONSIVE ARCHITECTURE
   Drawer Sidebar, Bottom Navigation Bar, Touch Targets, and Fluid Layouts
   ========================================================================== */

/* Mobile Sidebar Drawer & Overlay */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 89;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.mobile-menu-btn {
  display: none;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 7px;
  cursor: pointer;
  margin-right: 10px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}
.mobile-menu-btn:hover {
  background: var(--bg-card-hover);
}

.sidebar-close-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px 8px;
  margin-left: auto;
  border-radius: var(--radius-sm);
}
.sidebar-close-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

/* Mobile Bottom Navigation Bar */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(18, 22, 34, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  z-index: 80;
  align-items: center;
  justify-content: space-around;
  padding: 0 4px;
  padding-bottom: max(6px, env(safe-area-inset-bottom, 0px));
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 0;
  transition: color var(--transition-fast);
  font-family: inherit;
  text-decoration: none;
}

.bottom-nav-item svg {
  width: 20px;
  height: 20px;
  transition: transform var(--transition-fast);
}

.bottom-nav-item:active svg {
  transform: scale(0.9);
}

.bottom-nav-item.active {
  color: #a78bfa;
}
.bottom-nav-item.active svg {
  color: var(--accent-primary);
}

/* Tablet & Mobile Screens (<= 768px) */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    z-index: 95;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }

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

  .sidebar-close-btn {
    display: inline-flex;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .topbar {
    padding: 0 16px;
    height: 58px;
  }

  .content-area {
    padding: 18px 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-title {
    font-size: 1.25rem;
  }

  .dashboard-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .modal-dialog.large {
    max-width: 95vw;
  }
}

/* Mobile Phones (<= 640px) */
@media (max-width: 640px) {
  .bottom-nav {
    display: flex;
  }

  .content-area {
    padding: 14px 12px 86px 12px; /* Leave space for bottom navigation bar */
  }

  /* Compact Topbar */
  .topbar {
    padding: 0 12px;
  }

  .server-name-label {
    font-size: 0.85rem;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topOsBadge {
    display: none;
  }

  .live-indicator {
    padding: 4px 8px;
    font-size: 0.72rem;
  }

  #telegramStatusBadge {
    display: none; /* Hide on small mobile to avoid crowding */
  }

  /* 2-Column Hero Metrics on Phone */
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }

  .metric-card {
    padding: 14px 12px;
    border-radius: var(--radius-md);
  }

  .metric-title {
    font-size: 0.76rem;
  }

  .metric-icon {
    width: 28px;
    height: 28px;
  }
  .metric-icon svg {
    width: 15px;
    height: 15px;
  }

  .metric-value {
    font-size: 1.35rem;
  }

  .metric-subtext {
    flex-direction: column;
    gap: 2px;
    font-size: 0.7rem;
  }

  /* Tables */
  .table-container {
    border-radius: var(--radius-sm);
    -webkit-overflow-scrolling: touch;
  }

  .data-table th,
  .data-table td {
    padding: 9px 10px;
    font-size: 0.78rem;
  }

  .panel-card {
    padding: 16px 14px;
    border-radius: var(--radius-md);
  }

  /* Modals Full Width on Mobile */
  .modal-dialog {
    max-width: 96vw;
    width: 96vw;
    margin: 8px;
    border-radius: var(--radius-md);
  }

  .modal-body {
    padding: 16px 14px;
    max-height: 80vh;
  }

  .code-editor-area {
    height: 55vh;
    font-size: 14px; /* Prevents auto zoom-in on iPhone */
  }

  /* Auth Card */
  .auth-card {
    padding: 24px 18px;
    border-radius: var(--radius-lg);
  }

  .auth-title {
    font-size: 1.25rem;
  }

  .otp-input-field {
    font-size: 1.35rem;
    letter-spacing: 0.35em;
  }

  /* File Manager Toolbar */
  .fm-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
  }

  #fmSearchInput {
    width: 100% !important;
  }

  /* Terminal Window */
  .terminal-output {
    height: 230px;
    font-size: 0.78rem;
    padding: 12px;
  }

  .terminal-input-bar {
    padding: 8px 12px;
  }

  .term-prompt {
    font-size: 0.8rem;
    margin-right: 6px;
  }

  .term-input {
    font-size: 0.82rem;
  }
}

/* Extra Small Phones (<= 380px) */
@media (max-width: 380px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .server-name-label {
    max-width: 95px;
  }
}

