/*
 * Purpose: Porter page layout in the OnTrack background-client visual language (FRS-044-0029).
 * Architecture: Shared resources own panel rows, notices and log details; these rules style Porter content.
 * Changelog: 2026-11-15 R1V0: align public and operator shells with Nexus/Custodian; follows CTRL-106.
 * 2026-11-15 R1V0: grouped header actions for launcher/account pages (FRS-044-0038; CTRL-106).
 * 2026-11-15 R1V0: bounded log filters and accessible shared sorting (FRS-044-0029; CTRL-106).
 * 2026-11-17 R1V0: header actions host the shared page menu; bounded release text (PORTER-BUG-007; CTRL-106).
 * 2026-11-17 R1V0: responsive app-card identity and description reuse the existing grid (FRS-044-0004; CTRL-106).
 */
:root {
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --panel: #fff;
  --page: #f3f6f6;
  --accent: #1e3a5f;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}
* { box-sizing: border-box; }
body { margin: 0; }
.page-header { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6em; padding: 0.8em 1.2em; background: var(--panel); border-bottom: 1px solid var(--line); }
.page-header h1 { font-size: 1.4rem; margin: 0; line-height: 1.1; min-width: 0; overflow-wrap: anywhere; }
.page-identity, .page-identity svg { width: 1.4rem; height: 1.4rem; display: inline-flex; flex: 0 0 auto; }
.page-subtitle { color: var(--muted); }
.page-header > .icon-button, .page-header .page-actions { margin-left: auto; }
/* FRS-044-0038: grouped header actions stay together; a hidden optional action takes no space. */
.page-actions { display: flex; align-items: center; gap: 0.4em; flex: 0 0 auto; }
.icon-button[hidden] { display: none; }
.panels { display: flex; flex-direction: column; gap: 1em; padding: 1em 1.2em; min-width: 0; }
.public-main { max-width: 1000px; margin: auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0.8em 1em; min-width: 0; }
.panel h2 { display: flex; align-items: center; gap: 0.5em; font-size: 1rem; margin: 0 0 0.6em; }
.panel-icon, .panel-icon svg { width: 1em; height: 1em; display: inline-flex; flex: 0 0 auto; color: var(--accent); }
.operator-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 1em; }
.operator-panel-heading h2 { margin: 0; }
.table-heading { flex-wrap: wrap; }
.health-pill { padding: 0 0.6em; border-radius: 999px; background: var(--muted); color: #fff; font-size: 0.8rem; line-height: 1.6; }
.health-pill[data-state="ok"] { background: #16a34a; }
.health-pill[data-state="unreachable"] { background: #dc2626; }
.operator-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.3em 1em; margin: 0.8em 0 0; }
.operator-facts dt { color: var(--muted); }
.operator-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.application-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 1em; }
.application-card { display: grid; align-content: start; gap: 0.5em; min-width: 0; overflow-wrap: anywhere; padding: 1em; border: 1px solid var(--line); border-radius: 6px; color: inherit; text-decoration: none; background: var(--page); }
.application-heading { display: flex; align-items: center; gap: 0.5em; min-width: 0; }
.application-icon, .application-icon > span, .application-icon svg, .application-icon img { display: inline-flex; width: 1em; height: 1em; flex: 0 0 auto; }
.application-icon img[hidden] { display: none; }
.application-description, .application-details { color: var(--muted); font-size: 0.9rem; }
.application-card:hover, .application-card:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.sign-in-panel { width: 100%; max-width: 30rem; }
.sign-in-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 0.75em; margin-top: 1em; }
/* FRS-044-0023: grid display must not expose disabled or not-yet-available sign-in methods. */
.sign-in-form[hidden] { display: none; }
.sign-in-form label { grid-column: 1 / -1; font-weight: 600; }
.sign-in-form input { min-width: 0; min-height: 2.5rem; padding: 0.5em; border: 1px solid #9ca3af; border-radius: 6px; background: var(--panel); color: var(--ink); }
.icon-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 2rem; height: 2rem; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); cursor: pointer; }
.icon-button svg { width: 1.125rem; height: 1.125rem; }
.icon-button:hover, .icon-button:focus-visible { background: #eaf0f6; outline: 2px solid #2563eb; outline-offset: 2px; }
.table-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5em; margin-left: auto; font-size: 0.85rem; }
.table-controls label { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4em; }
.table-controls input[type="number"] { width: 5em; }
.table-wrap { overflow: auto; max-width: 100%; margin-top: 0.6em; border: 1px solid var(--line); border-radius: 6px; }
table { table-layout: fixed; border-collapse: collapse; font-size: 0.85rem; }
th, td { height: 2.5rem; padding: 0.25rem 0.5rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
th { position: sticky; top: 0; background: #f9fafb; z-index: 1; }
.column-resize-handle { position: absolute; top: 0; right: 0; width: 10px; height: 100%; cursor: col-resize; touch-action: none; }
.log-filters { display: flex; flex-wrap: wrap; gap: 0.6em; margin-top: 0.8em; }
/* CTRL-109-0071: only the toolbar's own fields; the shared filter menus style their options and checkboxes. */
.log-filters > label { display: grid; gap: 0.25em; font-size: 0.85rem; min-width: 0; max-width: 100%; }
.log-filters > label input { min-width: 0; width: 100%; max-width: 100%; padding: 0.3em; }
#logs-update-state, #logs-counts { color: var(--muted); font-size: 0.85rem; overflow-wrap: anywhere; }
#logs-update-state[data-state="stale"], #logs-update-state[data-state="failed"], #logs-range-error { color: #b91c1c; }
#logs-table th[aria-sort] { cursor: pointer; padding-right: 1.5em; }
#logs-table th[aria-sort="ascending"]::after { content: "\2191"; margin-left: 0.3em; }
#logs-table th[aria-sort="descending"]::after { content: "\2193"; margin-left: 0.3em; }
#logs-table th[tabindex]:focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; }
.log-detail-button { width: 2rem; height: 2rem; }
/* CTRL-109-0042/0043: canonical changelog text stays readable and bounded without widening the page. */
.canonical-changes { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0.4em 0 0; }
pre.canonical-changes { max-height: 60vh; overflow: auto; padding: 0.6em; border: 1px solid var(--line); border-radius: 6px; background: var(--page); font-size: 0.8rem; }
@media (max-width: 700px) {
  .page-header { flex-wrap: wrap; }
  .table-controls { margin-left: 0; }
  /* FRS-044-0029: keep long resource labels from squeezing values on narrow screens. */
  .operator-facts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
