/* xRestart Console — page-specific styles */

/* ---- KPI --------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi {
  position: relative; overflow: hidden; padding: 16px 18px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs);
}
.kpi-head { display: flex; align-items: center; gap: 8px; font-size: var(--text-xs); font-weight: 500; color: var(--text-muted); }
.kpi-icon {
  width: 26px; height: 26px; border-radius: var(--r-md); display: grid; place-items: center;
  background: var(--idle-soft); color: var(--text-muted);
}
.kpi-icon svg { width: 14px; height: 14px; }
.kpi-value { font-size: var(--text-3xl); font-weight: 600; letter-spacing: -0.03em; margin-top: 10px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text); }
.kpi-foot { margin-top: 8px; font-size: var(--text-xs); color: var(--text-faint); font-variant-numeric: tabular-nums; min-height: 18px; }
.kpi-online .kpi-icon { background: var(--ok-soft); color: var(--ok-text); }
.kpi-offline .kpi-icon { background: var(--idle-soft); color: var(--idle-text); }
.kpi-rebooting .kpi-icon { background: var(--reboot-soft); color: var(--reboot-text); }
.kpi-total .kpi-icon { background: var(--accent-soft); color: var(--accent-text); }
.kpi-rebooting.is-hot { border-color: color-mix(in srgb, var(--reboot) 45%, var(--border)); }
.kpi-rebooting.is-hot::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--reboot), transparent);
  animation: scan 2s linear infinite;
}
@keyframes scan { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---- Dashboard grid --------------------------------------------------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.dash-main { display: grid; gap: 16px; min-width: 0; }
.dash-side { display: grid; gap: 16px; min-width: 0; }
@media (max-width: 1180px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 400px) { .kpi { padding: 12px 14px; } .kpi-value { font-size: var(--text-2xl); } }

/* ---- Org cards -------------------------------------------------------- */
.org-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; padding: 16px; }
.org-card {
  /* minmax(0,1fr): without it the implicit grid column grows to the footer's
     nowrap min-content and the bar/button spill out of the card. */
  display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 12px; padding: 14px; border-radius: var(--r-lg);
  border: 1px solid var(--border); background: var(--surface-2);
  transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
.org-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.org-card.is-rebooting { border-color: color-mix(in srgb, var(--reboot) 50%, var(--border)); background: color-mix(in srgb, var(--reboot) 4%, var(--surface-2)); }
.org-card-head { display: flex; align-items: center; gap: 10px; }
.org-avatar {
  width: 32px; height: 32px; border-radius: var(--r-md); display: grid; place-items: center; flex-shrink: 0;
  font-size: var(--text-xs); font-weight: 700; letter-spacing: 0; color: var(--accent-text);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  font-family: var(--font-mono);
}
.org-name { font-weight: 600; font-size: var(--text-md); color: var(--text); font-family: var(--font-mono); letter-spacing: 0; }
.org-meta { font-size: var(--text-xs); color: var(--text-muted); }
.org-card-head .badge { margin-left: auto; }
.org-rate { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.org-rate .pct { font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--text); }
.org-rate .pct small { font-size: var(--text-xs); font-weight: 500; color: var(--text-muted); margin-left: 4px; }
.org-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.org-legend span { display: inline-flex; align-items: center; gap: 5px; }
.org-legend .dot { width: 6px; height: 6px; }
.org-legend .dot::after { display: none; }
.org-card-foot { display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border-subtle); font-size: var(--text-xs); color: var(--text-muted); }
.org-card-foot .last { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-card-foot .btn { margin-left: auto; }

/* ---- Active commands -------------------------------------------------- */
.cmd-list { display: grid; }
.cmd {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--border-subtle);
}
.cmd:last-child { border-bottom: 0; }
.cmd-ring { width: 44px; height: 44px; position: relative; }
.cmd-ring svg { width: 44px; height: 44px; transform: rotate(-90deg); }
.cmd-ring .bg { stroke: var(--border); }
.cmd-ring .fg { stroke: var(--reboot); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.cmd-ring .ico { position: absolute; inset: 0; display: grid; place-items: center; color: var(--reboot-text); }
.cmd-ring .ico svg { width: 16px; height: 16px; transform: none; }
.cmd-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; color: var(--text); }
.cmd-meta { font-size: var(--text-xs); color: var(--text-muted); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 12px; min-width: 0; }
.cmd-meta code { overflow-wrap: anywhere; min-width: 0; }
.cmd-progress { margin-top: 8px; display: grid; gap: 4px; }
.cmd-progress .row { font-size: var(--text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.cmd-countdown { font-family: var(--font-mono); font-size: var(--text-md); font-weight: 600; color: var(--reboot-text); font-variant-numeric: tabular-nums; letter-spacing: 0; text-align: right; }
.cmd-countdown small { display: block; font-family: var(--font-sans); font-size: var(--text-2xs); font-weight: 500; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.cmd-actions { display: grid; gap: 6px; justify-items: end; }
@media (max-width: 560px) {
  .cmd { grid-template-columns: auto minmax(0, 1fr); }
  .cmd-actions { grid-column: 1 / -1; grid-auto-flow: column; justify-content: space-between; align-items: center; }
}

/* ---- Timeline --------------------------------------------------------- */
.timeline { list-style: none; padding: 8px 16px 12px; margin: 0; }
.tl-item { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; position: relative; padding: 8px 0; }
.tl-item::before {
  content: ""; position: absolute; left: 13.5px; top: 34px; bottom: -8px; width: 1px; background: var(--border);
}
.tl-item:last-child::before { display: none; }
.tl-icon {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted);
}
.tl-icon svg { width: 13px; height: 13px; }
.tl-icon.t-danger { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger-text); }
.tl-icon.t-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn-text); }
.tl-icon.t-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok-text); }
.tl-icon.t-accent { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--accent-text); }
.tl-text { font-size: var(--text-sm); color: var(--text-2); overflow-wrap: anywhere; }
.tl-text strong { color: var(--text); font-weight: 600; }
.tl-meta { font-size: var(--text-xs); color: var(--text-faint); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Emergency modal -------------------------------------------------- */
.em-impact {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border-radius: var(--r-md); overflow: hidden;
  background: var(--border); border: 1px solid var(--border); margin: 4px 0 16px;
}
.em-impact > div { background: var(--surface-2); padding: 10px 12px; }
.em-impact .lbl { font-size: var(--text-2xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
.em-impact .val { font-size: var(--text-xl); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); margin-top: 2px; }
.em-impact .val.hot { color: var(--danger-text); }
.em-list { margin: 0 0 14px; padding-left: 18px; font-size: var(--text-sm); color: var(--text-2); display: grid; gap: 4px; }
.em-confirm-ok { border-color: var(--ok) !important; }

/* ---- Key/Value -------------------------------------------------------- */
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.kv { padding: 14px 16px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); }
.kv .k { font-size: var(--text-xs); color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.kv .k svg { width: 14px; height: 14px; }
.kv .v { font-size: var(--text-lg); font-weight: 600; margin-top: 6px; color: var(--text); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.kv .v.mono { font-size: var(--text-md); }

/* ---- Notifications --------------------------------------------------- */
.route-form { display: grid; grid-template-columns: minmax(150px, 200px) max-content minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.route-form .segmented { height: 34px; align-items: stretch; }
.route-form .segmented button { height: auto; justify-content: center; }
@media (max-width: 980px) { .route-form { grid-template-columns: 1fr 1fr; } .route-form .full { grid-column: 1 / -1; } .route-form .segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; } }
@media (max-width: 480px) { .route-form { grid-template-columns: 1fr; } }
.route-type { display: inline-flex; align-items: center; gap: 6px; }
.route-type svg { width: 14px; height: 14px; color: var(--text-muted); }

/* ---- Password page --------------------------------------------------- */
.narrow { max-width: 520px; }

/* ---- Event type badges ---------------------------------------------- */
.ev-type { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0; }

/* ---- Releases: dropzone & bundles ------------------------------------ */
.mb-4 { margin-bottom: var(--sp-4); }
.dropzone {
  display: grid; justify-items: center; text-align: center; gap: 6px; padding: 28px 20px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--surface-2);
  cursor: pointer; transition: border-color var(--dur-1), background var(--dur-1);
}
.dropzone:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border-strong)); }
.dropzone:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--r-lg); }
.dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dz-icon { width: 44px; height: 44px; border-radius: var(--r-lg); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 4px; }
.dz-title { font-weight: 600; color: var(--text); }
.dz-or { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--text-muted); }
.dz-hint { font-size: var(--text-xs); color: var(--text-faint); max-width: 560px; font-family: var(--font-mono); letter-spacing: 0; }
.bundle-list { display: grid; gap: 8px; }
.bundle-list:empty { display: none; }
.bundle { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 14px; background: var(--surface); display: grid; gap: 8px; }
.bundle.has-error { border-color: var(--danger-border); }
.bundle-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.bundle-icon { width: 34px; height: 34px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--bg-subtle); color: var(--text-muted); }
.bundle-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; color: var(--text); }
.bundle-slots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.slot { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: var(--r-full); font-size: var(--text-xs); font-weight: 500; border: 1px solid var(--border); }
.slot.is-ok { color: var(--ok-text); background: var(--ok-soft); border-color: transparent; }
.slot.is-missing { color: var(--text-faint); border-style: dashed; }
.slot-meta { color: inherit; opacity: 0.75; font-variant-numeric: tabular-nums; font-weight: 400; }
.bundle-actions { display: flex; gap: 4px; }
.bundle-notes { font-size: var(--text-xs); color: var(--text-muted); }
.bundle-progress { display: grid; gap: 4px; }
.bundle-progress:has(.meter[hidden]) .bundle-status:empty { display: none; }
.bundle-status { font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .bundle-head { grid-template-columns: auto minmax(0, 1fr); } .bundle-actions { grid-column: 1 / -1; justify-content: flex-end; } }

.sha-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 6px; border-radius: var(--r-sm);
  color: var(--text-muted); font-size: var(--text-xs); border: 1px solid transparent;
}
.sha-btn:hover { background: var(--surface-hover); border-color: var(--border); color: var(--text); }
.sha-btn code { font-size: var(--text-xs); }

.range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: var(--r-full); margin: 10px 0 12px;
  background: linear-gradient(90deg, var(--accent) 0 var(--fill, 0%), var(--bg-subtle) var(--fill, 0%) 100%);
  border: 1px solid var(--border); cursor: pointer;
}
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); box-shadow: var(--shadow-sm); }
.range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); }
.range:focus-visible { box-shadow: var(--focus-ring); }
.range-out { font-size: var(--text-lg); font-weight: 600; color: var(--text); }
.switch-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); }
.switch-row .switch { margin-top: 2px; }
.switch-title { display: block; font-size: var(--text-sm); font-weight: 500; color: var(--text); }

/* ---- Dashboard: version distribution --------------------------------- */
.ver-list { list-style: none; padding: 12px 16px 16px; margin: 0; display: grid; gap: 10px; }
.ver-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; font-size: var(--text-sm); }
.ver-row .ver-name { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); color: var(--text); letter-spacing: 0; }
.ver-row .ver-count { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: var(--text-xs); }
.ver-row .meter { grid-column: 1 / -1; height: 6px; }
.ver-row .m-ver { background: var(--brand-300); }
.ver-row.is-latest .m-ver { background: var(--accent); }
[data-theme="dark"] .ver-row .m-ver { background: var(--brand-700); }
[data-theme="dark"] .ver-row.is-latest .m-ver { background: var(--brand-400); }

/* ---- Users: role cards ------------------------------------------------ */
.role-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 560px) { .role-cards { grid-template-columns: 1fr; } }
.role-card {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md);
  border: 1px solid var(--border-strong); cursor: pointer; background: var(--surface);
  transition: border-color var(--dur-1), background var(--dur-1);
}
.role-card input { margin-top: 3px; accent-color: var(--accent); }
.role-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.role-card:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.role-card:has(input:disabled) { opacity: 0.6; cursor: not-allowed; }
.role-card-title { display: block; font-weight: 600; font-size: var(--text-sm); color: var(--text); }
.role-card-desc { display: block; font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }
.sha-btn { white-space: nowrap; }
.table .rel-notes { font-family: var(--font-sans); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Devices: nickname column + inline editor ------------------------- */
.table .th-nick, .table .cell-nick { width: 210px; min-width: 170px; max-width: 210px; }
.nick-view { display: flex; align-items: center; gap: 4px; min-width: 0; }
.nick-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nick-empty { color: var(--text-faint); }
.nick-missing { white-space: nowrap; }
.nick-notice { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; color: inherit; text-decoration: none; }
.nick-notice > div { flex: 1; }
.nick-notice:hover { border-color: var(--warn); }
.chip-filter[aria-pressed="true"] { background: var(--warn-soft); border-color: var(--warn); color: var(--warn-text); }
.nick-edit-btn { flex-shrink: 0; color: var(--text-faint); opacity: 0; transition: opacity var(--dur-1), color var(--dur-1); }
.nick-edit-btn svg { width: 14px; height: 14px; }
.table tbody tr:hover .nick-edit-btn, .nick-edit-btn:focus-visible { opacity: 1; }
.nick-edit-btn:hover { color: var(--text); }
@media (hover: none) { .nick-edit-btn { opacity: 1; } }
.nick-form { display: grid; gap: 4px; min-width: 0; }
.nick-row { display: flex; align-items: center; gap: 4px; }
.nick-row .input { flex: 1; min-width: 0; }
.nick-foot { display: flex; align-items: flex-start; gap: 8px; }
.nick-foot .field-error { white-space: normal; }
.nick-foot .field-error { flex: 1; }
.nick-count { margin-left: auto; font-size: var(--text-2xs); color: var(--text-faint); }
.nick-count.is-over { color: var(--danger-text); }
.table tbody tr.is-editing, .table tbody tr.is-editing:hover { background: var(--accent-soft); }
.host-stack .host-name { color: var(--text-2); }
@media (max-width: 720px) {
  .table.stackable td.cell-nick { max-width: none; font-size: var(--text-md); }
  .table.stackable td.cell-nick .nick-view { justify-content: space-between; }
  .table.stackable td.cell-host .host-stack { text-align: right; }
  .nick-form { min-width: 0; }
}

/* ---- Org transitions (device move / org rename) ----------------------- */
.org-trans {
  display: inline-flex; align-items: center; gap: 4px; vertical-align: baseline; margin-right: 6px;
  padding: 1px 7px; border-radius: var(--r-full); background: var(--surface-2); border: 1px solid var(--border);
  font-size: var(--text-xs); color: var(--text); white-space: nowrap;
}
.org-trans svg { color: var(--text-faint); flex-shrink: 0; }
.move-preview { display: flex; align-items: center; gap: 10px; font-size: var(--text-sm); }
.move-preview .org-trans { font-size: var(--text-sm); padding: 3px 10px; }

/* ---- Departments ------------------------------------------------------- */
.scope-filters { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.page-actions .scope-filters .select { min-width: 160px; }
.dept-avatar {
  width: 28px; height: 28px; border-radius: var(--r-md); display: inline-grid; place-items: center; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-text);
}
.dept-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: var(--r-full);
  font-size: var(--text-xs); color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap;
}
.dept-chip svg { color: var(--accent-text); }
.dept-chip:hover { text-decoration: none; border-color: var(--border-strong); color: var(--text); }
.table .cell-sub.dep-desc { font-family: var(--font-sans); letter-spacing: normal; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dep-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.dep-stat { padding: 12px 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs); }
.dep-stat .lbl { font-size: var(--text-xs); color: var(--text-muted); font-weight: 500; }
.dep-stat .val { font-size: var(--text-2xl); font-weight: 600; color: var(--text); margin-top: 4px; letter-spacing: -0.02em; }
.dep-stat .sub { font-size: var(--text-xs); color: var(--text-faint); }
@media (max-width: 720px) { .dep-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Dashboard: department summary */
.dept-list { display: grid; padding: 4px 8px 8px; }
.dept-row {
  display: grid; grid-template-columns: minmax(0, 1.6fr) 56px 64px minmax(120px, 1.2fr) 96px; gap: 12px; align-items: center;
  padding: 9px 8px; border-radius: var(--r-md); color: var(--text-2); font-size: var(--text-sm);
}
a.dept-row:hover { background: var(--surface-hover); text-decoration: none; color: var(--text); }
.dept-row .num { text-align: right; font-variant-numeric: tabular-nums; }
.dept-head { font-size: var(--text-2xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); padding-top: 6px; padding-bottom: 4px; }
.dept-name { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 500; color: var(--text); }
.dept-rate { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 8px; align-items: center; }
.dept-rate .meter { height: 6px; }
.dept-flag { display: flex; justify-content: flex-end; color: var(--text-faint); }
.dept-row.is-rebooting .dept-avatar { background: var(--reboot-soft); color: var(--reboot-text); }
@media (max-width: 720px) {
  .dept-row { grid-template-columns: minmax(0, 1fr) 72px auto; }
  .dept-row > :nth-child(2), .dept-row > :nth-child(3) { display: none; }
  .dept-head { display: none; }
}

/* Orgs: grouped by department */
.table .group-row th {
  background: var(--bg-subtle); color: var(--text); font-size: var(--text-xs); font-weight: 600; text-align: left;
  padding: 8px 14px; border-top: 1px solid var(--border); position: static; border-radius: 0;
}
.table tbody .group-row:first-child th { border-top: 0; }
.table .group-row:hover { background: transparent; }
.group-title { display: inline-flex; align-items: center; gap: 6px; }
.group-title svg { color: var(--accent-text); }
.group-meta { margin-left: 10px; font-weight: 400; color: var(--text-faint); }
.toolbar-count { font-size: var(--text-xs); }
@media (max-width: 720px) {
  .table.stackable tr.group-row { padding: 0; background: var(--bg-subtle); }
  .table.stackable .group-row th { display: block; }
}

/* Users: role cards / scope pickers */
.role-cards-single { grid-template-columns: minmax(0, 1fr); }
.role-card-title .badge { font-size: var(--text-xs); }
.org-pick { display: grid; gap: 10px; max-height: 240px; overflow: auto; padding: 2px; }
.org-pick .chip-list { max-height: none; }
.org-pick-title { display: flex; align-items: center; gap: 5px; font-size: var(--text-2xs); font-weight: 600; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 4px; }
.org-pick-title svg { color: var(--accent-text); }

/* Account menu: role + scope */
.menu-head .meta { margin-top: 4px; }
.menu-scope { padding: 0 10px 8px; max-width: 280px; }
.menu-scope-label { font-size: var(--text-2xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin-bottom: 4px; }
.menu-scope-items { display: flex; flex-wrap: wrap; gap: 4px; font-size: var(--text-xs); }

/* ---- Command result breakdown (CONTRACT I3) --------------------------- */
.cmdp { display: grid; gap: 4px; min-width: 0; }
.cmdp .meter { min-width: 120px; }
.cmdp-caption { font-size: var(--text-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.cmdp-main { color: var(--text-2); font-weight: 500; }
.cmdp-lg .cmdp-caption { font-size: var(--text-sm); }
.meter-cmd > span[hidden] { display: none; }
.meter .m-rebooted { background: var(--ok); }
.meter .m-executing { background: var(--accent); }
.meter .m-failed { background: var(--danger); }
.meter .m-not-rebooted {
  background: repeating-linear-gradient(135deg, var(--danger) 0 3px, color-mix(in srgb, var(--danger) 35%, transparent) 3px 6px);
}
.meter .m-offline { background: var(--idle); }
.meter-cmd > span:last-of-type:not([hidden]) { border-radius: 0 var(--r-full) var(--r-full) 0; }
.td-progress { min-width: 200px; }
.cmd-actions .btn-ghost { justify-self: end; }

.badge-striped {
  background: repeating-linear-gradient(135deg, var(--danger-soft) 0 4px, color-mix(in srgb, var(--danger) 16%, var(--danger-soft)) 4px 8px);
}
.dot-t-rebooted { background: var(--ok); }
.dot-t-executing { background: var(--accent); }
.dot-t-failed { background: var(--danger); }
.dot-t-not_rebooted { background: repeating-linear-gradient(135deg, var(--danger) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px var(--danger); }
.dot-t-offline { background: var(--idle); }
.dot-t-pending { background: transparent; box-shadow: inset 0 0 0 1.5px var(--idle); }

/* Detail dialog */
.modal-xl { max-width: 960px; }
.cmdd { display: grid; gap: 14px; }
.cmdd-summary { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: thin; }
.tabs [role="tab"] {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; white-space: nowrap;
  font-size: var(--text-sm); font-weight: 500; color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs [role="tab"]:hover { color: var(--text); }
.tabs [role="tab"][aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs [role="tab"]:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--r-sm) var(--r-sm) 0 0; }
.tab-count { font-size: var(--text-2xs); padding: 0 6px; border-radius: var(--r-full); background: var(--bg-subtle); color: var(--text-muted); line-height: 18px; }
.tabs [role="tab"].is-bad .tab-count { background: var(--danger-soft); color: var(--danger-text); }
.tab-panel { border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.tab-panel .table th:first-child, .tab-panel .table th:last-child { border-radius: 0; }
.td-detail { max-width: 320px; }
.td-reason { display: grid; gap: 2px; }
.td-raw { display: block; font-size: var(--text-2xs); color: var(--text-faint); letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.table-compact td { padding-top: 8px; padding-bottom: 8px; }
@media (max-width: 720px) {
  .td-detail, .td-raw { max-width: none; }
  .td-reason { text-align: right; }
}
.cmdp-extra > span { white-space: nowrap; }

/* ---- Lid-close policy hint (CONTRACT J3) ------------------------------- */
.state-cell { display: inline-flex; align-items: center; gap: 8px; }
.lid-hint { display: inline-flex; align-items: center; gap: 4px; color: var(--text-faint); cursor: help; }
.lid-hint.lid-overridden_by_policy { color: var(--warn-text); }
.lid-hint.lid-unsupported { opacity: 0.45; }
.lid-text { display: none; font-size: var(--text-xs); }
.seg-moon { color: var(--sleep); }
@media (max-width: 720px) {
  .state-cell { flex-direction: column; align-items: flex-end; gap: 2px; }
  .lid-text { display: inline; }
}

/* ---- Catch-up window (CONTRACT J2) ------------------------------------- */
.input-group.has-suffix { display: flex; align-items: stretch; }
.input-group.has-suffix .input { border-top-right-radius: 0; border-bottom-right-radius: 0; max-width: 140px; }
.input-suffix {
  display: inline-flex; align-items: center; padding: 0 12px; font-size: var(--text-sm); color: var(--text-muted);
  background: var(--surface-2); border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 var(--r-md) var(--r-md) 0;
}
.chip-btn { cursor: pointer; font: inherit; font-size: var(--text-xs); }
.chip-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--accent-text); }
.chip-btn:focus-visible { box-shadow: var(--focus-ring); }
.catchup-note { display: inline-flex; align-items: center; gap: 4px; color: var(--sleep-text); white-space: nowrap; font-size: var(--text-xs); }
.catchup-note svg { color: var(--sleep); }
.completed-note { display: inline-flex; align-items: center; gap: 4px; color: var(--ok-text, var(--text-2)); white-space: nowrap; font-size: var(--text-xs); }
.completed-note svg { color: var(--ok, currentColor); }
.cmd-countdown .cd-long { font-size: var(--text-md); }
.cmd.is-catchup .cmd-ring .fg { stroke: var(--sleep); }
.cmd.is-catchup .cmd-countdown { color: var(--sleep-text); }
.catchup-friendly { align-self: center; margin-left: 12px; font-size: var(--text-sm); color: var(--sleep-text); font-weight: 500; white-space: nowrap; }
.chip-default { margin-left: 4px; font-size: var(--text-2xs); padding: 0 6px; border-radius: var(--r-full); background: var(--sleep-soft); color: var(--sleep-text); }
.cmdp-pending { color: var(--sleep-text); }
.dot-t-pending { background: var(--sleep); box-shadow: none; }
@media (max-width: 720px) { .lid-hint.lid-unsupported { display: none; } }
@media (max-width: 720px) {
  /* Command progress on phone cards: label on its own line, then a full-width bar and wrapping caption. */
  .table.stackable td.td-progress { display: block; min-width: 0; text-align: left; }
  .table.stackable td.td-progress::before { display: block; margin-bottom: 6px; }
  .td-progress .cmdp, .td-progress .cmdp .meter { width: 100%; min-width: 0; }
  .td-progress .cmdp-caption { white-space: normal; }
}
/* Grouped by department: the group header already names the department, so drop the column. */
.table.is-grouped thead th:nth-child(2),
.table.is-grouped tbody tr:not(.group-row) td:nth-child(2) { display: none; }

/* Enrollment key column (CONTRACT L) */
.key-cell { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.key-hint { font-size: var(--text-xs); color: var(--text-2); }
.key-cell.is-revealed { white-space: normal; }
.key-full { font-size: var(--text-xs); padding: 2px 6px; border-radius: 4px; background: var(--warn-soft); color: var(--text); user-select: all; word-break: break-all; max-width: 260px; }
