/* ═══════════════════════════════════════════
   Linux Admin Panel - Dark Theme
   ═══════════════════════════════════════════ */

:root {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-tertiary: #242836;
  --bg-hover: #2d3245;
  --bg-active: #363b50;
  --text-primary: #e4e6ed;
  --text-secondary: #9ca0b0;
  --text-muted: #6b7084;
  --border: #2d3245;
  --accent: #5b8def;
  --accent-hover: #7aa3f5;
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #38bdf8;
  --sidebar-width: 240px;
  --topbar-height: 56px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow: hidden;
}

/* ─── Gauge Ring Cards ─── */
.dash-row-gauges {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.gauge-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.15s, box-shadow 0.15s;
}

.gauge-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.gauge-card-info {
  align-items: stretch;
}

.gauge-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
  margin-bottom: 12px;
}

.gauge-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.gauge-sublabel {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Cascadia Code', monospace;
}

.gauge-ring-wrap {
  position: relative;
  width: 120px;
  height: 120px;
}

.gauge-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gauge-bg {
  fill: none;
  stroke: var(--bg-tertiary);
  stroke-width: 8;
}

.gauge-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 0.8s ease;
}

.gauge-fill-cpu { stroke: var(--accent); }
.gauge-fill-mem { stroke: var(--success); }
.gauge-fill-swap { stroke: var(--warning); }

.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gauge-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}

.gauge-unit {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.gauge-footer {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Info Rows (uptime card) ─── */
.info-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  justify-content: center;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.info-row-icon { font-size: 16px; width: 20px; text-align: center; }
.info-row-label { font-size: 12px; color: var(--text-secondary); flex: 1; }
.info-row-value { font-size: 13px; font-weight: 600; font-family: 'SF Mono', 'Cascadia Code', monospace; color: var(--text-primary); }

/* ─── CPU Cores Grid ─── */
.dash-section {
  margin-bottom: 20px;
}

.dash-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cpu-cores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.cpu-core-bar {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.cpu-core-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.cpu-core-label span:last-child {
  font-weight: 600;
  color: var(--text-primary);
}

.cpu-core-track {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.cpu-core-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.8s ease, background 0.3s;
  background: var(--accent);
}

.cpu-core-fill.warn { background: var(--warning); }
.cpu-core-fill.hot { background: var(--danger); }

/* ─── Chart Cards ─── */
.dash-row-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

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

.chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.chart-range {
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── 2-Column Rows ─── */
.dash-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.dash-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.dash-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.dash-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.dash-card-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── Disk List ─── */
.disk-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.disk-item:last-child { border-bottom: none; }

.disk-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.disk-mount {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

.disk-fs {
  font-size: 11px;
  color: var(--text-muted);
  font-family: monospace;
}

.disk-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.disk-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.disk-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s, background 0.3s;
  background: var(--accent);
}

.disk-bar-fill.warn { background: var(--warning); }
.disk-bar-fill.hot { background: var(--danger); }

.disk-bar-pct {
  font-size: 12px;
  font-weight: 600;
  width: 40px;
  text-align: right;
  color: var(--text-primary);
}

.disk-detail-row {
  display: flex;
  gap: 16px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── Disk I/O ─── */
.disk-io-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.disk-io-item:last-child { border-bottom: none; }

.disk-io-name {
  font-weight: 600;
  font-size: 13px;
  width: 60px;
  color: var(--text-primary);
  font-family: monospace;
}

.disk-io-stats {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.disk-io-stat {
  text-align: center;
}

.disk-io-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.disk-io-stat-value {
  font-size: 13px;
  font-weight: 600;
  font-family: monospace;
}

.disk-io-stat-value.read { color: var(--info); }
.disk-io-stat-value.write { color: var(--success); }
.disk-io-stat-value.iops { color: var(--warning); }

/* ─── Memory Breakdown ─── */
.mem-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mem-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mem-bar-label {
  font-size: 12px;
  color: var(--text-secondary);
  width: 70px;
  flex-shrink: 0;
}

.mem-bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.mem-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s;
}

.mem-bar-fill.used { background: var(--success); }
.mem-bar-fill.buffers { background: var(--info); }
.mem-bar-fill.cached { background: var(--accent); }
.mem-bar-fill.slab { background: #c084fc; }
.mem-bar-fill.swap { background: var(--warning); }

.mem-bar-value {
  font-size: 12px;
  font-weight: 600;
  width: 80px;
  text-align: right;
  font-family: monospace;
  color: var(--text-primary);
}

.mem-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.mem-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.mem-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ─── Top Processes ─── */
.top-procs-table {
  font-size: 12px;
}

.top-procs-table table {
  width: 100%;
  border-collapse: collapse;
}

.top-procs-table th {
  text-align: left;
  padding: 6px 8px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
}

.top-procs-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-procs-table tr:hover td {
  background: var(--bg-hover);
}

.top-procs-table .cmd-cell {
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  color: var(--text-muted);
  font-size: 11px;
}

.cpu-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 11px;
}

.cpu-badge.low { color: var(--text-primary); }
.cpu-badge.med { color: var(--warning); background: rgba(251,191,36,0.1); }
.cpu-badge.high { color: var(--danger); background: rgba(248,113,113,0.1); }

/* ─── System Info Grid ─── */
.sys-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.sys-info-item {
  display: flex;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 4px;
  font-size: 12px;
}

.sys-info-item:nth-child(odd) {
  background: var(--bg-tertiary);
}

.sys-info-label {
  color: var(--text-muted);
}

.sys-info-value {
  color: var(--text-primary);
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-weight: 500;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

/* ─── Network Interfaces (enhanced) ─── */
.iface-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
}

.iface-card:last-child { margin-bottom: 0; }

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

.iface-name {
  font-weight: 600;
  color: var(--accent);
  font-size: 13px;
}

.iface-ip {
  font-size: 12px;
  font-family: monospace;
  color: var(--text-primary);
}

.iface-stats {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--text-muted);
}

.iface-stats span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ─── Responsive for new dashboard ─── */
@media (max-width: 1200px) {
  .dash-row-gauges {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-row-charts,
  .dash-row-2col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .dash-row-gauges {
    grid-template-columns: 1fr 1fr;
  }
  .cpu-cores-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

.sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 24px;
}

.logo-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 2px;
  font-size: 14px;
}

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

.nav-item.active {
  background: var(--accent);
  color: #fff;
}

.nav-icon { font-size: 18px; width: 24px; text-align: center; }

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

/* ─── Main Content ─── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  height: 100vh;
  transition: margin-left 0.3s ease;
}

.main-content.expanded {
  margin-left: 0;
}

.topbar {
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
}

.menu-toggle {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  display: none;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-badge {
  font-size: 12px;
  color: var(--success);
  padding: 4px 10px;
  background: rgba(74, 222, 128, 0.1);
  border-radius: 20px;
}

.status-badge.disconnected {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.1);
}

/* ─── Pages ─── */
.page-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.page { display: none; }
.page.active { display: block; }

/* ─── Stats Grid ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  gap: 16px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-icon {
  font-size: 36px;
  display: flex;
  align-items: center;
}

.stat-info { flex: 1; }

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-detail {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* ─── Progress Bar ─── */
.progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
  background: linear-gradient(90deg, var(--accent), var(--info));
}

.progress-fill.warning { background: linear-gradient(90deg, var(--warning), #f59e0b); }
.progress-fill.danger { background: linear-gradient(90deg, var(--danger), #ef4444); }

/* ─── Charts ─── */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  height: 300px;
  display: flex;
  flex-direction: column;
}

.chart-card canvas {
  flex: 1;
  min-height: 0;
}

.chart-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

/* ─── Info Grid ─── */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.info-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.info-card h3 {
  font-size: 15px;
  margin-bottom: 16px;
  color: var(--text-primary);
}

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

.info-table td {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.info-table td:first-child {
  color: var(--text-secondary);
  width: 100px;
}

.info-table td:last-child {
  color: var(--text-primary);
  font-family: 'SF Mono', 'Cascadia Code', monospace;
}

/* ─── Tables ─── */
.table-container {
  overflow-x: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table tr:hover td {
  background: var(--bg-hover);
}

.data-table .cmd-cell {
  max-width: 400px;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Buttons ─── */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover { background: var(--bg-hover); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); }

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

.btn-danger:hover { background: #ef4444; }

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

.btn-success:hover { background: #22c55e; }

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* ─── Inputs ─── */
.text-input, .search-input, .select-input, .num-input {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.text-input:focus, .search-input:focus, .select-input:focus {
  border-color: var(--accent);
}

.search-input { width: 240px; }
.num-input { width: 80px; }

/* ─── Page Toolbar ─── */
.page-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* ─── Terminal ─── */
.terminal-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.terminal-status {
  font-size: 13px;
  color: var(--danger);
}

.terminal-status.connected {
  color: var(--success);
}

.terminal-container {
  background: #000;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 8px;
  height: calc(100vh - 180px);
  overflow: hidden;
}

.terminal-container .xterm {
  height: 100%;
}

/* ─── Network Tools ─── */
.network-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.tool-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.tool-card h3 {
  margin-bottom: 16px;
  font-size: 15px;
}

.tool-input {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tool-input .text-input { flex: 1; }

.tool-output {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ─── File Editor ─── */
.file-editor-container {
  margin-bottom: 16px;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--border);
  border-bottom: none;
}

.editor-toolbar span {
  flex: 1;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-size: 13px;
  color: var(--text-secondary);
}

.file-editor {
  width: 100%;
  height: 400px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 16px;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-size: 13px;
  resize: vertical;
  outline: none;
  tab-size: 4;
}

.crontab-editor {
  width: 100%;
  height: calc(100vh - 180px);
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-size: 13px;
  resize: none;
  outline: none;
  tab-size: 4;
}

.log-output {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  height: calc(100vh - 180px);
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ─── Breadcrumb ─── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  font-size: 13px;
}

.breadcrumb span {
  cursor: pointer;
  color: var(--accent);
  padding: 2px 4px;
  border-radius: 3px;
}

.breadcrumb span:hover {
  background: var(--bg-hover);
}

.breadcrumb span.current {
  color: var(--text-primary);
  cursor: default;
}

.breadcrumb .sep {
  color: var(--text-muted);
  cursor: default;
}

/* ─── File Actions ─── */
.file-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ─── Network Interfaces ─── */
.iface-card {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
}

.iface-name {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
  font-size: 13px;
}

.iface-detail {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Cascadia Code', monospace;
}

/* ─── Service Status ─── */
.badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.badge-active {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
}

.badge-inactive {
  background: rgba(156, 160, 176, 0.15);
  color: var(--text-muted);
}

.badge-failed {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
}

/* ─── Firewall ─── */
.firewall-block {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.firewall-block-header {
  padding: 14px 20px;
  background: var(--bg-tertiary);
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
}

.firewall-block pre {
  padding: 16px 20px;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 500px;
  overflow-y: auto;
}

/* ─── Toast ─── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #fff;
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
  box-shadow: var(--shadow);
  max-width: 360px;
}

.toast-success { background: #16a34a; }
.toast-error { background: #dc2626; }
.toast-info { background: #2563eb; }

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

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 380px;
  max-width: 500px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 15px;
}

.modal-body {
  padding: 20px 24px;
  font-size: 14px;
  color: var(--text-secondary);
}

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

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

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

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

  .menu-toggle {
    display: block;
  }

  .charts-row, .info-grid, .network-tools {
    grid-template-columns: 1fr;
  }
}

/* ─── Dropzone ─── */
.dropzone {
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  margin-bottom: 16px;
  background: rgba(91,141,239,0.05);
  transition: all 0.2s;
}

.dropzone.dragover {
  background: rgba(91,141,239,0.15);
  border-color: var(--accent-hover);
  transform: scale(1.01);
}

.dropzone-icon { font-size: 48px; margin-bottom: 12px; }
.dropzone-text { color: var(--text-secondary); font-size: 14px; }

/* ─── Upload Progress ─── */
.upload-progress {
  margin-bottom: 12px;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.upload-progress-bar {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}

.upload-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s;
  width: 0%;
}

.upload-progress-text {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ─── Search Panel ─── */
.search-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}

.search-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
}

.search-panel-body {
  padding: 16px;
}

.search-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.search-results {
  max-height: 400px;
  overflow-y: auto;
  font-size: 13px;
}

.search-result-item {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:hover {
  background: var(--bg-hover);
}

.search-result-path {
  color: var(--accent);
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-size: 12px;
  margin-bottom: 2px;
}

.search-result-line {
  color: var(--text-muted);
  font-size: 11px;
}

.search-result-content {
  color: var(--text-secondary);
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.search-result-content mark {
  background: rgba(251, 191, 36, 0.3);
  color: var(--warning);
  border-radius: 2px;
  padding: 0 2px;
}

/* ─── Context Menu ─── */
.context-menu {
  position: fixed;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 0;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 9999;
}

.context-item {
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.context-item:hover {
  background: var(--bg-hover);
}

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

.context-item.danger:hover {
  background: rgba(248, 113, 113, 0.1);
}

.context-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ─── Editor Enhancements ─── */
.editor-wrap {
  display: flex;
  height: 400px;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}

.editor-line-numbers {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.5;
  padding: 16px 8px 16px 12px;
  text-align: right;
  user-select: none;
  overflow: hidden;
  min-width: 48px;
  border-right: 1px solid var(--border);
}

.file-editor {
  flex: 1;
  width: auto;
  height: auto;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: none;
  border-radius: 0;
  padding: 16px;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: none;
  outline: none;
  tab-size: 4;
  white-space: pre;
  overflow: auto;
}

.editor-info {
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 8px;
}

/* ─── File Table Enhancements ─── */
.file-row {
  cursor: default;
}

.file-row .file-name {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.file-row .file-name:hover {
  color: var(--accent);
}

.file-row.selected {
  background: rgba(91,141,239,0.1) !important;
}

/* ─── Input Modal ─── */
#input-modal .modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#input-modal label {
  font-size: 13px;
  color: var(--text-secondary);
}

#input-modal input,
#input-modal select {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
}

#input-modal input:focus {
  border-color: var(--accent);
}

/* ─── Permission Checkboxes ─── */
.perm-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.perm-group {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.perm-group-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.perm-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 2px 0;
  cursor: pointer;
}

.perm-checkbox input {
  width: auto;
  accent-color: var(--accent);
}

.perm-octal {
  text-align: center;
  font-family: monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  padding: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

/* ═══ Login Page ═══ */
.login-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, #0f1117 0%, #1a1d27 50%, #0f1117 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  text-align: center;
}

.login-logo {
  font-size: 48px;
  margin-bottom: 8px;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.login-field {
  text-align: left;
  margin-bottom: 16px;
}

.login-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.login-field input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.login-field input:focus {
  border-color: var(--accent);
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 20px;
  margin-bottom: 8px;
}

.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.login-btn:hover { background: var(--accent-hover); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ═══ App Container ═══ */
.app-container {
  display: flex;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

/* ═══ Sidebar Footer User Info ═══ */
.user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
}

.btn-logout {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
}
.btn-logout:hover { background: var(--danger); color: #fff; }

/* ═══ Info Grid ═══ */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 13px;
}
.info-grid.compact { gap: 4px; }

/* ═══ Core Bars ═══ */
.core-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}
.core-label {
  font-size: 11px;
  width: 40px;
  color: var(--text-muted);
}
.core-pct {
  font-size: 11px;
  width: 35px;
  text-align: right;
  color: var(--text-secondary);
}

/* ═══ Disk/Net Items ═══ */
.disk-item, .net-item, .temp-item, .disk-io-item {
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.disk-item:last-child, .net-item:last-child, .temp-item:last-child, .disk-io-item:last-child {
  border-bottom: none;
}

/* ═══ Progress Bar ═══ */
.progress-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin: 4px 0;
}
.progress-bar.mini { height: 5px; }
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* ═══ Badges ═══ */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.badge-ok { background: rgba(74,222,128,0.15); color: var(--success); }
.badge-err { background: rgba(248,113,113,0.15); color: var(--danger); }

/* ═══ Status Badge ═══ */
.status-badge.status-ok { color: var(--success); }
.status-badge.status-err { color: var(--danger); }

/* ═══ Toast Types ═══ */
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-info { border-left: 3px solid var(--info); }
.toast-warning { border-left: 3px solid var(--warning); }

/* ═══ Text Utilities ═══ */
.text-truncate {
  max-width: 400px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  vertical-align: middle;
}

/* ═══ Dashboard Grid ═══ */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.dashboard-grid .wide-card { grid-column: span 2; }
.dashboard-grid .gauge-card { text-align: center; }

/* ═══ Breadcrumb ═══ */
.breadcrumb {
  padding: 8px 0;
  font-size: 13px;
}
.crumb {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}
.crumb:hover { text-decoration: underline; }
.crumb::after { content: ' / '; color: var(--text-muted); }
.crumb:last-child::after { content: ''; }

/* ═══ File Actions ═══ */
.file-actions {
  white-space: nowrap;
}
.file-actions .btn { margin-right: 4px; }

/* ═══ Responsive ═══ */
@media (max-width: 1200px) {
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid .wide-card { grid-column: span 2; }
}
@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid .wide-card { grid-column: span 1; }
  .sidebar { position: fixed; left: -260px; z-index: 100; transition: left 0.3s; }
  .sidebar.open { left: 0; }
}

/* ═══ Alert List ═══ */
.alert-list { }
.alert-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.alert-item.warning { border-left: 3px solid var(--warning); }
.alert-item.critical { border-left: 3px solid var(--danger); }
.alert-item.acknowledged { opacity: 0.5; }
.alert-msg { flex: 1; font-size: 13px; }
.alert-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.alert-actions .btn { margin-left: 6px; }

/* ═══ Docker Status Cards ═══ */
.docker-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.docker-stat {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}
.docker-stat-val {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}
.docker-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ═══ Container State Badges ═══ */
.state-running { background: rgba(74,222,128,0.15); color: var(--success); }
.state-exited { background: rgba(248,113,113,0.15); color: var(--danger); }
.state-paused { background: rgba(251,191,36,0.15); color: var(--warning); }
.state-created { background: rgba(107,112,132,0.15); color: var(--text-muted); }

/* ═══ Syntax Highlight Editor ═══ */
.code-editor {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.5;
  tab-size: 2;
  white-space: pre;
  overflow-x: auto;
}

/* ═══ Modal Large ═══ */
.modal-lg {
  max-width: 800px;
  width: 90%;
}


/* ─── File Manager ─── */
.file-link {
  cursor: default;
  text-decoration: none;
  color: var(--text);
  transition: color 0.15s;
}
.file-link:hover {
  color: var(--primary);
}
.file-dir {
  cursor: pointer;
  font-weight: 500;
}
.file-dir:hover {
  color: var(--primary);
  text-decoration: underline;
}
#file-table tbody tr:hover {
  background: var(--bg-hover, rgba(99,102,241,0.06));
}
.file-actions {
  white-space: nowrap;
}
.file-actions .btn {
  padding: 2px 8px;
  font-size: 12px;
  margin-right: 4px;
}

/* ─── Network Tools ─── */
.output-pre {
  background: var(--bg-secondary, #1a1a2e);
  color: var(--text, #e0e0e0);
  padding: 12px;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 400px;
  overflow-y: auto;
  margin-top: 8px;
}
#dns-results h4 {
  margin: 12px 0 4px;
  color: var(--text-muted, #888);
  font-size: 14px;
}
.card { margin-bottom: 16px; }
/* ─── Cron Editor ─── */
.cron-editor {
  width: 100%;
  min-height: calc(100vh - 300px);
  height: calc(100vh - 300px);
  resize: vertical;
  padding: 16px;
  border: 1px solid var(--border, #333);
  border-radius: 8px;
  background: var(--bg-secondary, #1a1a2e);
  color: var(--text, #e0e0e0);
  box-sizing: border-box;
}
.cron-editor:focus {
  outline: none;
  border-color: var(--primary, #6366f1);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.2);
}
.cron-help {
  margin-top: 12px;
  font-size: 14px;
}
.cron-help pre {
  background: var(--bg-secondary, #1a1a2e);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
}