/* ============================================================
 *  RankSphere AI — Design system v2
 *  Tokens, Tabler variable overrides, components and utilities.
 * ============================================================ */

/* ---- Fonts ---- */
@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('../vendor/fonts/plus-jakarta-sans-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('../vendor/fonts/plus-jakarta-sans-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('../vendor/fonts/plus-jakarta-sans-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('../vendor/fonts/plus-jakarta-sans-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('../vendor/fonts/plus-jakarta-sans-800.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../vendor/fonts/jetbrains-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../vendor/fonts/jetbrains-mono-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../vendor/fonts/jetbrains-mono-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  /* RankSphere tokens */
  --rs-brand: #137841;
  --rs-brand-rgb: 19, 120, 65;
  --rs-brand-deep: #0B5A30;
  --rs-brand-soft: #E3F1E8;
  --rs-ink: #0E1A14;
  --rs-ink-2: #44524A;
  --rs-ink-3: #66736B;
  --rs-ground: #F4F6F3;
  --rs-surface: #FFFFFF;
  --rs-line: #E1E7E2;
  --rs-row-line: #EEF2EF;
  --rs-warn: #F2A93B;
  --rs-warn-soft: #FFF1D9;
  --rs-warn-text: #7A4300;
  --rs-error: #B42318;
  --rs-error-soft: #FDECEA;
  --rs-error-text: #8F1B12;
  --rs-info: #1F44B8;
  --rs-info-soft: #E6EDFF;
  --rs-info-text: #1F44B8;
  --rs-accent-on-dark: #5FD08F;
  --rs-sidebar-bg: #0F1A14;
  --rs-sidebar-text: #B9C6BE;
  --rs-sidebar-group: #7C8C83;
  --rs-radius: 14px;
  --rs-radius-sm: 10px;
  --rs-radius-chip: 999px;

  /* Tabler overrides */
  --tblr-body-font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --tblr-font-monospace: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --tblr-primary: var(--rs-brand);
  --tblr-primary-rgb: var(--rs-brand-rgb);
  --tblr-body-color: var(--rs-ink);
  --tblr-body-bg: var(--rs-ground);
  --tblr-border-color: var(--rs-line);
  --tblr-border-radius: var(--rs-radius);
  --tblr-secondary: var(--rs-ink-3);
  --tblr-success: var(--rs-brand);
  --tblr-warning: var(--rs-warn);
  --tblr-danger: var(--rs-error);
  --tblr-info: var(--rs-info);
  --tblr-link-color: var(--rs-brand-deep);
  --tblr-link-hover-color: var(--rs-brand);
}

[data-bs-theme="dark"] {
  --rs-ink: #E8EEEA;
  --rs-ink-2: #B3C1B8;
  --rs-ink-3: #8A9A90;
  --rs-ground: #0B120E;
  --rs-surface: #121C16;
  --rs-line: #22322A;
  --rs-row-line: #1A2721;
  --rs-brand-soft: #1A3324;
  --rs-warn-soft: #3B2A0E;
  --rs-error-soft: #3B1815;
  --rs-info-soft: #17254D;
  --tblr-body-bg: var(--rs-ground);
  --tblr-body-color: var(--rs-ink);
  --tblr-border-color: var(--rs-line);
  --tblr-bg-surface: var(--rs-surface);
  --tblr-bg-surface-secondary: #15241B;
  --tblr-secondary: var(--rs-ink-3);
}

* { box-sizing: border-box; }

html, body {
  font-family: var(--tblr-body-font-family);
  font-size: 14px;
  color: var(--rs-ink);
  background: var(--rs-ground);
  max-width: 100%;
  overflow-x: clip;
}

a { color: var(--rs-brand-deep); text-decoration: none; }
a:hover { color: var(--rs-brand); text-decoration: none; }

.mono, .font-monospace { font-family: var(--tblr-font-monospace); }

/* ---- Layout ---- */
.container-xl {
  --tblr-container-max-xl: 1200px;
}
@media (min-width: 1400px) {
  .container-xl { max-width: 1320px; }
}
@media (min-width: 1600px) {
  .container-xl { max-width: 1480px; }
}
@media (min-width: 1920px) {
  .container-xl { max-width: 1640px; }
}

.navbar-vertical {
  width: 260px;
  background: var(--rs-sidebar-bg);
  padding: 18px 12px 28px;
}
.navbar-brand {
  gap: 10px;
  padding: 4px 8px 18px;
  margin: 0;
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  letter-spacing: -0.02em;
}
.navbar-brand:hover { color: #fff; }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--rs-brand);
  display: grid;
  place-items: center;
  color: #fff;
  flex: 0 0 auto;
}
.brand-mark svg, .brand-mark .ti { width: 18px; height: 18px; }

.nav-section {
  padding: 18px 12px 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rs-sidebar-group);
  font-weight: 600;
}

.navbar-vertical .navbar-nav { width: 100%; }
.navbar-vertical .nav-link {
  min-height: 36px;
  border-radius: 8px;
  margin: 2px 0;
  padding: 8px 12px;
  color: var(--rs-sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}
.navbar-vertical .nav-link:hover { background: #1A2A21; color: #fff; }
.navbar-vertical .nav-link.active,
.navbar-vertical .nav-link[aria-current="page"] {
  background: var(--rs-brand);
  color: #fff;
}
.navbar-vertical .nav-link .nav-link-icon {
  width: 1.25rem;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-count {
  margin-left: auto;
  background: var(--rs-warn);
  color: var(--rs-warn-text);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  line-height: 1;
}
.navbar-vertical .nav-link.active .nav-count { background: #fff; color: var(--rs-sidebar-bg); }

/* Site switcher in top nav */
.site-switcher { min-width: 0; max-width: 420px; }
.site-switcher .dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #24362B;
  background: #15241B;
  color: #fff;
  font: 600 13px var(--tblr-body-font-family);
  text-align: left;
  cursor: pointer;
}
.site-switcher .site-copy { min-width: 0; }
.site-switcher .site-name,
.site-switcher .site-url { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-switcher .site-url { font-size: 11.5px; color: #8FA197; font-weight: 500; }
.client-site-menu {
  width: min(440px, calc(100vw - 24px));
  max-height: min(72vh, 680px);
  overflow-y: auto;
  border-radius: var(--rs-radius);
  border: 1px solid var(--rs-line);
  box-shadow: 0 12px 40px rgba(0,0,0,.12);
}
.client-site-group + .client-site-group { border-top: 1px solid var(--rs-line); }
.client-industry { max-width: 220px; }
.site-switch-item { display: flex; align-items: center; min-height: 52px; }
.switcher-footer { position: sticky; bottom: 0; background: var(--rs-surface); padding: 0.25rem 0; }

.page-wrapper { min-height: 100vh; }
.page-body > .container-xl { padding-top: 28px; padding-bottom: 64px; }

/* ---- Cards ---- */
.card {
  background: var(--rs-surface);
  border: 1px solid var(--rs-line);
  border-radius: var(--rs-radius);
  box-shadow: none;
}
[data-bs-theme="dark"] .card { background: var(--rs-surface); }

.card-header,
.rs-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--rs-row-line);
  background: transparent;
}
.card-header h2, .rs-card-head h2, .rs-section-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--rs-ink);
}
.card-header p, .rs-card-head p, .rs-section-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--rs-ink-2);
}

/* ---- Eyebrow / labels ---- */
.rs-eyebrow {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rs-ink-3);
}
.rs-caption {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--rs-ink-3);
}

/* ---- Page head ---- */
.rs-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.rs-page-head__title {
  margin: 6px 0 6px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--rs-ink);
}
.rs-page-head__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--rs-ink-2);
}
.rs-page-head__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* ---- Buttons ---- */
.rs-btn,
.rs-btn:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--rs-radius-sm);
  border: 1px solid #D3DBD5;
  background: var(--rs-surface);
  color: var(--rs-ink);
  font: 600 13.5px var(--tblr-body-font-family);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.rs-btn:hover { background: var(--rs-ground); border-color: var(--rs-line); color: var(--rs-ink); }
.rs-btn--primary,
.rs-btn--primary:visited {
  background: var(--rs-brand);
  border-color: var(--rs-brand);
  color: #fff;
}
.rs-btn--primary:hover { background: var(--rs-brand-deep); border-color: var(--rs-brand-deep); color: #fff; }
.rs-btn--dark,
.rs-btn--dark:visited {
  background: var(--rs-sidebar-bg);
  border-color: var(--rs-sidebar-bg);
  color: #fff;
}
.rs-btn--dark:hover { background: #1A2A21; border-color: #1A2A21; color: #fff; }
.rs-btn--ghost,
.rs-btn--ghost:visited {
  background: transparent;
  border-color: transparent;
  color: var(--rs-ink-2);
}
.rs-btn--ghost:hover { background: var(--rs-row-line); color: var(--rs-ink); }
.rs-btn--danger,
.rs-btn--danger:visited { color: var(--rs-error); border-color: var(--rs-error-soft); background: var(--rs-error-soft); }
.rs-btn--danger:hover { background: var(--rs-error); border-color: var(--rs-error); color: #fff; }
.rs-btn--sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.rs-btn:disabled, .rs-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---- Chips ---- */
.rs-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--rs-radius-chip);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
}
.rs-chip--pass { background: var(--rs-brand-soft); color: var(--rs-brand-deep); }
.rs-chip--warn { background: var(--rs-warn-soft); color: var(--rs-warn-text); }
.rs-chip--error { background: var(--rs-error-soft); color: var(--rs-error-text); }
.rs-chip--info { background: var(--rs-info-soft); color: var(--rs-info-text); }
.rs-chip--neutral { background: var(--rs-row-line); color: var(--rs-ink-2); }
.rs-chip--up { background: var(--rs-brand-soft); color: var(--rs-brand-deep); }
.rs-chip--down { background: var(--rs-error-soft); color: var(--rs-error-text); }
.rs-chip--dot::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* ---- KPI ---- */
.rs-kpi-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.rs-kpi {
  background: var(--rs-surface);
  border: 1px solid var(--rs-line);
  border-radius: var(--rs-radius);
  padding: 16px 18px;
}
.rs-kpi__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.rs-kpi__label {
  font-size: 12.5px;
  color: var(--rs-ink-3);
  font-weight: 600;
}
.rs-kpi__value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-top: 8px;
  line-height: 1;
  color: var(--rs-ink);
}
.rs-kpi__value small {
  font-size: 15px;
  color: var(--rs-ink-3);
  font-weight: 600;
  letter-spacing: 0;
}
.rs-kpi__bar {
  height: 6px;
  border-radius: 6px;
  background: var(--rs-row-line);
  margin-top: 12px;
  overflow: hidden;
}
.rs-kpi__bar > span {
  display: block;
  height: 6px;
  border-radius: 6px;
  background: var(--rs-brand);
}
.rs-kpi__segments {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 3px;
  margin-top: 12px;
}
.rs-kpi__segments > i {
  height: 6px;
  border-radius: 2px;
  display: block;
  background: var(--rs-row-line);
}
.rs-kpi__segments > i.pass { background: var(--rs-brand); }
.rs-kpi__segments > i.warn { background: var(--rs-warn); }
.rs-kpi__sparkline {
  margin-top: 8px;
  display: block;
  width: 100%;
  height: 44px;
}
.rs-kpi__delta { margin-top: 8px; }

/* ---- Score hero ---- */
.rs-score-hero {
  display: flex;
  flex-wrap: wrap;
  overflow: hidden;
}
.rs-score-hero__left {
  flex: 0 1 380px;
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 24px 28px;
  border-right: 1px solid var(--rs-row-line);
  min-width: 0;
}
.rs-score-hero__right {
  flex: 1 1 0;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.rs-score-hero__kpi {
  padding: 22px 24px;
  border-right: 1px solid var(--rs-row-line);
  min-width: 0;
}
.rs-score-hero__kpi:last-child { border-right: 0; }
.rs-score-hero__kpi-value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-top: 8px;
  line-height: 1;
}
.rs-score-hero__kpi-value small {
  font-size: 15px;
  color: var(--rs-ink-3);
  font-weight: 600;
}
@media (max-width: 1199.98px) {
  .rs-score-hero__left { flex: 1 1 100%; border-right: 0; border-bottom: 1px solid var(--rs-row-line); }
  .rs-score-hero__right { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rs-score-hero__kpi:nth-child(2n) { border-right: 0; }
  .rs-score-hero__kpi:nth-child(1),
  .rs-score-hero__kpi:nth-child(2) { border-bottom: 1px solid var(--rs-row-line); }
}
@media (max-width: 575.98px) {
  .rs-score-hero__right { grid-template-columns: 1fr; }
  .rs-score-hero__kpi { border-right: 0; border-bottom: 1px solid var(--rs-row-line); }
  .rs-score-hero__kpi:last-child { border-bottom: 0; }
}

/* ---- Score ring ---- */
.rs-score-ring {
  position: relative;
  width: 132px;
  height: 132px;
  flex: 0 0 auto;
}
.rs-score-ring svg { transform: rotate(-90deg); }
.rs-score-ring__track { fill: none; stroke: var(--rs-row-line); stroke-width: 12; }
.rs-score-ring__fill {
  fill: none;
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dasharray 0.5s ease;
}
.rs-score-ring__value {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.rs-score-ring__score {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--rs-ink);
}
.rs-score-ring__label {
  font-size: 11.5px;
  color: var(--rs-ink-3);
  font-weight: 600;
  margin-top: 4px;
}

/* ---- Insight banner ---- */
.rs-insight {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  padding: 16px 20px;
  border-radius: var(--rs-radius);
  background: var(--rs-sidebar-bg);
  color: #fff;
  margin-bottom: 16px;
}
.rs-insight__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--rs-radius-sm);
  background: #1F3328;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--rs-accent-on-dark);
}
.rs-insight__body {
  flex: 1 1 420px;
  min-width: 0;
}
.rs-insight__eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--rs-accent-on-dark);
}
.rs-insight__text {
  font-size: 15px;
  line-height: 1.5;
  margin-top: 4px;
}
.rs-insight__action {
  background: var(--rs-accent-on-dark);
  border-color: var(--rs-accent-on-dark);
  color: var(--rs-sidebar-bg);
}
.rs-insight__action:hover {
  background: #4cb87a;
  border-color: #4cb87a;
  color: var(--rs-sidebar-bg);
}

/* ---- Ranked queue item ---- */
.rs-queue {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.rs-queue-item {
  border-top: 1px solid var(--rs-row-line);
}
.rs-queue-item__summary {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px 22px;
  cursor: pointer;
  list-style: none;
}
.rs-queue-item__summary::-webkit-details-marker { display: none; }
.rs-queue-item__number {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--rs-row-line);
  color: var(--rs-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  font-family: var(--tblr-font-monospace);
}
.rs-queue-item[open] .rs-queue-item__number,
.rs-queue-item__summary:hover .rs-queue-item__number { background: var(--rs-sidebar-bg); color: #fff; }
.rs-queue-item__title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.rs-queue-item__title-row b { font-size: 15px; }
.rs-queue-item__meta {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
}
.rs-queue-item__scope {
  flex: 0 1 220px;
  min-width: 120px;
  height: 6px;
  border-radius: 6px;
  background: var(--rs-row-line);
  overflow: hidden;
}
.rs-queue-item__scope > span {
  display: block;
  height: 6px;
  border-radius: 6px;
  background: var(--rs-warn);
}
.rs-queue-item__scope-text {
  font-size: 12.5px;
  color: var(--rs-ink-2);
  white-space: nowrap;
}
.rs-queue-item__chevron { color: var(--rs-ink-3); transition: transform 0.2s ease; }
.rs-queue-item[open] .rs-queue-item__chevron { transform: rotate(180deg); }
.rs-queue-item__body {
  padding: 0 22px 20px 68px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.rs-queue-item__panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.rs-queue-item__panel {
  padding: 14px;
  border-radius: var(--rs-radius-sm);
  background: var(--rs-ground);
}
.rs-queue-item__panel-title {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--rs-ink-3);
}
.rs-queue-item__panel p {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--rs-ink-2);
}
.rs-queue-item__urls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rs-pathrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--rs-ground);
  font-family: var(--tblr-font-monospace);
  font-size: 12.5px;
  color: var(--rs-ink);
}
.rs-pathrow a { font-family: var(--tblr-body-font-family); font-size: 12px; font-weight: 600; }
.rs-queue-item__actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---- Tabs ---- */
.rs-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--rs-row-line);
  border-radius: var(--rs-radius-sm);
}
.rs-tab {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--rs-ink-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.rs-tab[aria-selected="true"] {
  background: var(--rs-surface);
  color: var(--rs-ink);
  box-shadow: 0 1px 2px rgba(14,26,20,.12);
}

/* ---- Heatmap ---- */
.rs-heatmap {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(8, minmax(64px, 1fr)) 72px;
  align-items: center;
  min-width: 900px;
}
.rs-heatmap-wrap { overflow-x: auto; }
.rs-heatmap > div {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--rs-row-line);
}
.rs-heatmap__head {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--rs-ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.rs-heatmap > .rs-heatmap__url {
  justify-content: flex-start;
  padding-left: 20px;
  font-family: var(--tblr-font-monospace);
  font-size: 12.5px;
  color: var(--rs-ink);
}
.rs-heatmap__cell {
  width: 36px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}
.rs-heatmap__cell--ok { background: var(--rs-brand-soft); color: var(--rs-brand-deep); }
.rs-heatmap__cell--warn { background: var(--rs-warn-soft); color: var(--rs-warn-text); }
.rs-heatmap__cell--error { background: var(--rs-error-soft); color: var(--rs-error-text); }
.rs-heatmap__cell--na { background: var(--rs-row-line); color: var(--rs-ink-3); }
.rs-heatmap__row--clustered { background: rgba(242, 169, 59, 0.06); }

/* ---- Tables ---- */
.rs-table-wrap { overflow-x: auto; }
.rs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.rs-table th {
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rs-ink-3);
  font-weight: 700;
  padding: 10px 16px;
  background: #F8FAF8;
  border-bottom: 1px solid var(--rs-row-line);
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
[data-bs-theme="dark"] .rs-table th { background: #15241B; }
.rs-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--rs-row-line);
  vertical-align: middle;
}
.rs-table tbody tr:hover { background: rgba(19,120,65,0.03); }
.rs-table tbody tr:last-child td { border-bottom: 0; }
.rs-table .mono { font-weight: 500; }
.rs-table .num { text-align: right; font-family: var(--tblr-font-monospace); }

/* ---- Empty state ---- */
.rs-empty {
  padding: 32px;
  text-align: center;
  border-style: dashed;
  border-radius: var(--rs-radius);
}
.rs-empty__title { font-weight: 700; font-size: 15px; }
.rs-empty p { margin: 6px 0 14px; font-size: 13px; color: var(--rs-ink-2); }

/* ---- Status cards ---- */
.rs-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.rs-status-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border-radius: var(--rs-radius);
  border: 1px solid var(--rs-line);
  background: var(--rs-surface);
}
.rs-status-card__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--rs-radius-sm);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--rs-brand-soft);
  color: var(--rs-brand-deep);
}

/* ---- Forms ---- */
.form-control, .form-select {
  border-color: var(--rs-line);
  border-radius: var(--rs-radius-sm);
  font-size: 14px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--rs-brand);
  box-shadow: 0 0 0 3px rgba(var(--rs-brand-rgb), 0.12);
}

/* ---- Alerts ---- */
.alert {
  border-radius: var(--rs-radius-sm);
  border-width: 1px;
}
.alert-ok { background: var(--rs-brand-soft); border-color: var(--rs-brand-soft); color: var(--rs-brand-deep); }
.alert-warning { background: var(--rs-warn-soft); border-color: var(--rs-warn-soft); color: var(--rs-warn-text); }
.alert-danger { background: var(--rs-error-soft); border-color: var(--rs-error-soft); color: var(--rs-error-text); }

/* ---- Proc / job progress toast ---- */
.proc {
  display: none;
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 1080;
  width: 340px;
  max-width: calc(100vw - 36px);
  background: var(--rs-surface);
  border: 1px solid var(--rs-line);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(14, 26, 20, .18);
}
.proc.show { display: block; }
.proc-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 700; font-size: 13.5px; }
.proc-eta { font-size: 12px; font-weight: 600; color: var(--rs-ink-3); }
.proc-bar { height: 6px; background: var(--rs-row-line); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.proc-bar i { display: block; height: 100%; width: 0; background: var(--rs-brand); border-radius: 99px; transition: width .3s ease; }
.proc-sub { font-size: 12.5px; color: var(--rs-ink-2); margin-top: 10px; }
.proc.done .proc-bar i { background: var(--rs-brand); }

/* ---- Focus/accessibility ---- */
a:focus-visible, button:focus-visible, .rs-btn:focus-visible, .rs-tab:focus-visible, .form-control:focus-visible {
  outline: 2px solid var(--rs-brand);
  outline-offset: 2px;
}

/* ---- Print ---- */
@media print {
  .navbar, .rs-page-head__actions, .offcanvas, .proc { display: none !important; }
  .page-wrapper { margin: 0 !important; }
  .card { break-inside: avoid; }
}

/* ---- Guide ---- */
.rs-guide-wrap {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.rs-guide-toc {
  position: sticky;
  top: 90px;
  background: var(--rs-surface);
  border: 1px solid var(--rs-line);
  border-radius: var(--rs-radius);
  padding: 12px;
  max-height: calc(100vh - 110px);
  overflow: auto;
}
.rs-guide-progress { margin-bottom: 12px; padding: 0 4px; }
.rs-guide-progress__bar {
  height: 6px;
  border-radius: 6px;
  background: var(--rs-row-line);
  overflow: hidden;
  margin-top: 6px;
}
.rs-guide-progress__bar > span {
  display: block;
  height: 6px;
  border-radius: 6px;
  background: var(--rs-brand);
  transition: width 0.3s ease;
}
.rs-guide-progress__text {
  font-size: 12px;
  color: var(--rs-ink-2);
  font-weight: 600;
}
.rs-guide-toc a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--rs-ink-2);
  text-decoration: none;
  font-weight: 600;
  line-height: 1.35;
}
.rs-guide-toc a:hover { background: var(--rs-ground); color: var(--rs-ink); }
.rs-guide-toc a.active { background: var(--rs-brand-soft); color: var(--rs-brand-deep); }
.rs-guide-toc .n {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--rs-row-line);
  color: var(--rs-ink-3);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-family: var(--tblr-font-monospace);
  flex: 0 0 auto;
}
.rs-guide-toc a.active .n { background: var(--rs-brand); color: #fff; }
.rs-guide-toc .done { margin-left: auto; color: var(--rs-brand); font-size: 13px; }
.rs-guide-sec { padding: 18px 22px; }
.rs-guide-sec__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.rs-guide-sec__badge {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--rs-brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--tblr-font-monospace);
  flex: 0 0 auto;
}
.rs-guide-sec h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.rs-guide-sec__lead {
  color: var(--rs-ink-2);
  font-size: 13px;
  margin: 0 0 16px;
}
.rs-guide-sec__label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--rs-ink-3);
  text-transform: uppercase;
  margin: 16px 0 6px;
}
.rs-guide-sec p,
.rs-guide-sec li { font-size: 13px; line-height: 1.7; color: var(--rs-ink); }
.rs-guide-sec ol,
.rs-guide-sec ul { margin: 8px 0 14px; padding-left: 22px; }
.rs-guide-sec li { margin-bottom: 6px; }
.rs-guide-sec code {
  background: var(--rs-ground);
  border: 1px solid var(--rs-line);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 12px;
  font-family: var(--tblr-font-monospace);
}
.rs-guide-shot {
  display: block;
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--rs-line);
  border-radius: var(--rs-radius-sm);
  margin: 14px 0;
}
.rs-guide-shot--mobile {
  display: inline-block;
  width: min(200px, 46%);
  margin: 0 8px 16px 0;
}
.rs-guide-tip {
  background: var(--rs-info-soft);
  border-left: 4px solid var(--rs-info);
  padding: 12px 14px;
  border-radius: 8px;
  margin: 14px 0;
}
.rs-guide-tip b { display: block; font-size: 13px; color: var(--rs-info); margin-bottom: 4px; }
.rs-guide-tip p { margin: 0; font-size: 12.5px; color: var(--rs-ink-2); }
.rs-guide-problem {
  background: var(--rs-warn-soft);
  border-left: 4px solid var(--rs-warn);
  padding: 12px 14px;
  border-radius: 8px;
  margin: 10px 0;
}
.rs-guide-problem b { display: block; font-size: 13px; color: var(--rs-warn-text); margin-bottom: 4px; }
.rs-guide-problem p { margin: 0; font-size: 12.5px; color: var(--rs-warn-text); }
.rs-guide-shot-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 180px;
  border: 2px dashed var(--rs-line);
  border-radius: var(--rs-radius-sm);
  color: var(--rs-ink-3);
  font-size: 12px;
  margin: 14px 0;
  background: var(--rs-ground);
}
.rs-guide-flow { padding: 16px; margin-bottom: 16px; overflow-x: auto; }
.rs-guide-flow .mermaid { display: flex; justify-content: center; background: var(--rs-surface); min-width: 700px; }
.rs-guide-flow .mermaid svg { width: 100% !important; min-width: 600px; max-width: 100% !important; height: auto; }
.rs-guide-tabs { display: flex; gap: 4px; padding: 4px; background: var(--rs-row-line); border-radius: var(--rs-radius-sm); }
.rs-guide-tab {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--rs-ink-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.rs-guide-tab[aria-selected="true"] {
  background: var(--rs-surface);
  color: var(--rs-ink);
  box-shadow: 0 1px 2px rgba(14,26,20,.12);
}
.rs-guide-changelog h3 { font-size: 15px; font-weight: 800; margin: 0 0 4px; }
.rs-guide-changelog time { font-size: 12px; color: var(--rs-ink-3); font-weight: 600; }
.rs-guide-changelog ul { font-size: 13px; color: var(--rs-ink-2); }
.guide-lightbox[hidden] { display: none; }
.guide-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(3,8,5,.94);
  display: flex;
  flex-direction: column;
  color: #fff;
}
.guide-lightbox-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(0,0,0,.55);
}
.guide-lightbox-title { font-weight: 700; flex: 1; }
.guide-lightbox-stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.guide-lightbox-image { display: block; max-width: 100%; max-height: calc(100vh - 100px); height: auto; cursor: zoom-in; }
.guide-lightbox button {
  min-width: 40px;
  min-height: 40px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 8px;
  background: #17251d;
  color: #fff;
}
.lightbox-open { overflow: hidden; }
@media (max-width: 991.98px) {
  .rs-guide-wrap { grid-template-columns: 1fr; }
  .rs-guide-toc { position: static; max-height: none; margin-bottom: 16px; }
}
@media print { .navbar, .rs-guide-toc, .guide-lightbox { display: none !important; } .rs-guide-wrap { grid-template-columns: 1fr; } }

/* ---- Responsive ---- */
@media (max-width: 1199.98px) {
  .rs-kpi-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 991.98px) {
  .navbar-vertical { width: 100%; }
  .page-body > .container-xl { padding-top: 1rem; }
  .rs-score-hero { flex-direction: column; }
}
@media (max-width: 767.98px) {
  .page-body > .container-xl { padding-inline: 0.75rem; }
  .rs-page-head { flex-direction: column; align-items: flex-start; }
  .rs-page-head__actions { width: 100%; }
  .rs-kpi-band { grid-template-columns: 1fr; }
  .rs-heatmap { display: block; overflow-x: auto; }
  .rs-heatmap > div { min-width: 64px; }
  .rs-table thead { display: none; }
  .rs-table tbody, .rs-table tr, .rs-table td { display: block; width: 100%; }
  .rs-table tr { padding: 1rem; border-bottom: 1px solid var(--rs-row-line); }
  .rs-table td { border: 0; padding: 0.25rem 0; }
  .rs-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--rs-ink-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 2px;
  }
  .rs-queue-item__summary { grid-template-columns: 32px minmax(0, 1fr); }
  .rs-queue-item__chevron { display: none; }
  .rs-queue-item__body { padding-left: 22px; }
}

/* ---- Legacy compatibility layer (remove as pages migrate) ---- */
.tool-grid, .metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--rs-row-line); }
.panel-head h2 { font-size: 1rem; margin: 0; }
.panel-head p { font-size: 12px; color: var(--rs-ink-3); margin: 0.25rem 0 0; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.pill.green { background: var(--rs-brand-soft); color: var(--rs-brand-deep); }
.pill.warn { background: var(--rs-warn-soft); color: var(--rs-warn-text); }
.pill.red { background: var(--rs-error-soft); color: var(--rs-error-text); }
.pill.blue { background: var(--rs-info-soft); color: var(--rs-info-text); }
