/* ═══════════════════════════════════════════════
   Arcano Design System
   All values → CSS tokens in tokens.css
   Component rules → ARCANO_STYLE_GUIDE.md
   ═══════════════════════════════════════════════ */

/* ── Page shell ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body-md);
  color: var(--text-primary);
  background: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  line-height: var(--lh-body);
}

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── App topbar bits (shared by the console topbar) ───────────────── */

/* Company switcher (multi-company console) — reuses .menu from components.css */
.company-switcher { position: relative; margin-right: 24px; }
.company-switcher-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.company-switcher-trigger:hover { background: var(--bg-secondary); border-color: var(--border-default); }
.company-switcher-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-switcher-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 60;
  min-width: 240px;
}
.company-switcher-menu[hidden] { display: none; }
.company-switcher-label {
  padding: 6px 10px 4px;
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.nq-nav-end {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.nq-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-body-sm);
  color: var(--text-secondary);
}

/* Hamburger + drawer backdrop are desktop-hidden; shown by the ≤860 rules. */
.nq-hamburger { display: none; }
.console-backdrop { display: none; }

/* ── Console app shell (collapsible sidebar + slim topbar) ────────── */
.console-shell {
  display: flex;
  align-items: stretch;
  /* Fixed viewport shell: the sidebar stays put and the main column scrolls
     on its own (see .console-main), so long pages are always fully reachable.
     100dvh (with a 100vh fallback) tracks the *actual* viewport, so a dynamic
     browser bar (e.g. the Translate prompt) can't push the footer off-screen. */
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.console-sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  height: 100dvh;
  flex: 0 0 256px;
  width: 256px;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-subtle);
  overflow: hidden;
  transition: flex-basis var(--dur-base, 200ms) var(--ease-out), width var(--dur-base, 200ms) var(--ease-out);
}
.sidebar-collapsed .console-sidebar { flex-basis: 64px; width: 64px; }

.sidebar-head {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.sidebar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-heading-sm);
  letter-spacing: var(--ls-heading);
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand-mark { width: 28px; height: 28px; border-radius: var(--radius-md); flex-shrink: 0; display: block; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px;
  border-radius: var(--radius-md);
  font-size: var(--fs-body-md);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.sidebar-item:hover { background: var(--bg-secondary); color: var(--text-primary); text-decoration: none; }
.sidebar-item.active { background: var(--brand-tint); color: var(--brand-on-tint); }
.sidebar-icon { font-size: 17px; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sidebar-soon { font-size: 14px; color: var(--text-tertiary); opacity: .7; flex-shrink: 0; }
.sidebar-item.is-disabled { color: var(--text-tertiary); cursor: default; }
.sidebar-item.is-disabled:hover { background: transparent; color: var(--text-tertiary); }
.sidebar-item.is-disabled .sidebar-icon { opacity: .6; }
.sidebar-sep { height: 1px; background: var(--border-subtle); margin: 8px 6px; }

.sidebar-foot { border-top: 1px solid var(--border-subtle); padding: 10px; flex-shrink: 0; }
.sidebar-collapse {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  white-space: nowrap;
}
.sidebar-collapse:hover { background: var(--bg-secondary); color: var(--text-primary); }
.sidebar-collapse .sidebar-icon { transition: transform var(--dur-base, 200ms) var(--ease-out); }

/* Collapsed — icons only (scoped to the sidebar so the no-company topbar
   brand keeps its name) */
.sidebar-collapsed .console-sidebar .sidebar-brand-name,
.sidebar-collapsed .console-sidebar .sidebar-label,
.sidebar-collapsed .console-sidebar .sidebar-soon { display: none; }
.sidebar-collapsed .console-sidebar .sidebar-item,
.sidebar-collapsed .console-sidebar .sidebar-collapse,
.sidebar-collapsed .console-sidebar .sidebar-head { justify-content: center; padding: 0; gap: 0; }
.sidebar-collapsed .console-sidebar .sidebar-collapse .sidebar-icon { transform: rotate(180deg); }

/* Fixed-height column: a sticky topbar and an always-visible footer bracket a
   single scrolling region (.console-scroll) in the middle. */
.console-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.console-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.console-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  background: color-mix(in oklab, var(--bg-primary) 92%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

/* Narrow screens: the sidebar becomes an off-canvas hamburger drawer.
   It slides in over the content (with a backdrop) instead of taking a
   permanent column, so phones get the full content width. */
@media (max-width: 860px) {
  .nq-hamburger { display: inline-flex; }

  .console-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 80;
    height: 100vh;
    flex-basis: auto;
    width: 264px;
    transform: translateX(-100%);
    transition: transform var(--dur-default) var(--ease-out);
    box-shadow: var(--elev-4);
  }
  .console-shell.sidebar-open .console-sidebar { transform: translateX(0); }

  /* Ignore a persisted desktop "collapsed" state inside the drawer —
     always show the full, labelled sidebar. */
  .sidebar-collapsed .console-sidebar { width: 264px; flex-basis: auto; }
  .sidebar-collapsed .console-sidebar .sidebar-brand-name,
  .sidebar-collapsed .console-sidebar .sidebar-label,
  .sidebar-collapsed .console-sidebar .sidebar-soon { display: revert; }
  .sidebar-collapsed .console-sidebar .sidebar-item,
  .sidebar-collapsed .console-sidebar .sidebar-head { justify-content: flex-start; padding: 0 10px; gap: 8px; }
  .sidebar-collapsed .console-sidebar .sidebar-head { padding: 0 16px; }

  /* The desktop collapse control is meaningless in drawer mode. */
  .sidebar-foot { display: none; }

  .console-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 70;
    background: color-mix(in oklab, var(--gray-950) 55%, transparent);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-default) var(--ease-out);
  }
  .console-shell.sidebar-open .console-backdrop { opacity: 1; pointer-events: auto; }
}

/* ── Page content ─────────────────────────────────────────────────── */
.nq-page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 32px 24px;
  width: 100%;
}

.console-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px 24px;
  flex-wrap: wrap;
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  color: var(--text-tertiary);
  font-size: var(--fs-caption);
}
.console-footer a { color: var(--text-tertiary); }
.console-footer a:hover { color: var(--text-secondary); }

.nq-page-header {
  margin-bottom: 28px;
}
.nq-page-company {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--brand-600);
  margin-bottom: 4px;
}
.nq-page-title {
  font-size: var(--fs-heading-xl);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-heading);
  color: var(--text-primary);
  line-height: var(--lh-heading);
}
.nq-page-subtitle {
  font-size: var(--fs-body-md);
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── Card ─────────────────────────────────────────────────────────── */
.nq-card {
  position: relative;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--elev-1);
}

/* Two-corner ornament — top-left and bottom-right */
.nq-card::before,
.nq-card::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
}
.nq-card::before {
  top: 10px;
  left: 10px;
  border-top: 1.5px solid var(--brand-400);
  border-left: 1.5px solid var(--brand-400);
  opacity: 0.45;
}
.nq-card::after {
  bottom: 10px;
  right: 10px;
  border-bottom: 1.5px solid var(--brand-400);
  border-right: 1.5px solid var(--brand-400);
  opacity: 0.45;
}

/* ── Auth layout ──────────────────────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-canvas);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}
.auth-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-lg);
  background: var(--brand-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 15px;
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  box-shadow: 0 4px 12px oklch(70% 0.16 220 / 0.3);
}
.auth-brand-name {
  font-family: var(--font-serif);
  font-size: var(--fs-heading-lg);
  color: var(--text-primary);
  letter-spacing: var(--ls-heading);
}

.auth-card {
  width: 100%;
  max-width: 400px;
}
.auth-card-title {
  font-size: var(--fs-heading-md);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-heading);
  margin-bottom: 20px;
}

.auth-footer {
  margin-top: 12px;
  text-align: center;
  font-size: var(--fs-body-sm);
  color: var(--text-secondary);
}

/* ── Form helpers ─────────────────────────────────────────────────── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

.field-error {
  font-size: var(--fs-caption);
  color: var(--danger-text);
  margin-top: 3px;
}

/* ── Alert banner ─────────────────────────────────────────────────── */
.nq-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: var(--fs-body-sm);
  margin-bottom: 16px;
}
.nq-alert.danger { background: var(--danger-bg); border: 1px solid var(--danger-border); color: var(--danger-text); }
.nq-alert.success { background: var(--success-bg); border: 1px solid var(--success-border); color: var(--success-text); }
.nq-alert.info { background: var(--info-bg); border: 1px solid var(--info-border); color: var(--info-text); }

/* ── Standards grid ──────────────────────────────────────────────── */
.standards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.std-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: box-shadow var(--dur-default) var(--ease-out),
              border-color var(--dur-default) var(--ease-out),
              transform var(--dur-default) var(--ease-out);
}
.std-card:hover {
  box-shadow: var(--elev-2);
  border-color: var(--brand-200);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}
/* Stretched link makes the whole card navigate to the detail page, while the
   "Contactar ventas" button sits above it (higher z-index) and is clickable. */
.std-card-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.std-card-footer .contact-sales-btn { position: relative; z-index: 2; }

.std-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
/* Logo + name/issuer cluster on the left of a card / detail header. */
.std-card-id,
.detail-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.detail-header-brand { margin-bottom: 6px; }

/* Framework logo tile — brand-tinted fallback (icon) sits behind the image,
   so it shows through when the logo is absent or fails to load. */
.std-logo {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-tint);
}
.std-logo-img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.std-logo-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--brand-on-tint);
}
.std-logo--lg {
  width: 56px;
  height: 56px;
}
.std-logo--lg .std-logo-fallback { font-size: 28px; }

.std-card-name {
  font-size: var(--fs-heading-sm);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-heading);
  line-height: var(--lh-heading);
  color: var(--text-primary);
}
.std-card-issuer {
  font-size: var(--fs-body-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}
.std-card-desc {
  font-size: var(--fs-body-sm);
  color: var(--text-secondary);
  line-height: var(--lh-body);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.std-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-caption);
  color: var(--text-tertiary);
}

/* ── Badge ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
}
.badge-brand { background: var(--brand-tint); color: var(--brand-on-tint); }
.badge-success { background: var(--success-bg); color: var(--success-text); border: 1px solid var(--success-border); }
.badge-leaf { background: var(--leaf-100); color: var(--leaf-800); }

/* ── Pillar badge ────────────────────────────────────────────────── */
.pillar-env { background: var(--leaf-100); color: var(--leaf-800); }
.pillar-social { background: var(--info-bg); color: var(--info-text); }
.pillar-gov { background: oklch(97% 0.02 280); color: oklch(42% 0.10 280); }

/* ── Requirement status badge ────────────────────────────────────── */
.status-compliant { background: var(--success-bg); color: var(--success-text); border: 1px solid var(--success-border); }
.status-partial { background: var(--brand-tint); color: var(--brand-on-tint); }
.status-non_compliant { background: var(--danger-bg); color: var(--danger-text); border: 1px solid var(--danger-border); }
.status-not_applicable { background: var(--bg-subtle); color: var(--text-tertiary); }
.status-pending { background: var(--bg-subtle); color: var(--text-secondary); }

/* ── Glossary term (auto-linked, hover tooltip) ──────────────────── */
.kg-term {
  position: relative;
  color: var(--brand-600);
  border-bottom: 1px dashed var(--brand-400);
  cursor: help;
}
.kg-term::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(4px);
  width: max-content;
  max-width: 280px;
  white-space: normal;
  text-align: left;
  font-size: var(--fs-caption);
  font-weight: var(--fw-regular);
  line-height: 1.45;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--elev-2, var(--elev-1));
  padding: 8px 11px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
  z-index: 50;
}
.kg-term:hover::after,
.kg-term:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.kg-term:focus { outline: none; }
.kg-term:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 2px; }

/* ── Requirement filters ─────────────────────────────────────────── */
.req-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.req-filter { display: flex; flex-direction: column; gap: 6px; min-width: 180px; }
.req-filter-label {
  font-size: var(--fs-caption);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-tertiary);
  font-weight: var(--fw-semibold);
}

/* ── Requirement table ───────────────────────────────────────────── */
.req-section { margin-bottom: 28px; }
.req-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-heading-sm);
  font-weight: var(--fw-semibold);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

/* ── Onboarding steps ────────────────────────────────────────────── */
.onboard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 32px;
}
.onboard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-body-sm);
  color: var(--text-tertiary);
}
.onboard-step.active { color: var(--text-primary); font-weight: var(--fw-medium); }
.onboard-step.done { color: var(--success-text); }
.onboard-step-dot {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-default);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  background: var(--bg-primary);
}
.onboard-step.active .onboard-step-dot { border-color: var(--brand-600); color: var(--brand-600); }
.onboard-step.done .onboard-step-dot { border-color: var(--success-solid); background: var(--success-solid); color: white; }
.onboard-step-line {
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
  min-width: 24px;
  max-width: 48px;
}

/* ── Native select ───────────────────────────────────────────────── */
.select {
  width: 100%;
  font-family: var(--font-sans);
  font-size: var(--fs-body-md);
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border-control);
  border-radius: var(--radius-md);
  padding: 0 12px;
  height: 36px;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.select:hover { border-color: var(--border-control-hover); }
.select:focus { border-color: var(--border-focus); box-shadow: var(--ring-focus); }
.select.error { border-color: var(--danger-solid); }

/* ── Spinner ─────────────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border-default);
  border-top-color: var(--brand-600);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Empty state ─────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-secondary);
}
.empty-state .icon { font-size: 40px; color: var(--text-tertiary); margin-bottom: 12px; }
.empty-state p { font-size: var(--fs-body-md); }

/* ── Detail header ───────────────────────────────────────────────── */
.detail-header {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--elev-1);
  position: relative;
}
.detail-header::before,
.detail-header::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
}
.detail-header::before {
  top: 10px; left: 10px;
  border-top: 1.5px solid var(--brand-400);
  border-left: 1.5px solid var(--brand-400);
  opacity: 0.45;
}
.detail-header::after {
  bottom: 10px; right: 10px;
  border-bottom: 1.5px solid var(--brand-400);
  border-right: 1.5px solid var(--brand-400);
  opacity: 0.45;
}
.detail-header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.detail-header-title {
  font-size: var(--fs-heading-xl);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-heading);
  line-height: var(--lh-heading);
  margin-bottom: 6px;
}
.detail-header-desc {
  font-size: var(--fs-body-md);
  color: var(--text-secondary);
  line-height: var(--lh-body);
  max-width: 640px;
}
.detail-stats {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}
.detail-stat { font-size: var(--fs-body-sm); color: var(--text-secondary); }
.detail-stat strong { color: var(--text-primary); font-weight: var(--fw-semibold); }

/* ── Back link ───────────────────────────────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-body-sm);
  color: var(--text-secondary);
  margin-bottom: 16px;
  transition: color var(--dur-fast) var(--ease-out);
}
.back-link:hover { color: var(--text-primary); text-decoration: none; }

/* ── Requirement row link (standards detail + requirements list) ──── */
.req-row-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
}
.req-row-link:hover { color: var(--brand-600); text-decoration: none; }
.req-row-arrow {
  font-size: 13px;
  color: var(--brand-600);
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.req-row-link:hover .req-row-arrow { opacity: 1; transform: translateX(0); }

/* ── Change-history timeline (requirement detail) ─────────────────── */
.kg-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.kg-timeline-item {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 0 0 16px 4px;
}
.kg-timeline-item::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 24px;
  bottom: 0;
  width: 1px;
  background: var(--border-subtle);
}
.kg-timeline-item:last-child { padding-bottom: 0; }
.kg-timeline-item:last-child::before { display: none; }
.kg-timeline-dot {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  background: var(--brand-tint);
  color: var(--brand-on-tint);
  border: 1px solid var(--border-subtle);
  z-index: 1;
}
.kg-timeline-check .kg-timeline-dot { background: var(--leaf-100); color: var(--leaf-800); }
.kg-timeline-body { padding-top: 1px; }

/* ═══════════════════════════════════════════════════════════════════
   Requirement detail — verdict + checks (redesign)
   Layout adapted from the Claude Design "Requisitos" import; all values
   resolve to design tokens (tokens.css) so it respects light/dark themes.
   ═══════════════════════════════════════════════════════════════════ */

/* Collapsible disclosure (toggled description / changelog) */
.kg-disclosure { margin-top: 16px; }
.kg-disclosure-section { margin-top: 28px; }
/* Description toggle that sits on the page between the header and verdict
   blocks rather than inside a card. */
.kg-disclosure-standalone { margin-top: -8px; margin-bottom: 24px; padding: 0 4px; }
.kg-disclosure > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  user-select: none;
}
.kg-disclosure-section > summary {
  font-size: var(--fs-heading-sm);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.kg-disclosure > summary::-webkit-details-marker { display: none; }
.kg-disclosure > summary:hover { color: var(--brand-600); }
.kg-disclosure > summary:focus-visible {
  outline: 2px solid var(--brand-400);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
.kg-disclosure-chevron {
  font-size: 16px;
  color: var(--text-tertiary);
  transition: transform var(--dur-fast) var(--ease-out);
}
.kg-disclosure[open] > summary .kg-disclosure-chevron { transform: rotate(90deg); }
.kg-disclosure-count {
  margin-left: auto;
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-regular);
  color: var(--text-tertiary);
}
.kg-disclosure-body { padding-top: 12px; }

/* Two-column verdict + checks grid */
.req-verdict-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
  margin-bottom: 28px;
}

/* Verdict card — mirrors the .nq-card surface + corner ornaments */
.req-verdict-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--elev-1);
}
.req-verdict-card::before,
.req-verdict-card::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
  opacity: 0.45;
}
.req-verdict-card::before {
  top: 10px; left: 10px;
  border-top: 1.5px solid var(--brand-400);
  border-left: 1.5px solid var(--brand-400);
}
.req-verdict-card::after {
  bottom: 10px; right: 10px;
  border-bottom: 1.5px solid var(--brand-400);
  border-right: 1.5px solid var(--brand-400);
}
.req-verdict-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: var(--bg-secondary);
  color: var(--text-tertiary);
}
.req-verdict-label {
  font-size: var(--fs-heading-md);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-heading);
  color: var(--text-primary);
  line-height: 1.1;
}
.req-verdict-score {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  line-height: 1;
}
.req-verdict-score-unit {
  font-family: var(--font-sans);
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-medium);
  color: var(--text-tertiary);
  margin-left: 4px;
}
.req-verdict-hint {
  font-size: var(--fs-body-sm);
  color: var(--text-secondary);
  line-height: var(--lh-body);
}
.req-verdict-meta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: var(--fs-caption);
  color: var(--text-secondary);
}

/* Verdict status accents — icon box tinted per status */
.req-verdict--compliant .req-verdict-icon { background: var(--success-bg); color: var(--success-text); }
.req-verdict--compliant .req-verdict-label { color: var(--success-text); }
.req-verdict--non_compliant .req-verdict-icon { background: var(--danger-bg); color: var(--danger-text); }
.req-verdict--non_compliant .req-verdict-label { color: var(--danger-text); }
.req-verdict--partial .req-verdict-icon { background: var(--warning-bg); color: var(--warning-text); }
.req-verdict--partial .req-verdict-label { color: var(--warning-text); }
.req-verdict--pending .req-verdict-icon { background: var(--info-bg); color: var(--info-text); }
/* "No aplica" — deliberately muted (the check & requirement verdict panels can both
   surface a not_applicable instance/status). */
.req-verdict--not_applicable .req-verdict-icon { background: var(--bg-tertiary); color: var(--text-tertiary); }
.req-verdict--not_applicable .req-verdict-label { color: var(--text-secondary); }

/* Checks panel */
.req-checks-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.req-rule-banner {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: var(--brand-tint);
  border: 1px solid var(--brand-200);
}
.req-rule-banner > i { font-size: 18px; color: var(--brand-600); flex: none; }
.req-rule-title {
  display: block;
  font-size: var(--fs-body-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}
.req-rule-progress {
  display: block;
  font-size: var(--fs-caption);
  color: var(--text-secondary);
}

/* Rich check row (links to the per-check page) */
.req-check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--elev-1);
  text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.req-check-row:hover {
  border-color: var(--brand-400);
  box-shadow: var(--elev-2);
  text-decoration: none;
}
.req-check-icon { font-size: 20px; flex: none; color: var(--text-tertiary); }
.req-check-row--pass .req-check-icon { color: var(--success-solid); }
.req-check-row--fail .req-check-icon { color: var(--danger-solid); }
.req-check-row--partial .req-check-icon { color: var(--warning-solid); }
.req-check-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.req-check-name {
  font-size: var(--fs-body-md);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.req-check-desc {
  margin: 0;
  font-size: var(--fs-body-sm);
  line-height: 1.45;
  color: var(--text-secondary);
}
.req-check-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-caption);
  color: var(--text-secondary);
}
.req-check-meta i { font-size: 13px; color: var(--text-tertiary); margin-right: 4px; }
.req-check-sep { color: var(--border-strong); }
.req-check-value { font-family: var(--font-mono); color: var(--text-primary); }
.req-check-empty { color: var(--text-tertiary); font-style: italic; }
.req-check-chevron { font-size: 17px; color: var(--text-tertiary); flex: none; }

@media (max-width: 860px) {
  .req-verdict-grid { grid-template-columns: 1fr; }
}

/* ── Page transition loader ──────────────────────────────────────── */
#nq-page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-canvas);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 56px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 600ms var(--ease-out);
}
#nq-page-loader.visible { opacity: 1; pointer-events: all; }

.splash-stage {
  position: relative;
  width: 340px;
  height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.splash-mark {
  width: 76px;
  height: 76px;
  position: relative;
  z-index: 3;
  animation: splash-breathe 2.4s var(--ease-out) infinite;
  filter: drop-shadow(0 4px 24px color-mix(in oklab, var(--brand-600) 40%, transparent));
}
@keyframes splash-breathe {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.08); }
}

.splash-pulse {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 76px; height: 76px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1.5px solid var(--brand-600);
  opacity: 0;
  animation: splash-pulse 2.4s var(--ease-out) infinite;
}
.splash-pulse.p2 { animation-delay: 0.8s; }
.splash-pulse.p3 { animation-delay: 1.6s; }
@keyframes splash-pulse {
  0%   { transform: translate(-50%, -50%) scale(0.6); opacity: 0.6; }
  80%  { opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(3.2); opacity: 0; }
}

.splash-ring {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  border: 1px dashed color-mix(in oklab, var(--brand-600) 35%, transparent);
  border-radius: 50%;
  pointer-events: none;
}
.splash-ring.r1 { width: 180px; height: 180px; }
.splash-ring.r2 { width: 280px; height: 280px; }

.splash-orbit {
  position: absolute;
  inset: 50% auto auto 50%;
  pointer-events: none;
}
.splash-orbit.o1 { width: 180px; height: 180px; animation: splash-spin 9s linear infinite; }
.splash-orbit.o2 { width: 280px; height: 280px; animation: splash-spin 14s linear infinite reverse; }

.splash-item {
  position: absolute;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 1px solid color-mix(in oklab, var(--brand-600) 25%, var(--border-subtle));
  box-shadow: var(--elev-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-on-tint);
  font-size: 18px;
  transform: translate(-50%, -50%);
}
.splash-orbit.o1 .splash-item { animation: splash-counter 9s linear infinite; }
.splash-orbit.o2 .splash-item { width: 36px; height: 36px; font-size: 16px; animation: splash-counter 14s linear infinite reverse; }

@keyframes splash-spin    {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes splash-counter {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(-360deg); }
}

/* Inner orbit positions (3 items @ 0°/120°/240°) */
.splash-orbit.o1 .splash-item:nth-child(1) { top: 0%;   left: 50%; }
.splash-orbit.o1 .splash-item:nth-child(2) { top: 75%;  left: 93.3%; }
.splash-orbit.o1 .splash-item:nth-child(3) { top: 75%;  left: 6.7%; }

/* Outer orbit positions (4 items @ 0°/90°/180°/270°) */
.splash-orbit.o2 .splash-item:nth-child(1) { top: 0%;   left: 50%; }
.splash-orbit.o2 .splash-item:nth-child(2) { top: 50%;  left: 100%; }
.splash-orbit.o2 .splash-item:nth-child(3) { top: 100%; left: 50%; }
.splash-orbit.o2 .splash-item:nth-child(4) { top: 50%;  left: 0%; }

.splash-item.tint-leaf { color: var(--leaf-600);  border-color: color-mix(in oklab, var(--leaf-600) 28%, var(--border-subtle)); }
.splash-item.tint-rule { color: oklch(58% 0.14 268); border-color: color-mix(in oklab, oklch(58% 0.14 268) 28%, var(--border-subtle)); }
.splash-item.tint-warn { color: oklch(60% 0.13 70);  border-color: color-mix(in oklab, oklch(60% 0.13 70) 28%, var(--border-subtle)); }

.splash-cap {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.splash-brand {
  font-weight: var(--fw-semibold);
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.splash-tag {
  font-size: var(--fs-body-sm);
  color: var(--text-tertiary);
  max-width: 36ch;
  animation: splash-fade 1.8s var(--ease-out) infinite alternate;
}
@keyframes splash-fade { from { opacity: 0.45; } to { opacity: 0.95; } }

.splash-bar {
  width: 200px;
  height: 2px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}
.splash-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, var(--brand-600), transparent);
  animation: splash-sweep 1.4s var(--ease-out) infinite;
}
@keyframes splash-sweep {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

@media (prefers-reduced-motion: reduce) {
  .splash-mark, .splash-pulse, .splash-orbit, .splash-tag, .splash-bar::after { animation: none !important; }
}

/* ── Landing page ────────────────────────────────────────────────── */
.land-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.land-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 24px;
  background: color-mix(in oklab, var(--bg-canvas) 92%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}
.land-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text-primary);
}
.land-brand:hover { text-decoration: none; }
.land-nav-end { display: flex; align-items: center; gap: 8px; }

/* Landing brand marks show the blue-on-transparent mark itself, not a filled
   blue tile (the tile is reserved for the auth screens). */
.land-brand .auth-brand-mark,
.land-footer-brand .auth-brand-mark {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.land-hero {
  padding: 96px 0 80px;
  text-align: center;
}
.land-eyebrow { margin-bottom: 20px; }
.land-hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 20px;
}
.land-accent { color: var(--brand-600); }
.land-hero-sub {
  font-size: var(--fs-body-lg);
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto 36px;
  line-height: 1.65;
}
.land-hero-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.land-features {
  padding: 80px 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}
.land-section-label {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--brand-600);
  margin-bottom: 10px;
}
.land-section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-heading);
  color: var(--text-primary);
  margin-bottom: 40px;
  line-height: var(--lh-heading);
}
.land-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.land-feat-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--elev-1);
  transition: box-shadow var(--dur-default) var(--ease-out),
              border-color var(--dur-default) var(--ease-out);
}
.land-feat-card:hover { box-shadow: var(--elev-2); border-color: var(--border-default); }
.land-feat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 14px;
}
.land-feat-title {
  font-size: var(--fs-body-lg);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  margin-bottom: 8px;
}
.land-feat-desc {
  font-size: var(--fs-body-sm);
  color: var(--text-secondary);
  line-height: 1.65;
}

.land-how { padding: 80px 0; }
.land-steps {
  display: flex;
  align-items: flex-start;
  gap: 0;
  flex-wrap: wrap;
}
.land-step {
  flex: 1;
  min-width: 160px;
  text-align: center;
  padding: 0 16px;
}
.land-step-num {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--brand-tint);
  color: var(--brand-600);
  font-size: var(--fs-heading-sm);
  font-weight: var(--fw-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
.land-step-title {
  font-size: var(--fs-body-md);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  margin-bottom: 6px;
}
.land-step-desc {
  font-size: var(--fs-body-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}
.land-step-arrow {
  display: flex;
  align-items: center;
  padding-top: 20px;
  color: var(--text-tertiary);
  font-size: 20px;
}
@media (max-width: 640px) {
  .land-step-arrow { display: none; }
  .land-step { min-width: 45%; }
}

.land-contact {
  padding: 80px 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

.land-footer {
  padding: 28px 0;
  border-top: 1px solid var(--border-subtle);
}
.land-footer .land-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.land-footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
}
.land-footer a:hover { text-decoration: underline; }

/* ── Check detail: comply controls ─────────────────────────────── */
.kg-comply-row { margin: 0; }
.kg-comply-sep {
  height: 1px;
  background: var(--border-subtle);
  margin: 18px 0;
}
.kg-file-input {
  font-size: var(--fs-body-sm);
  color: var(--text-secondary);
  max-width: 100%;
}
.kg-file-input::file-selector-button {
  font: inherit;
  margin-right: 10px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-subtle);
  color: var(--text-primary);
  cursor: pointer;
}
.kg-file-input::file-selector-button:hover { border-color: var(--border-strong); }
.kg-comply-msg {
  margin-top: 14px;
  font-size: var(--fs-body-sm);
  padding: 10px 12px;
  border-radius: var(--radius-md);
}
.kg-comply-msg.is-ok { background: var(--success-bg); color: var(--success-text); }
.kg-comply-msg.is-err { background: var(--danger-bg); color: var(--danger-text); }

/* ── Rendered markdown guide (check detail) ────────────────────── */
.kg-prose { line-height: 1.7; font-size: var(--fs-body-md); color: var(--text-primary); }
.kg-prose > :first-child { margin-top: 0; }
.kg-prose > :last-child { margin-bottom: 0; }
.kg-prose h1, .kg-prose h2, .kg-prose h3, .kg-prose h4 {
  font-family: var(--font-display, inherit);
  font-weight: var(--fw-semibold);
  line-height: 1.3;
  margin: 22px 0 10px;
}
.kg-prose h1 { font-size: var(--fs-h3); }
.kg-prose h2 { font-size: var(--fs-h4, 1.15rem); }
.kg-prose h3 { font-size: var(--fs-body-lg, 1.05rem); }
.kg-prose p { margin: 0 0 14px; }
.kg-prose ul, .kg-prose ol { margin: 0 0 14px; padding-left: 22px; }
.kg-prose li { margin-bottom: 6px; }
.kg-prose strong { font-weight: var(--fw-semibold); }
.kg-prose code {
  font-family: var(--font-mono);
  font-size: .9em;
  background: var(--bg-subtle);
  padding: 1px 5px;
  border-radius: var(--radius-sm, 4px);
}
.kg-prose pre {
  background: var(--bg-subtle);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 0 0 14px;
}
.kg-prose pre code { background: none; padding: 0; }
.kg-prose blockquote {
  margin: 0 0 14px;
  padding: 4px 14px;
  border-left: 3px solid var(--brand-600);
  color: var(--text-secondary);
}
.kg-prose table { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: var(--fs-body-sm); }
.kg-prose th, .kg-prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border-subtle); }
.kg-prose a { color: var(--brand-600); }

/* ════════════════════════════════════════════════════════════════════
   Responsive — phone / small-tablet coverage
   Mobile is a secondary device; goal is "reasonably well displayed".
   At ≤860px the console sidebar turns into an off-canvas hamburger drawer
   (see the rule near the top of this file); the rules below tighten the
   topbar, page padding, landing sections and prose tables for phones.
   ════════════════════════════════════════════════════════════════════ */

/* ── Console: tighten the topbar so it fits next to the icon rail ───── */
@media (max-width: 700px) {
  .console-topbar { padding: 0 12px; gap: 8px; }
  .company-switcher { margin-right: 8px; }
  .company-switcher-name { max-width: 130px; }
  /* nq-page is a flex child of .console-main. Its `margin: 0 auto` makes
     the auto cross-axis margins disable flex stretch, so it would size to
     its content and overflow the rail. A definite width:100% + min-width:0
     pins it to the container width; wide children (tables) scroll instead. */
  .nq-page { padding: 24px 16px; width: 100%; min-width: 0; }
}

@media (max-width: 540px) {
  /* The user identity is shown in the menu/account flows — drop the pill
     from the topbar, and collapse the logout button to its icon, so the
     company switcher always fits beside the icon rail. */
  .nq-user-pill { display: none; }
  .nq-btn-label { display: none; }
  .nq-nav-end { gap: 4px; }
  .company-switcher { margin-right: 4px; }
  .company-switcher-name { max-width: 90px; }
  .nq-page { padding: 20px 12px; }
  .nq-card { padding: 16px; }
  .detail-header { padding: 20px; }
  .detail-header-title { font-size: var(--fs-heading-lg); }
  /* The card footer is a no-wrap flex row; on phones let it wrap so the
     card can shrink to the viewport instead of forcing horizontal scroll. */
  .std-card-footer { flex-wrap: wrap; row-gap: 6px; }
  /* Section headers carry an action button (e.g. "Agregar documento") that
     would overflow a phone — let the header wrap. */
  .req-section-title { flex-wrap: wrap; row-gap: 8px; }
}

/* detail stats + onboarding can be wider than a phone — let them wrap */
.detail-stats { flex-wrap: wrap; }
.onboard-steps { flex-wrap: wrap; row-gap: 12px; }

/* ── Landing: collapse cards to one column, trim section padding ─────── */
@media (max-width: 640px) {
  .land-nav { padding: 0 16px; }
  .land-hero { padding: 56px 0 48px; }
  .land-features,
  .land-how,
  .land-contact { padding: 56px 0; }
  .land-features-grid,
  .standards-grid { grid-template-columns: 1fr; }
  .land-container { padding: 0 16px; }
}

/* ── Rendered markdown tables (check detail): scroll instead of clip ── */
@media (max-width: 640px) {
  .kg-prose table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
}

/* ── Operational conditions (condiciones operativas) ──────────────────── */
/* Shared status pill (also defined inline on the check detail page — kept
   here so the conditions pages and any future page get it from the sheet). */
.kg-status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 12px; border-radius: var(--radius-full);
  font-size: var(--fs-caption); font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-label); text-transform: uppercase;
}
.kg-status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

/* ── Data method: calculated (ratio) vs captured (measured) ─────────────
   Calculada → brand cyan (auto-derived). Capturada → warning amber (manual
   entry). Tokens only — adapts to light/dark; see tokens.css. */
.kg-method-legend {
  display: flex; align-items: center; gap: var(--space-5);
  flex-wrap: wrap; margin-bottom: var(--space-6);
}
.kg-method-legend-label {
  font-size: var(--fs-label); font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-label); text-transform: uppercase;
  color: var(--text-tertiary);
}
.kg-method-legend-item {
  display: inline-flex; align-items: center; gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle); background: var(--bg-secondary);
}
.kg-method-legend-text { display: flex; flex-direction: column; line-height: 1.3; }
.kg-method-legend-text strong { font-size: var(--fs-body-sm); font-weight: var(--fw-semibold); color: var(--text-primary); }
.kg-method-legend-text span { font-size: var(--fs-caption); color: var(--text-tertiary); }

/* Square method glyph used in the legend */
.kg-method-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: var(--radius-md);
  font-size: 15px; flex: none;
}
.kg-method-icon.is-calc { background: var(--brand-tint); color: var(--brand-on-tint); }
.kg-method-icon.is-measured { background: var(--warning-bg); color: var(--warning-text); }

/* Method pill in the table */
.kg-method-pill {
  display: inline-flex; align-items: center; gap: var(--space-3);
  padding: 4px 11px; border-radius: var(--radius-full);
  font-size: var(--fs-caption); font-weight: var(--fw-semibold);
  white-space: nowrap; border: 1px solid transparent;
}
.kg-method-pill i { font-size: 14px; }
.kg-method-pill.is-calc { background: var(--brand-tint); color: var(--brand-on-tint); border-color: var(--brand-200); }
.kg-method-pill.is-measured { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning-border); }

.kg-method-hint {
  margin-top: var(--space-3); font-size: var(--fs-caption);
  color: var(--text-tertiary); max-width: 190px; line-height: 1.45;
}
.kg-method-formula {
  display: inline-block; margin-top: var(--space-3);
  font-family: var(--font-mono); font-size: var(--fs-label);
  color: var(--brand-on-tint); background: var(--brand-tint);
  border: 1px solid var(--brand-200); padding: 2px 8px;
  border-radius: var(--radius-md);
}
.kg-agg-icon { font-size: 13px; color: var(--text-tertiary); margin-right: 3px; vertical-align: -1px; }

/* Colour-coded left edge so the two methods read apart at a glance. */
.tbl tbody tr.kg-row-calc td:first-child { box-shadow: inset 3px 0 0 var(--brand-400); }
.tbl tbody tr.kg-row-measured td:first-child { box-shadow: inset 3px 0 0 var(--warning-solid); }

.kg-history > summary::-webkit-details-marker { display: none; }
.kg-history > summary { display: flex; align-items: center; gap: 6px; }
.kg-history[open] .kg-history-caret { transform: rotate(180deg); }
.kg-history-caret { transition: transform var(--dur-fast, .15s) ease; }

/* Coverage grid: one column per month, value bar + (optional) evidence bar. */
.kg-coverage-grid th.cov-month {
  font-size: var(--fs-caption); color: var(--text-tertiary);
  text-align: center; white-space: nowrap; padding: 8px 4px;
}
.kg-coverage-grid td.cov-cell-wrap { padding: 8px 3px; vertical-align: middle; }
.cov-cell {
  height: 14px; border-radius: 3px; min-width: 26px;
  background: var(--bg-tertiary); border: 1px solid var(--border-subtle);
}
.cov-cell + .cov-cell { margin-top: 3px; }
.cov-cell.is-covered { background: var(--success-bg); border-color: var(--success-border); }
.cov-cell.is-partial { background: var(--warning-bg); border-color: var(--warning-border); }
.cov-cell.is-gap { background: var(--danger-bg); border-color: var(--danger-border); }
.cov-cell-evidence { height: 6px; opacity: .85; }

/* ── Verdict objetivo line (requirement & check detail) ────────────────────
   The numeric "Objetivo ≤ X" row inside the verdict panel; shown only when the
   requirement carries a target_value. Tokens only — see tokens.css. */
.req-verdict-target {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-caption); color: var(--text-secondary);
}
.req-verdict-target i { font-size: 13px; color: var(--text-tertiary); }
.req-verdict-target .mono { font-family: var(--font-mono); color: var(--text-primary); }

/* `.detail-stats` carries a top divider; this modifier drops it when the stats
   are the first thing in their container (e.g. a card with no preceding text). */
.detail-stats--flush { border-top: 0; padding-top: 0; margin-top: 0; }

/* ── Impact explorer (reusable: range + time-series plot + dimension filter) ── */
.impact-explorer { padding: 18px 20px; }
.impact-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.impact-title { display: block; font-weight: var(--fw-semibold); font-size: var(--fs-body); }
.impact-title .ti { color: var(--brand-600); margin-right: 6px; }
.impact-sub { display: block; font-size: var(--fs-caption); color: var(--text-tertiary); margin-top: 2px; }
.impact-total { text-align: right; }
.impact-total-num { display: block; font-weight: var(--fw-bold); font-size: var(--fs-h3); font-variant-numeric: tabular-nums; }
.impact-total-cap { font-size: var(--fs-caption); color: var(--text-tertiary); }
.impact-toolbar { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-end; margin: 14px 0 4px; }
.impact-range { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.impact-field { display: flex; flex-direction: column; gap: 3px; font-size: var(--fs-caption); color: var(--text-secondary); }
.impact-field .input, .impact-field .select { min-width: 130px; }
.impact-gran { margin-left: auto; }
.impact-chart-wrap { position: relative; height: 300px; margin: 12px 0 6px; }
.impact-filters { display: flex; gap: 20px; flex-wrap: wrap; border-top: 1px solid var(--border-subtle); padding-top: 12px; margin-top: 8px; }
.impact-filter-group { display: flex; flex-direction: column; gap: 6px; }
.impact-filter-title { font-size: var(--fs-caption); font-weight: var(--fw-semibold); color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .04em; }
.impact-chip { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-body-sm); cursor: pointer; }
.impact-chip input { accent-color: var(--brand-600); }

/* Impact explorer: multi-select filter dropdowns (componentes / inmuebles). */
.impact-msel { position: relative; }
.impact-msel-toggle {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 7px 12px; border-radius: var(--radius-md);
  background: var(--bg-primary); border: 1px solid var(--border-default);
  font-family: inherit; font-size: var(--fs-body-sm); color: var(--text-primary);
}
.impact-msel-toggle:hover { border-color: var(--brand-600); }
.impact-msel-label { font-weight: var(--fw-medium); }
.impact-msel-count {
  font-size: var(--fs-caption); color: var(--text-tertiary);
  padding: 1px 7px; border-radius: var(--radius-full); background: var(--bg-secondary);
}
.impact-msel-toggle .ti { font-size: 15px; color: var(--text-tertiary); transition: transform var(--dur-fast, .15s) ease; }
.impact-msel.is-open .impact-msel-toggle .ti { transform: rotate(180deg); }
.impact-msel-panel[hidden] { display: none; }
.impact-msel-panel {
  position: absolute; z-index: 40; top: calc(100% + 4px); left: 0;
  min-width: 220px; max-width: 340px; max-height: 280px; overflow-y: auto;
  background: var(--bg-primary); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); box-shadow: 0 10px 28px -14px rgba(0, 0, 0, .35); padding: 6px;
}
.impact-msel-opt, .impact-msel-all {
  display: flex; align-items: center; gap: 8px; padding: 7px 9px;
  border-radius: var(--radius-sm); cursor: pointer; font-size: var(--fs-body-sm); color: var(--text-primary);
}
.impact-msel-opt:hover, .impact-msel-all:hover { background: var(--bg-secondary); }
.impact-msel-all { border-bottom: 1px solid var(--border-subtle); margin-bottom: 4px; font-weight: var(--fw-medium); }
.impact-msel input { accent-color: var(--brand-600); flex: none; }

/* Impact explorer: split-by-component toggle + download (PNG/CSV) popover. */
.impact-split {
  display: inline-flex; align-items: center; gap: 7px; align-self: flex-end;
  padding-bottom: 8px; cursor: pointer; font-size: var(--fs-body-sm); color: var(--text-secondary);
}
.impact-split input { accent-color: var(--brand-600); }
.impact-dl { position: relative; align-self: flex-end; }
.impact-dl-menu { left: auto; right: 0; min-width: 180px; }
.impact-dl-opt {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 8px 9px; border: none; background: none; cursor: pointer;
  border-radius: var(--radius-sm); font-family: inherit; font-size: var(--fs-body-sm); color: var(--text-primary);
}
.impact-dl-opt:hover { background: var(--bg-secondary); }
.impact-dl-opt .ti { font-size: 15px; color: var(--text-tertiary); }

/* Breakdown tables: icon-only export button (downloads selected rows, or all). */
.kg-export-actions { margin-left: auto; align-self: flex-end; display: inline-flex; gap: 8px; }
.kg-icon-btn { padding: 3px 6px; line-height: 1; }
.kg-icon-btn .ti { font-size: 14px; }
.impact-dl-toggle { gap: 2px; padding: 5px 8px; }
.impact-dl-toggle .ti { font-size: 14px; }
.tbl td .kg-row-select, .tbl th input[type="checkbox"] { accent-color: var(--brand-600); cursor: pointer; }

/* Sortable table headers (breakdown tables): click a header to sort, toggling asc/desc. */
.tbl-sortable th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.tbl-sortable th.sortable:hover { color: var(--text-primary); }
.tbl-sortable th.is-sorted { color: var(--text-primary); }
.tbl-sortable th .sort-ind { font-size: 10px; color: var(--brand-600); margin-left: 3px; }

/* ── Operational-conditions list: filter toolbar (método toggles, search, attention) ── */
.kg-cond-toolbar {
  display: flex;
  align-items: center;
  gap: 10px 18px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.kg-filter-group { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kg-filter-label {
  font-size: var(--fs-caption); font-weight: var(--fw-semibold); color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: .04em;
}
.kg-filter-toggle, .kg-filter-chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 6px 12px; border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle); background: var(--bg-primary);
  color: var(--text-secondary); font-size: var(--fs-body-sm); font-weight: var(--fw-medium);
  transition: background var(--dur-fast, 120ms) var(--ease-out), border-color var(--dur-fast, 120ms) var(--ease-out), color var(--dur-fast, 120ms) var(--ease-out);
}
.kg-filter-toggle:hover, .kg-filter-chip:hover { border-color: var(--brand-400); }
.kg-filter-toggle.is-active {
  background: var(--brand-tint, color-mix(in oklab, var(--brand-600) 12%, transparent));
  border-color: var(--brand-400); color: var(--brand-on-tint, var(--brand-800));
}
.kg-filter-toggle:not(.is-active) { opacity: .72; }
.kg-filter-toggle .kg-method-icon { width: 18px; height: 18px; font-size: 11px; }
.kg-filter-chip.is-active {
  background: color-mix(in oklab, var(--danger, #e5484d) 12%, transparent);
  border-color: color-mix(in oklab, var(--danger, #e5484d) 45%, transparent);
  color: var(--danger, #c62828);
}
.kg-filter-search {
  display: inline-flex; align-items: center; gap: 6px; flex: 1 1 200px; max-width: 320px;
  padding: 6px 12px; border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle); background: var(--bg-primary); color: var(--text-tertiary);
}
.kg-filter-search:focus-within { border-color: var(--brand-400); }
.kg-filter-search input {
  flex: 1; min-width: 0; border: 0; background: none; outline: none;
  font-size: var(--fs-body-sm); color: var(--text-primary);
}
.kg-cond-row[hidden] { display: none; }
.kg-cond-nomatch { margin: 16px 4px; font-size: var(--fs-body-sm); color: var(--text-secondary); }
