/* Shared components. Loaded after the per-page sheets and before mobile.css.

   Each redesigned page grew its own status pill, empty state and loading
   line (pt-, pdx-, dp-, cdx-, cdp-, dsh-, badge-). They were close but not the
   same: different padding, gaps, dot sizes and tone colours. This sheet makes
   every family render as one component. New code should use .pill with an
   is-* tone; the older class names stay valid until their pages are rebuilt. */

/* ── Status pill ─────────────────────────────────────────────────────────── */
.pill,
.pt-pill, .pdx-pill, .dp-pill, .cdx-pill, .cdp-pill, .dsh-pill, .badge {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 22px; line-height: 22px; padding: 0 9px;
  border: 0; border-radius: var(--radius-pill);
  font-size: var(--t-meta); font-weight: 600; white-space: nowrap;
}
.pill { background: var(--bg-muted); color: var(--text-btn); }

/* Grey check after "Offline": this printer is meant to be off sometimes. */
.st-expected {
  display: inline-flex; align-items: center; flex: none;
  margin-left: 6px; vertical-align: middle;
  color: var(--text-muted); cursor: help;
}
.pdx-pill .st-expected { margin-left: 0; }

/* Tones: one colour pair per meaning, whatever the family calls it. */
.pill.is-ok, .pt-pill-ok, .pdx-pill.is-ok, .dp-pill.is-ok, .cdp-pill.is-ok, .cdx-pill.is-on, .dsh-pill-green, .badge-success {
  background: var(--success-bg); color: var(--success-dark);
}
.pill.is-warn, .pt-pill-warn, .pdx-pill.is-warn, .dp-pill.is-warn, .cdp-pill.is-warn, .dsh-pill-amber, .badge-warn {
  background: var(--warning-bg); color: var(--warning-dark);
}
.pill.is-bad, .pt-pill-bad, .pdx-pill.is-bad, .dp-pill.is-bad, .cdp-pill.is-bad, .dsh-pill-red, .badge-error {
  background: var(--danger-bg); color: var(--danger-dark);
}
.pill.is-info, .pill.is-blue, .pdx-pill.is-blue, .dp-pill.is-blue, .cdp-pill.is-blue, .dsh-pill-blue, .badge-primary {
  background: var(--info-bg); color: var(--info-text);
}
.pill.is-gray, .pill.is-off, .pt-pill-off, .pdx-pill.is-gray, .dp-pill.is-gray, .cdp-pill.is-off, .dsh-pill-gray, .badge-gray {
  background: var(--bg-muted); color: var(--text-btn); border: 0;
}
.pill.is-violet, .pdx-pill.is-violet { background: var(--variant-bg); color: var(--variant-text); }
.pill.is-none, .pt-pill-muted, .cdp-pill.is-none {
  background: transparent; color: var(--text-muted); box-shadow: inset 0 0 0 1px var(--border-strong);
}

/* Leading dot: same size everywhere. */
.pill.has-dot::before, .pt-pill::before, .cdp-pill::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none;
}
.pdx-pill-dot { width: 7px; height: 7px; }
.pill.is-warn.has-dot::before, .pt-pill-warn::before, .cdp-pill.is-warn::before { background: var(--warning); }
.pill.is-none.has-dot::before, .pt-pill-muted::before, .cdp-pill.is-none::before {
  background: transparent; box-shadow: inset 0 0 0 1.5px currentColor;
}

/* ── Empty states and loading lines ──────────────────────────────────────── */
/* Layout (padding, centring) stays with each page; the text is one style. */
.empty,
.pt-empty, .pt-tree-empty, .pt-dp-empty, .pdx-empty, .dp-filter-empty, .cdp-empty, .comp-empty, .dsh-empty,
.comp-printers-empty, .driver-printers-empty, .tmpl-group-empty, .logs-empty, .ulogs-empty, .srv-empty, .empty-state {
  font-size: var(--t-small); color: var(--text-muted);
}
.empty { padding: 16px; }
.loading-line,
.pt-loading, .dp-loading, .cd-loading, .cd-loading-sm, .pd-loading, .pd-loading-sm,
.comp-printers-loading, .docs-loading, .ulogs-loading {
  font-size: var(--t-small); color: var(--text-muted);
}

/* ── Section tabs (js/section_tabs.js) ───────────────────────────────────── */
.sec-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: -4px 0 20px; overflow-x: auto; }
.sec-tab {
  padding: 9px 12px; margin-bottom: -1px; border-bottom: 2px solid transparent;
  font-size: var(--t-body); font-weight: 500; color: var(--text-muted); text-decoration: none; white-space: nowrap;
}
.sec-tab:hover { color: var(--text); text-decoration: none; }
.sec-tab.active { color: var(--text); font-weight: 600; border-bottom-color: var(--primary); }
.sec-tab:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.sec-tabs + .page-bar { margin-top: 0; }

/* ── Plain list page pieces shared by Drivers, Templates and Groups ─────── */
.page-intro { font-size: var(--t-small); color: var(--text-muted); margin: -8px 0 16px; max-width: 760px; }
.list-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.list-toolbar .list-sp { flex: 1; }
.list-search { min-width: 220px; max-width: 320px; flex: 1; }
.list-group-h {
  display: flex; align-items: center; gap: 8px; margin: 20px 0 8px;
  font-size: var(--t-small); font-weight: 600; color: var(--text-btn);
}
.list-group-h:first-child { margin-top: 0; }
.list-group-h .muted { font-weight: 400; color: var(--text-muted); }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { font-size: var(--t-meta); color: var(--text-muted); margin-top: 2px; }
.cell-actions { white-space: nowrap; text-align: right; width: 1%; }
.cell-actions .btn + .btn, .cell-actions .btn + .row-menu-btn { margin-left: 4px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: var(--radius-sm); background: var(--bg-muted); color: var(--text-btn); font-size: var(--t-meta); white-space: nowrap; }
a.chip:hover { background: var(--hover-strong); color: var(--text); text-decoration: none; }
.dtable tr.row-click { cursor: pointer; }
.dtable tr.row-detail > td { background: var(--bg-alt); padding: 12px 16px; }
.dtable tr.row-detail:hover > td { background: var(--bg-alt); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Group detail, opened under its row on Computers → Groups. */
.gd-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px 24px; }
.gd-h { display: flex; align-items: center; gap: 8px; font-size: var(--t-small); font-weight: 600; margin-bottom: 6px; }
.gd-h .muted { font-weight: 400; color: var(--text-muted); }
.gd-h .pdx-link { margin-left: auto; font-weight: 500; }
.gd-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card-bg); }
.gd-list li { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-bottom: 1px solid var(--border); font-size: var(--t-small); }
.gd-list li:last-child { border-bottom: 0; }
.gd-list li > a { color: var(--text); font-weight: 500; }
.gd-list li > .muted { color: var(--text-muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-list li > a + .muted { margin-left: 4px; }
.dp-groups-link { align-self: center; font-size: var(--t-small); white-space: nowrap; }
.chg-manage { margin-right: auto; align-self: center; font-size: var(--t-small); }
.pdx-crumb-text { padding: 2px 4px; color: var(--text-muted); }
.pdx-crumb .pdx-crumb-text:last-child { color: var(--text); font-weight: 600; }

/* Server log line colours (Logs → Server log). The log pane is dark in both
   themes, so one set serves both. */
:root {
  --log-green: #34d399; --log-orange: #fb923c; --log-red: #f87171; --log-blue: #60a5fa;
  --log-violet: #a78bfa; --log-cyan: #22d3ee; --log-mint: #6ee7b7; --log-amber: #fbbf24;
  --log-yellow: #fcd34d; --log-pink: #f472b6; --log-purple: #c084fc; --log-gray: #9ca3af; --log-text: #d1d5db;
}
.logs-page .sec-tabs { margin-top: -8px; }
.srv-status-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }

/* Integrations (Settings → Integrations): the same quiet intro and card as
   the rest of Settings, instead of the older icon tile and shadowed cards. */
.int-intro { gap: 0; margin-bottom: 16px; }
.int-intro-icon { display: none; }
.int-intro h3 { font-size: var(--t-card); margin: 0 0 4px; }
.int-intro p { font-size: var(--t-small); }
.int-card { border-radius: var(--radius-lg); box-shadow: none; }
.int-card-head { padding: 12px 14px; }
.int-card-body { padding: 14px; }
.int-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 16px; margin-bottom: 12px; }
.int-head .page-intro { flex: 1; min-width: 260px; margin: 0; }
.int-admin-note { font-size: var(--t-small); color: var(--warning-dark); background: var(--warning-bg); border-radius: var(--radius-md); padding: 8px 12px; margin: 0 0 16px; }
.pdc-hint { font-size: var(--t-small); color: var(--text-muted); margin: 6px 0 0; }

/* Computers → Nabu updates. */
.upd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 8px; align-items: start; }
.upd-card-h { background: var(--bg-alt); }
.upd-roll-b { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; font-size: var(--t-small); }
.upd-roll-b p { margin: 0; }
.upd-roll-b .set-actions { align-items: center; }
.upd-started { font-size: var(--t-meta); }

/* Computers page in the Printers layout. */
.comp-phone-scope { display: none; }
.comp-table .comp-status-cell { width: 1%; white-space: nowrap; }
.comp-table .comp-host-cell .pt-p1 { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.comp-table .comp-host-cell .pt-p2 { font-size: var(--t-meta); color: var(--text-muted); margin-top: 2px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 768px) {
  .comp-phone-scope { display: block; width: 100%; margin-bottom: 4px; }
  .comp-table thead .comp-status-cell { display: none; }
  .comp-page .comp-table tbody tr { grid-template-areas: "cb host host menu" "cb st seen pr"; }
  .comp-page .comp-table .comp-status-cell { grid-area: st; width: auto; }
  .comp-page .comp-table .comp-ver { display: none; }
}
.dsh-panel-link { margin-left: auto; font-size: var(--t-small); font-weight: 500; }

/* Printers and Computers lists never scroll sideways. Fixed column widths, with
   the Printer / Computer column taking whatever is left; secondary columns drop
   out at set panel widths (the sum of the fixed columns plus ~220px for the
   name column) so the action buttons always fit. Phones use the stacked layout
   in mobile.css instead. */
@media (min-width: 769px) {
  .pt-table-wrap, .comp-table-wrap { overflow-x: hidden; }
  .pt-table, .comp-table { table-layout: fixed; }
  .pt-table td.pt-col-printer, .comp-table td.comp-host-cell { min-width: 0; }
  .pt-table td.pt-col-printer .pt-p2,
  .comp-table td.comp-host-cell .pt-p2 { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pt-table .pt-name, .comp-table .pt-name { overflow-wrap: anywhere; }

  /* Printers */
  .pt-table th.pt-cb { width: 60px; }
  .pt-table th:nth-child(2) { width: 110px; }
  .pt-table th.pt-col-folder { width: 200px; }
  .pt-table th.pt-col-ip { width: 140px; }
  .pt-table th.pt-col-toner { width: 100px; }
  .pt-table th.pt-col-comp { width: 110px; }
  .pt-table th.pt-actions { width: 250px; }
  .pt-table td.pt-col-folder, .pt-table td.pt-col-ip { overflow: hidden; text-overflow: ellipsis; }
  @container (max-width: 1200px) { .pt-table .pt-col-toner { display: none; } }
  @container (max-width: 1100px) { .pt-table .pt-col-folder { display: none; } }
  @container (max-width: 900px)  { .pt-table .pt-col-ip { display: none; } }
  @container (max-width: 760px)  { .pt-table .pt-col-comp { display: none; } }

  /* Computers */
  .comp-table th.comp-cb-cell { width: 44px; }
  .comp-table th.comp-status-cell { width: 110px; }
  .comp-table th.col-client, .comp-table th.col-folder { width: 180px; }
  .comp-table th.col-ver { width: 100px; }
  .comp-table th.num { width: 150px; }
  .comp-table th.col-seen { width: 110px; }
  .comp-table th.comp-menu-cell { width: 250px; }
  .comp-table td.col-ver, .comp-table td.comp-seen { overflow: hidden; text-overflow: ellipsis; }
  @container (max-width: 1400px) { .comp-table .col-client { display: none; } }
  @container (max-width: 1010px) { .comp-table .col-ver { display: none; } }
  @container (max-width: 900px)  { .comp-table .col-seen, .comp-table .comp-seen { display: none; } }
}
