/* ============================================================
   Hermes Hub Portal — Feuille de style partagée
   Commentaires en français, identifiants de code en anglais
   ============================================================ */

/* ----- Thème sombre (défaut) ----- */
:root,
[data-theme="dark"] {
  --bg-primary: #0f1117;
  --bg-secondary: #161822;
  --bg-card: #1c1e2e;
  --bg-input: #222438;
  --bg-hover: #262840;
  --bg-sidebar: #12141e;
  --bg-header: #12141ee0;

  --text-primary: #e4e6f0;
  --text-secondary: #8b8fa3;
  --text-muted: #5c5f73;

  --border-color: #2a2d3e;
  --border-light: #222438;

  --accent: #4a9eff;
  --accent-hover: #6ab0ff;
  --accent-bg: rgba(74, 158, 255, 0.12);

  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --info: #4a9eff;
  --info-bg: rgba(74, 158, 255, 0.12);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);

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

  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --transition: 200ms ease;

  --header-height: 56px;
  --sidebar-width: 240px;
}

/* ----- Thème clair ----- */
[data-theme="light"] {
  --bg-primary: #f4f5f9;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #eef0f5;
  --bg-hover: #e8eaf2;
  --bg-sidebar: #ffffff;
  --bg-header: #fffffff0;

  --text-primary: #1a1c2e;
  --text-secondary: #5c5f73;
  --text-muted: #9ca0b5;

  --border-color: #d8dce8;
  --border-light: #e4e6f0;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-bg: rgba(37, 99, 235, 0.08);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* ----- Thème bleu ----- */
[data-theme="blue"] {
  --bg-primary: #0c1322;
  --bg-secondary: #101a2e;
  --bg-card: #14203a;
  --bg-input: #1a2848;
  --bg-hover: #1e3055;
  --bg-sidebar: #0e1628;
  --bg-header: #0e1628e0;

  --text-primary: #dbeafe;
  --text-secondary: #7ca8f8;
  --text-muted: #4a7ac7;

  --border-color: #1e3a6a;
  --border-light: #162852;

  --accent: #60a5fa;
  --accent-hover: #7bb8ff;
  --accent-bg: rgba(96, 165, 250, 0.15);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.6);
}

/* ----- Thème vert ----- */
[data-theme="green"] {
  --bg-primary: #0c1a12;
  --bg-secondary: #0f2417;
  --bg-card: #14301f;
  --bg-input: #183d26;
  --bg-hover: #1c4a2e;
  --bg-sidebar: #0e1e14;
  --bg-header: #0e1e14e0;

  --text-primary: #d1fae5;
  --text-secondary: #6ee7a7;
  --text-muted: #3ba06b;

  --border-color: #1a4a2e;
  --border-light: #14381f;

  --accent: #34d399;
  --accent-hover: #6ee7a7;
  --accent-bg: rgba(52, 211, 153, 0.15);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.6);
}

/* ----- Reset & Base ----- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--accent-hover); }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ----- Layout ----- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ----- Sidebar ----- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: background var(--transition), transform 300ms ease;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-primary);
  white-space: nowrap;
}

.sidebar-logo svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

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

.sidebar-nav-section {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 12px 4px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin: 1px 0;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all var(--transition);
  cursor: pointer;
}

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

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

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

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

.nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 600;
}

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

/* ----- Main Content ----- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 0;
  min-height: 100vh;
}

/* ----- Header ----- */
.page-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: var(--header-height);
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-header-left h1 {
  font-size: 1.1rem;
  font-weight: 600;
}

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

/* ----- Bouton hamburger (mobile) ----- */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}
.hamburger:hover {
  background: var(--bg-hover);
}

/* ----- Page Body ----- */
.page-body {
  padding: 24px 28px;
}

/* ----- Cards ----- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), background var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

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

.card-header h2,
.card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-grid {
  display: grid;
  gap: 16px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ----- Stats Bars (CPU/Mem/Disk) ----- */
.stat-bar-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-bar-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-bar-label {
  width: 45px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  flex-shrink: 0;
}

.stat-bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.stat-bar-fill.cpu { background: linear-gradient(90deg, #4a9eff, #7bb8ff); }
.stat-bar-fill.mem { background: linear-gradient(90deg, #22c55e, #4ade80); }
.stat-bar-fill.disk { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.stat-bar-value {
  width: 45px;
  text-align: right;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ----- Status Badges ----- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}

.status-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-badge.online,
.status-badge.up,
.status-badge.healthy,
.status-badge.success {
  background: var(--success-bg);
  color: var(--success);
}
.status-badge.online::before,
.status-badge.up::before,
.status-badge.healthy::before,
.status-badge.success::before {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.status-badge.offline,
.status-badge.down,
.status-badge.error,
.status-badge.danger {
  background: var(--danger-bg);
  color: var(--danger);
}
.status-badge.offline::before,
.status-badge.down::before,
.status-badge.error::before,
.status-badge.danger::before {
  background: var(--danger);
  box-shadow: 0 0 6px var(--danger);
}

.status-badge.warning {
  background: var(--warning-bg);
  color: var(--warning);
}
.status-badge.warning::before {
  background: var(--warning);
  box-shadow: 0 0 6px var(--warning);
}

.status-badge.idle,
.status-badge.pending {
  background: var(--info-bg);
  color: var(--info);
}
.status-badge.idle::before,
.status-badge.pending::before {
  background: var(--info);
  box-shadow: 0 0 6px var(--info);
}

/* ----- Tables ----- */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

tbody tr:hover {
  background: var(--bg-hover);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-bg);
}

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

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

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

/* ----- Form Controls ----- */
input[type="text"],
input[type="search"],
select,
textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  transition: border var(--transition), box-shadow var(--transition);
}

input[type="text"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

/* ----- Service Cards (index page) ----- */
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.service-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

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

.service-card-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.service-card-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.service-card-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ----- Quick actions ----- */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ----- Gauges (health page) ----- */
.gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

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

.gauge svg {
  transform: rotate(-90deg);
}

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

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

.gauge-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.gauge-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}

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

/* ----- Sparklines (mini charts) ----- */
.sparkline {
  display: inline-block;
  height: 30px;
}

.sparkline svg {
  height: 100%;
}

/* ----- Palette / Ctrl+K ----- */
.palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}

.palette-overlay.open {
  display: flex;
}

.palette {
  width: 560px;
  max-width: 90vw;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: paletteIn 200ms ease;
}

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

.palette input {
  width: 100%;
  padding: 16px 20px;
  border: none;
  border-bottom: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: var(--font);
}

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

.palette input:focus {
  outline: none;
  box-shadow: none;
}

.palette-results {
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-primary);
  transition: background var(--transition);
}

.palette-item:hover,
.palette-item.selected {
  background: var(--bg-hover);
}

.palette-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.palette-item-shortcut {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ----- Help Dialog ----- */
.help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
}

.help-overlay.open {
  display: flex;
}

.help-dialog {
  width: 560px;
  max-width: 90vw;
  max-height: 80vh;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  animation: paletteIn 200ms ease;
}

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

.help-dialog-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

.help-dialog-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.help-dialog-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.help-dialog-body {
  padding: 16px 20px;
}

.help-section {
  margin-bottom: 16px;
}

.help-section h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.help-shortcut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.9rem;
}

.help-shortcut kbd {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.78rem;
  font-family: var(--font);
  color: var(--text-secondary);
}

/* ----- Theme Switcher ----- */
.theme-options {
  display: flex;
  gap: 6px;
}

.theme-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.theme-btn:hover {
  transform: scale(1.15);
}

.theme-btn.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-bg);
}

.theme-btn.dark {
  background: #0f1117;
}
.theme-btn.light {
  background: #f4f5f9;
}
.theme-btn.blue {
  background: #0c1322;
}
.theme-btn.green {
  background: #0c1a12;
}

/* ----- Log viewer ----- */
.log-viewer {
  background: #0a0b10;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.78rem;
  line-height: 1.7;
  overflow-x: auto;
  max-height: 500px;
  overflow-y: auto;
}

.log-line {
  white-space: pre-wrap;
  word-break: break-all;
  color: #a0a4b8;
}

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

.log-line .level-info {
  color: var(--accent);
}

.log-line .level-warn,
.log-line .level-warning {
  color: var(--warning);
}

.log-line .level-error {
  color: var(--danger);
}

/* ----- Changelog ----- */
.changelog-entry {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.changelog-entry:last-child {
  border-bottom: none;
}

.changelog-hash {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  color: var(--accent);
}

.changelog-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.changelog-msg {
  margin-top: 4px;
  font-size: 0.9rem;
}

.changelog-author {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ----- Providers ----- */
.provider-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.provider-card:hover {
  border-color: var(--accent);
}

.provider-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.provider-info {
  flex: 1;
}

.provider-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.provider-model {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.provider-meta {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ----- Activity Feed ----- */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

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

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.activity-content {
  flex: 1;
}

.activity-title {
  font-size: 0.9rem;
  font-weight: 500;
}

.activity-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

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

/* ----- System Info ----- */
.sysinfo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.sysinfo-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.sysinfo-key {
  color: var(--text-secondary);
}

.sysinfo-value {
  font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Progress bars inside sysinfo items */
.sysinfo-item .progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface-alt);
  border-radius: 3px;
  overflow: hidden;
}
.sysinfo-item .progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* ----- Footer ----- */
.page-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ----- Empty states ----- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

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

/* ----- Loading spinner (HTMX indicator) ----- */
.htmx-indicator {
  opacity: 0;
  transition: opacity 200ms ease;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ----- Tooltips ----- */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  white-space: nowrap;
  color: var(--text-primary);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  box-shadow: var(--shadow-md);
}
[data-tooltip]:hover::after {
  opacity: 1;
}

/* ----- Responsive: breakpoint 720px ----- */
@media (max-width: 720px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }

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

  .page-header {
    padding: 0 16px;
  }

  .page-body {
    padding: 16px;
  }

  .page-footer {
    padding: 12px 16px;
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .hamburger {
    display: inline-flex;
  }

  .service-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .palette {
    width: 95vw;
  }

  .help-dialog {
    width: 95vw;
  }

  .header-actions .btn span {
    display: none;
  }

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

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

/* ----- Print ----- */
@media print {
  .sidebar, .page-header, .header-actions { display: none; }
  .main-content { margin-left: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  body { background: #fff; color: #000; }
}
