/*
 * Lientur UI conventions (v1.13.0-alpha.1, refreshed v1.23.0-alpha.1).
 *
 * Server-rendered Bootstrap 5 only — no build step, no frontend framework.
 * This file is the single place shared visual conventions live; avoid
 * one-off inline styles in templates when a class here already covers it.
 *
 * Severity/status *color mapping* stays server-side in templating.py's
 * SEVERITY_BADGE_CLASSES/STATUS_BADGE_CLASSES (they emit plain Bootstrap
 * bg-* classes) — this file never re-colors a badge by status name. What's
 * defined here is shared page chrome: headers, cards, danger zones, tab
 * navigation, code blocks, and the responsive/accessibility baseline.
 */

:root {
  --lientur-bg: #f3f6fa;
  --lientur-surface: #ffffff;
  --lientur-surface-subtle: #f8fafc;
  --lientur-border: #d9e2ec;
  --lientur-border-strong: #c5d1de;
  --lientur-muted: #526579;
  --lientur-heading: #102a43;
  --lientur-ink: #243b53;
  --lientur-navy: #07192d;
  --lientur-navy-soft: #0c2541;
  --lientur-radius: 0.75rem;
  --lientur-radius-sm: 0.5rem;
  --lientur-shadow-sm: 0 1px 2px rgba(15, 35, 56, 0.04), 0 4px 14px rgba(15, 35, 56, 0.04);
  --lientur-shadow-md: 0 10px 30px rgba(15, 35, 56, 0.09);

  /* Accent hue used sparingly for primary actions/links — distinct from any
     severity/status semantic color, which always comes from a bg-* badge
     class instead of this token. */
  --lientur-accent: #1d5fd1;
  --lientur-accent-hover: #174ca7;
  --lientur-accent-soft: #eaf2ff;
  --lientur-success: #13795b;
  --lientur-warning: #a85b00;

  /* Danger-zone tokens for destructive-action sections (archive/delete/
     revoke/reject). Kept separate from Bootstrap's .text-danger/.btn-danger
     so a whole section (border + wash) can be styled consistently. */
  --lientur-danger: #dc3545;
  --lientur-danger-bg: rgba(220, 53, 69, 0.06);
  --lientur-danger-border: rgba(220, 53, 69, 0.35);
}

body {
  background-color: var(--lientur-bg);
  color: var(--lientur-ink);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: #1756b3;
  text-underline-offset: 0.16em;
}

a:hover { color: #103f87; }

.skip-link {
  position: fixed;
  z-index: 2000;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.65rem 0.9rem;
  color: #fff;
  background: var(--lientur-accent);
  border-radius: var(--lientur-radius-sm);
  box-shadow: var(--lientur-shadow-md);
  transform: translateY(-150%);
  transition: transform 160ms ease-out;
}

.skip-link:focus { color: #fff; transform: translateY(0); }

/* Visible keyboard focus ring on interactive elements — Bootstrap already
   handles form controls/buttons reasonably, this covers plain links used as
   nav/table actions so Tab-navigation never loses track of focus. */
a:focus-visible,
button:focus-visible,
.dropdown-item:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(29, 95, 209, 0.42);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* --- Page structure ------------------------------------------------------ */

.app-main {
  width: min(100%, 1600px);
  padding-inline: clamp(1rem, 2.3vw, 2.5rem);
  flex: 1 0 auto;
}

.page-title {
  margin-bottom: 1rem;
  font-size: clamp(1.65rem, 2vw, 2.15rem);
  line-height: 1.18;
  letter-spacing: -0.025em;
  font-weight: 700;
  color: var(--lientur-heading);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.page-subtitle {
  color: var(--lientur-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 78ch;
  margin-top: -0.75rem;
  margin-bottom: 1.25rem;
}

.section-heading {
  font-weight: 700;
  color: var(--lientur-heading);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
}

/* Keep card-title sizing consistent regardless of heading level (Phase 4 §8 —
   headings promoted h5/h6 -> h2/h3 to remove a heading-order skip; the class,
   not the tag, sets the size). */
h2.card-title,
h3.card-title {
  font-size: 1.15rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--lientur-accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.breadcrumb-bar {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

/* --- Page header component (partial: templates/_page_header.html) --------- */
/* title/subtitle/breadcrumbs/primary action/secondary actions/status badge,
   used in place of a bare .page-title + .page-subtitle pair wherever a page
   also needs actions or a status badge next to its title. */

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--lientur-border);
}

.page-header .page-header-text {
  min-width: 0;
  flex: 1 1 20rem;
}

.page-header .page-title {
  margin-bottom: 0.25rem;
}

.page-header .page-subtitle {
  margin-top: 0;
  margin-bottom: 0;
}

.page-header .page-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.page-header .page-header-secondary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
}

/* --- Helper / caption text -------------------------------------------------- */

.text-helper {
  color: var(--lientur-muted);
  font-size: 0.8rem;
}

/* --- Code / command blocks -------------------------------------------------- */

.code-block {
  background-color: var(--lientur-navy);
  color: #e9ecef;
  border-radius: var(--lientur-radius);
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  overflow-x: auto;
}

.code-block code {
  color: inherit;
  white-space: pre;
}

/* --- Tab navigation ---------------------------------------------------------- */

.nav-tabs {
  border-bottom-color: var(--lientur-border);
  margin-bottom: 1rem;
}

.nav-tabs .nav-link {
  color: var(--lientur-muted);
  font-weight: 500;
  border: none;
  border-bottom: 2px solid transparent;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: color 160ms ease, border-color 160ms ease;
}

.nav-tabs .nav-link.active {
  color: var(--lientur-heading);
  background-color: transparent;
  border-bottom-color: var(--lientur-accent);
}

/* --- Danger zone -------------------------------------------------------------- */
/* Wraps destructive-only actions (archive/delete/revoke/reject/reset) so
   they read as visually separated from routine actions, without changing
   any permission or workflow semantics — styling only. */

.danger-zone {
  border: 1px solid var(--lientur-danger-border);
  background-color: var(--lientur-danger-bg);
  border-radius: var(--lientur-radius);
  padding: 1rem;
  margin-top: 1.5rem;
}

.danger-zone .danger-zone-title {
  color: var(--lientur-danger);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

/* Collapsible variant: same wash/border, but the destructive actions stay
   folded away until the operator asks for them. Use <details class="danger-zone
   danger-zone-collapsible"> with a <summary class="danger-zone-title">. */

details.danger-zone-collapsible {
  padding: 0.55rem 0.9rem;
  margin-top: 1rem;
}

details.danger-zone-collapsible > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0;
  padding: 0.15rem 0;
  min-height: 32px;
}

details.danger-zone-collapsible > summary::-webkit-details-marker {
  display: none;
}

details.danger-zone-collapsible > summary::before {
  content: "\25B8";
  font-size: 0.75rem;
  line-height: 1;
  transition: transform 140ms ease;
}

details.danger-zone-collapsible[open] > summary::before {
  transform: rotate(90deg);
}

details.danger-zone-collapsible > summary .danger-zone-summary-hint {
  color: var(--lientur-muted);
  font-weight: 400;
  font-size: 0.8rem;
}

details.danger-zone-collapsible > .danger-zone-body {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--lientur-danger-border);
}

/* --- Compact tab navigation ------------------------------------------------ */
/* For pages with many tabs (host detail has ~18) where the default 44px-tall
   pills wrap into three full-height rows. Keeps the same markup/behavior. */

.nav-tabs-compact .nav-link {
  min-height: 34px;
  padding: 0.25rem 0.6rem;
  font-size: 0.85rem;
}

.nav-tabs-compact .tab-count {
  color: var(--lientur-muted);
  font-size: 0.78rem;
  margin-left: 0.2rem;
}

.nav-tabs-compact .nav-link.active .tab-count {
  color: inherit;
}

/* --- Compact in-tab sub navigation ----------------------------------------- */
/* Pill-shaped secondary links (e.g. the Patches tab's links out to the fleet
   views). Lighter than a row of .btn-outline-secondary buttons. */

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.subnav-link {
  font-size: 0.82rem;
  line-height: 1.3;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--lientur-border);
  background-color: var(--lientur-surface);
  color: var(--lientur-muted);
  text-decoration: none;
}

.subnav-link:hover,
.subnav-link:focus {
  color: var(--lientur-accent);
  border-color: var(--lientur-accent);
  text-decoration: none;
}

/* --- Inline stat chips ------------------------------------------------------ */
/* A compact label/value row used instead of a full card body of <span>s. */

.stat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.stat-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--lientur-border);
  background-color: var(--lientur-surface-subtle);
}

.stat-chip-label {
  color: var(--lientur-muted);
}

.stat-chip-value {
  font-weight: 600;
  color: var(--lientur-heading);
}

/* --- Scrollable long tables ------------------------------------------------- */
/* A host with hundreds of pending patches/packages renders a page several
   screens tall even when paginated. This bounds a single table's height and
   keeps its header visible while scrolling inside it. Use instead of (not in
   addition to) .table-responsive — it scrolls on both axes. */

.table-scroll {
  max-height: 26rem;
  overflow: auto;
  border: 1px solid var(--lientur-border);
  border-radius: var(--lientur-radius-sm);
  background-color: var(--lientur-surface);
}

.table-scroll > .table {
  margin-bottom: 0;
}

.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background-color: var(--lientur-surface);
  box-shadow: inset 0 -1px 0 var(--lientur-border);
}

/* --- Collapsible page section ----------------------------------------------- */
/* <details class="section-collapse"><summary>Title <span class="section-collapse-count">N</span></summary>
   Secondary sections (non-actionable inventory) start folded so the page opens
   at a readable length; the operator expands what they actually need. */

details.section-collapse {
  margin-top: 1.5rem;
}

details.section-collapse > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  color: var(--lientur-heading);
  font-size: 1.08rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
}

details.section-collapse > summary::-webkit-details-marker {
  display: none;
}

details.section-collapse > summary::before {
  content: "\25B8";
  font-size: 0.75rem;
  line-height: 1;
  color: var(--lientur-muted);
  transition: transform 140ms ease;
}

details.section-collapse[open] > summary::before {
  transform: rotate(90deg);
}

.section-collapse-count {
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--lientur-muted);
}

/* --- Compact recommended-action list --------------------------------------- */

.action-list-compact .action-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0.85rem;
  border-top: 1px solid var(--lientur-border);
}

.action-list-compact .action-row:first-child {
  border-top: none;
}

.action-list-compact .action-row-main {
  flex: 1 1 16rem;
  min-width: 0;
}

.action-list-compact .action-row-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--lientur-heading);
}

.action-list-compact .action-row-why {
  color: var(--lientur-muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

/* --- Form sections -------------------------------------------------------- */

.form-section {
  border: 1px solid var(--lientur-border);
  background-color: var(--lientur-surface);
  border-radius: var(--lientur-radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--lientur-shadow-sm);
}

.form-section-title {
  font-weight: 600;
  color: var(--lientur-heading);
  margin-bottom: 0.25rem;
}

.form-section-hint {
  color: var(--lientur-muted);
  font-size: 0.82rem;
  margin-bottom: 0.75rem;
}

/* --- Active filter summary -------------------------------------------------- */

.active-filter-summary {
  font-size: 0.82rem;
  color: var(--lientur-muted);
  margin: 0.5rem 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.active-filter-summary .badge {
  font-weight: 500;
  text-transform: none;
}

/* --- Cards ---------------------------------------------------------------- */

.card {
  border: 1px solid var(--lientur-border);
  border-radius: var(--lientur-radius);
  box-shadow: var(--lientur-shadow-sm);
}

.card-header {
  min-height: 3rem;
  display: flex;
  align-items: center;
  background-color: var(--lientur-surface-subtle);
  border-bottom-color: var(--lientur-border);
  font-weight: 650;
  color: var(--lientur-heading);
}

.card-metric {
  text-align: center;
  height: 100%;
  position: relative;
  transition: transform 180ms ease-out, box-shadow 180ms ease-out, border-color 180ms ease-out;
}

.card-metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--lientur-accent);
}

.card-metric:hover {
  transform: translateY(-2px);
  border-color: var(--lientur-border-strong);
  box-shadow: var(--lientur-shadow-md);
}

.card-metric .metric-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--lientur-heading);
  font-variant-numeric: tabular-nums;
}

.card-metric .metric-label {
  color: var(--lientur-muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

.metric-card-link {
  display: block;
  height: 100%;
  color: inherit;
  text-decoration: none;
  border-radius: var(--lientur-radius);
  cursor: pointer;
}

.metric-card-link:focus-visible {
  outline: 3px solid var(--lientur-accent);
  outline-offset: 3px;
}

.metric-card-link:focus-visible .card-metric,
.metric-card-link:hover .card-metric {
  border-color: var(--lientur-border-strong);
  box-shadow: var(--lientur-shadow-md);
}

.metric-link-hint {
  margin-top: 0.7rem;
  color: var(--lientur-accent);
  font-size: 0.78rem;
  font-weight: 650;
}

.metric-danger::before { background: var(--lientur-danger); }
.metric-warning::before { background: #d97706; }
.metric-info::before { background: #168aad; }
.metric-posture::before { background: var(--lientur-success); }

/* --- Badges (severity / status) ------------------------------------------ */
/* Actual color mapping lives server-side in templating.py's severity_badge/
   status_badge filters — this section only sets shared badge geometry/type. */

.badge {
  text-transform: capitalize;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* --- Tables ---------------------------------------------------------------- */

.table-responsive {
  background-color: var(--lientur-surface);
  border-radius: var(--lientur-radius);
  border: 1px solid var(--lientur-border);
  padding: 0;
  box-shadow: var(--lientur-shadow-sm);
}

.table-responsive table {
  margin-bottom: 0;
}

.table-compact td,
.table-compact th,
.table-sm td,
.table-sm th {
  padding-top: 0.45rem;
  padding-bottom: 0.65rem;
  padding-inline: 0.85rem;
}

.table thead th {
  color: var(--lientur-muted);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  font-weight: 600;
  border-bottom-width: 1px;
  background: var(--lientur-surface-subtle);
  padding: 0.8rem 0.85rem;
  white-space: nowrap;
}

.table tbody td {
  border-color: #e8eef4;
  vertical-align: middle;
}

.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f2f7fd; }
.table tbody tr:last-child td { border-bottom: 0; }

/* --- Filter bars / forms ---------------------------------------------------- */

.filter-bar {
  background-color: var(--lientur-surface);
  border: 1px solid var(--lientur-border);
  border-radius: var(--lientur-radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--lientur-shadow-sm);
}

.filter-bar .form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--lientur-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.25rem;
}

form .form-label {
  font-weight: 600;
  color: var(--lientur-heading);
}

.form-control,
.form-select {
  min-height: 44px;
  border-color: var(--lientur-border-strong);
  border-radius: var(--lientur-radius-sm);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--lientur-accent);
  box-shadow: 0 0 0 0.22rem rgba(29, 95, 209, 0.14);
}

.form-check-input { border-color: #9fb0c1; }

form .required-marker {
  color: #dc3545;
  margin-left: 0.15rem;
}

.form-text {
  font-size: 0.8rem;
}

.field-error {
  color: #dc3545;
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

/* --- Empty states ----------------------------------------------------------- */

.empty-state {
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--lientur-muted);
  background-color: var(--lientur-surface);
  border-radius: var(--lientur-radius);
  border: 1px dashed var(--lientur-border-strong);
}

.empty-state.empty-state-positive {
  color: #0f684d;
  background: #f0faf6;
  border-color: #adddcb;
}

.empty-state .empty-state-title {
  color: var(--lientur-heading);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.empty-state .empty-state-action {
  margin-top: 0.85rem;
}

/* --- Action dropdowns / row actions -------------------------------------- */
/* Every findings/exceptions/jobs list row uses this single-button dropdown
   pattern instead of a wide inline button group. */

.action-dropdown .dropdown-toggle {
  min-width: 6.5rem;
}

.action-dropdown .dropdown-menu {
  min-width: 14rem;
}

.action-dropdown .dropdown-item {
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

/* --- Nav ------------------------------------------------------------------- */

.app-navbar {
  background: linear-gradient(115deg, var(--lientur-navy), var(--lientur-navy-soft));
  border-bottom: 1px solid rgba(136, 180, 222, 0.2);
  box-shadow: 0 8px 24px rgba(5, 22, 39, 0.16);
}

.app-navbar .container-fluid {
  width: min(100%, 1660px);
  padding-inline: clamp(1rem, 2vw, 2rem);
}

.navbar-brand {
  font-weight: 700;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 52px;
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  display: inline-grid;
  place-items: center;
  color: #8ab8ff;
  background: rgba(76, 142, 240, 0.13);
  border: 1px solid rgba(138, 184, 255, 0.3);
  border-radius: 0.6rem;
}

.brand-mark svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-navbar .nav-link {
  min-height: 44px;
  display: flex;
  align-items: center;
  margin-inline: 0.1rem;
  padding-inline: 0.72rem !important;
  color: #bfd0e3;
  border-radius: var(--lientur-radius-sm);
  transition: color 160ms ease, background-color 160ms ease;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.app-navbar .nav-link.active {
  color: #fff;
  background: rgba(72, 133, 224, 0.2);
  box-shadow: inset 0 -2px #72a7f5;
}

.dropdown-menu {
  padding: 0.45rem;
  border-color: var(--lientur-border);
  border-radius: var(--lientur-radius);
  box-shadow: var(--lientur-shadow-md);
}

.dropdown-item {
  min-height: 44px;
  display: flex;
  align-items: center;
  border-radius: 0.4rem;
}

.dropdown-item:hover,
.dropdown-item:focus { background: var(--lientur-accent-soft); color: #123f82; }

.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: var(--lientur-radius-sm);
  font-weight: 600;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.btn-sm { min-height: 38px; }
.btn-primary { --bs-btn-bg: var(--lientur-accent); --bs-btn-border-color: var(--lientur-accent); --bs-btn-hover-bg: var(--lientur-accent-hover); --bs-btn-hover-border-color: var(--lientur-accent-hover); }
.btn-outline-primary { --bs-btn-color: #1756b3; --bs-btn-border-color: #6495dc; --bs-btn-hover-bg: #1756b3; --bs-btn-hover-border-color: #1756b3; }
.btn:disabled { cursor: not-allowed; opacity: 0.5; }

.nav-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8a97a3;
  padding: 0.35rem 1rem 0.15rem;
}

.operator-identity {
  font-size: 0.85rem;
}

.dashboard-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--lientur-border);
}

.dashboard-hero .page-title { margin-bottom: 0.35rem; }
.dashboard-hero .page-subtitle { margin: 0; }

.dashboard-readonly {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.7rem;
  color: #3f5368;
  background: var(--lientur-surface);
  border: 1px solid var(--lientur-border);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow: var(--lientur-shadow-sm);
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  display: inline-block;
  flex: 0 0 auto;
  background: var(--lientur-success);
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(19, 121, 91, 0.12);
}

.status-dot-accent { margin-right: 0.35rem; background: var(--lientur-accent); box-shadow: 0 0 0 3px rgba(29, 95, 209, 0.12); }
.action-center-card { border-color: #b9cef0; }

.workflow-status-card {
  border-color: #b9cef0;
  background: linear-gradient(135deg, #fff, #f6f9ff);
}

/* Accessible patch-wizard progress bar (Phase 4 §3). The visible bar is
   decorative; the accessible value lives on the role="progressbar" wrapper's
   aria-valuenow/aria-label, so screen readers never depend on the fill width. */
.workflow-progress {
  width: 100%;
  max-width: 22rem;
  height: 0.5rem;
  background: #e3e9f2;
  border-radius: 999px;
  overflow: hidden;
}
.workflow-progress-bar {
  height: 100%;
  background: #2b6cb0;
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* Visually-hidden but screen-reader-available (project has no Bootstrap CSS
   bundled, only its class names in markup — define the utility explicitly). */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (prefers-reduced-motion: reduce) {
  .workflow-progress-bar { transition: none !important; }
}

.package-allowlist {
  columns: 2;
  column-gap: 2rem;
}

.package-allowlist li { break-inside: avoid; margin-bottom: 0.35rem; }

.login-shell {
  width: min(100% - 2rem, 440px);
  min-height: 100vh;
  min-height: 100dvh;
  margin-inline: auto;
  padding-block: clamp(2rem, 10vh, 7rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
  color: var(--lientur-heading);
  font-size: 1.2rem;
  font-weight: 750;
}

.login-brand .brand-mark { color: var(--lientur-accent); background: var(--lientur-accent-soft); border-color: #bdd2f1; }
.login-card { box-shadow: var(--lientur-shadow-md); }
.login-card .card-body { padding: clamp(1.4rem, 5vw, 2rem); }

/* --- Responsive helpers ----------------------------------------------------- */

@media (max-width: 767.98px) {
  .page-title {
    font-size: 1.35rem;
  }
  .card-metric .metric-value {
    font-size: 1.5rem;
  }
  .filter-bar .row > [class^="col"] {
    margin-bottom: 0.5rem;
  }
  .dashboard-hero { display: block; }
  .dashboard-readonly { margin-top: 1rem; }
  .page-header .page-header-actions { width: 100%; }
  .page-header .page-header-actions .btn { flex: 1 1 auto; }
  .table-responsive { border-radius: var(--lientur-radius-sm); }
  .btn-sm { min-height: 44px; }
  .package-allowlist { columns: 1; }
}

@media (max-width: 991.98px) {
  .app-navbar .navbar-collapse { padding-block: 0.5rem 1rem; }
  .app-navbar .nav-link { margin-block: 0.1rem; }
  .app-navbar .navbar-nav.ms-auto { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid rgba(255, 255, 255, 0.12); }
}

/* --- Read-only / warning banners (RBAC, password, policy exceptions) ------ */

.alert-readonly {
  border-left: 4px solid #0d6efd;
}

.alert-once {
  border-left: 4px solid #ffc107;
  font-weight: 500;
}

.alert-safety {
  border-left: 4px solid #6c757d;
  background-color: rgba(108, 117, 125, 0.08);
  color: var(--lientur-heading);
}

/* --- Command blocks (copy-to-clipboard, v1.28.1-alpha.1) -------------------- */

.command-block-wrapper {
  position: relative;
}

.command-block-pre {
  margin-bottom: 0;
  padding-right: 5.5rem;
  overflow-x: auto;
}

.command-copy-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
}

.command-copy-btn-success {
  border-color: #198754;
  color: #75db9e;
}

/* --- Footer ----------------------------------------------------------------- */

.app-footer {
  font-size: 0.8rem;
  border-top: 1px solid var(--lientur-border);
  flex-shrink: 0;
}


/* --- Pagination (Phase 5 §4) --------------------------------------------- */
/* Shared by every paginated list page. Wraps on narrow viewports so controls
   never overflow the page; disabled controls are non-interactive <span>s, and
   the current page/size is marked with aria-current (not colour alone). */

.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--lientur-border);
}

.pagination-summary {
  margin: 0;
  color: var(--lientur-muted);
  font-size: 0.85rem;
}

.pagination-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 0.7rem;
  border: 1px solid var(--lientur-border-strong);
  border-radius: var(--lientur-radius-sm);
  background: var(--lientur-surface);
  color: #14508f;
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
}

.pagination-link:hover { background: var(--lientur-accent-soft); color: #0f3d70; }

.pagination-link.is-current {
  background: #14508f;
  border-color: #14508f;
  color: #fff;
  font-weight: 600;
}

.pagination-link.is-disabled {
  color: #5d6b7a;
  background: var(--lientur-surface-subtle);
  border-color: var(--lientur-border);
  cursor: not-allowed;
}

.pagination-size {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--lientur-muted);
}

@media (max-width: 575.98px) {
  .pagination-bar { justify-content: flex-start; }
  .pagination-link { padding: 0 0.55rem; font-size: 0.8rem; }
}


/* --- Phase 5 §8/§9: real-browser overflow + contrast fixes ---------------- */

/* `body` is a column flexbox, so `.app-main` is a flex item whose default
   `min-width: auto` lets wide table content push the whole PAGE wider than the
   viewport (measured in Chromium: /ui/patches scrollWidth 1820 vs 1440). With
   `min-width: 0` the item can shrink and the horizontal scrolling is contained
   inside `.table-responsive`, which is where it belongs. */
.app-main {
  min-width: 0;
  max-width: 100%;
}

/* Defensive: the scroll container must always actually scroll. */
.table-responsive {
  overflow-x: auto;
  max-width: 100%;
}

/* Cards and card bodies are flex/grid children in several layouts — same
   min-width:auto trap. */
.card,
.card-body,
.pagination-bar {
  min-width: 0;
}

/* Long opaque values (UUIDs, hashes, package versions) must wrap rather than
   force the row wide; the full value stays selectable/copyable. */
td code,
td .text-helper,
.table code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Contrast (WCAG 2.1 AA, verified with axe-core in Chromium):
   - .text-warning on white measured 1.63:1 -> use the darker amber token;
   - .btn-outline-secondary measured 4.32:1 on the page background -> darken;
   - .badge.bg-info with white text measured 1.95:1 -> dark text on cyan
     (the class mapping now emits `bg-info text-dark`; this backstops any
     remaining bare `.bg-info` badge). */
.metric-value.text-warning,
.text-warning {
  color: var(--lientur-warning) !important;
}

.btn-outline-secondary {
  color: #4b5563;
  border-color: #97a3b4;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  color: #fff;
  background-color: #4b5563;
  border-color: #4b5563;
}

.badge.bg-info {
  color: #06323b;
}

/* danger-zone title measured 3.8:1 (#dc3545 on the danger wash) in Chromium —
   darken to a red that clears 4.5:1 while staying unmistakably "danger". */
.danger-zone .danger-zone-title {
  color: #a4161a;
}

/* Patch operations lazy expansion (RP-2 §E/§K).
   The expanded panel is a full-width row under its host, indented and tinted
   so the relationship reads at a glance without an extra nesting level that
   would break the table's column alignment. */
.patch-details-row > .patch-details-cell {
  background: var(--bs-tertiary-bg, #f8f9fa);
  border-top: 0;
}

.patch-details-body {
  padding: 0.75rem 0.5rem 0.25rem 2.5rem;
}

.patch-expand-btn {
  min-width: 2.25rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.patch-expand-icon {
  font-weight: 600;
}

/* On narrow viewports the indent costs more than it conveys — the panel is
   already visually distinct, and the primary action must stay reachable
   without horizontal scrolling (RP-2 §K). */
@media (max-width: 768px) {
  .patch-details-body {
    padding-left: 0.75rem;
  }
}


/* --- OP-2B item 15: advisory table progressive disclosure ----------------- */
/*
   Narrow viewports defer the columns that INFORM, and never the ones that
   GOVERN ACTION. A column an operator needs to decide with — package,
   vendor severity, advisory/CVE evidence, applicability — stays visible at
   every width; horizontal scrolling remains available for the rest.

   `.advisory-col-deferred` is the only thing that hides, and what it hides is
   re-rendered inline under the package name by `.advisory-inline-detail`. The
   data is deferred, never dropped: an operator on a phone sees the same
   facts, arranged differently. Hiding a version would be tolerable; hiding
   whether an advisory could be evaluated would not.
*/
.advisory-inline-detail {
  display: none;
  color: var(--lientur-muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

@media (max-width: 767.98px) {
  .advisory-col-deferred { display: none; }
  .advisory-inline-detail { display: block; }
}
