/* pages-system: page-level styles (phase 2) for audit, releases, modules, settings, login and status pages.
   Linked by the page templates through {% block page_assets %}, not by base.html.
   Colours come only from the --lx-* tokens and --nb-shadow*; text on flat fills is literal #000. */

/* Shared helpers --------------------------------------------------------- */
.sys-nowrap { white-space: nowrap; }
.sys-muted { color: var(--lx-text-soft); }
.sys-code { display: block; margin-top: 4px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; color: var(--lx-text-soft); }
.sys-code--wrap { overflow-wrap: anywhere; min-width: 150px; }
.sys-id { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; font-weight: 700; background: var(--lx-surface-3); color: var(--lx-text); border: 2px solid var(--lx-edge); border-radius: 6px; padding: 2px 8px; }
.sys-foot span:last-child { color: var(--lx-text-soft); font-size: 13px; }
.sys-empty { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px 18px 32px; text-align: center; }
.sys-hint { margin: 0; font-size: 13px; color: var(--lx-text-soft); }
.sys-hint--top { margin: -8px 0 16px; }
.sys-subhead { margin: 22px 0 10px; font-size: 15px; }
.sys-section { margin-top: 20px; }
.sys-list { overflow: hidden; }

/* Audit ------------------------------------------------------------------ */
.sys-filters .toolbar-filters { flex: 1 1 auto; }
.audit-table td { vertical-align: top; }
.audit-table .sys-detail { min-width: 260px; max-width: 460px; }
.audit-lines { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.audit-lines li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 13px; }
.audit-key { font-weight: 800; }
.audit-key::after { content: ":"; }
.audit-val, .audit-new { overflow-wrap: anywhere; }
.audit-old { overflow-wrap: anywhere; color: var(--lx-text-soft); text-decoration: line-through; }
.audit-arrow { color: var(--lx-text-soft); }
.audit-new { font-weight: 700; }
.audit-raw { margin-top: 6px; }
.audit-raw summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--lx-text-soft); }
.audit-raw summary:focus-visible { outline: 3px solid var(--lx-blue); outline-offset: 2px; }
.audit-raw pre { margin: 6px 0 0; padding: 8px 10px; max-height: 220px; overflow: auto; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; border: 2px solid var(--lx-edge); border-radius: 6px; background: var(--lx-surface-3); color: var(--lx-text); }

/* Releases --------------------------------------------------------------- */
.sys-notice { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 18px; padding: 12px 16px; font-size: 14px; font-weight: 600; }
.sys-notice .ui-icon { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.sys-notice--ok { background: var(--lx-surface); color: var(--lx-text); border: 2px solid var(--lx-edge); border-radius: 8px; box-shadow: var(--nb-shadow-sm); }
.sys-notice--ok .ui-icon { color: var(--lx-text); }
.sys-notice code, .sys-keyid { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; padding: 1px 7px; border: 2px solid var(--lx-edge); border-radius: 6px; background: var(--lx-yellow); color: #000; }
.sys-hash { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.sys-hash code { font-size: 13px; color: var(--lx-text); }
.sys-copy { padding: 3px 10px; font-size: 13px; box-shadow: var(--nb-shadow-sm); }

/* Modules (edit drawer field table) -------------------------------------- */
.sys-fields { border: 2px solid var(--lx-edge); border-radius: 8px; }
.sys-fields-table th, .sys-fields-table td { padding: 8px 12px; font-size: 13px; }
.sys-fields-table code { font-size: 13px; overflow-wrap: anywhere; }
#module-create .modal-body .field .ui-select-field, [id^="module-edit-"] .modal-body .field .ui-select-field { width: 100%; }

/* Settings --------------------------------------------------------------- */
.sys-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.sys-count { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 12px; padding: 14px; color: var(--lx-text); text-decoration: none; background: var(--lx-surface-2); border: 2px solid var(--lx-edge); border-radius: 8px; box-shadow: var(--nb-shadow-sm); transition: transform 0.12s ease, box-shadow 0.12s ease; }
.sys-count:hover { transform: translate(1px, 1px); box-shadow: none; }
.sys-count:focus-visible { outline: 3px solid var(--lx-blue); outline-offset: 2px; }
.sys-count-icon { grid-row: 1 / 3; display: grid; place-items: center; width: 40px; height: 40px; background: var(--lx-mint); color: #000; border: 2px solid var(--lx-edge); border-radius: 8px; }
.sys-count b { font-size: 26px; line-height: 1; }
.sys-count span:last-child { font-size: 13px; color: var(--lx-text-soft); font-weight: 700; }
.tab-pane .settings-row-actions { align-items: center; justify-content: flex-end; }

/* Auth (login) ----------------------------------------------------------- */
.auth-cover { position: relative; overflow: hidden; display: grid; place-items: center; min-height: 0; flex: 1; width: 100%; padding: 24px 16px; margin: 0 auto; background-color: var(--lx-mint); background-image: radial-gradient(color-mix(in srgb, var(--lx-edge) 22%, transparent) 2px, transparent 2.5px); background-size: 22px 22px; border: 2px solid var(--lx-edge); border-radius: 8px; box-shadow: var(--nb-shadow); }
.auth-blob { position: absolute; border: 2px solid var(--lx-edge); border-radius: 50%; pointer-events: none; }
.auth-blob--yellow { width: 280px; height: 280px; top: -90px; left: -70px; background: var(--lx-yellow); }
.auth-blob--mint { width: 200px; height: 200px; right: -50px; bottom: -70px; background: var(--lx-yellow); border-radius: 18%; transform: rotate(14deg); }
.auth-card { position: relative; width: min(100%, 440px); padding: 30px 32px 24px; background: var(--lx-surface); color: var(--lx-text); border: 2px solid var(--lx-edge); border-radius: 10px; box-shadow: var(--nb-shadow-lg); }
.auth-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 18px; }
.auth-brand .brand-mark { width: auto; min-width: 44px; padding: 0 12px; margin-bottom: 8px; }
.auth-product { margin: 0; font-size: 15px; font-weight: 800; }
.auth-subtitle { margin: 0; font-size: 13px; color: var(--lx-text-soft); }
.auth-title { margin: 0 0 6px; font-size: 28px; line-height: 1.15; }
.auth-lede { margin: 0 0 18px; font-size: 14px; color: var(--lx-text-soft); }
.auth-form { display: grid; gap: 14px; }
.auth-submit { width: 100%; justify-content: center; gap: 8px; margin-top: 4px; }
.auth-note { margin: 14px 0 0; font-size: 13px; color: var(--lx-text-soft); }
.auth-card .alert { margin: 0 0 16px; padding: 10px 14px; font-weight: 700; }

/* Status pages (404 / 500 ...) ------------------------------------------- */
.status-page { display: grid; place-items: center; padding: 24px 0; }
.status-card { position: relative; width: min(100%, 560px); padding: 32px 32px 28px; text-align: center; background: var(--lx-surface); color: var(--lx-text); border: 2px solid var(--lx-edge); border-radius: 10px; box-shadow: var(--nb-shadow-lg); }
.status-code { margin: 0; font-size: clamp(72px, 18vw, 120px); line-height: 1; font-weight: 900; letter-spacing: -4px; }
.status-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; margin: 8px 0 14px; color: #000; background: var(--lx-yellow); border: 2px solid var(--lx-edge); border-radius: 12px; box-shadow: var(--nb-shadow-sm); }
.status-icon .ui-icon { width: 26px; height: 26px; }
.status-card--mint .status-icon { background: var(--lx-mint); }
.status-card--red .status-icon { background: var(--lx-red); }
.status-card h1 { margin: 0 0 8px; font-size: 24px; }
.status-message { margin: 0 auto 10px; max-width: 44ch; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.status-hint { margin: 0 auto; max-width: 46ch; font-size: 13.5px; color: var(--lx-text-soft); }
.status-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 24px; }
.status-actions .button { display: inline-flex; align-items: center; gap: 8px; }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 700px) {
  .sys-filters .toolbar-filters { width: 100%; }
  .sys-filters .toolbar-filters .ui-select-field { flex: 1 1 100%; }
  .auth-cover { min-height: 0; padding: 24px 12px; }
  .auth-card { padding: 22px 18px 18px; }
  .auth-title { font-size: 24px; }
  .status-card { padding: 24px 18px; }
  .sys-hash { flex-wrap: wrap; white-space: normal; }
}

/* Login fits the viewport: no page-level vertical scroll */
.guest-body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.guest-body > main { width: 100%; box-sizing: border-box; flex: 1; min-height: 0; display: flex; overflow: auto; padding-top: 16px; padding-bottom: 16px; }
.guest-body > footer { flex: none; width: 100%; box-sizing: border-box; }
.auth-card { max-height: 100%; }
