:root,
html[data-theme="dark"] {
  --bg: #0b1120;
  --bg-card: #111827;
  --bg-elevated: #1e293b;
  --bg-input: #0f172a;
  --border: #334155;
  --text: #f8fafc;
  --text-label: #cbd5e1;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --code-bg: #090d16;
  --code-text: #e2e8f0;
  --radius: 12px;
}

html[data-theme="light"] {
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-input: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-label: #334155;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --code-bg: #0f172a;
  --code-text: #f8fafc;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  transition: background-color 0.2s ease, color 0.2s ease;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

/* Auth View */
.auth-wrapper {
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
}

/* Layout z pełną szerokością i lewym Sidebarem */
.app-layout {
  display: flex;
  width: 100vw;
  min-height: 100vh;
  max-width: none;
  margin: 0;
  padding: 0;
  position: relative;
}

/* Sidebar wzorowany na Google AI Studio */
.sidebar {
  width: 250px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 30;
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.sidebar.collapsed {
  width: 68px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
  min-height: 65px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.brand-name {
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-tag {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar.collapsed .brand-text {
  display: none;
}

.sidebar-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  padding: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  color: var(--text);
  background: var(--bg-elevated);
}

.sidebar-nav {
  padding: 12px 8px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-section-header {
  padding: 14px 12px 4px;
  margin-top: 4px;
}

.sidebar-section-title {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.sidebar.collapsed .sidebar-section-header {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  white-space: nowrap;
}

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

.nav-item.active {
  font-weight: 600;
  color: var(--text);
  background: var(--bg-elevated);
}

html[data-theme="dark"] .nav-item.active {
  background: #1e293b;
  color: #38bdf8;
}

html[data-theme="light"] .nav-item.active {
  background: #e2e8f0;
  color: #1d4ed8;
}

.nav-icon {
  flex-shrink: 0;
}

.sidebar.collapsed .nav-item {
  position: relative;
  justify-content: center;
  padding: 10px 0;
  width: 44px;
  margin: 3px auto;
}

.sidebar.collapsed .nav-label {
  display: none;
}

/* Wskaźnik statusu kontenerów przy przycisku Pulpit */
.nav-status-indicator {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.status-green {
  color: #10b981;
}

.status-amber {
  color: #f59e0b;
}

.status-red {
  color: #ef4444;
}

.sidebar.collapsed .nav-status-indicator {
  position: absolute;
  top: 4px;
  right: 4px;
}

.sidebar.collapsed .nav-status-indicator svg {
  width: 8px;
  height: 8px;
}

/* Odznaka i obramowanie przycisków w sidebarze */
.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  transition: all 0.15s ease;
}

.sidebar.collapsed .nav-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  min-width: 8px;
  padding: 0;
  border-radius: 50%;
  font-size: 0;
  line-height: 0;
  border: 1.5px solid var(--bg-card);
}

.nav-item.nav-item-warning {
  border-left: 3px solid #f59e0b;
}

.nav-item.nav-item-ok {
  border-left: 3px solid #10b981;
}

.nav-item.nav-item-danger {
  border-left: 3px solid #ef4444;
}

/* 3 ostatnie kopie zapasowe w sekcji Utrzymanie w sidebarze */
.sidebar-recent-backups {
  margin: 6px 4px 10px;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 11px;
  transition: opacity 0.2s ease;
}

.sidebar.collapsed .sidebar-recent-backups {
  display: none;
}

.sidebar-backups-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.sidebar-backups-header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.sidebar-backups-spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  line-height: 1;
}

.sidebar-backups-spinner.hidden {
  display: none !important;
}

.sidebar-backups-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10px;
  color: var(--text-muted);
}

.sidebar-backups-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 9999px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.sidebar-backups-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 24px;
}

.sidebar-backup-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-backup-loading .spinner-circle {
  color: var(--primary);
}

.sidebar-backup-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
  font-size: 11px;
}

.sidebar-backup-item:hover {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--primary);
}

.sidebar-backup-icon {
  color: #10b981;
  flex-shrink: 0;
  display: inline-flex;
}

.sidebar-backup-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  line-height: 1.25;
}

.sidebar-backup-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.sidebar-backup-time {
  font-size: 10px;
  color: var(--text-muted);
}

.sidebar-backup-empty {
  color: var(--text-muted);
  font-size: 11px;
  padding: 6px 2px;
  text-align: center;
}

/* Dolny pasek sidebara: język, motyw, wylogowanie */
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-surface);
  transition: padding 0.2s ease;
}

.sidebar-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar.collapsed .sidebar-footer {
  padding: 10px 4px;
}

.sidebar.collapsed .sidebar-footer-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.sidebar.collapsed .lang-toggle-group {
  padding: 2px;
  width: 36px;
  justify-content: center;
}

.sidebar.collapsed .lang-divider,
.sidebar.collapsed .lang-btn:not(.active) {
  display: none;
}

.sidebar.collapsed .lang-btn.active {
  padding: 4px 6px;
  width: 100%;
  text-align: center;
}

.sidebar.collapsed .theme-toggle-group {
  padding: 2px;
  width: 36px;
  justify-content: center;
}

.sidebar.collapsed .theme-icon-btn:not(.active) {
  display: none;
}

.sidebar.collapsed .theme-icon-btn.active {
  width: 100%;
}

.sidebar.collapsed .logout-icon-btn {
  width: 36px;
  padding: 6px 0;
  justify-content: center;
}

/* Wybór języka EN/PL */
.lang-toggle-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  transition: all 0.15s ease;
}

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

.lang-btn.active {
  background: var(--primary);
  color: #fff;
}

.lang-divider {
  color: var(--text-muted);
  opacity: 0.4;
  font-size: 10px;
  user-select: none;
}

/* Wybór motywu z 3 ikonami: Słońce, Księżyc, System */
.theme-toggle-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.theme-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

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

.theme-icon-btn.active {
  background: var(--primary);
  color: #fff;
}

/* Przycisk wylogowania z drzwiczkami */
.logout-icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.logout-icon-btn:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.1);
}

/* Baner 2FA na samej górze sekcji Bezpieczeństwo */
.security-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.security-banner-inner {
  display: flex;
  align-items: center;
  gap: 14px;
}

.security-banner-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.security-banner-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* Główny obszar roboczy (Main Wrapper) */
.main-wrapper {
  flex: 1;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px 40px 64px;
  position: relative;
  overflow-y: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 18px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 16px;
}

.current-view-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-select {
  width: auto !important;
  padding: 6px 10px !important;
  font-size: 13px !important;
}

/* Karty i siatka (Grid) */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 18px;
}

.card-subtitle {
  margin-top: 0;
  margin-bottom: 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

/* Formularze */
.form-group {
  margin-bottom: 16px;
}

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

.form-group small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}

textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  min-height: 110px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
}

/* Przyciski */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}

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

.btn-secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  opacity: 0.9;
}

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

.btn-success:hover {
  background: #059669;
}

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

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

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

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-running {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-stopped {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

/* Karta usługi */
.service-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.service-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.service-title {
  font-weight: 700;
  font-size: 15px;
  margin: 0;
}

.service-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 6px 0 0;
}

.service-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Okno logów z filtrami i formatowaniem JSON */
.logs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.logs-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.logs-refresh-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 4px;
  gap: 4px;
}

.logs-refresh-group .btn {
  border: none;
  background: transparent;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: none;
}

.logs-refresh-group .btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.logs-refresh-select {
  border: none !important;
  background: transparent !important;
  font-size: 12px !important;
  padding: 4px 6px !important;
  color: var(--text) !important;
  cursor: pointer;
  outline: none;
  font-weight: 500;
  box-shadow: none !important;
}

.logs-refresh-select option {
  background: var(--bg-card);
  color: var(--text);
}

.live-indicator-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ef4444;
  padding: 2px 7px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin-right: 4px;
  user-select: none;
}

.live-indicator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 6px #ef4444;
  animation: pulse-live 1.2s infinite ease-in-out;
}

@keyframes pulse-live {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.3;
    transform: scale(0.75);
  }
}

.spinning-icon {
  animation: spin-refresh 0.8s linear infinite;
}

@keyframes spin-refresh {
  100% {
    transform: rotate(360deg);
  }
}

.logs-filters-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.logs-search-wrapper {
  flex: 1;
  min-width: 220px;
}

.logs-level-wrapper select {
  width: auto !important;
}

.logs-count-badge {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border-radius: 6px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.logs-viewport {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 220px;
  max-height: 480px;
  overflow-y: auto;
  overflow-x: auto;
  scroll-behavior: smooth;
  position: relative;
}

.logs-empty-hint {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.logs-formatted-list {
  display: flex;
  flex-direction: column;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
}

.log-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 4px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.log-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.log-num {
  color: var(--text-muted);
  width: 34px;
  text-align: right;
  user-select: none;
  flex-shrink: 0;
  opacity: 0.5;
  font-size: 11px;
}

.log-time {
  color: #94a3b8;
  flex-shrink: 0;
  font-size: 11px;
  padding-top: 1px;
}

.log-badge {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}

.log-badge-error {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.log-badge-warn {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.log-badge-info {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.log-badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.log-msg {
  flex: 1;
  word-break: break-word;
  white-space: pre-wrap;
  color: var(--code-text);
}

.log-json-details {
  margin-top: 4px;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  color: #cbd5e1;
}

/* Pionowy motyw graficzny z logo po prawej stronie */
.side-brand-ribbon {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 36px;
  pointer-events: none;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.18;
  transition: opacity 0.2s ease;
}

.side-brand-ribbon svg {
  width: 100%;
  height: 100%;
}

html[data-theme="light"] .side-brand-ribbon {
  opacity: 0.12;
  color: #2563eb;
}

html[data-theme="dark"] .side-brand-ribbon {
  opacity: 0.22;
  color: #38bdf8;
}

/* Alerty i preformatted */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.alert-error {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.alert-success {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #10b981;
}

pre.code-box {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  overflow-x: auto;
  overflow-y: auto;
  font-size: 12px;
  color: var(--code-text);
  max-height: 480px;
  scroll-behavior: smooth;
  margin: 0;
}

.qr-box {
  background: #fff;
  padding: 12px;
  border-radius: 10px;
  display: inline-block;
  margin: 12px 0;
}

/* Przycisk menu mobilnego w topbarze */
.mobile-menu-btn {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
  padding: 6px 8px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 12px;
  transition: all 0.15s ease;
}

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

/* Tło przyciemniające przy otwartym menu mobilnym */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 45;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

.btn-icon {
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Tabele danych (lista obrazów Docker) */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  margin-top: 10px;
}

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

.data-table th {
  background: var(--bg-elevated);
  padding: 10px 14px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

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

@media (max-width: 900px) {
  .mobile-menu-btn {
    display: inline-flex;
  }

  /* Na mobilkach przycisk w nagłówku sidebara staje się wyraźnym 'X' do zamykania szuflady */
  .icon-toggle-desktop {
    display: none !important;
  }
  .icon-close-mobile {
    display: inline-block !important;
  }

  /* Na urządzeniach mobilnych sidebar ZAWSZE jest szufladą wysuwaną z lewej i nigdy nie zwęża się do samych ikon */
  .sidebar,
  .sidebar.collapsed {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    width: 280px !important;
    max-width: 85vw !important;
    transform: translateX(-100%) !important;
    box-shadow: none !important;
    z-index: 50 !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }

  .sidebar.mobile-open,
  .sidebar.collapsed.mobile-open {
    transform: translateX(0) !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.45) !important;
  }

  /* Przywrócenie pełnych etykiet i układu dla menu mobilnego */
  .sidebar .brand-text,
  .sidebar.collapsed .brand-text,
  .sidebar .sidebar-section-header,
  .sidebar.collapsed .sidebar-section-header,
  .sidebar .nav-label,
  .sidebar.collapsed .nav-label {
    display: block !important;
  }

  .sidebar .nav-item,
  .sidebar.collapsed .nav-item {
    width: 100% !important;
    justify-content: flex-start !important;
    padding: 10px 14px !important;
    margin: 3px 0 !important;
  }

  .sidebar .nav-badge,
  .sidebar.collapsed .nav-badge {
    position: static !important;
    font-size: 10px !important;
    width: auto !important;
    height: auto !important;
    min-width: auto !important;
    padding: 2px 7px !important;
    border-radius: 9999px !important;
    line-height: normal !important;
    border: none !important;
  }

  .sidebar .sidebar-recent-backups,
  .sidebar.collapsed .sidebar-recent-backups {
    display: block !important;
  }

  .sidebar .sidebar-footer,
  .sidebar.collapsed .sidebar-footer {
    padding: 14px 16px !important;
  }

  .sidebar .sidebar-footer-row,
  .sidebar.collapsed .sidebar-footer-row {
    flex-direction: row !important;
    justify-content: space-between !important;
    width: 100% !important;
  }

  .sidebar .lang-toggle-group,
  .sidebar.collapsed .lang-toggle-group,
  .sidebar .theme-toggle-group,
  .sidebar.collapsed .theme-toggle-group {
    width: auto !important;
  }

  .sidebar .lang-divider,
  .sidebar.collapsed .lang-divider,
  .sidebar .lang-btn,
  .sidebar.collapsed .lang-btn,
  .sidebar .theme-icon-btn,
  .sidebar.collapsed .theme-icon-btn {
    display: inline-flex !important;
  }

  .main-wrapper {
    padding: 16px 14px 60px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .side-brand-ribbon {
    display: none;
  }
}

/* Passkeys & Trusted Devices */
.passkey-item,
.device-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  gap: 12px;
  flex-wrap: wrap;
}

.passkey-info,
.device-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.passkey-icon,
.device-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.passkey-meta,
.device-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.passkey-name,
.device-name {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-main);
}

.passkey-detail,
.device-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Terminal Card for Live Updates Output */
.terminal-card {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.terminal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.terminal-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.terminal-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.terminal-dots .dot-red {
  background: #ef4444;
}

.terminal-dots .dot-yellow {
  background: #f59e0b;
}

.terminal-dots .dot-green {
  background: #10b981;
}

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

.terminal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.terminal-content {
  margin: 0;
  padding: 14px 16px;
  background: transparent;
  color: #38bdf8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  max-height: 420px;
  min-height: 160px;
  overflow-y: auto;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  scroll-behavior: smooth;
}

/* Borg Archive Preview and File Explorer */
.archive-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.archive-stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, monospace;
}

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

.text-success {
  color: var(--success) !important;
}

.archive-volumes-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.archive-vol-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.archive-vol-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.archive-vol-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.archive-vol-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.archive-vol-badge {
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

.search-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}

.search-input:focus {
  border-color: var(--primary);
}

/* Diagnostyczny panel błędów (Tryb Dev / Błędy krytyczne) */
.debug-error-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  max-width: 520px;
  width: calc(100vw - 48px);
  background: var(--bg-card);
  border: 2px solid var(--danger);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  padding: 16px;
  z-index: 99999;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  animation: slideInUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.debug-toast-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--danger);
}

.debug-toast-msg {
  word-break: break-word;
  line-height: 1.4;
  margin-bottom: 8px;
  color: var(--text);
}

.debug-toast-stack {
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: #f87171;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  line-height: 1.4;
  max-height: 180px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

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

/* Wskaźniki ładowania (Spinner) i stany pobierania danych */
.spinner-circle {
  animation: spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

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

/* Globalny wskaźnik ładowania w nagłówku strony */
.topbar-spinner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(59, 130, 246, 0.12);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(59, 130, 246, 0.3);
  letter-spacing: 0.3px;
  animation: fadeIn 0.15s ease-out;
}

.topbar-spinner .spinner-circle {
  width: 14px;
  height: 14px;
}

/* Stan ładowania danych wewnątrz kart (Placeholder) */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  width: 100%;
  grid-column: 1 / -1;
  animation: fadeIn 0.2s ease;
}

.loading-state .spinner-circle {
  color: var(--primary);
  width: 28px;
  height: 28px;
}

/* Płynne pojawianie się załadowanych kart usług i list */
.service-card,
.archive-vol-card,
.archive-stat-card {
  animation: fadeIn 0.25s ease-out;
}

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

/* Okna modalne (Modals) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-card-danger {
  border-color: rgba(239, 68, 68, 0.5);
}

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

.modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.15s, background-color 0.15s;
}

.btn-modal-close:hover {
  color: var(--text);
  background-color: var(--bg-hover);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Checkbox stylu AIO */
.aio-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  border-radius: 4px;
}

/* Karta kontenera po zaznaczeniu */
.service-card.selected {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.05);
  box-shadow: 0 0 0 1px var(--primary);
}

.containers-toolbar {
  animation: fadeIn 0.2s ease-out;
}

.bulk-actions-group {
  animation: fadeIn 0.15s ease-out;
}

