@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Geist+Mono:wght@400;500;600&display=swap');

:root {
  --bg-primary: #0a0d1a;
  --bg-secondary: #0d1120;
  --bg-card: #111525;
  --bg-card-hover: #161b30;

  --accent-primary: #a855f7;
  --accent-pink: #ec4899;
  --accent-gradient: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
  --accent-secondary: #22d3ee;
  --accent-danger: #f5495c;
  --accent-success: #2dd4a7;
  --accent-warning: #f5a623;

  --text-primary: #f1f3fb;
  --text-secondary: #8b93ab;
  --text-muted: #5b6280;

  --border-subtle: #1b2034;
  --border-default: #262d49;
  --border-accent: #a855f7;

  --glow-purple: rgba(168, 85, 247, 0.06);
  --glow-cyan: rgba(34, 211, 238, 0.06);

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

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 0 1px rgba(168, 85, 247, 0.12), 0 12px 40px rgba(0, 0, 0, 0.65);
  --shadow-hover: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 16px 40px rgba(0, 0, 0, 0.6);

  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-spring: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(168, 85, 247, 0.07), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 0%, rgba(34, 211, 238, 0.06), transparent 55%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: #262626;
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3a3a3a;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.4rem;
}

h3 {
  font-size: 1.15rem;
}

p {
  color: var(--text-secondary);
}

a {
  text-decoration: none;
  color: inherit;
}

.app-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */

.sidebar {
  width: 250px;
  min-height: 100vh;
  background: linear-gradient(180deg, #0d1120 0%, #090b15 100%);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  transition: var(--transition);
}

.CodeMirror {
  width: 100% !important;
  height: 100% !important;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.65rem;
  margin-bottom: 2rem;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
}

.sidebar-logo .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent-gradient);
  color: #ffffff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.35);
}

.sidebar-logo .logo-text {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.sidebar-logo .logo-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-section {
  margin-bottom: 0.5rem;
}

.nav-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0 0.5rem;
  margin-bottom: 0.55rem;
  margin-top: 1.1rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition-fast);
  border: 1px solid transparent;
  border-left: 2px solid transparent;
  width: 100%;
  background: transparent;
  font-family: 'Inter', sans-serif;
  text-align: left;
  margin-bottom: 0.2rem;
}

.nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: transparent;
  border-left-color: var(--border-default);
  transform: translateX(2px);
}

.nav-item.active {
  background: rgba(168, 85, 247, 0.1);
  color: #d6b8fb;
  border-color: transparent;
  border-left-color: var(--accent-primary);
  font-weight: 600;
  box-shadow: none;
}

.nav-item .nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem;
  border-radius: var(--radius-md);
  background: #0d1120;
  border: 1px solid var(--border-subtle);
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.user-info:hover {
  border-color: var(--border-default);
  background: #161b30;
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--accent-gradient);
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  overflow: hidden;
}

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

.user-name {
  font-size: 0.8rem;
  font-weight: 600;
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ---------- Main content ---------- */

.main-content {
  margin-left: 250px;
  flex: 1;
  padding: 2.5rem 3rem;
  min-height: 100vh;
  background: transparent;
}

body.file-editor-mode .back-link,
body.file-editor-mode .page-header,
body.file-editor-mode .metrics-row,
body.file-editor-mode .tabs {
  display: none;
}

body.file-editor-mode .main-content {
  padding: 1rem 1.5rem !important;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hamburger-menu-btn {
  display: none !important;
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  left: auto;
  z-index: 1001;
  background: rgba(10, 10, 10, 0.85) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  cursor: pointer;
  transition: var(--transition-fast);
  color: var(--text-primary);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.hamburger-menu-btn:hover {
  background: #1e253f;
  border-color: var(--border-default) !important;
}

.hamburger-menu-btn.is-active {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 99;
  backdrop-filter: blur(6px);
  transition: opacity 0.3s ease;
  opacity: 0;
}

.sidebar-overlay.is-visible {
  display: block;
  opacity: 1;
}

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

body.no-scroll {
  overflow: hidden;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.page-title span {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

/* ---------- Stats / cards ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.025), transparent 55%);
  pointer-events: none;
}

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

.stat-icon {
  display: none;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.3rem;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 0.2rem 0.65rem;
  border-radius: 99px;
  font-weight: 500;
}

.systems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1rem;
  max-width: 1200px;
}

.service-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px;
  gap: 0.75rem;
  max-width: 1200px;
  margin-bottom: 1rem;
}

.service-search,
.service-filter-select {
  min-height: 40px;
}

/* ---------- Service cards ---------- */

.service-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 160px;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

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

.service-main {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.service-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.service-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.service-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-success);
  margin-top: 0.35rem;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(45, 212, 167, 0.15);
}

.service-card.offline .service-status-dot {
  background: var(--accent-danger);
  box-shadow: 0 0 0 3px rgba(245, 73, 92, 0.15);
}

.service-mark {
  display: none;
}

.service-title {
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.service-title span {
  color: var(--text-secondary);
  font-weight: 400;
  font-size: 0.85rem;
}

.service-endpoint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-family: 'Geist Mono', monospace;
  margin-top: 0.2rem;
}

.service-code {
  display: inline-block;
  font-family: 'Geist Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-secondary);
  background: #1e253f;
  border: 1px solid var(--border-subtle);
  padding: 0.18rem 0.45rem;
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
}

.service-state {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--text-secondary);
}

.service-metrics {
  display: flex;
  gap: 1rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.75rem;
  margin-top: auto;
}

.service-metric {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.service-metric svg {
  width: 14px;
  height: 14px;
  stroke: var(--text-secondary);
  fill: none;
  stroke-width: 2;
}

.service-metric-value {
  font-family: 'Geist Mono', monospace;
}

.service-actions {
  display: flex;
  border-top: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.015);
}

.service-actions .btn {
  flex: 1;
  border: none;
  border-radius: 0;
  font-size: 0.75rem;
  min-height: 38px;
  background: transparent;
  color: var(--text-secondary);
  border-right: 1px solid var(--border-subtle);
}

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

.service-actions .btn:hover {
  background: #1e253f;
  color: #ffffff;
}

.system-card:hover {
  border-color: var(--border-default);
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

/* ---------- Resource metric charts ---------- */

.metric-chart-panel {
  position: relative;
  z-index: 1;
  margin-bottom: 1rem;
  padding: 0.9rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.012);
}

.metric-chart-row + .metric-chart-row {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border-subtle);
}

.metric-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.metric-chart-head strong {
  font-size: 0.86rem;
  letter-spacing: 0;
  font-family: 'Geist Mono', monospace;
  color: var(--text-primary);
}

.metric-line-chart {
  width: 100%;
  height: 52px;
  display: block;
  overflow: visible;
}

.metric-chart-grid {
  fill: none;
  stroke: #1e253f;
  stroke-width: 1;
}

.metric-chart-fill {
  opacity: 0.08;
}

.metric-chart-line {
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: var(--transition);
}

.metric-chart-row.cpu .metric-chart-line {
  stroke: var(--accent-primary);
}

.metric-chart-row.ram .metric-chart-line {
  stroke: var(--accent-secondary);
}

.metric-chart-row.disk .metric-chart-line {
  stroke: #f5a623;
}

.metric-chart-row.cpu .metric-chart-fill {
  fill: var(--accent-primary);
}

.metric-chart-row.ram .metric-chart-fill {
  fill: var(--accent-secondary);
}

.metric-chart-row.disk .metric-chart-fill {
  fill: #f5a623;
}

/* Resource usage bars (per-container CPU/RAM/disk) */
.resource-bar-track {
  width: 100%;
  height: 6px;
  background: #1e253f;
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.resource-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  background: linear-gradient(90deg, #5ea6ff, #7cc4ff);
}

.resource-bar-fill.ram {
  background: linear-gradient(90deg, #2dd4a7, #5eead4);
}

.resource-bar-fill.disk {
  background: linear-gradient(90deg, #f5a623, #ffc35c);
}

.resource-bar-fill.warning {
  background: linear-gradient(90deg, #f5a623, #ffc35c);
}

.resource-bar-fill.critical {
  background: linear-gradient(90deg, #f5495c, #ff7a87);
}

.system-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.system-card-icon {
  width: 48px;
  height: 48px;
  background: #0d1120;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xs);
}

.system-card-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  letter-spacing: -0.01em;
}

.system-card-port {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'Geist Mono', monospace;
}

/* ---------- Status badges ---------- */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.78rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.status-badge.online {
  background: rgba(45, 212, 167, 0.1);
  border: 1px solid rgba(45, 212, 167, 0.22);
  color: var(--accent-success);
}

.status-badge.online .dot {
  background: var(--accent-success);
  animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(45, 212, 167, 0.45);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(45, 212, 167, 0);
  }
}

.status-badge.offline {
  background: rgba(245, 73, 92, 0.1);
  border: 1px solid rgba(245, 73, 92, 0.22);
  color: var(--accent-danger);
}

.status-badge.offline .dot {
  background: var(--accent-danger);
}

.system-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.015);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.meta-item {
  flex: 1;
  text-align: center;
}

.meta-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'Geist Mono', monospace;
}

.meta-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
  font-weight: 500;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: #ffffff;
  transition: var(--transition-fast);
  outline: none;
  font-family: 'Inter', sans-serif;
}

.btn:hover {
  border-color: var(--border-default);
}

.btn:active {
  transform: scale(0.97);
}

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

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.3);
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.4);
}

.btn-success {
  background: rgba(45, 212, 167, 0.1);
  color: var(--accent-success);
  border-color: rgba(45, 212, 167, 0.22);
}

.btn-success:hover {
  background: var(--accent-success);
  color: #000000;
  border-color: var(--accent-success);
}

.btn-danger {
  background: rgba(245, 73, 92, 0.1);
  color: var(--accent-danger);
  border-color: rgba(245, 73, 92, 0.22);
}

.btn-danger:hover {
  background: var(--accent-danger);
  color: #ffffff;
  border-color: var(--accent-danger);
}

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

.btn-ghost:hover {
  background: #161b30;
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-cyan {
  background: rgba(34, 211, 238, 0.1);
  border-color: rgba(34, 211, 238, 0.25);
  color: var(--accent-secondary);
}

.btn-cyan:hover {
  background: var(--accent-secondary);
  color: #04222b;
  border-color: var(--accent-secondary);
}

.btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  min-height: auto;
}

.btn-icon {
  padding: 0.55rem;
  aspect-ratio: 1;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: stretch;
  margin-top: auto;
  position: relative;
  z-index: 1;
}

.card-actions .btn {
  flex: 1 1 96px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

/* ---------- Toasts ---------- */

#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid;
  min-width: 260px;
  max-width: 380px;
  animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: #0d1120;
  box-shadow: var(--shadow-glow);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast.success {
  border-color: rgba(45, 212, 167, 0.35);
  color: var(--accent-success);
}

.toast.error {
  border-color: rgba(245, 73, 92, 0.35);
  color: var(--accent-danger);
}

.toast.info {
  border-color: var(--border-default);
  color: #ffffff;
}

.toast.warning {
  border-color: rgba(245, 166, 35, 0.35);
  color: var(--accent-warning);
}

.toast-icon {
  font-size: 1.1rem;
}

/* ---------- Login ---------- */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-glow);
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.login-logo-icon {
  width: 56px;
  height: 56px;
  background: var(--accent-gradient);
  color: #ffffff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.35);
}

.login-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.login-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: #0a0d18;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: 'Inter', sans-serif;
  transition: var(--transition-fast);
  outline: none;
}

.form-input:focus {
  border-color: #555555;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

select.form-input option {
  background-color: #0d1120;
  color: var(--text-primary);
}

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

.form-help {
  display: block;
  margin-top: 0.4rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.btn-login {
  width: 100%;
  padding: 0.85rem;
  background: var(--accent-gradient);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.1);
}

.btn-login:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.4);
}

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

.btn-login:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.login-error {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(245, 73, 92, 0.1);
  border: 1px solid rgba(245, 73, 92, 0.22);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--accent-danger);
  text-align: center;
  display: none;
}

/* ---------- Tabs ---------- */

.tabs {
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
  display: flex;
  gap: 0.25rem;
}

.tab-btn {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition-fast);
  margin-bottom: -1px;
}

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

.tab-btn.active {
  color: #e9d5ff;
  border-bottom-color: var(--accent-primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

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

/* ---------- Files workspace ---------- */

.files-workspace {
  min-height: calc(100vh - 270px);
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
}

.files-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.8rem;
}

.files-header.hidden,
.editor-header {
  display: none;
}

.editor-header.active {
  display: flex;
}

.files-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.15rem;
}

.files-path {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem;
}

.files-path span {
  color: var(--text-primary);
}

.files-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.file-manager {
  display: block;
  min-height: 620px;
}

.file-tree {
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: auto;
  padding: 0;
  max-width: 1120px;
}

.file-list-head,
.file-row {
  display: grid;
  grid-template-columns: 34px minmax(260px, 1fr) 150px 250px 34px;
  align-items: center;
  gap: 0.9rem;
  text-align: center;
}

.file-list-head {
  padding: 0 0 0.85rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-subtle);
}

.file-list-body {
  min-width: 760px;
}

.file-item {
  min-height: 49px;
  padding: 0;
  border-radius: 0;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  transition: var(--transition-fast);
}

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

.file-item.selected,
.file-item.multi-selected {
  background: #1a2038;
}

.file-item.dir .file-icon {
  color: var(--text-secondary);
}

.file-select,
.file-select-head {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  justify-self: center;
  margin-left: 4px;
  cursor: pointer;
  transition: var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border-default);
  background: #0a0d18;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.file-select:hover,
.file-select-head:hover {
  border-color: #6a6a6a;
}

.file-select:checked,
.file-select-head:checked {
  background: #ffffff;
  border-color: #ffffff;
}

.file-select:checked::after,
.file-select-head:checked::after {
  content: "";
  width: 4px;
  height: 8px;
  border: solid #000;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.file-select-head:indeterminate {
  background: #1a2038;
  border-color: #ffffff;
}

.file-select-head:indeterminate::after {
  content: "";
  width: 8px;
  height: 2px;
  background: #ffffff;
  display: block;
}

.file-name-wrap {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.8rem;
  font-weight: 500;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  color: var(--text-secondary);
}

.file-size,
.file-modified {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: 'Geist Mono', monospace;
}

.file-menu-dots {
  color: var(--text-primary);
  font-size: 1.35rem;
  line-height: 1;
  text-align: center;
}

.context-menu {
  position: fixed;
  z-index: 2000;
  display: none;
  min-width: 180px;
  padding: 0.35rem;
  background: #111525;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glow);
}

.context-menu.open {
  display: block;
  animation: fadeIn 0.15s ease;
}

.context-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.65rem;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
}

.context-menu button:hover {
  background: #1e253f;
  color: var(--text-primary);
}

.context-menu button.danger {
  color: var(--accent-danger);
}

.context-menu button[hidden] {
  display: none;
}

/* ---------- Editor ---------- */

.file-editor {
  display: none;
  background: #0a0d18;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  height: calc(100vh - 250px) !important;
  min-height: 400px !important;
  width: 100%;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

body.file-editor-mode .file-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100% !important;
  min-height: 0 !important;
  width: 100%;
  min-width: 0;
}

.file-manager.editor-open .file-tree {
  display: none;
}

.file-manager.editor-open .file-editor {
  display: flex;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: #0d1120;
  border-bottom: 1px solid var(--border-subtle);
}

.editor-filename {
  display: none;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: monospace;
  color: var(--accent-secondary);
}

.editor-textarea {
  display: none;
  flex: 1;
  width: 100%;
  min-height: 0;
  background: #0a0d18;
  border: none;
  outline: none;
  color: #e2e8f0;
  font-family: 'Geist Mono', Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.7;
  padding: 1rem;
  resize: none;
  tab-size: 2;
  overflow-y: auto;
}

#cm-editor {
  flex: 1;
  min-height: 0;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  display: none;
  flex-direction: column;
  background: #0a0d18;
}

#cm-editor .cm-editor {
  height: 100%;
  width: 100%;
  min-width: 0;
  flex: 1;
  min-height: 0;
}

#cm-editor .cm-scroller {
  height: 100%;
  width: 100%;
  min-width: 0;
  min-height: 0;
}

.lang-badge {
  display: none;
  font-family: monospace;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 9px;
  border-radius: 999px;
  align-items: center;
  line-height: 1.5;
  white-space: nowrap;
  user-select: none;
}

/* ---------- Console ---------- */

.console-container {
  background: #0a0d18;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  height: 540px;
  overflow: hidden;
  font-family: 'Geist Mono', Consolas, monospace;
  position: relative;
  box-shadow: var(--shadow-card);
}

.console-container::after {
  display: none;
}

.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: #0d1120;
  border-bottom: 1px solid var(--border-subtle);
  z-index: 11;
}

.console-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.console-dot.red {
  background: var(--accent-danger);
}

.console-dot.yellow {
  background: #f59e0b;
}

.console-dot.green {
  background: var(--accent-success);
}

.console-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

#console-system-label,
button[id*="clear"], button[class*="clear"],
button[id*="limpiar"], button[class*="limpiar"] {
  display: none !important;
}

.console-output {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  font-size: 0.82rem;
  line-height: 1.6;
  z-index: 5;
}

.console-line {
  margin-bottom: 0.25rem;
  word-break: break-all;
  font-weight: 500;
}

.console-timestamp {
  color: var(--text-muted);
  margin-right: 0.6rem;
  user-select: none;
  font-weight: 400;
  opacity: 0.85;
}

.console-line.cmd {
  color: var(--accent-secondary);
}

.console-line.out {
  color: #ffffff;
}

.console-line.err {
  color: var(--accent-danger);
}

.console-line.sys {
  color: var(--text-secondary);
}

.console-input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  background: #0d1120;
  z-index: 11;
  transition: var(--transition);
}

.console-input-row:focus-within {
  background: #161b30;
}

.console-prompt {
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.console-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  caret-color: #ffffff;
}

.logs-container {
  background: #0a0d18;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  height: 520px;
  overflow-y: auto;
  font-family: 'Geist Mono', monospace;
  font-size: 0.78rem;
  line-height: 1.8;
  color: #ffffff;
  white-space: pre-wrap;
  word-break: break-all;
  box-shadow: var(--shadow-card);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  margin-bottom: 1.5rem;
}

.back-link:hover {
  background: #161b30;
  color: var(--text-primary);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.875rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
  .page-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 1.25rem !important;
    margin-bottom: 1.5rem !important;
  }

  .page-header > div:first-child {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem !important;
  }

  #system-controls {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    width: 100% !important;
  }

  #system-controls .btn {
    flex: 1 1 calc(50% - 0.25rem) !important;
    min-width: 110px !important;
    justify-content: center !important;
  }

  .sidebar {
    transform: translateX(-100%);
    background: #060606 !important;
    backdrop-filter: none !important;
    width: 280px !important;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.7);
  }

  .table-panel {
    padding: 1rem !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .form-panel {
    padding: 1.25rem !important;
    overflow: visible !important;
  }

  .form-grid,
  .form-grid.wide {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }

  .form-grid .form-group {
    margin-bottom: 0.25rem !important;
  }

  .form-grid > .btn {
    margin-top: 0.5rem !important;
    width: 100% !important;
  }

  .data-table {
    min-width: 550px !important;
  }

  .metrics-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
    width: 100% !important;
  }

  .metrics-row .metric-card {
    width: 100% !important;
    min-width: 0 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  }

  .metric-value {
    align-self: flex-start !important;
    font-size: 0.9rem !important;
  }

  #system-port-label {
    display: inline-block !important;
    font-family: 'Geist Mono', monospace;
    font-weight: 700;
    color: var(--text-muted);
    margin-left: 0.5rem !important;
  }

  #system-port-label {
    font-family: 'Geist Mono', monospace;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-left: 0.5rem;
    vertical-align: middle;
  }

  .sidebar.is-open {
    transform: translateX(0) !important;
  }

  .hamburger-menu-btn {
    display: flex !important;
  }

  .main-content {
    margin-left: 0;
    padding: 1.5rem 1rem;
  }

  .file-manager {
    grid-template-columns: 1fr;
    height: auto;
  }

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

  .service-filters {
    grid-template-columns: 1fr;
  }

  .service-card {
    grid-template-columns: 1fr;
  }

  .service-top {
    padding: 1rem;
  }

  .service-title {
    font-size: 1rem;
  }

  .service-metrics {
    grid-template-columns: 1fr;
    align-items: start;
    padding: 0.85rem 1rem;
  }

  .service-metric {
    justify-content: flex-start;
  }

  .service-actions {
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    border-left: 0;
    border-top: 1px solid var(--border-subtle);
  }

  .service-actions .btn {
    flex: 1 1 120px;
  }

  .tabs {
    overflow-x: auto !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch;
    gap: 0.25rem !important;
    padding-bottom: 2px !important;
  }

  .tab-btn {
    flex: 0 0 auto !important;
    padding: 0.5rem 0.85rem !important;
    font-size: 0.8rem !important;
  }

  .files-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.85rem !important;
  }

  .files-actions {
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }

  .file-tree {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
  }

  .file-list-head,
  .file-row {
    min-width: 700px !important;
  }

  .editor-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }

  .editor-toolbar > div {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }

  .console-container,
  .logs-container {
    height: 420px !important;
  }

  .stats-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
    width: 100% !important;
  }

  .stats-grid .stat-card {
    width: 100% !important;
    min-width: 0 !important;
    padding: 1rem !important;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
  }
  #system-controls .btn {
    flex: 1 1 100% !important;
  }
}

/* ---------- Utility classes ---------- */

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 0.75rem;
}

.mt-1 {
  margin-top: 0.25rem;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.75rem;
}

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

.font-mono {
  font-family: monospace;
}

.w-full {
  width: 100%;
}

.hidden {
  display: none;
}

.form-panel,
.table-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
}

.form-panel:hover,
.table-panel:hover {
  border-color: var(--border-default);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  align-items: end;
}

.form-grid .form-group {
  margin-bottom: 0;
}

.form-grid.wide {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-grid > .btn {
  width: 100%;
  min-height: 43px;
  align-self: end;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  padding: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

.data-table th {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.data-table tbody tr {
  transition: var(--transition-fast);
}

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

.icon {
  display: inline-block;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.15em;
}

.icon-xs {
  width: 14px;
  height: 14px;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

.icon-md {
  width: 20px;
  height: 20px;
}

.icon-lg {
  width: 24px;
  height: 24px;
}

.icon-xl {
  width: 28px;
  height: 28px;
}

.icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.icon-tile.purple {
  background: rgba(168, 85, 247, 0.12);
  color: var(--accent-primary);
}

.icon-tile.cyan {
  background: rgba(34, 211, 238, 0.12);
  color: var(--accent-secondary);
}

.icon-tile.green {
  background: rgba(45, 212, 167, 0.1);
  color: var(--accent-success);
}

.icon-tile.red {
  background: rgba(245, 73, 92, 0.1);
  color: var(--accent-danger);
}

.icon-tile.amber {
  background: rgba(245, 166, 35, 0.1);
  color: var(--accent-warning);
}

.icon-tile.neutral {
  background: var(--bg-card);
  color: var(--text-secondary);
}

.nav-item .icon {
  color: inherit;
  opacity: 0.85;
}

.nav-item.active .icon {
  opacity: 1;
}

/* ---------- Metrics ---------- */

.metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
}

.metric-card:hover {
  border-color: var(--border-default);
}

.metric-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.metric-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.metric-value {
  font-size: 0.95rem;
  font-weight: 700;
  font-family: 'Geist Mono', monospace;
  color: var(--text-primary);
}

.metric-value .metric-trend {
  font-size: 0.68rem;
  font-weight: 600;
  margin-left: 0.35rem;
  font-family: 'Inter', sans-serif;
}

.metric-trend.up {
  color: var(--accent-danger);
}

.metric-trend.down {
  color: var(--accent-success);
}

.metric-trend.flat {
  color: var(--text-muted);
}

.sparkline {
  width: 100%;
  height: 44px;
  display: block;
  overflow: visible;
}

.sparkline .spark-fill {
  fill: url(#sparkGradient);
  opacity: 0.1;
}

.sparkline .spark-line {
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: d 0.3s ease;
}

.sparkline.purple .spark-line {
  stroke: var(--accent-primary);
}

.sparkline.cyan .spark-line {
  stroke: var(--accent-secondary);
}

.sparkline.green .spark-line {
  stroke: var(--accent-success);
}

.sparkline.amber .spark-line {
  stroke: var(--accent-warning);
}

.sparkline .spark-dot {
  fill: currentColor;
}

.system-meta.with-metrics {
  flex-wrap: wrap;
}

.meta-spark {
  flex: 1 1 100%;
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-subtle);
}

.meta-spark-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.meta-spark-row + .meta-spark-row {
  margin-top: 0.5rem;
}

.meta-spark-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  width: 38px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.meta-spark-svg {
  flex: 1;
  height: 22px;
}

.meta-spark-value {
  font-size: 0.72rem;
  font-family: 'Geist Mono', monospace;
  color: var(--text-secondary);
  width: 38px;
  text-align: right;
  flex-shrink: 0;
}

.metrics-grid-top {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.metric-card-simple {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
}

.metric-card-simple:hover {
  border-color: var(--border-default);
}

.metric-card-simple .metric-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.metric-value-simple {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .metrics-grid-top {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
    width: 100% !important;
    overflow: visible !important;
  }

  .metrics-grid-top .metric-card-simple {
    flex: none !important;
    min-width: 0 !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0.6rem 1rem !important;
  }

  .metrics-grid-top .metric-card-simple .metric-label {
    margin-bottom: 0 !important;
  }

  .metrics-grid-top .metric-card-simple .metric-value-simple {
    font-size: 0.9rem !important;
  }
}

.breadcrumb-link {
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.breadcrumb-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.force-password-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.force-password-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-glow);
}

.force-password-title {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #ffffff;
}

.force-password-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.role-badge.admin {
  background: #ffffff;
  border: 1px solid #ffffff;
  color: #000000;
}

.role-badge.user {
  background: #1a2038;
  border: 1px solid var(--border-subtle);
  color: #ffffff;
}

.remove-tag-btn:hover {
  color: var(--accent-danger) !important;
  opacity: 1 !important;
}

.search-result-row:hover {
  background: #161b30 !important;
}

.sidebar .tab-btn {
  color: #ffffff !important;
}

.sidebar .tab-btn.active {
  background: #1a2038 !important;
  border: 1px solid var(--border-subtle) !important;
  color: #ffffff !important;
}

#content-files.drag-over {
  border: 2px dashed #ffffff !important;
  background: #161b30 !important;
  position: relative;
}

#content-files.drag-over::after {
  content: "📥 Arrastra aquí para subir";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  z-index: 1000;
  pointer-events: none;
}