/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

body {
    background-color: #e6f9ec;
}

.btn-primary {
    background-color: #4caf50;
    border-color: #4caf50;
}

.navbar, .card {
    background-color: #f4fff7;
}

.text-primary {
    color: #388e3c !important;
}


/* Custom styles - loaded after Bootstrap */
.invalid-job {
  background-color: #dc3545 !important;
  color: white !important;
  border: 2px solid #b02a37 !important;
}

.list-group .list-group-item.invalid-job {
  background-color: #f8d7da !important;
  color: #721c24 !important;
  border-color: #f5c6cb !important;
  border-left: 5px solid #dc3545 !important;
}

.list-group .list-group-item.invalid-job:hover {
  background-color: #f1b0b7 !important;
}

.whois-popover {
  max-width: 800px;
}

/* Domain/subdomain status badges (domain_statuses/_badges.html.haml): the
   "x" to remove one only appears on hover, so a row with several statuses
   assigned doesn't show a delete control on every single one all the time. */
.status-badge {
  display: inline-flex;
  align-items: center;
}

.status-badge .status-remove {
  width: 0.5em;
  height: 0.5em;
  margin-left: 0.35em;
  opacity: 0;
  transition: opacity 0.15s ease-in-out;
}

.status-badge:hover .status-remove {
  opacity: 1;
}

/* Module type is carried as a class on the row for hooks and tests, but is no
   longer tinted: the row already says passive/active/commercial through the
   group it sits in, and three background tints competed with the status colours
   for the same attention. The old rules keyed on .list-group-item, which module
   rows no longer are, so they had stopped matching anything. */

/* Grey out disabled or error modules */
.list-group .list-group-item.module-inactive {
  filter: grayscale(60%);
  opacity: 0.6;
}

.list-group .list-group-item.module-inactive:hover {
  opacity: 0.8;
}

/* Enhanced Sidebar Styles */

/* The nav stays put while the main column scrolls.

   Three parts, none of them optional:

   - `align-self: flex-start` is what makes the stickiness work at all. The
     sidebar is a flex item of `main.d-flex`, so it stretches to the full
     height of the row by default — and an element that already fills its
     containing block has nowhere to travel, so `position: sticky` alone is
     a no-op. This is why the nav used to scroll away on a long project or
     job-log page.
   - `height: 100vh` (replacing the `min-height: 100vh` that used to sit
     inline on the element) keeps the `mt-auto` account block pinned to the
     bottom of the viewport rather than to the bottom of the page.
   - `overflow-y: auto` covers an admin with every section expanded, where
     the nav itself is taller than the viewport. Without it the account
     block and sign-out link would be unreachable.

   `position: fixed` would also hold the nav in place, but it takes the
   element out of the flex row, so the main column loses its 280px offset
   and slides underneath. */
.sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: 280px;
  height: 100vh;
  overflow-y: auto;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

/* Condensed mode: an icon-only rail for when the sidebar's full width isn't
   worth the screen space. Toggled by the "sidebar" Stimulus controller
   (app/javascript/controllers/sidebar_controller.js), which also persists
   the preference in localStorage. `.sidebar-label` marks every bit of text
   (nav labels, the brand title, account name/email, the footer) that has no
   room in a 72px rail; icons (`.bi`) and the toggle button are the only
   things a `.sidebar-condensed` sidebar keeps. Width lives here rather than
   inline on the element specifically so this rule can override it — an
   inline `style="width: ..."` on the <nav> would otherwise win over any
   external stylesheet rule regardless of specificity. */
.sidebar.sidebar-condensed {
  width: 72px;
}

/* !important is required here, not just belt-and-braces: several
   `.sidebar-label` elements (the account name/email block, the
   unauthenticated-state panel) are also Bootstrap `.d-flex`/`.d-flex-column`
   containers, and Bootstrap's display utilities are themselves declared
   `!important`. A plain `display: none` here would lose to `.d-flex` despite
   this selector's higher specificity — `!important` ignores specificity. */
.sidebar.sidebar-condensed .sidebar-label {
  display: none !important;
}

.sidebar.sidebar-condensed .nav-link-sidebar,
.sidebar.sidebar-condensed .btn-sidebar-toggle {
  justify-content: center;
}

.sidebar.sidebar-condensed .nav-link-sidebar .me-1,
.sidebar.sidebar-condensed .nav-link-sidebar .me-2,
.sidebar.sidebar-condensed .btn-sidebar-toggle .me-1,
.sidebar.sidebar-condensed .btn-sidebar-toggle .me-2 {
  margin-right: 0 !important;
}

.sidebar.sidebar-condensed .ms-3 {
  margin-left: 0 !important;
}

/* The brand link is neither a `.nav-link-sidebar` nor a `.btn-sidebar-toggle`,
   so the margin rule above never reached it. Harmless while the brand was a
   glyph, visible now that it is a 40px logo: with the wordmark hidden, the
   leftover right margin pushes it off-centre in the 72px rail. */
.sidebar.sidebar-condensed .sidebar-brand {
  justify-content: center;
}

.sidebar.sidebar-condensed .sidebar-brand .me-2 {
  margin-right: 0 !important;
}

.btn-sidebar-toggle {
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.btn-sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.2) !important;
  color: white !important;
  transform: translateX(5px);
}

.btn-sidebar-toggle:focus {
  box-shadow: 0 0 0 0.25rem rgba(129, 199, 132, 0.4);
  color: white !important;
}

.nav-link-sidebar {
  color: rgba(255, 255, 255, 0.85) !important;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.nav-link-sidebar:hover {
  color: white !important;
  background: rgba(255, 255, 255, 0.15) !important;
  transform: translateX(3px);
}

.nav-link-sidebar.active {
  color: white !important;
  background: rgba(255, 255, 255, 0.25) !important;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sidebar-chevron {
  transition: transform 0.2s ease;
  font-size: 0.8rem;
}

.btn-sidebar-toggle[aria-expanded="true"] .sidebar-chevron {
  transform: rotate(180deg);
}

/* Smooth collapse animations */
.collapse {
  transition: all 0.3s ease;
}

/* Badge styling */
.badge {
  font-size: 0.7rem;
  padding: 0.25em 0.5em;
}

/* Focus indicators for accessibility */
.nav-link-sidebar:focus,
.btn-sidebar-toggle:focus {
  outline: 2px solid #81c784;
  outline-offset: 2px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  /* Not sticky on a phone: a full-viewport-tall nav with its own scrollbar
     would leave no room for the page behind it. */
  .sidebar {
    width: 100% !important;
    position: static;
    height: auto;
    overflow-y: visible;
  }
}
/* Settings forms (/admin/settings, /module_settings, a module's own page).
   The controls sit in a table cell, which is as wide as the column — a
   two-digit page limit in a 700px-wide input reads as a mistake, and a
   Save button a screen away from the label it belongs to is a long trip.
   Capped rather than fixed so they still shrink on a narrow viewport. */
.setting-control {
    max-width: 26rem;
}

/* Retained for anything that genuinely wants a narrow control. The module
   settings form no longer uses it: its Save buttons only form a column if every
   input area is the same width, because the button sits immediately after the
   input inside a joined input-group. */
.setting-control-narrow {
    max-width: 11rem;
}

.setting-control-wide {
    max-width: 34rem;
}

/* Bootstrap checks and switches keep their default blue, which is the only
   blue on a green UI. Matches .btn-primary above. */
.form-check-input:checked {
    background-color: #4caf50;
    border-color: #4caf50;
}

.form-check-input:focus {
    border-color: #a5d6a7;
    box-shadow: 0 0 0 0.25rem rgba(76, 175, 80, 0.25);
}

/* Report preview (reports/show). The report's own stylesheet lives in
   ReportRenderer and ships inside the standalone HTML/PDF downloads; this is
   only what the same markup needs when it's inlined into an app page, so it
   deliberately restyles nothing the app already handles. */
.report-body > :first-child {
  margin-top: 0;
}

.report-body h1 {
  font-size: 1.6rem;
  border-bottom: 2px solid #2e7d32;
  padding-bottom: 0.3rem;
}

.report-body h2 {
  font-size: 1.25rem;
  margin-top: 2rem;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 0.2rem;
}

.report-body h3 {
  font-size: 1.1rem;
  margin-top: 1.5rem;
  color: #2e7d32;
}

.report-body h4,
.report-body h5 {
  font-size: 0.85rem;
  margin-top: 1.1rem;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6c757d;
}

.report-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 1rem;
  font-size: 0.875rem;
}

.report-body th,
.report-body td {
  border: 1px solid #dee2e6;
  padding: 0.3rem 0.45rem;
  text-align: left;
  vertical-align: top;
}

.report-body th {
  background: #f0f5f1;
}

.report-body pre {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  padding: 0.5rem;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 22rem;
  overflow-y: auto;
}

/* Finding severity chips.

   A pale tint with a saturated left marker rather than a saturated fill: the
   ramp in FindingsHelper::SEVERITY_FILL is chosen for colourblind *separation*,
   and three of the five do not meet text contrast as a background (amber is
   1.67:1 against the page). The marker carries the colour, the text stays
   readable, and the icon and word carry the meaning for anyone who cannot
   distinguish the marker at all. */
.finding-severity {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.15em 0.5em 0.15em 0.4em;
    border-radius: 0.25rem;
    border-left: 3px solid currentColor;
    white-space: nowrap;
}

.finding-severity-critical { color: #8f1d1d; background-color: #fbe9e9; }
.finding-severity-high     { color: #8a4520; background-color: #fdefe7; }
.finding-severity-medium   { color: #7a5600; background-color: #fdf6e3; }
.finding-severity-low      { color: #2b4979; background-color: #eaf0fa; }
.finding-severity-info     { color: #5a5854; background-color: #f1f0ee; }

/* ==========================================================================
   Project chrome — header, status strip, tabs, section pills.
   Built on the app's existing palette (#e6f9ec ground, #f4fff7 surface,
   #4caf50 primary) rather than a new one, so these pages sit beside the
   untouched ones without a seam. Status colours are the JobStats set and are
   reserved for state: never reused as a decorative accent.
   ========================================================================== */
:root {
  --kbk-ground: #e6f9ec;
  --kbk-surface: #f4fff7;
  --kbk-rule: #c9ded1;
  --kbk-rule-soft: #dcebe2;
  --kbk-ink: #16241b;
  --kbk-muted: #5b6b60;
  --kbk-faint: #8b9a90;
  --kbk-primary: #2e7d32;
  --kbk-ok: #0ca30c;
  --kbk-warn: #fab219;
  --kbk-bad: #d03b3b;
  --kbk-idle: #8b9a90;
  /* A refused run: the module declined to send traffic, rather than failing.
     Off the good/bad axis on purpose. Measured, not chosen — see
     JobStatsHelper::STATUS_FILL. */
  --kbk-refused: #5f4bb6;
}

/* --- header ------------------------------------------------------------- */
.project-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.project-head__name {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0;
  color: var(--kbk-ink);
}
.project-head__desc {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--kbk-muted);
  max-width: 60ch;
}
.project-head__actions { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.project-head__actions form { margin-bottom: 0; }

/* --- status strip ------------------------------------------------------- */
.status-strip { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.9rem; }
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--kbk-rule);
  border-radius: 999px;
  background: var(--kbk-surface);
  color: var(--kbk-ink);
  text-decoration: none;
  white-space: nowrap;
}
a.status-chip:hover { border-color: var(--kbk-muted); color: var(--kbk-ink); }
.status-chip b { font-weight: 600; font-variant-numeric: tabular-nums; }
.status-chip.is-quiet { color: var(--kbk-muted); }
.status-chip.is-attention { border-color: var(--kbk-warn); background: #fdf6e3; }
.status-led { width: 7px; height: 7px; border-radius: 50%; flex: none; display: inline-block; }
.status-led.is-ok { background: var(--kbk-ok); }
.status-led.is-bad { background: var(--kbk-bad); }
.status-led.is-warn { background: var(--kbk-warn); }
.status-led.is-run { background: var(--kbk-warn); }
.status-led.is-idle { background: var(--kbk-idle); }
.status-led.is-refused { background: var(--kbk-refused); }

/* Bootstrap has no contextual class for this one — see
   ProjectSectionsHelper#job_run_status_badge_class. */
.badge.bg-refused { background-color: var(--kbk-refused); color: #fff; }

/* --- tabs --------------------------------------------------------------- */
.project-tabs {
  display: flex;
  gap: 0.1rem;
  border-bottom: 1px solid var(--kbk-rule);
  margin-bottom: 1.1rem;
  overflow-x: auto;
  scrollbar-width: thin;
}
.project-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.88rem;
  color: var(--kbk-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.project-tab:hover { color: var(--kbk-ink); }
.project-tab.is-active { color: var(--kbk-ink); font-weight: 600; border-bottom-color: var(--kbk-primary); }
.project-tab.is-empty { color: var(--kbk-faint); }
.project-tab__count {
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--kbk-faint);
}
.project-tab.is-active .project-tab__count { color: var(--kbk-primary); }
.project-tab:focus-visible { outline: 2px solid var(--kbk-primary); outline-offset: -2px; border-radius: 3px; }

/* --- section pills ------------------------------------------------------ */
.section-nav { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.9rem; }
.section-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--kbk-rule);
  border-radius: 999px;
  background: var(--kbk-surface);
  color: var(--kbk-muted);
  text-decoration: none;
}
.section-pill:hover { color: var(--kbk-ink); border-color: var(--kbk-muted); }
.section-pill.is-active {
  background: var(--kbk-primary);
  border-color: var(--kbk-primary);
  color: #fff;
  font-weight: 600;
}
.section-pill.is-empty { color: var(--kbk-faint); border-style: dashed; }
.section-pill.is-active.is-empty { color: #fff; border-style: solid; }
.section-pill__count { font-variant-numeric: tabular-nums; font-size: 0.72rem; }
.section-pill:focus-visible { outline: 2px solid var(--kbk-primary); outline-offset: 1px; }

/* --- overview tiles ----------------------------------------------------- */
.tile-grid {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-bottom: 1rem;
}
.tile {
  background: var(--kbk-surface);
  border: 1px solid var(--kbk-rule-soft);
  border-radius: 7px;
  padding: 0.65rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  text-decoration: none;
  color: inherit;
}
a.tile:hover { border-color: var(--kbk-muted); }
.tile__label {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--kbk-muted);
}
.tile__value { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.tile__note { font-size: 0.75rem; color: var(--kbk-faint); }
.tile.is-empty .tile__value { color: var(--kbk-faint); }
.tile.is-attention { border-left: 3px solid var(--kbk-warn); }

/* --- shared section furniture ------------------------------------------- */
.section-empty {
  background: var(--kbk-surface);
  border: 1px dashed var(--kbk-rule);
  border-radius: 7px;
  padding: 1.6rem 1rem;
  text-align: center;
  color: var(--kbk-muted);
}
.section-empty p { margin: 0; }
.section-empty .section-empty__why { font-size: 0.82rem; color: var(--kbk-faint); margin-top: 0.3rem; }

.host-cell { font-family: var(--bs-font-monospace, monospace); font-size: 0.85rem; word-break: break-all; }
.num-cell { font-variant-numeric: tabular-nums; text-align: right; }

@media (max-width: 575.98px) {
  .project-head__name { font-size: 1.3rem; }
  .project-tab { padding: 0.45rem 0.55rem; font-size: 0.82rem; }
}

/* --- record pages ------------------------------------------------------- */
/* A detail page — one domain, one address, one autonomous system — wears the
   same tab bar as the section it came from, then names the record and its
   parent. Replaces the stacked breadcrumb, which said where you were a second
   time in a different visual language. */
.record-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--kbk-rule-soft);
  margin-bottom: 1rem;
}
.record-head__parent {
  font-size: 0.75rem;
  color: var(--kbk-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0 0 0.15rem;
}
.record-head__parent a { color: var(--kbk-muted); text-decoration: none; }
.record-head__parent a:hover { color: var(--kbk-ink); text-decoration: underline; }
.record-head__name {
  font-family: var(--bs-font-monospace, monospace);
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
  word-break: break-all;
  color: var(--kbk-ink);
}
.record-head__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-top: 0.35rem; }
.record-head__actions { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: flex-start; }
.record-head__actions form { margin-bottom: 0; }

/* The rescan menu items carry a second line saying what each covers. */
.project-rescan-menu { min-width: 18rem; }
.project-rescan-menu .dropdown-item { white-space: normal; }

.record-section { margin-bottom: 1.4rem; }
.record-section > h2 {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--kbk-muted);
  margin: 0 0 0.5rem;
  font-weight: 600;
}

/* --- list pages --------------------------------------------------------- */
/* Projects, Archived and New are not inside a project, so they carry no tab
   bar — but they wear the same head, surfaces and empty state, so moving
   between them and a project does not feel like two applications. */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--kbk-rule);
  margin-bottom: 1.2rem;
}
.page-head__title { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; margin: 0; color: var(--kbk-ink); }
.page-head__note { font-size: 0.82rem; color: var(--kbk-muted); margin: 0.15rem 0 0; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.page-head__actions form { margin-bottom: 0; }

/* A project in a list. Same surface and rule as a section card; the counts use
   the tile's label/value pairing so a project reads the same way its own
   overview does. */
.project-card {
  background: var(--kbk-surface);
  border: 1px solid var(--kbk-rule-soft);
  border-radius: 7px;
  padding: 0.85rem 1rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.project-card:hover { border-color: var(--kbk-rule); }
.project-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.project-card__name { font-size: 1.05rem; font-weight: 600; line-height: 1.25; margin: 0; }
.project-card__name a { color: var(--kbk-ink); text-decoration: none; }
.project-card__name a:hover { text-decoration: underline; }
.project-card__desc { font-size: 0.82rem; color: var(--kbk-muted); margin: 0; }
.project-card__counts { display: flex; flex-wrap: wrap; gap: 1.1rem; margin-top: auto; padding-top: 0.4rem; }
.count-pair { display: flex; flex-direction: column; line-height: 1.15; }
.count-pair__value { font-size: 1.1rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.count-pair__label { font-size: 0.66rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--kbk-muted); }
.count-pair.is-zero .count-pair__value { color: var(--kbk-faint); }
.project-card__foot { font-size: 0.72rem; color: var(--kbk-faint); border-top: 1px solid var(--kbk-rule-soft); padding-top: 0.45rem; }

.form-card {
  background: var(--kbk-surface);
  border: 1px solid var(--kbk-rule-soft);
  border-radius: 7px;
  padding: 1.1rem 1.2rem;
  max-width: 44rem;
}

/* --- modules ------------------------------------------------------------ */
/* A module carries two states that the old badges ran together: whether it is
   switched on, and whether it *could* run at all. AGENTS.md is explicit that
   these are different questions — validate_configuration auto-disabling a
   module is about capability, ManualTriggerOnly is about intent — so the LED
   answers "can it run" and the word answers "is it on". */
.module-group { margin-bottom: 1.6rem; }
.module-group__head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.module-group__title {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--kbk-muted);
  font-weight: 600;
  margin: 0;
}
.module-group__count { font-size: 0.72rem; color: var(--kbk-faint); font-variant-numeric: tabular-nums; }

.module-list {
  background: var(--kbk-surface);
  border: 1px solid var(--kbk-rule-soft);
  border-radius: 7px;
  overflow: hidden;
}
.module-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--kbk-rule-soft);
}
.module-row:last-child { border-bottom: 0; }
.module-row__led { margin-top: 0.42rem; }
.module-row__main { flex: 1 1 16rem; min-width: 0; }
.module-row__name { font-size: 0.92rem; font-weight: 600; margin: 0; line-height: 1.3; }
.module-row__name a { color: var(--kbk-ink); text-decoration: none; }
.module-row__name a:hover { text-decoration: underline; }
.module-row__id {
  font-family: var(--bs-font-monospace, monospace);
  font-size: 0.72rem;
  color: var(--kbk-muted);
}
.module-row__desc { font-size: 0.78rem; color: var(--kbk-muted); margin: 0.15rem 0 0; }
.module-row__problem {
  font-size: 0.75rem;
  margin: 0.3rem 0 0;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  border-left: 3px solid var(--kbk-bad);
  background: #fdecec;
  color: #7a2020;
  word-break: break-word;
}
.module-row__problem.is-config { border-left-color: var(--kbk-warn); background: #fdf6e3; color: #6b4e05; }
.module-row__side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; flex: none; }
.module-state {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  border: 1px solid var(--kbk-rule);
  color: var(--kbk-muted);
  background: var(--kbk-ground);
}
.module-state.is-on { border-color: var(--kbk-primary); color: var(--kbk-primary); background: #eaf6ec; }
.module-row__version { font-size: 0.7rem; color: var(--kbk-faint); font-variant-numeric: tabular-nums; }

/* --- module rows: type is the colour, enabled is the saturation ---------- */
/* Two states, two channels. The tint says what kind of module it is — passive
   reads indexes, active sends traffic, commercial costs money — and that is
   worth seeing at a glance across a whole list. Whether it is switched on is
   carried by saturation, not by a word: a row that says "DISABLED" next to a
   button that says "Enable" states the same fact twice. */
.module-row.module-passive { background-color: #eef4fd; }
.module-row.module-active { background-color: #fdeeee; }
.module-row.module-commercial { background-color: #fdf6e4; }

.module-row.is-off {
  filter: grayscale(0.85);
  opacity: 0.68;
}
.module-row.is-off .module-row__name a { color: var(--kbk-muted); }
.module-row:hover { filter: none; opacity: 1; }

/* The id and version read as one identifier, because that is what they are:
   which module, at which version. */
.module-row__ident {
  font-family: var(--bs-font-monospace, monospace);
  font-size: 0.72rem;
  color: var(--kbk-muted);
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
}
.module-row__version { color: var(--kbk-faint); font-variant-numeric: tabular-nums; }
.module-row__version::before { content: "·"; margin-right: 0.35rem; }

/* Filter chips: same shape as the status strip they replace, but they act. */
a.status-chip.is-filter { cursor: pointer; }
a.status-chip.is-filter.is-on {
  border-color: var(--kbk-primary);
  background: var(--kbk-primary);
  color: #fff;
}
a.status-chip.is-filter.is-on .status-led { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.85); }

/* A settings table per group — per module on /module_settings, per area on
   /admin/settings — so keys that repeat across groups cannot be read as one
   list. */
.settings-group { margin-bottom: 1.1rem; }
.settings-group__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.45rem 0.8rem;
  background: var(--kbk-ground);
  border: 1px solid var(--kbk-rule-soft);
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
}
.settings-group__name { font-size: 0.85rem; font-weight: 600; margin: 0; }
.settings-group__name a { color: var(--kbk-ink); text-decoration: none; }
.settings-group__name a:hover { text-decoration: underline; }
.settings-group__count { font-size: 0.7rem; color: var(--kbk-faint); margin-left: auto; font-variant-numeric: tabular-nums; }
.settings-group .card {
  border-radius: 0 0 7px 7px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

/* --- dashboard ---------------------------------------------------------- */
/* A table of projects rather than cards: every column is a number you compare
   across rows, and cards make comparison a scavenger hunt. The severity stripe
   on the left is the one thing meant to be seen without reading. */
.project-table__row td { vertical-align: middle; }
.project-table__name { font-weight: 600; }
.project-table__name a { color: var(--kbk-ink); text-decoration: none; }
.project-table__name a:hover { text-decoration: underline; }
.project-table__owner { font-size: 0.72rem; color: var(--kbk-faint); }
.sev-stripe {
  display: inline-block;
  width: 3px;
  height: 1.5rem;
  border-radius: 2px;
  background: var(--kbk-rule);
  vertical-align: middle;
}
.sev-stripe.is-critical, .sev-stripe.is-high { background: var(--kbk-bad); }
.sev-stripe.is-medium { background: var(--kbk-warn); }
.sev-stripe.is-low { background: var(--kbk-idle); }

.finding-line { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.8rem; border-bottom: 1px solid var(--kbk-rule-soft); font-size: 0.82rem; }
.finding-line:last-child { border-bottom: 0; }
.finding-line__project { font-size: 0.72rem; color: var(--kbk-faint); white-space: nowrap; }
.finding-line__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* A card's rounded corners are drawn on its border; the table inside paints its
   own cells right up to that edge, so the bottom corners came out rounded and
   square at the same time. The card has to clip its content. Scoped to cards
   that wrap a table so it cannot clip a dropdown or tooltip in any other card. */
.card:has(> .table-responsive) {
  overflow: hidden;
}

/* --- signed-out pages --------------------------------------------------- */
/* No sidebar, no chrome: there is nothing to navigate to until you are in.
   The ground is the app's own so the two do not feel like separate products,
   and the card is the same surface every form in the app sits on. */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  /* The sidebar's gradient, so signing in and using the app are visibly the
     same product. logo-light.png is the variant drawn for this ground — it is
     what the sidebar puts on the same green. */
  background: linear-gradient(135deg, #2e7d32 0%, #388e3c 50%, #43a047 100%);
  background-attachment: fixed;
}
.auth-shell {
  width: 100%;
  max-width: 24rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.auth-brand { display: flex; justify-content: center; }
.auth-brand__mark { display: block; }
.auth-card {
  background: var(--kbk-surface);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  padding: 1.4rem 1.5rem;
  box-shadow: 0 10px 40px -12px rgba(0, 0, 0, 0.35);
}
.auth-card h2,
.auth-card h1 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--kbk-ink);
}
.auth-card .form-label { font-size: 0.82rem; margin-bottom: 0.25rem; }
.auth-card .btn-primary { width: 100%; }
.auth-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--kbk-rule-soft);
  font-size: 0.82rem;
}
.auth-links a { color: var(--kbk-muted); }
.auth-links a:hover { color: var(--kbk-ink); }
