/* xRestart Console — components */

/* ---- Buttons ----------------------------------------------------------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-bd: var(--border-strong);
  --btn-bg-hover: var(--surface-hover);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--r-md);
  font-size: var(--text-sm); font-weight: 500; line-height: 1; white-space: nowrap;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1px solid var(--btn-bd);
  box-shadow: var(--shadow-xs), var(--shadow-inset);
  transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1), box-shadow var(--dur-1), transform var(--dur-1);
  user-select: none; position: relative;
}
.btn:hover:not(:disabled) { background: var(--btn-bg-hover); text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.5; }
.btn svg { width: 15px; height: 15px; }
.btn-sm { height: 28px; padding: 0 10px; font-size: var(--text-xs); border-radius: var(--r-sm); }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { height: 40px; padding: 0 16px; font-size: var(--text-md); }
.btn-block { width: 100%; }
.btn-icon { width: 32px; padding: 0; }
.btn-icon.btn-sm { width: 28px; }

.btn-primary {
  --btn-bg: var(--accent); --btn-fg: var(--text-on-accent); --btn-bd: transparent;
  --btn-bg-hover: var(--accent-hover);
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.btn-danger {
  --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: transparent;
  --btn-bg-hover: var(--danger-hover);
  box-shadow: 0 1px 2px rgba(180, 35, 24, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.btn-danger-soft {
  --btn-bg: var(--danger-soft); --btn-fg: var(--danger-text); --btn-bd: var(--danger-border);
  --btn-bg-hover: color-mix(in srgb, var(--danger) 14%, var(--surface));
}
.btn-ghost {
  --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--text-2);
  --btn-bg-hover: var(--surface-hover);
  box-shadow: none;
}
.btn-ghost:hover:not(:disabled) { color: var(--text); }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--btn-fg); border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Arming progress inside dangerous confirm button */
.btn-arm { overflow: hidden; isolation: isolate; }
.btn-arm .arm-fill {
  position: absolute; inset: 0; z-index: -1; transform-origin: left center;
  background: rgba(255, 255, 255, 0.18); transform: scaleX(0);
}
.btn-arm.is-arming .arm-fill { animation: arm var(--arm-ms, 1500ms) linear forwards; }
@keyframes arm { to { transform: scaleX(1); } }

/* ---- Form controls ----------------------------------------------------- */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: var(--sp-4); }
.field-label { font-size: var(--text-sm); font-weight: 500; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; }
.field-hint { font-size: var(--text-xs); color: var(--text-muted); }
.field-error { font-size: var(--text-xs); color: var(--danger-text); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-3); }

.input, .select, .textarea {
  width: 100%; height: 34px; padding: 0 10px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  font-size: var(--text-md); line-height: 1.2;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur-1), box-shadow var(--dur-1), background var(--dur-1);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--text-muted)); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible,
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: var(--r-md);
}
.input[aria-invalid="true"] { border-color: var(--danger); }
.input-sm, .select-sm { height: 30px; font-size: var(--text-sm); }
.input.mono { font-family: var(--font-mono); font-size: var(--text-sm); }
.textarea { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; }
.select {
  appearance: none; -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23889' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 14px;
}
.select option { background: var(--surface); color: var(--text); }

.input-group { position: relative; display: flex; align-items: center; }
.input-group > .input { flex: 1; }
.input-group .input-icon {
  position: absolute; left: 10px; color: var(--text-faint); pointer-events: none;
  width: 15px; height: 15px;
}
.input-group .input-icon + .input { padding-left: 32px; }
.input-group .input-addon { position: absolute; right: 4px; }
.input-group.has-addon > .input { padding-right: 38px; }

.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--text-2); cursor: pointer; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--accent); margin: 0; cursor: pointer; }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
  width: 32px; height: 18px; border-radius: var(--r-full); background: var(--border-strong);
  position: relative; transition: background var(--dur-2) var(--ease-out); flex-shrink: 0;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform var(--dur-2) var(--ease-out);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { box-shadow: var(--focus-ring); }
.switch input:disabled + .track { opacity: 0.5; cursor: not-allowed; }

/* Segmented control */
.segmented {
  display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--r-md);
  background: var(--bg-subtle); border: 1px solid var(--border);
  overflow-x: auto; max-width: 100%;
}
.segmented button {
  height: 26px; padding: 0 10px; border-radius: 6px; font-size: var(--text-xs); font-weight: 500;
  color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background var(--dur-1), color var(--dur-1);
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"], .segmented button[aria-checked="true"] {
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
}
.segmented .count { color: var(--text-faint); font-variant-numeric: tabular-nums; }

/* Chip checklist (org multi-select) */
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 168px; overflow: auto; padding: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border-radius: var(--r-full); border: 1px solid var(--border-strong); background: var(--surface);
  font-size: var(--text-xs); font-weight: 500; color: var(--text-2); cursor: pointer; user-select: none;
}
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip:has(input:checked) { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--accent-text); }
.chip:has(input:focus-visible) { box-shadow: var(--focus-ring); }

/* ---- Cards ------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: 14px var(--sp-4); border-bottom: 1px solid var(--border-subtle); min-height: 52px;
}
.card-title { font-size: var(--text-md); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title svg { width: 16px; height: 16px; color: var(--text-muted); }
.card-sub { font-size: var(--text-xs); color: var(--text-muted); font-weight: 400; }
.card-body { padding: var(--sp-4); }
.card-footer { padding: 12px var(--sp-4); border-top: 1px solid var(--border-subtle); }

/* ---- Badges & state pills --------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px;
  border-radius: var(--r-full); font-size: var(--text-2xs); font-weight: 600; letter-spacing: 0.01em;
  background: var(--idle-soft); color: var(--idle-text); white-space: nowrap;
  border: 1px solid transparent;
}
.badge-outline { background: transparent; border-color: var(--border-strong); color: var(--text-muted); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-ok { background: var(--ok-soft); color: var(--ok-text); }
.badge-warn { background: var(--warn-soft); color: var(--warn-text); }
.badge-danger { background: var(--danger-soft); color: var(--danger-text); }
.badge svg { width: 12px; height: 12px; }

.state { display: inline-flex; align-items: center; gap: 7px; font-size: var(--text-sm); font-weight: 500; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); flex-shrink: 0; position: relative; }
.state-online .dot, .dot-online { background: var(--ok); }
.state-online .dot::after, .dot-online.pulse::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  background: var(--ok); opacity: 0.25; animation: ping 2.4s var(--ease-out) infinite;
}
.state-offline .dot, .dot-offline { background: var(--idle); }
.state-stale .dot, .dot-stale { background: transparent; border: 1.5px solid var(--idle); }
.state-rebooting .dot, .dot-rebooting { background: var(--reboot); }
.state-rebooting .dot::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 1.5px solid var(--reboot);
  border-right-color: transparent; animation: spin 1s linear infinite;
}
.state-online { color: var(--ok-text); }
.state-offline { color: var(--text-muted); }
.state-stale { color: var(--text-faint); }
.state-rebooting { color: var(--reboot-text); }
@keyframes ping { 0% { transform: scale(0.6); opacity: 0.4; } 80%, 100% { transform: scale(1.8); opacity: 0; } }

/* ---- Tables ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; font-size: var(--text-sm); }
.table th {
  text-align: left; font-weight: 500; font-size: var(--text-xs); color: var(--text-muted);
  padding: 9px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.table th:first-child { border-top-left-radius: var(--r-lg); }
.table th:last-child { border-top-right-radius: var(--r-lg); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; color: var(--text-2); }
.table tbody tr { transition: background var(--dur-1); }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .col-actions { text-align: right; white-space: nowrap; width: 1%; }
.table .col-num { text-align: right; font-variant-numeric: tabular-nums; }
.table .cell-primary { color: var(--text); font-weight: 500; }
.table .cell-sub { display: block; font-size: var(--text-xs); color: var(--text-faint); font-family: var(--font-mono); letter-spacing: 0; margin-top: 1px; }
.table .row-actions { display: inline-flex; gap: 4px; justify-content: flex-end; }
.th-sort { display: inline-flex; align-items: center; gap: 4px; color: inherit; font: inherit; }
.th-sort:hover { color: var(--text); }
.th-sort svg { width: 12px; height: 12px; opacity: 0.6; }
.th-sort.is-active svg { opacity: 1; color: var(--accent-text); }

/* Card-ify tables on small screens */
@media (max-width: 720px) {
  .table.stackable thead { display: none; }
  .table.stackable, .table.stackable tbody, .table.stackable tr, .table.stackable td { display: block; width: 100%; }
  .table.stackable tr { padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); }
  .table.stackable tbody tr:last-child { border-bottom: 0; }
  .table.stackable td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table.stackable td::before {
    content: attr(data-label); font-family: var(--font-sans); letter-spacing: normal; color: var(--text-faint); font-size: var(--text-xs); font-weight: 500; text-align: left; flex-shrink: 0;
  }
  .table.stackable td.cell-head { display: block; text-align: left; padding-bottom: 6px; }
  .table.stackable td.cell-head::before { display: none; }
  .table.stackable td.col-actions { width: 100%; justify-content: flex-end; padding-top: 8px; }
  .table.stackable td.col-actions::before { display: none; }
}

/* ---- Pagination -------------------------------------------------------- */
.pagination {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap;
  padding: 10px var(--sp-4); border-top: 1px solid var(--border-subtle); font-size: var(--text-xs); color: var(--text-muted);
}
.pagination .pages { display: inline-flex; align-items: center; gap: 4px; }
.pagination .page-info { font-variant-numeric: tabular-nums; }
.pagination .select { width: auto; height: 28px; font-size: var(--text-xs); }

/* ---- Modal ------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: var(--z-modal); background: var(--overlay);
  display: grid; place-items: center; padding: 16px; overflow-y: auto;
  animation: fade-in var(--dur-2) var(--ease-out);
  backdrop-filter: blur(2px);
}
.modal {
  width: 100%; max-width: 480px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  animation: pop-in var(--dur-3) var(--ease-out); overflow: hidden; display: flex; flex-direction: column;
  max-height: calc(100dvh - 32px);
}
.modal-lg { max-width: 640px; }
.modal-header { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 0; }
.modal-title { font-size: var(--text-lg); font-weight: 600; }
.modal-desc { font-size: var(--text-sm); color: var(--text-muted); margin-top: 4px; }
.modal-close { margin-left: auto; margin-top: -4px; margin-right: -6px; }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px;
  border-top: 1px solid var(--border-subtle); background: var(--surface-2); flex-wrap: wrap;
}
.modal-icon {
  width: 40px; height: 40px; border-radius: var(--r-lg); display: grid; place-items: center; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-text);
}
.modal-icon svg { width: 20px; height: 20px; }
.modal-icon.danger { background: var(--danger-soft); color: var(--danger-text); box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger) 6%, transparent); }
.modal-danger { border-color: var(--danger-border); }
.modal-danger .modal-header { position: relative; }
.modal-danger::before {
  content: ""; display: block; height: 3px;
  background: repeating-linear-gradient(135deg, var(--danger) 0 10px, color-mix(in srgb, var(--danger) 40%, transparent) 10px 20px);
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* ---- Toasts ------------------------------------------------------------ */
.toast-region {
  position: fixed; z-index: var(--z-toast); right: 16px; bottom: 16px;
  display: flex; flex-direction: column-reverse; gap: 8px; width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 12px 12px 14px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  font-size: var(--text-sm); color: var(--text-2);
  animation: toast-in var(--dur-3) var(--ease-out);
}
.toast.is-leaving { animation: toast-out var(--dur-2) var(--ease-in-out) forwards; }
.toast-icon { width: 18px; height: 18px; margin-top: 1px; color: var(--accent-text); }
.toast-success .toast-icon { color: var(--ok); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warn .toast-icon { color: var(--warn); }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 600; color: var(--text); }
.toast-msg { color: var(--text-muted); margin-top: 1px; overflow-wrap: anywhere; }
.toast .btn-icon { margin: -4px -4px 0 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* ---- Callouts ---------------------------------------------------------- */
.callout {
  display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--r-md); font-size: var(--text-sm);
  background: var(--accent-soft); color: var(--text-2); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.callout svg { width: 16px; height: 16px; margin-top: 2px; color: var(--accent-text); }
.callout-danger { background: var(--danger-soft); border-color: var(--danger-border); }
.callout-danger svg { color: var(--danger-text); }
.callout-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.callout-warn svg { color: var(--warn-text); }
.callout strong { color: var(--text); font-weight: 600; }

/* ---- Skeleton ---------------------------------------------------------- */
.skeleton {
  display: block; border-radius: var(--r-sm); min-height: 12px;
  background: linear-gradient(90deg, var(--skeleton-a) 25%, var(--skeleton-b) 37%, var(--skeleton-a) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite;
}
.sk-line { height: 12px; }
.sk-title { height: 22px; width: 40%; }
.sk-w-20 { width: 20%; } .sk-w-30 { width: 30%; } .sk-w-40 { width: 40%; } .sk-w-60 { width: 60%; } .sk-w-80 { width: 80%; }
.sk-block { height: 96px; border-radius: var(--r-lg); }
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* ---- Empty state ------------------------------------------------------- */
.empty { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 40px 20px; }
.empty-art { width: 120px; height: 96px; margin-bottom: 8px; color: var(--text-faint); }
.empty-title { font-size: var(--text-md); font-weight: 600; color: var(--text); }
.empty-desc { font-size: var(--text-sm); color: var(--text-muted); max-width: 360px; }
.empty .btn { margin-top: 10px; }
.empty-art .ea-card { fill: var(--surface); stroke: var(--border-strong); }
.empty-art .ea-card-2 { fill: var(--surface-2); stroke: var(--border); }
.empty-art .ea-line { fill: var(--border-strong); }
.empty-art .ea-accent { fill: var(--accent-soft); stroke: color-mix(in srgb, var(--accent) 55%, transparent); }
.empty-art .ea-icon { color: var(--accent-text); }
.empty-art .ea-dash { stroke: var(--border-strong); fill: none; }

/* ---- Menus / popovers -------------------------------------------------- */
.menu-anchor { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: var(--z-overlay);
  min-width: 220px; padding: 4px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg); animation: pop-in var(--dur-2) var(--ease-out);
}
.menu[hidden] { display: none; }
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border-radius: var(--r-sm);
  font-size: var(--text-sm); color: var(--text-2); text-align: left;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-hover); color: var(--text); text-decoration: none; box-shadow: none; }
.menu-item svg { width: 15px; height: 15px; color: var(--text-muted); }
.menu-item.danger { color: var(--danger-text); }
.menu-item.danger svg { color: var(--danger-text); }
.menu-item .check { margin-left: auto; color: var(--accent-text); }
.menu-sep { height: 1px; background: var(--border-subtle); margin: 4px 0; }
.menu-label { padding: 6px 10px 4px; font-size: var(--text-2xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
.menu-head { padding: 8px 10px; }
.menu-head .name { font-weight: 600; color: var(--text); font-size: var(--text-sm); }
.menu-head .meta { font-size: var(--text-xs); color: var(--text-muted); }

/* ---- Progress / meters -------------------------------------------------- */
.meter {
  display: flex; height: 6px; border-radius: var(--r-full); overflow: hidden;
  background: var(--bg-subtle); gap: 2px;
}
.meter > span { display: block; height: 100%; width: var(--w, 0%); transition: width var(--dur-3) var(--ease-out); }
.meter > span:first-child { border-radius: var(--r-full) 0 0 var(--r-full); }
.meter .m-online { background: var(--ok); }
.meter .m-rebooting { background: var(--reboot); }
.meter .m-offline { background: var(--idle); }
.meter .m-stale { background: var(--stale); }
.meter .m-acked { background: var(--accent); }
.meter .m-failed { background: var(--danger); }
.meter-lg { height: 8px; }

/* ---- Misc -------------------------------------------------------------- */
.kbd {
  display: inline-flex; align-items: center; height: 18px; padding: 0 5px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 10px; color: var(--text-muted);
  background: var(--surface-2); border: 1px solid var(--border); box-shadow: 0 1px 0 var(--border);
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  font-size: var(--text-xs); font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-700));
}
.avatar-sm { width: 22px; height: 22px; font-size: 10px; }

.secret-box {
  display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; border-radius: var(--r-md);
  background: var(--bg-subtle); border: 1px dashed var(--border-strong);
  font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text); letter-spacing: 0;
}
.secret-box code { flex: 1; overflow-wrap: anywhere; user-select: all; font-size: inherit; }

.confirm-word {
  font-family: var(--font-mono); font-weight: 600; color: var(--text); padding: 1px 6px; border-radius: 4px;
  background: var(--bg-subtle); border: 1px solid var(--border); letter-spacing: 0; font-size: 0.92em;
}

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.text-danger { color: var(--danger-text); }
.text-ok { color: var(--ok-text); }
.text-warn { color: var(--warn-text); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack { display: grid; gap: var(--sp-4); }
.row { display: flex; align-items: center; gap: var(--sp-2); }
.row-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); } .mt-4 { margin-top: var(--sp-4); }
.divider { height: 1px; background: var(--border-subtle); margin: var(--sp-4) 0; }
.min0 { min-width: 0; }
.stack-xs { display: grid; gap: 4px; min-width: 120px; }

/* Sleeping (CONTRACT J2): purple-grey, moon icon */
.state-sleeping { color: var(--sleep-text); }
.state-sleeping .state-icon { color: var(--sleep); }
.dot-sleeping { background: var(--sleep); }
.meter .m-sleeping { background: var(--sleep); }
.badge-sleep { background: var(--sleep-soft); color: var(--sleep-text); }

/* Narrow screens: segmented filters wrap into an even grid instead of overflowing the card
   (English labels such as "Restarting" were being cut off at 375px). */
@media (max-width: 640px) {
  .toolbar .segmented { display: grid; width: 100%; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 2px; }
  .toolbar .segmented button { justify-content: center; min-width: 0; padding: 0 6px; }
}
@media (max-width: 640px) {
  .toolbar .segmented:has(> button:nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.menu.menu-fixed { position: fixed; }
