/* Neutrals taken from rutzenholzer.eu's surface palette; accent kept blue. */
:root {
  --bg: #121214;
  --card: #1b1b1e;
  --input-bg: #0e0e10;
  --border: #303034;
  --text: #f6f6f8;
  --muted: #9a9aa2;
  --accent: #4f8cff;
  --accent-dark: #2f6fe0;
  --green: #2fbf71;
  --red: #ef5350;
  --amber: #f5a623;
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --card: #f6f6f8;
  --input-bg: #ffffff;
  --border: #e7e7ea;
  --text: #171719;
  --muted: #45464b;
  --accent: #2f6fe0;
  --accent-dark: #1d54b8;
  --green: #1f9d5c;
  --red: #c62828;
  --amber: #b9790a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 12%, rgba(79,140,255,0.20), transparent 45%),
    radial-gradient(circle at 88% 90%, rgba(79,140,255,0.14), transparent 50%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
}
:root[data-theme="light"] body {
  background:
    radial-gradient(circle at 12% 12%, rgba(47,111,224,0.10), transparent 45%),
    radial-gradient(circle at 88% 90%, rgba(47,111,224,0.08), transparent 50%),
    var(--bg);
  background-attachment: fixed;
}
.refresh-select-form select {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: 6px; padding: 0 0 0 6px; font-size: 12px; height: 26px;
  width: 50px; box-sizing: border-box; cursor: pointer;
}
.refresh-select-form select:hover { color: var(--amber); border-color: var(--amber); }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 500;
  background: rgba(18,18,20,0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 0.25s;
}
:root[data-theme="light"] .topbar { background: rgba(255,255,255,0.85); }
/* Hides on scroll-down (past a small threshold so it doesn't flicker near
   the top of the page), reappears on any scroll-up - same behavior as the
   header on rutzenholzer.at. */
.topbar.header-hidden { transform: translateY(-100%); }
.brand { display: inline-flex; align-items: center; color: var(--text); text-decoration: none; }
.brand-logo { height: 60px; width: auto; display: none; }
.brand-logo-dark { display: block; }
:root[data-theme="light"] .brand-logo-dark { display: none; }
:root[data-theme="light"] .brand-logo-light { display: block; }
.topnav { display: flex; align-items: center; gap: 14px; }
.nav-divider { width: 1px; height: 20px; background: var(--border); }
.whoami { color: var(--muted); font-size: 13px; }
.icon-btn.nav-toggle { display: none; }
.is-hidden-icon { display: none; }

/* Mobile nav: logo + hamburger in the header bar, tapping it drops a
   full-width panel below (primary links stacked, utility icons/actions
   wrapped into a compact row) - same collapse pattern as rutzenholzer.at. */
@media (max-width: 760px) {
  .icon-btn.nav-toggle { display: inline-flex; }
  .topbar { flex-wrap: wrap; row-gap: 4px; }
  .topnav {
    display: none;
    flex-wrap: wrap;
    width: 100%;
    flex-basis: 100%;
    gap: 6px;
    padding-top: 14px;
    margin-top: 12px;
    border-top: 1px solid var(--border);
  }
  .topnav.is-open { display: flex; }
  .topnav > .btn, .topnav > .navlink, .topnav > .whoami { flex: 0 0 100%; }
  .topnav > .btn, .topnav > .navlink { padding: 10px 4px; }
  .topnav > .navlink { border-bottom: 1px solid var(--border); }
  .topnav > .nav-divider { display: none; }
  .topnav > .whoami { padding: 6px 4px 0; }
}
.role-badge {
  font-size: 10px; padding: 1px 6px; border-radius: 8px; border: 1px solid var(--accent);
  color: var(--accent); text-transform: uppercase; letter-spacing: 0.03em;
}
.navlink {
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 6px 4px; border-bottom: 2px solid transparent;
}
.navlink:hover { color: var(--text); }
.navlink.is-active { color: var(--text); border-bottom-color: var(--accent); }
/* .btn.btn-outline (not just .btn-outline) so this reliably overrides
   .btn's own background/color regardless of source order - as a same-
   specificity single-class selector defined earlier in the file, plain
   .btn-outline was silently losing to .btn's later background: var(--accent)
   for any element carrying both classes, rendering every "outline" button
   (Abbrechen, Neue Backup-Codes erzeugen, ...) as a solid accent button
   instead of the intended muted/transparent look. */
.btn.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn.btn-outline:hover { border-color: var(--muted); color: var(--text); }
/* Specifically for "Abbrechen" buttons - a red outline (not the solid red
   of .btn-danger, which is reserved for actually destructive actions) so
   cancelling an in-progress edit reads as distinct from every other
   .btn-outline use (pagination, "Verbindung testen", etc.), which stay
   the neutral gray/transparent style above. */
.btn.btn-cancel { background: transparent; border: 1px solid var(--red); color: var(--red); }
.btn.btn-cancel:hover { background: rgba(239,83,80,0.1); }
main { max-width: 1000px; margin: 0 auto; padding: 24px; }
h1 { font-size: 22px; margin-bottom: 20px; }
h2 { font-size: 17px; margin: 0; }
h3 { font-size: 14px; color: var(--muted); margin-top: 20px; }

.customer-group { margin-bottom: 28px; }
.customer-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.customer-meta { display: flex; gap: 8px; align-items: center; }
.notes { color: var(--muted); margin: 4px 0 12px; font-size: 14px; }

.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--border);
  color: var(--muted); white-space: nowrap; display: inline-block; text-decoration: none;
}
.tag-wg { color: var(--accent); border-color: var(--accent); }
.tag-wg-on { color: var(--green); border-color: var(--green); background: rgba(47,191,113,0.12); }
.tag-wg-error { color: var(--red); border-color: var(--red); background: rgba(239,83,80,0.12); }
.tag-auto { color: var(--green); border-color: var(--green); }

.ms-table-scroll { width: 100%; overflow-x: auto; }
.ms-table-scroll .ms-table { min-width: 640px; }
/* The narrow-screen fallback below sets `.ms-table { display: block }`,
   which breaks <thead>/<tr>/<th> table layout (headers stack vertically
   instead of sitting side by side over their columns) - .ms-table-scroll
   is the correct responsive strategy here (scroll the whole table
   sideways), so keep real table layout and let the wrapper handle it. */
.ms-table-scroll .ms-table { display: table; }
.ms-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.ms-table th, .ms-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
.ms-table th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; }
.ms-table th.js-sort:hover { color: var(--text); }
.ms-table th.js-sort[data-sort-dir="asc"]::after { content: " \25B2"; font-size: 9px; }
.ms-table th.js-sort[data-sort-dir="desc"]::after { content: " \25BC"; font-size: 9px; }
/* Icon-only header, compact on every screen size - the full label is the
   title attribute (hover/long-press tooltip) instead of always-on text.
   Deliberately NOT `display: flex` here - that turns the <th> itself into
   a block-level flex container, which breaks out of the <tr>'s table-cell
   layout entirely (headers stack vertically instead of sitting in a row). */
.ms-table th.th-icon { text-align: left; vertical-align: middle; }
.ms-table th.th-icon svg { vertical-align: middle; }
.ms-table tr:last-child td { border-bottom: none; }
.ms-table td.truncate { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; gap: 10px; align-items: center; }
.error-cell { text-align: center; }
.error-cell .icon-btn { color: var(--red); border-color: var(--red); }
.error-popover {
  position: fixed; z-index: 2000; max-width: 320px; background: var(--card);
  border: 1px solid var(--red); border-radius: 6px; padding: 8px 10px;
  font-size: 12.5px; color: var(--text); box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  white-space: normal; word-wrap: break-word;
}

.status { padding: 3px 10px; border-radius: 10px; font-size: 12px; text-transform: capitalize; }
.status-success { background: rgba(47,191,113,0.15); color: var(--green); }
.status-failed { background: rgba(239,83,80,0.15); color: var(--red); }
.status-running { background: rgba(245,166,35,0.15); color: var(--amber); }
.status-never { background: rgba(154,162,175,0.15); color: var(--muted); }

.backup-icon { display: inline-flex; vertical-align: middle; }
.backup-icon-success { color: var(--green); }
.backup-icon-failed { color: var(--red); }
.backup-icon-running { color: var(--amber); }
.backup-icon-never { color: var(--muted); }

.btn {
  background: transparent; color: var(--accent); border: 1px solid var(--accent); padding: 8px 14px;
  border-radius: 6px; text-decoration: none; font-size: 14px; cursor: pointer;
  line-height: 1; white-space: nowrap;
}
.btn:hover { background: rgba(79,140,255,0.1); }
/* Fixed height (not just matching padding) so a bordered .btn-outline next
   to a border-less .btn-danger/.btn always lines up exactly, regardless of
   that 1px border or any padding tweaks either one picks up later.
   white-space: nowrap above stops long labels (e.g. "Neue Backup-Codes
   erzeugen") from wrapping to a second line and visually overflowing this
   fixed height. */
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; }
/* .btn is now outline-style by default (see above) - .btn-danger stays the
   solid, filled look it always had, so it still reads as the more urgent
   of the two rather than picking up the new outline treatment too. */
.btn-danger { background: var(--red); color: white; border: none; }
.btn-danger:hover { background: var(--red); filter: brightness(1.1); }
.link { color: var(--accent); text-decoration: none; font-size: 13px; }
.empty { color: var(--muted); font-size: 14px; }

.card {
  background: linear-gradient(160deg, rgba(79,140,255,0.09), transparent 60%), var(--card);
  border: 1px solid rgba(79,140,255,0.14); border-radius: 8px;
  padding: 18px; margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px;
}
:root[data-theme="light"] .card {
  background: linear-gradient(160deg, rgba(47,111,224,0.05), transparent 60%), var(--card);
  border: 1px solid rgba(47,111,224,0.12);
}
.card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }

.settings-summary {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  font-size: 16px; font-weight: 600; color: var(--text); list-style: none;
}
.settings-summary::-webkit-details-marker { display: none; }
.settings-summary .settings-icon {
  color: var(--accent); display: inline-flex; flex-shrink: 0;
  width: 30px; height: 30px; align-items: center; justify-content: center;
  background: rgba(79,140,255,0.12); border-radius: 8px;
}
.settings-summary .settings-summary-text { display: flex; flex-direction: column; gap: 1px; }
.settings-summary .settings-summary-sub { font-size: 12px; font-weight: 400; color: var(--muted); }
.settings-summary .chevron { margin-left: auto; color: var(--muted); transition: transform 0.15s; flex-shrink: 0; }
details[open] > .settings-summary .chevron { transform: rotate(90deg); }
.settings-body { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.card input[type=text], .card input[type=number], .card input[type=password], .card textarea {
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
  color: var(--text); font-size: 14px; font-family: inherit;
}
.card textarea { width: 100%; box-sizing: border-box; }
.card .checkbox { flex-direction: row; align-items: center; gap: 8px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form[hidden] { display: none; }
.inline-form input, .inline-form select { flex: 1 1 140px; background: var(--input-bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; color: var(--text); }
/* Native <select> chrome renders its own dropdown arrow flush against the
   box edge, ignoring padding - too close to the rounded border to look
   right. Custom-drawn arrow with real breathing room instead; specificity
   (2 classes + element) has to beat `.inline-form select`'s padding shorthand. */
select.js-role-select, select.js-2fa-select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa2af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  padding: 8px 34px 8px 10px;
}

.access-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.site-check { flex-direction: row; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text); }
.site-check input { margin: 0; }
/* Site-access row styled as a toggle button rather than a plain checkbox -
   the checkbox itself stays for form submission, just visually hidden. */
.site-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 13px;
  transition: border-color 0.15s, background 0.15s;
}
.site-toggle:has(input[type="checkbox"]:checked) { border-color: var(--accent); background: rgba(79,140,255,0.08); }
/* .site-toggle sets its own `display: flex`, which as an author-stylesheet
   rule outranks the browser's built-in `[hidden] { display: none }` UA rule
   regardless of selector specificity - so the search filter's `hidden`
   toggle would silently do nothing without this. */
.site-toggle[hidden] { display: none; }
.site-toggle input[name="site_ids"], .site-toggle input[name="twofa_email"] {
  position: absolute; opacity: 0; width: 0; height: 0;
}
/* Notification bell toggle, same bordered-chip language as .site-toggle. */
.notify-toggle {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; margin: 0;
  color: var(--accent); cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.notify-toggle:has(input:checked) { border-color: var(--accent); background: rgba(79,140,255,0.08); }
.notify-toggle:has(input:disabled) { opacity: 0.4; cursor: not-allowed; }
.notify-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.site-toggle-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border); flex-shrink: 0; transition: background 0.15s; }
.site-toggle:has(input[type="checkbox"]:checked) .site-toggle-dot { background: var(--accent); }

.ms-form { display: flex; flex-direction: column; gap: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.form-grid[hidden] { display: none; }
.form-grid input { background: var(--input-bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; color: var(--text); font-size: 14px; }

.window-bar-wrap { position: relative; width: 100%; margin: 20px 0 4px; padding-top: 18px; }
.window-bar {
  position: relative; height: 34px; border-radius: 4px;
  background: var(--input-bg); border: 1px solid var(--border); overflow: hidden;
}
.window-bar-ticks-half {
  position: absolute; inset: 0; pointer-events: none;
  background-image: repeating-linear-gradient(to right, var(--border) 0, var(--border) 1px, transparent 1px, transparent calc(100% / 48));
  opacity: 0.7;
}
.window-bar-ticks-hour {
  position: absolute; inset: 0; pointer-events: none;
  background-image: repeating-linear-gradient(to right, var(--border) 0, var(--border) 1px, transparent 1px, transparent calc(100% / 24));
}
.window-bar-fill { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: var(--accent); opacity: 0.35; }
.window-bar-allowed {
  position: absolute; top: 0; bottom: 0; pointer-events: none;
  background: rgba(245,166,35,0.12); border-left: 1px dashed var(--amber); border-right: 1px dashed var(--amber);
}
.window-bar-marker {
  position: absolute; top: 18px; bottom: 0; width: 2px; background: var(--accent);
  left: 0; transform: translateX(-1px); pointer-events: none;
}
.window-bar-marker-label {
  position: absolute; top: 0; left: 0; transform: translateX(-50%);
  font-size: 11px; color: var(--accent); white-space: nowrap; font-weight: 600;
}
.window-bar-scale {
  display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 3px;
}
.hint { color: var(--muted); font-size: 12px; margin: 0; line-height: 1.4; }
.backup-fields { padding: 10px; border: 1px dashed var(--border); border-radius: 6px; }

.month-calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; max-width: 320px; }
.month-calendar-day { position: relative; display: block; }
.month-calendar-day input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.month-calendar-day span {
  display: flex; align-items: center; justify-content: center; height: 30px;
  border: 1px solid var(--border); border-radius: 6px; font-size: 12.5px; color: var(--muted);
}
.month-calendar-day input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.month-calendar-day input:hover + span { border-color: var(--accent); }
.month-calendar-day input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
h4 { font-size: 13px; color: var(--text); margin: 10px 0 0; }

.flash { background: rgba(79,140,255,0.15); border: 1px solid var(--accent); color: var(--accent); padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto; z-index: 1000;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: linear-gradient(160deg, rgba(79,140,255,0.09), transparent 60%), var(--card);
  border: 1px solid rgba(79,140,255,0.14); border-radius: 10px;
  padding: 20px; max-width: 640px; width: 100%; box-shadow: 0 10px 40px rgba(0,0,0,0.35);
}
:root[data-theme="light"] .modal-box {
  background: linear-gradient(160deg, rgba(47,111,224,0.05), transparent 60%), var(--card);
  border: 1px solid rgba(47,111,224,0.12);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
/* Flat, solid background (no gradient overlay) - this box holds a whole
   fetched-in page's content, and the gradient meant for small dialogs reads
   as a distracting "background image" at that size. */
.modal-box-page {
  max-width: 1100px; width: 95vw; height: 88vh;
  display: flex; flex-direction: column; padding: 0;
  background: var(--card); border: 1px solid var(--border);
  position: relative; overflow: hidden;
}
.page-modal-body { flex: 1; overflow-y: auto; padding: 24px; }
.page-modal-close { position: absolute; top: 12px; right: 12px; z-index: 2; }

/* Monitoring dashboard */
.summary-bar {
  display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px;
}
.summary-stat {
  background: linear-gradient(160deg, rgba(79,140,255,0.09), transparent 60%), var(--card);
  border: 1px solid rgba(79,140,255,0.14); border-radius: 8px;
  padding: 18px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px; text-align: center;
  flex: 1 1 140px; min-width: 140px; min-height: 90px;
}
:root[data-theme="light"] .summary-stat {
  background: linear-gradient(160deg, rgba(47,111,224,0.05), transparent 60%), var(--card);
  border: 1px solid rgba(47,111,224,0.12);
}
.summary-value { font-size: 22px; font-weight: 700; line-height: 1.1; overflow-wrap: break-word; }
.summary-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.02em; }
.summary-online .summary-value { color: var(--green); }
.summary-offline .summary-value { color: var(--red); }
.summary-unknown .summary-value { color: var(--muted); }

/* align-items: start (not the grid default "stretch") so a collapsed card
   next to an expanded one keeps its own compact height instead of being
   stretched to match its taller row-sibling. */
.ms-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 18px; align-items: start; }

@media (max-width: 480px) {
  main { padding: 16px; }
  .ms-grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  .topnav { flex-wrap: wrap; gap: 8px 12px; }
  .ms-table { display: block; overflow-x: auto; }
}
.ms-card {
  background: linear-gradient(160deg, rgba(79,140,255,0.09), transparent 60%), var(--card);
  border: 1px solid rgba(79,140,255,0.14); border-radius: 10px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
  border-left: 3px solid var(--muted); overflow: hidden;
}
.ms-card.js-highlight-flash { outline: 2px solid var(--red); outline-offset: 4px; }
:root[data-theme="light"] .ms-card {
  background: linear-gradient(160deg, rgba(47,111,224,0.05), transparent 60%), var(--card);
  border: 1px solid rgba(47,111,224,0.12);
}
.ms-card.is-online { border-left-color: var(--green); }
.ms-card.is-offline { border-left-color: var(--red); }
.ms-card.is-unknown { border-left-color: var(--muted); }
.ms-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.ms-card-heading { min-width: 0; }
.ms-card-title { font-weight: 600; font-size: 15px; }
.ms-card-sub { color: var(--muted); font-size: 12px; margin-top: 2px; overflow-wrap: break-word; }
.ms-card-badges { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; }
.ms-card-meta-row { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.ms-model-photo { flex-shrink: 0; max-width: 84px; max-height: 84px; object-fit: contain; margin-left: 8px; }
.ms-card-head { cursor: pointer; }
.ms-card-expand { flex-shrink: 0; }
.ms-card-expand .chevron { transition: transform 0.15s; }
.ms-card.is-expanded .ms-card-expand .chevron { transform: rotate(180deg); }
.ms-card-detail { display: none; flex-direction: column; gap: 8px; }
.ms-card.is-expanded .ms-card-detail { display: flex; }
/* .ms-card/.customer-group set their own `display` (flex/block), which as
   an author-stylesheet rule outranks the browser's built-in `[hidden] {
   display: none }` UA rule regardless of selector specificity - so search/
   filter toggling the hidden attribute silently did nothing without this. */
.ms-card[hidden], .customer-group[hidden] { display: none; }

/* ---- Monitoring toolbar: search, status filter, compact-view toggle ---- */
.ms-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.ms-chart-filter-bar {
  display: flex; align-items: center; gap: 8px; margin: -8px 0 16px;
  padding: 8px 12px; border-radius: 8px; font-size: 13px; color: var(--muted);
  background: rgba(79,140,255,0.08); border: 1px solid rgba(79,140,255,0.14);
}
.ms-chart-filter-bar[hidden] { display: none; }
.ms-chart-filter-bar .icon-btn { margin-left: auto; }
.ms-pagination { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 20px 0; }
.ms-pagination[hidden] { display: none; }
.ms-toolbar-search { position: relative; flex: 1 1 240px; display: flex; align-items: center; }
.ms-toolbar-search svg { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
/* [type="text"] (not just `input`) so this ties .card's own
   `input[type=text]` rule on specificity and wins on source order - that
   rule would otherwise strip the left padding the icon needs, e.g. for the
   Site-Berechtigung search box nested inside a .card. */
.ms-toolbar-search input[type="text"] {
  width: 100%; padding: 8px 10px 8px 32px; background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 14px; font-family: inherit;
}
/* Summary-bar Online/Offline/Unbekannt stats double as click-to-filter
   toggles - clicking an already-active one clears back to "alle". */
.summary-stat.js-status-filter { cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.summary-stat.js-status-filter:hover { border-color: var(--accent); }
.summary-stat.js-status-filter.is-active-filter { border-color: var(--accent); background: rgba(79,140,255,0.08); }
.summary-stat.summary-errors { cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.summary-stat.summary-errors:hover { border-color: var(--red); }

.btn-reboot {
  background: none; border: 1px solid var(--border); color: var(--muted); cursor: pointer;
  border-radius: 6px; width: 26px; height: 26px; font-size: 20px; line-height: 1;
  font-weight: 700; padding: 0; text-align: center;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-reboot span { display: inline-block; transform: translateY(-1px); }
.btn-reboot:hover { color: var(--amber); border-color: var(--amber); }
.icon-btn {
  background: none; border: 1px solid var(--border); color: var(--muted); cursor: pointer;
  border-radius: 6px; width: 26px; height: 26px; padding: 0; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { color: var(--amber); border-color: var(--amber); }
.icon-btn.is-active { color: var(--accent); border-color: var(--accent); }
.pill { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 10px; border-radius: 12px; font-weight: 500; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-online { background: rgba(47,191,113,0.15); color: var(--green); }
.pill-offline { background: rgba(239,83,80,0.15); color: var(--red); }
.pill-unknown { background: rgba(154,162,175,0.15); color: var(--muted); }
.ms-card-meta { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12.5px; color: var(--muted); }
.ms-card-meta strong { color: var(--text); font-weight: 500; }
.btn-refresh {
  background: none; border: none; color: var(--accent); cursor: pointer;
  font-size: 13px; padding: 0 0 0 6px; line-height: 1; vertical-align: middle;
}
.btn-refresh:hover { color: var(--text); }
.btn-refresh.is-spinning, .is-spinning { animation: lox-spin 0.8s linear infinite; display: inline-block; }
@keyframes lox-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.ms-card-sparkline { display: flex; flex-direction: column; gap: 4px; text-decoration: none; cursor: pointer; }
.sparkline-wrap { height: 10px; border-radius: 5px; overflow: hidden; background: var(--border); transition: transform 0.1s; }
.ms-card-sparkline:hover .sparkline-wrap { transform: scaleY(1.3); }
.sparkline-wrap canvas { display: block; width: 100%; height: 100%; }
.sparkline-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.ms-card-messages { font-size: 12.5px; }
.ms-card-messages a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.js-message-count { font-weight: 600; }
.ms-card-backup { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 8px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 12.5px; }
.ms-card-backup > span:first-child { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
.ms-card-actions { display: flex; gap: 10px; align-items: center; }

/* ---- Auth screens (login, 2FA challenge, password reset, first-run setup) ---- */
/* Background itself now comes from the shared body rule above (used app-wide);
   this just centers the auth card on the viewport. */
.auth-body {
  min-height: 100vh; margin: 0; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card-wrap {
  width: 100%; max-width: 440px;
  background: linear-gradient(160deg, rgba(79,140,255,0.09), transparent 60%), var(--card);
  border: 1px solid rgba(79,140,255,0.14); border-radius: 18px;
  padding: 44px 40px; box-shadow: 0 24px 70px rgba(0,0,0,0.4);
  display: flex; flex-direction: column; align-items: center;
}
:root[data-theme="light"] .auth-card-wrap {
  background: linear-gradient(160deg, rgba(47,111,224,0.05), transparent 60%), var(--card);
  border: 1px solid rgba(47,111,224,0.12);
  box-shadow: 0 24px 60px rgba(20,30,60,0.12);
}
.auth-logo { height: 68px; width: auto; margin-bottom: 24px; display: none; }
.auth-logo.brand-logo-dark { display: block; }
:root[data-theme="light"] .auth-logo.brand-logo-dark { display: none; }
:root[data-theme="light"] .auth-logo.brand-logo-light { display: block; }
.auth-card-wrap h1 { font-size: 21px; margin: 0 0 6px; text-align: center; }
.auth-card-wrap .notes { text-align: center; margin: 0 0 20px; }
.auth-card-wrap .flash { width: 100%; }
.auth-form { width: 100%; display: flex; flex-direction: column; gap: 16px; margin-top: 4px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.auth-form input {
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 11px 13px; color: var(--text); font-size: 15px; font-family: inherit;
}
.auth-form input:focus { outline: none; border-color: var(--accent); }
.auth-form .btn { width: 100%; padding: 11px 14px; font-size: 15px; font-weight: 600; }
.auth-links { display: flex; flex-direction: column; gap: 8px; align-items: center; margin-top: 20px; width: 100%; }
.auth-theme-toggle { position: fixed; top: 18px; right: 18px; background: var(--card); border: 1px solid var(--border); }
