/*
 * style.css — dark, lightweight admin aesthetic.
 *
 * Design goals (per spec): dark mode, mobile-friendly, simple admin dashboard
 * look, clear status badges. No framework — a single hand-written stylesheet
 * keeps the page tiny and fast on a Pi and avoids a build step.
 *
 * All colours are CSS custom properties so the palette lives in one place.
 */

:root {
  --bg: #0f141b;
  --bg-elevated: #161d27;
  --bg-input: #0c1117;
  --border: #263141;
  --text: #e6edf3;
  --text-muted: #8b97a7;
  --accent: #3b82f6;
  --accent-hover: #2f6fd6;
  --success: #2ea043;
  --success-bg: #133a1d;
  --warning: #d29922;
  --warning-bg: #3a2f10;
  --danger: #f85149;
  --danger-bg: #3a1514;
  --info: #58a6ff;
  --radius: 8px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.small { font-size: 0.8rem; }
.muted { color: var(--text-muted); }
.center { text-align: center; }
.hidden { display: none !important; }

/* ===== Top bar / nav ===== */
.topbar {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  /* The header holds only the toggle + brand now, so it must never wrap. */
  flex-wrap: nowrap;
}
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; min-width: 0; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%; flex: none;
  background: var(--success); box-shadow: 0 0 8px var(--success);
}

/* ===== Hamburger toggle ===== */
.nav-toggle {
  flex: none;
  display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
  width: 40px; height: 40px; padding: 0 9px; cursor: pointer;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius);
}
.nav-toggle:hover { background: #1b2531; }
.nav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-toggle-bar { display: block; height: 2px; border-radius: 2px; background: var(--text); }

/* ===== Off-canvas nav drawer ===== */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55);
  opacity: 0; visibility: hidden; transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 55;
}
.drawer-backdrop.open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; left: 0; height: 100vh; height: 100dvh;
  width: min(82vw, 300px);
  background: var(--bg-elevated); border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
  transform: translateX(-100%); transition: transform 0.22s ease;
  z-index: 60; display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); font-weight: 600;
}
.drawer-close {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 1.05rem; line-height: 1; padding: 0.3rem 0.45rem; border-radius: var(--radius);
}
.drawer-close:hover { background: var(--bg-input); color: var(--text); }
.drawer-nav { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.75rem; flex: 1; }
.drawer-nav a {
  padding: 0.7rem 0.8rem; border-radius: var(--radius); color: var(--text-muted);
}
.drawer-nav a:hover { background: var(--bg-input); text-decoration: none; }
.drawer-nav a.active { color: var(--text); background: var(--bg-input); }
.drawer-foot {
  padding: 1rem; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
}
/* In the drawer the logout sits on its own — drop the inline header divider. */
.drawer-foot .logout-form { border-left: none; margin-left: 0; padding-left: 0; }
/* Prevent the page behind the drawer from scrolling while it's open. */
body.no-scroll { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer-backdrop { transition: none; }
}

/* ===== Layout ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.page-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.page-head h1 { font-size: 1.5rem; margin: 0; }
.footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem 1.5rem; flex-wrap: wrap;
  color: var(--text-muted); font-size: 0.8rem;
  padding: 1.5rem 1rem; border-top: 1px solid var(--border);
}
.footer-version { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ===== Cards (dashboard metrics) ===== */
.cards {
  display: grid; gap: 0.75rem; margin-bottom: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
}
.card-label { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.card-value { font-size: 1.6rem; font-weight: 600; margin-top: 0.25rem; }
.card-sub { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.15rem; overflow-wrap: break-word; word-break: normal; }

/* ===== Panels ===== */
.panel {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1.25rem;
}
.panel h2 { margin: 0 0 0.75rem; font-size: 1.1rem; }

/* ===== Health ===== */
.health-grid { display: grid; gap: 0.6rem; }
.health-item {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.5rem 0; border-bottom: 1px solid var(--border);
}
.health-item:last-child { border-bottom: none; }
.health-name { min-width: 200px; font-weight: 500; }
.health-detail { color: var(--text-muted); font-size: 0.85rem; }

/* ===== Docker container list ===== */
.subhead {
  font-size: 0.95rem; margin: 1.1rem 0 0.5rem; padding-top: 0.9rem;
  border-top: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap;
}
.container-list { display: grid; gap: 0.4rem; }
.container-row {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  padding: 0.45rem 0; border-bottom: 1px solid var(--border);
}
.container-row:last-child { border-bottom: none; }
.container-name { font-weight: 600; min-width: 140px; }
.container-image { color: var(--text-muted); word-break: break-all; }
.container-meta { flex-basis: 100%; }

/* ===== Badges ===== */
.badge {
  display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; line-height: 1.4;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-success { color: var(--success); background: var(--success-bg); border-color: var(--success); }
.badge-warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning); }
.badge-danger  { color: var(--danger);  background: var(--danger-bg);  border-color: var(--danger); }
.badge-info    { color: var(--info);    background: rgba(88,166,255,0.12); border-color: var(--info); }
.badge-muted   { color: var(--text-muted); background: var(--bg-input); border-color: var(--border); }
.badge-lg      { font-size: 1rem; padding: 0.35rem 1rem; }

/* ===== Buttons ===== */
.btn {
  display: inline-block; cursor: pointer; font: inherit; font-weight: 500;
  padding: 0.5rem 0.9rem; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-input); color: var(--text);
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:hover { background: #1b2531; text-decoration: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-small { padding: 0.3rem 0.6rem; font-size: 0.82rem; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #d83a33; }
.btn-outline-danger { color: var(--danger); background: transparent; border-color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger-bg); }

/* ===== Banners ===== */
.banner {
  border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 1rem;
  border: 1px solid transparent; font-size: 0.92rem;
}
.banner-success { color: #aff3c0; background: var(--success-bg); border-color: var(--success); }
.banner-danger  { color: #ffd7d4; background: var(--danger-bg);  border-color: var(--danger); }
.banner-warning { color: #ffe7b0; background: var(--warning-bg); border-color: var(--warning); }
.banner-info    { color: var(--text); background: rgba(88,166,255,0.08); border-color: var(--info); }
/* UPS on-battery: pulse border to draw attention above a plain config warning */
@keyframes ups-pulse { 0%,100% { border-color: var(--warning); } 50% { border-color: #f5c24e; box-shadow: 0 0 0 3px rgba(210,153,34,0.25); } }
.ups-battery-banner.banner-warning { animation: ups-pulse 2s ease-in-out infinite; }
@keyframes ups-low-pulse { 0%,100% { border-color: var(--danger); } 50% { border-color: #ff8080; box-shadow: 0 0 0 3px rgba(248,81,73,0.3); } }
.ups-battery-banner.banner-danger { animation: ups-low-pulse 1s ease-in-out infinite; }

/* ===== Toolbar / inputs ===== */
.toolbar { display: flex; gap: 0.6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.input {
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius); padding: 0.5rem 0.7rem; font: inherit; min-width: 0;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.input-error { border-color: var(--danger) !important; outline: 1px solid var(--danger); }
#searchBox { flex: 1; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-muted); font-weight: 600; background: var(--bg-elevated); position: sticky; top: 0; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-input); }
.col-actions { text-align: right; white-space: nowrap; }
.col-actions .btn { margin-left: 0.35rem; }
/* Truncate long backup filenames; full key visible in title tooltip on hover */
.key-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: default; }
.col-check { width: 2rem; text-align: center; padding: 0.3rem 0.4rem !important; }
.col-check input[type="checkbox"] { cursor: pointer; }

/* ===== Bulk selection bar ===== */
.selection-bar {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.55rem 0.9rem;
  background: var(--bg-elevated); border: 1px solid var(--accent);
  border-radius: var(--radius); margin-bottom: 0.75rem;
  font-size: 0.9rem;
}
.selection-bar.hidden { display: none; }

/* ===== Pager ===== */
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1rem; }

/* ===== Key/value (schedule) ===== */
.kv { display: grid; gap: 0.5rem; }
.kv-row { display: flex; gap: 1rem; flex-wrap: wrap; padding: 0.4rem 0; border-bottom: 1px solid var(--border); }
.kv-row:last-child { border-bottom: none; }
.kv-key { min-width: 160px; color: var(--text-muted); }
.kv-val { font-weight: 500; word-break: break-all; }

/* ===== Schedule list ===== */
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem;
}
.panel-head h2 { margin: 0; }
.sched-list { display: grid; gap: 0.75rem; }
.sched-card {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.9rem 1rem;
}
.sched-card.is-disabled { opacity: 0.62; }
.sched-main { flex: 1; min-width: 220px; }
.sched-title { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.sched-name { font-weight: 600; font-size: 1.02rem; }
.sched-sentence { margin: 0.4rem 0 0.5rem; line-height: 1.45; }
.sched-meta { display: flex; gap: 1.25rem; flex-wrap: wrap; color: var(--text-muted); font-size: 0.85rem; }
.sched-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: flex-start; }

/* ===== Servers ===== */
.server-grid {
  display: grid; gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.server-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-input); padding: 0.9rem 1rem;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.server-card.is-disabled { opacity: 0.62; }
.server-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.server-name { font-weight: 600; }
.server-host { color: var(--text-muted); word-break: break-all; }
.server-health { display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap; }
.server-detail { white-space: pre-line; }
.server-meta { margin-top: 0.1rem; }
.server-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.3rem; }
.server-targets > summary { cursor: pointer; color: var(--text-muted); font-size: 0.85rem; }
.server-targets[open] > summary { color: var(--text); margin-bottom: 0.35rem; }
.targets-list { display: grid; gap: 0.3rem; }
.target-item { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.target-tick { color: var(--success); font-weight: 700; }
.target-name { font-weight: 500; }
.target-src { color: var(--text-muted); }

/* ===== Setup & diagnostics (Guided Command Runner) ===== */
.diag-item {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.6rem 0.75rem; margin-bottom: 0.5rem; background: var(--bg-input);
  border-left-width: 3px;
}
.diag-ok { border-left-color: var(--success); }
.diag-fail { border-left-color: var(--danger); }
.diag-warn { border-left-color: var(--warning); }
.diag-info, .diag-na, .diag-unknown { border-left-color: var(--border); }
.diag-head { display: flex; align-items: center; gap: 0.5rem; }
.diag-icon { font-weight: 700; width: 1.1rem; text-align: center; }
.diag-ok .diag-icon { color: var(--success); }
.diag-fail .diag-icon { color: var(--danger); }
.diag-warn .diag-icon { color: var(--warning); }
.diag-label { font-weight: 600; }
.diag-detail { margin-top: 0.25rem; }
.diag-note { margin-top: 0.3rem; font-style: italic; }
.cmd-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem; flex-wrap: wrap; }
.cmd {
  flex: 1; min-width: 0; background: #07090d; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.4rem 0.6rem; color: #cfe3f7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem; overflow-x: auto; white-space: pre; word-break: break-all;
}
.diag-item .btn-primary { margin-top: 0.5rem; }
.diag-actions { margin-top: 0.6rem; }

/* ===== Schedule wizard ===== */
.modal-wide { max-width: 640px; }
.wizard-steps {
  display: flex; gap: 0.5rem; list-style: none; padding: 0; margin: 0 0 1.1rem;
  flex-wrap: wrap; font-size: 0.85rem;
}
.wizard-steps li {
  flex: 1; min-width: 90px; text-align: center; padding: 0.4rem 0.5rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-muted); background: var(--bg-input);
}
.wizard-steps li.active { color: #fff; background: var(--accent); border-color: var(--accent); }
.wizard-steps li.done { color: var(--text); border-color: var(--accent); }
/* Pill navigation: reachable steps are clickable; not-yet-valid steps are
   visibly inert so the operator can't jump forward into an incomplete step. */
.wizard-steps li.clickable { cursor: pointer; }
.wizard-steps li.clickable:hover { border-color: var(--accent); }
.wizard-steps li.disabled { opacity: 0.5; cursor: not-allowed; }

.target-grid { display: grid; gap: 0.6rem; }
.target-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.8rem 0.9rem; background: var(--bg-input);
}
.target-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.target-card.is-disabled { opacity: 0.6; }
.target-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.target-label { font-weight: 600; }
.target-desc { margin: 0.35rem 0 0.2rem; }
.target-reason { margin: 0 0 0.6rem; }

/* ===== Retention sentence-style controls ===== */
.sentence-line { display: inline-flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap; }
.input-inline { width: 5.5rem; text-align: center; }

/* ===== Forms ===== */
.form { display: grid; gap: 1rem; max-width: 460px; }
.field { display: grid; gap: 0.35rem; }
.field code { background: var(--bg-input); padding: 0.1rem 0.4rem; border-radius: 4px; }
.checkbox { display: flex; align-items: center; gap: 0.5rem; }
.preview { padding: 0.6rem 0.8rem; background: var(--bg-input); border-radius: var(--radius); border: 1px solid var(--border); }

/* ===== Console (streamed output) ===== */
.console {
  margin-top: 1rem; background: #07090d; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.8rem; max-height: 360px; overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem; white-space: pre-wrap; word-break: break-word; color: #cfe3f7;
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.65);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 2rem 1rem; z-index: 50; overflow-y: auto;
}
.modal {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; width: 100%; max-width: 560px;
  box-shadow: var(--shadow);
}
.modal h2 { margin-top: 0; }
/* Left-aligned button row — used on settings/notifications pages. */
.action-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1rem; flex-wrap: wrap; }

/* ===== Dashboard refresh toggle ===== */
.refresh-toggle { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; color: var(--text-muted); }

/* ===== Login page ===== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.75rem; box-shadow: var(--shadow); display: grid; gap: 1rem;
}
.login-brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 1.1rem; }
.login-sub { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.login-btn { width: 100%; margin-top: 0.25rem; }
.login-foot { text-align: center; font-size: 0.75rem; margin: 0; }

/* ===== Header user + logout ===== */
/* Separate the user/logout group from the nav links with a subtle divider and
   vertically centre everything so the smaller Logout button lines up with the
   taller nav links. */
.logout-form {
  display: inline-flex; align-items: center; gap: 0.6rem; margin: 0;
  margin-left: 0.5rem; padding-left: 0.85rem; border-left: 1px solid var(--border);
}
.nav-user { font-size: 0.85rem; white-space: nowrap; }

/* ===== Small screens ===== */
@media (max-width: 600px) {
  .health-name { min-width: 0; }
  .card-value { font-size: 1.35rem; }
  .modal-actions { justify-content: stretch; }
  .modal-actions .btn { flex: 1; text-align: center; }
}

/* ===== Backup groups (grouped details view) ===== */
.backup-group { margin-bottom: 1rem; }
.backup-group summary { cursor: pointer; list-style: none; }
.backup-group summary::-webkit-details-marker { display: none; }
.backup-group[open] summary { cursor: pointer; }
.backup-group-header {
  display: flex; flex-direction: row; align-items: center;
  justify-content: space-between; flex-wrap: wrap;
  padding: 0.65rem 0.9rem; gap: 0.5rem;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.backup-group[open] .backup-group-header {
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
}
.backup-group-label { font-weight: 600; }
.backup-group-meta { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.backup-group-table {
  width: 100%; margin-top: 0;
  border: 1px solid var(--border); border-top: none;
  border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius);
  overflow: hidden;
}

/* ===== Restic date sub-groups (nested inside .backup-group) ===== */
/* A wrapper that carries the outer left/right/bottom border for the
   content area of an open Restic backup-group. */
.restic-group-body {
  border: 1px solid var(--border); border-top: none;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  overflow: hidden;
}
/* Subtle breadcrumb for the backed-up paths (e.g. /home/pi/apps/akaunting). */
.restic-paths-line {
  font-size: 0.82rem; color: var(--text-muted);
  padding: 0.3rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
/* Date sub-group: collapsible by day. */
.restic-date-group { border-bottom: 1px solid var(--border); }
.restic-date-group:last-child { border-bottom: none; }
.restic-date-group summary { cursor: pointer; list-style: none; }
.restic-date-group summary::-webkit-details-marker { display: none; }
.restic-date-header {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  padding: 0.4rem 0.9rem;
  background: var(--bg-elevated); font-size: 0.9rem;
  user-select: none;
}
.restic-date-group[open] .restic-date-header {
  border-bottom: 1px solid var(--border);
}
.restic-date-label { font-weight: 600; }
/* Table inside a date group: no extra borders — the .restic-group-body provides them. */
.restic-date-group table { width: 100%; margin: 0; border: none; border-radius: 0; }
/* Repo summary banner: compact flex layout (replaces inline style). */
.restic-repo-summary { font-size: 0.88rem; display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; margin-bottom: 0; }
/* Repository tools collapsible — advanced maintenance at the bottom of each Restic group. */
.restic-tools { border-top: 1px solid var(--border); }
.restic-tools > summary {
  cursor: pointer; list-style: none;
  padding: 0.5rem 0.9rem;
  font-size: 0.83rem; font-weight: 500; color: var(--text);
  user-select: none; background: var(--bg-elevated);
  display: flex; align-items: center; gap: 0.5rem;
}
.restic-tools > summary:hover { background: color-mix(in srgb, var(--bg-elevated) 80%, var(--border)); }
.restic-tools > summary::before {
  content: '▶';
  font-size: 0.6em; color: var(--text-muted);
  display: inline-block; transition: transform 0.15s; flex-shrink: 0;
}
.restic-tools[open] > summary::before { transform: rotate(90deg); }
.restic-tools > summary::-webkit-details-marker { display: none; }
.restic-tools[open] > summary { border-bottom: 1px solid var(--border); }
.restic-maintenance-row {
  padding: 0.65rem 0.9rem 0.75rem;
  display: flex; flex-direction: column; gap: 0.5rem;
  background: var(--bg-elevated);
}
.restic-tool-item { display: flex; flex-direction: column; gap: 0.3rem; }
.danger-help-text { font-size: 0.8rem; color: var(--text-muted); }

/* ===== Server-level Restic group (wraps profile accordions) ===== */
.server-group-body {
  border: 1px solid var(--border); border-top: none;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}
.restic-repo-summary-container {
  padding: 0.5rem 0.9rem;
  border-bottom: 1px solid var(--border);
}
.restic-repo-summary-container:empty { display: none; }
.restic-profiles {
  padding: 0.5rem 0.75rem 0.75rem;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.restic-profiles .backup-group { margin-bottom: 0; }

/* ===== Run log (schedule history modal) ===== */
.run-list { display: grid; gap: 0.6rem; }
.run-entry {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.6rem 0.75rem; background: var(--bg-input);
}
.run-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* ===== Setup checklist ===== */
.setup-list { display: grid; gap: 0.1rem; }
.setup-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.setup-item:last-child { border-bottom: none; }
.setup-item-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
  margin-bottom: 0.25rem;
}
.setup-item-label { font-weight: 500; flex: 1; min-width: 0; }
.setup-item-action { white-space: nowrap; }
.setup-item-action-done { white-space: nowrap; }
.setup-item-detail { margin: 0; }

/* ===== Setup banner (dashboard) ===== */
.setup-banner-link { font-weight: 600; }
.banner-info { border-color: var(--info); background: rgba(88,166,255,0.1); color: var(--text); }
.banner-success { border-color: var(--success); background: var(--success-bg); color: var(--text); }
.run-key { color: var(--text-muted); overflow-wrap: anywhere; }
