/* Admin Resources (master goal V·D·21, page 17): page styles (strict CSP; no inline styles).

   The resource table fits its card at desktop widths, so the list never scrolls sideways (owner request 2026-11-15):
   six columns in a fixed layout, related fields sharing a cell on two lines, a cut-off value keeping its full text in
   its title, and every cell allowed to shrink.  When the card itself is narrower than the columns need (a container
   query, so it holds with the sidebar open or collapsed), each row becomes a card.  Colours come from the theme
   tokens, so light and dark follow the shell; directions are logical, so Arabic mirrors without overrides.  Every rule
   is scoped to this page: admin-ops-kit.css and the shell stay unchanged for the other operations pages. */
.res-card { min-width: 0; overflow: visible; container: res-list / inline-size; }

/* the state filter: the shared Admin pill bar (admin-console.css .adm-pills) */
.res-card .adm-pills { margin-block-end: 14px; }
.res-toolbar { gap: 10px; flex-wrap: wrap; margin-block-end: 12px; }

/* the bulk bar, shown while rows are selected */
.res-bulkbar {
  display: none; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; margin-block-end: 12px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 10px;
}
.res-bulkbar.is-open { display: flex; }
.res-bulk-count { font-size: 13px; color: var(--accent); font-variant-numeric: tabular-nums; }
.res-bulkbar .res-bulk-suspend { background: var(--warn-fill); border-color: var(--warn-fill); color: #fff; }
.res-bulkbar .res-bulk-unsuspend { background: transparent; border-color: color-mix(in srgb, var(--ok) 55%, transparent); color: var(--ok); }
.res-bulkbar .res-bulk-terminate, .res-bulkbar .res-bulk-purge { background: var(--danger-fill); border-color: var(--danger-fill); color: #fff; }
.res-actions .btn { flex: none; }
.res-spacer { flex: 1; }
.res-bulkbar .btn[disabled], .res-toolbar .btn[disabled], .res-actions .btn[disabled] { opacity: .55; cursor: not-allowed; }

/* frame and columns */
.res-card .ops-table-wrap.res-wrap { border: 1px solid var(--border-soft); border-radius: 12px; background: var(--panel); }
.res-table { width: 100%; margin: 0; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: 13px; white-space: normal; }
.res-col-sel { width: 40px; }
.res-col-cust { width: 21%; }
.res-col-plan { width: 14%; }
.res-col-net { width: 112px; }
.res-col-state { width: 112px; }
.res-col-act { width: 150px; }
.res-table th {
  position: sticky; top: 0; z-index: 1; padding: 10px 8px; background: var(--panel-2); color: var(--muted); border-block-end: 1px solid var(--border-soft);
  font-size: 10.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; text-align: start; vertical-align: middle;
  overflow: hidden; text-overflow: ellipsis;
}
.res-table th:first-child { border-start-start-radius: 11px; }
.res-table th:last-child { border-start-end-radius: 11px; }
.res-table td {
  padding: 12px 8px; vertical-align: top; border-block-start: 1px solid var(--border-soft); border-block-end: 0; white-space: normal;
  overflow-wrap: anywhere; min-width: 0; transition: background .12s ease;
}
.res-table tbody tr:first-child > td { border-block-start: 0; }
.res-table th:first-child, .res-table td:first-child { padding-inline-start: 16px; }
.res-table th:last-child, .res-table td:last-child { padding-inline-end: 12px; }
.res-table tbody tr:last-child > td:first-child { border-end-start-radius: 11px; }
.res-table tbody tr:last-child > td:last-child { border-end-end-radius: 11px; }
.res-table tbody tr:hover > td { background: var(--row-hover); }
.res-table tbody tr:hover { background: transparent; }
.res-table .res-select { text-align: center; padding-inline: 12px 4px; }
.res-table .res-select input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; }

/* cells: a primary line and a quieter second line */
.res-pri { display: flex; align-items: center; gap: 4px; min-width: 0; font-weight: 600; line-height: 1.4; color: var(--text); }
.res-sub { display: flex; min-width: 0; margin-block-start: 3px; font-size: 12px; line-height: 1.45; color: var(--muted); }
.res-trunc { display: block; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 11.5px; font-weight: 500; letter-spacing: .01em; }
.res-ltr, .res-mono { direction: ltr; unicode-bidi: plaintext; }
[dir="rtl"] .res-ltr, [dir="rtl"] .res-mono { text-align: right; }
.res-c-cust a, .res-c-cust a:visited { color: var(--accent); text-decoration: none; }
.res-c-cust a:hover { text-decoration: underline; }
.res-c-cust .res-pri { font-weight: 500; }
.res-copy {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); line-height: 0; cursor: pointer; opacity: .75;
}
.res-copy:hover { opacity: 1; background: var(--row-hover); color: var(--text); }
.res-copy:focus-visible { opacity: 1; outline: 2px solid var(--accent); outline-offset: 1px; }
.res-c-net .res-pri { font-weight: 500; color: var(--text-dim); }
.res-states { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.res-states .ops-pill { max-width: 100%; padding: 2px 8px; font-size: 11px; white-space: normal; text-align: start; }
.res-vis { color: var(--muted); }
.res-vis-archived { color: var(--info); background: color-mix(in srgb, var(--info) 12%, transparent); }
.res-setup { font-size: 11.5px; font-weight: 600; color: var(--info); }
/* A live server without a billable subscription (owner decision 2026-11-26): a warning anyone can spot. */
.res-billing { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: var(--warn);
  background: color-mix(in srgb, var(--warn) 14%, transparent); }
.res-detail-billing { border-inline-start: 3px solid var(--warn); padding-inline-start: 10px; }

/* actions: Details and the row menu */
.res-table td.res-c-act { padding-inline: 4px 12px; }
.res-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.res-details { flex: none; }
.res-menu { position: relative; flex: none; }
.res-menu-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 30px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); color: var(--muted); list-style: none; cursor: pointer;
}
.res-menu-btn::-webkit-details-marker { display: none; }
.res-menu-btn::marker { content: ""; }
.res-menu-btn:hover, .res-menu[open] .res-menu-btn { background: var(--row-hover); color: var(--text); }
.res-menu[open] .res-menu-btn { border-color: var(--accent); }
.res-menu-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.res-menu-list {
  position: absolute; z-index: 20; inset-block-start: calc(100% + 4px); inset-inline-end: 0; display: grid; min-width: 180px; padding: 5px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel); box-shadow: var(--shadow-md);
}
.res-menu-item {
  appearance: none; display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text);
  font: inherit; font-size: 13px; text-align: start; white-space: nowrap; cursor: pointer;
}
.res-menu-item:hover, .res-menu-item:focus-visible { background: var(--row-hover); outline: none; }
.res-menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.res-menu-item--warn { color: var(--warn); }
.res-menu-item--danger { color: var(--danger); }
.res-menu-item[disabled] { opacity: .5; cursor: not-allowed; }

.res-empty { text-align: center; padding: 40px 16px; color: var(--muted); font-size: 13px; }

/* the termination dialog (admin-resources-actions.js) */
.res-terminate-steps { margin-block: 6px 8px; margin-inline-start: 18px; line-height: 1.7; }

/* the details dialog */
.res-detail { display: grid; gap: 18px; max-height: 64vh; overflow-x: hidden; overflow-y: auto; overflow-wrap: anywhere; }
.res-detail-group { display: grid; gap: 6px; }
.res-detail-h { margin: 0; font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.res-detail .ops-details-row { padding-block: 7px; font-size: 13px; }
.res-detail-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; direction: ltr; unicode-bidi: plaintext; }
.res-detail-note { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.res-detail-more > summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--accent); }
.res-detail-more > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.res-detail-raw {
  margin: 0; max-height: 220px; overflow-x: hidden; overflow-y: auto; white-space: pre-wrap; word-break: break-all; direction: ltr; text-align: start;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; color: var(--text-dim);
}
.res-segs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px;
  border: 1px solid var(--border-soft); border-radius: 10px; background: var(--panel-2); }
.res-seg {
  appearance: none; padding: 6px 14px; border: 0; border-radius: 7px; background: transparent; color: var(--text-dim); font: inherit; font-size: 13px;
  font-weight: 600; cursor: pointer;
}
.res-seg:hover { color: var(--text); }
.res-seg.is-on { background: var(--panel); color: var(--accent); box-shadow: var(--shadow-sm); cursor: default; opacity: 1; }
.res-seg:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.res-timeline { margin-block-start: 4px; }
.res-detail-extra { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }

/* the card is too narrow for the columns: each row becomes a card (two across when there is room).  The !important
   rules win over the shell's phone rule that turns every table into a sideways-scrolling block. */
@container res-list (max-width: 879px) {
  .res-card .ops-table-wrap.res-wrap { border: 0; border-radius: 0; background: transparent; }
  .res-card .res-table { display: block !important; width: 100% !important; overflow: visible !important; white-space: normal !important; }
  .res-card .res-table caption, .res-card .res-table colgroup, .res-card .res-table thead { display: none !important; }
  .res-card .res-table tbody { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 12px; }
  .res-card .res-table tbody tr {
    display: grid !important; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 0; align-content: start; padding: 2px 14px 4px;
    border: 1px solid var(--border-soft); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow-sm);
  }
  .res-card .res-table tbody tr.res-empty-row { display: block !important; grid-column: 1 / -1; }
  .res-card .res-table tbody tr > td {
    display: grid !important; grid-column: 1 / -1; grid-template-columns: minmax(78px, 30%) minmax(0, 1fr); column-gap: 12px; align-items: start;
    padding: 10px 0 !important; border-block-start: 1px solid var(--border-soft); border-radius: 0 !important; background: transparent !important;
    white-space: normal !important;
  }
  .res-card .res-table td::before {
    content: attr(data-label); padding-block-start: 2px; color: var(--muted); font-size: 10.5px; font-weight: 650; letter-spacing: .05em;
    text-transform: uppercase;
  }
  .res-card .res-table tbody tr > td.res-select { grid-column: 1; grid-row: 1; display: flex !important; align-items: flex-start;
    padding: 14px 10px 0 0 !important; border-block-start: 0; }
  [dir="rtl"] .res-card .res-table tbody tr > td.res-select { padding: 14px 0 0 10px !important; }
  .res-card .res-table tbody tr > td.res-c-res { grid-column: 2; grid-row: 1; display: block !important; padding: 12px 0 10px !important;
    border-block-start: 0; }
  .res-card .res-table tbody tr > td.res-c-act { grid-column: 3; grid-row: 1; display: flex !important; padding: 10px 0 0 8px !important;
    border-block-start: 0; }
  [dir="rtl"] .res-card .res-table tbody tr > td.res-c-act { padding: 10px 8px 0 0 !important; }
  .res-card .res-table td.res-select::before, .res-card .res-table td.res-c-res::before, .res-card .res-table td.res-c-act::before,
  .res-card .res-table td.res-empty::before { content: none; }
  .res-card .res-table td.res-empty { display: block !important; border: 1px dashed var(--border);
    border-radius: 12px !important; padding: 32px 16px !important; }
  .res-card .res-table .res-select input { width: 22px; height: 22px; }
  .res-card .res-table .res-menu-btn { width: 44px; height: 44px; }
  .res-card .res-table .res-details { min-height: 44px; }
  .res-card .res-table .res-copy { width: 40px; height: 40px; }
  .res-card .res-table .res-menu-item { min-height: 44px; }
}
@container res-list (max-width: 560px) {
  .res-card .res-toolbar { display: grid; grid-template-columns: 1fr; }
  .res-card .res-toolbar .ops-field { width: 100%; min-width: 0; }
  .res-card .ops-pager { display: grid; grid-template-columns: 1fr; justify-items: center; }
  .res-card .ops-pager .btn { min-height: 44px; }
}
@media (pointer: coarse) {
  .res-actions .btn, .res-bulkbar .btn, .res-menu-item, .res-seg { min-height: 44px; }
  .res-menu-btn { width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .res-table td { transition: none !important; }
}

/* The shell paints a mobile "scroll for more" edge on every table; this list never scrolls sideways (review 052a026). */
.res-card table.res-table { background-image: none !important; }
/* admin_infra-1: the bulk confirmation lists every resource it acts on. */
.res-bulk-targets { max-height: 240px; overflow-y: auto; margin: 6px 0 0; padding-inline-start: 20px; }
.res-bulk-host { color: var(--muted); margin-inline-start: 6px; }
/* admin_infra-11: a history entry's details as labelled values. */
.res-hist-facts { display: grid; gap: 2px; margin: 4px 0 0; }
.res-hist-facts > div { display: flex; gap: 6px; flex-wrap: wrap; }
.res-hist-facts dt { font-weight: 600; }
.res-hist-facts dd { margin: 0; overflow-wrap: anywhere; }
