#dashboardScreen {
  display: none;
  flex-direction: column;
}

#dashboardScreen.active {
  display: flex;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 12px 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.shield-icon {
  width: 24px;
  height: 24px;
  background: var(--accent-light);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shield-icon svg {
  width: 13px;
  height: 13px;
  fill: var(--accent);
}

.shield-icon img {
  width: 15px;
  height: 15px;
  object-fit: contain;
}

.card-title {
  font-family: 'Rubik', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.card-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.time-tabs-row {
  padding: 10px 16px;
  display: flex;
}

/* ── Time Tabs ── */
.time-tabs {
  display: flex;
  gap: 2px;
}

.time-tab {
  padding: 4px 10px;
  border-radius: 5px;
  font-family: "Manrope", sans-serif;
  font-size: 11px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.time-tab.active {
  background: var(--accent);
  color: #fff;
}

.time-tab:not(.active):hover {
  background: var(--bg);
  color: var(--text-secondary);
}

/* ── Score Section ── */
.score-section {
  padding: 5px 18px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.score-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.score-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.grade-badge {
  font-family: 'Rubik', sans-serif;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2.5px solid var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  color: var(--green);
  flex-shrink: 0;
}

.score-number {
  font-family: 'Rubik', sans-serif;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1.5px;
  color: var(--green);
  line-height: 1;
}

.score-denom {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
}

.score-change {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--green);
  background: var(--green-bg);
  border-radius: 20px;
  padding: 2px 8px;
  margin-top: 4px;
  width: fit-content;
}

.score-right {
  display: flex;
  gap: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-line {
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.legend-dashed {
  width: 18px;
  height: 0;
  border-top: 2px dashed var(--chart-avg);
}

.chart-wrap {
  padding: 6px 18px 16px;
  position: relative;
  height: 200px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
}

.stat-cell {
  display: contents;
}

.stat-cell:not(:last-child)>.stat-label,
.stat-cell:not(:last-child)>.stat-value,
.stat-cell:not(:last-child)>.stat-sub {
  border-right: 1px solid var(--border);
}

.stat-label {
  grid-row: 1;
  padding: 14px 16px 0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-family: 'Rubik', sans-serif;
  grid-row: 2;
  padding: 0 16px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.stat-sub {
  grid-row: 3;
  padding: 0 16px 14px;
  font-size: 11px;
  color: var(--text-muted);
}

.green-val {
  color: var(--green);
}

.red-val {
  color: var(--red);
}

.blue-val {
  color: var(--accent);
}

.risk-cat-header {
  padding: 11px 16px 9px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.risk-counts {
  display: flex;
  gap: 8px;
}

.risk-count-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: none;
  letter-spacing: 0;
}

.badge-red {
  background: var(--red-bg);
  color: var(--red);
}

.badge-green {
  background: var(--green-bg);
  color: var(--green);
}

.badge-blue {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid #c7d2fe;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}

.cat-cell {
  padding: 14px 16px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.cat-cell:nth-child(2n) {
  border-right: none;
}

.cat-cell:nth-last-child(-n+2) {
  border-bottom: none;
}

.cat-cell:last-child {
  border-bottom: none;
}

.cat-cell-active {
  background: var(--accent-light) !important;
  border: 1.5px solid var(--accent) !important;
  border-radius: var(--radius);
}

.cat-click-hint {
  font-size: 9px;
  color: var(--accent);
  margin-left: 3px;
  opacity: 0.7;
}

.cat-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.cat-bar-wrap {
  height: 4px;
  background: var(--bg);
  border-radius: 3px;
  margin-bottom: 5px;
  overflow: hidden;
}

.cat-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--green);
  transition: width 0.4s;
}

.cat-bar.warn {
  background: var(--orange);
}

.cat-bar.danger {
  background: var(--red);
}

.cat-stats {
  display: flex;
  gap: 6px;
  font-size: 10px;
}

.cat-pass {
  color: var(--green);
  font-weight: 600;
}

.cat-fail {
  color: var(--red);
  font-weight: 600;
}

.top-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.ci-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.ci-row:last-child {
  border-bottom: none;
}

.ci-icon {
  font-size: 13px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.ci-label {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
}

.info-tip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 4px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}

.info-tip-btn:hover,
.info-tip-btn.active {
  color: var(--accent);
}

.info-tip-btn svg {
  width: 14px;
  height: 14px;
  display: block;
}

.info-tip-btn img {
  width: 16px;
  height: 16px;
  display: block;
}

.info-tip-bubble {
  display: none;
  position: fixed;
  width: 260px;
  max-width: calc(100vw - 32px);
  background: var(--text-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
  padding: 12px 14px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  text-align: left;
  z-index: 200;
}

.info-tip-bubble.show {
  display: block;
}

.info-tip-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 20px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--text-primary);
}

.ci-value {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 5px;
}

.policy-detail-value {
  color: var(--accent);
  font-weight: 600;
}

.ci-num-green {
  color: var(--green);
  font-weight: 600;
}

.ci-num-muted {
  color: var(--text-muted);
  font-weight: 500;
}

.ci-num-blue {
  color: var(--accent);
  font-weight: 600;
}

.risk-dist-body {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  padding: 16px;
}

.donut-wrap {
  position: relative;
  width: 150px;
  height: 150px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donut-wrap canvas {
  width: 150px !important;
  height: 150px !important;
}

.risk-legend {
  display: flex;
  flex-direction: column;
  align-items: left;
  gap: 8px;
}

.rl-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rl-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.rl-label {
  font-size: 11px;
  color: var(--text-secondary);
}

.rl-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
}

.policy-details-card {
  margin-bottom: 12px;
}

.policy-body {
  padding: 28px 16px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.policy-icon {
  font-size: 28px;
  margin-bottom: 4px;
}

.policy-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.policy-sub {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  max-width: 280px;
  line-height: 1.6;
}

.policy-rows {
  width: 100%;
}

.policy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.policy-row:last-child {
  border-bottom: none;
}

.policy-row-label {
  color: var(--text-secondary);
}

.policy-row-value {
  font-weight: 500;
  color: var(--text-primary);
}

.domain-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid #c7d2fe;
  border-radius: 20px;
  padding: 3px 12px;
  margin-left: 10px;
  vertical-align: middle;
  white-space: nowrap;
}

.risks-card {
  margin-top: 12px;
}

.risk-row {
  flex-direction: column !important;
  align-items: stretch !important;
  padding: 0 !important;
  border-bottom: 1px solid var(--border);
}

.risk-row:last-child {
  border-bottom: none;
}

.risk-main {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.1s;
}

.risk-main:hover {
  background: var(--bg);
}

.risk-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  margin-top: 1px;
}

.icon-fail {
  background: var(--red-bg);
}

.icon-pass {
  background: var(--green-bg);
}

/* Body column — takes remaining width */
.risk-body {
  flex: 1;
  min-width: 0;
}

.risk-header-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
}

.risk-title {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-word;
  line-height: 1.4;
}

.sev-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 1px;
}

.sev-4 {
  background: var(--critical-bg);
  color: var(--critical);
}

.sev-3 {
  background: var(--red-bg);
  color: var(--red);
}

.sev-2 {
  background: var(--orange-bg);
  color: var(--orange);
}

.sev-1 {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.sev-0 {
  background: #e0f2fe;
  color: #0369a1;
}

.risk-expand-icon {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}

.risk-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  word-break: break-word;
  line-height: 1.5;
}

.risk-hostnames {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.risk-hostname {
  font-size: 10px;
  background: var(--accent-light);
  color: var(--accent);
  padding: 1px 8px;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.risk-hostname-more {
  font-size: 10px;
  background: var(--bg);
  color: var(--text-muted);
  padding: 1px 8px;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid var(--border);
}

.risk-detail {
  padding: 12px 16px 16px 48px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.risk-detail-section {
  margin-bottom: 12px;
}

.risk-detail-section:last-child {
  margin-bottom: 0;
}

.risk-detail-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.risk-detail-text {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.7;
  word-break: break-word;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.dot-red {
  background: var(--red);
}

.dot-green {
  background: var(--green);
}

.risk-hostnames {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.risk-hostname {
  font-size: 10px;
  background: var(--accent-light);
  color: var(--accent);
  padding: 1px 8px;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.risk-hostname-more {
  font-size: 10px;
  background: var(--bg);
  color: var(--text-muted);
  padding: 1px 8px;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid var(--border);
}

.risk-detail {
  padding: 12px 16px 16px 48px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.risk-detail-section {
  margin-bottom: 12px;
}

.risk-detail-section:last-child {
  margin-bottom: 0;
}

.risk-detail-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.risk-detail-text {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.7;
  word-break: break-word;
}

.risk-left {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.risk-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  margin-top: 1px;
}

.icon-fail {
  background: var(--red-bg);
}

.icon-pass {
  background: var(--green-bg);
}

.risk-right {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-shrink: 0;
  padding-top: 1px;
}

.sev-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.sev-4 {
  background: var(--critical-bg);
  color: var(--critical);
}

.sev-3 {
  background: var(--red-bg);
  color: var(--red);
}

.sev-2 {
  background: var(--orange-bg);
  color: var(--orange);
}

.sev-1 {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.sev-0 {
  background: #e0f2fe;
  color: #0369a1;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.dot-red {
  background: var(--red);
}

.dot-green {
  background: var(--green);
}

/* ── Services Page ── */
.services-page {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

.services-page .page-top {
  padding: 16px 0 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.assurance-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  transition: box-shadow 0.15s, transform 0.15s;
  cursor: pointer;
}

.assurance-hero:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.assurance-logo-box {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  background: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.assurance-logo-box svg {
  width: 40px;
  height: 40px;
  fill: #fff;
}

.assurance-partner-img {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: cover;
  flex-shrink: 0;
}

.assurance-hero-text {
  flex: 1;
  min-width: 200px;
}

.assurance-hero-title {
  font-family: 'Rubik', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.assurance-hero-sub {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 440px;
}

.assurance-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--accent-light);
  color: var(--accent);
  margin-top: 10px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .top-grid {
    grid-template-columns: 1fr;
  }

  .score-right {
    display: none;
  }

  .assurance-hero {
    padding: 20px 16px;
  }
}

@media (max-width: 600px) {
  .stats-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .stat-label {
    padding: 12px 8px 0;
    font-size: 12px;
    letter-spacing: 0.2px;
  }

  .stat-value {
    padding: 0 8px;
    font-size: 22px;
  }

  .stat-sub {
    padding: 0 8px 12px;
    font-size: 13px;
  }

  .domain-badge {
    display: block;
    margin-left: 0;
    margin-top: 6px;
    width: fit-content;
    font-size: 13px;
  }

  .page-top {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 10px;
  }

  .page-top-left {
    flex: 1;
    min-width: 0;
  }

  .page-top-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .page-top-actions .btn {
    padding: 9px 12px;
    font-size: 13px;
    white-space: nowrap;
    width: 100%;
    justify-content: center;
  }

  .page-top-actions .btn svg {
    width: 16px;
    height: 16px;
  }

  /* Card header / titles / icons */
  .card-title {
    font-size: 16px;
  }

  .shield-icon {
    width: 28px;
    height: 28px;
  }

  .shield-icon svg {
    width: 16px;
    height: 16px;
  }

  /* Security rating */
  .score-number {
    font-size: 38px;
  }

  .score-denom {
    font-size: 17px;
  }

  .score-date {
    font-size: 13px;
  }

  .grade-badge {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }

  .score-change {
    font-size: 13px;
  }

  /* Risk category cells: 2-col grid had no mobile override at all, so at
     375px each cell was squeezed to ~155px — not enough room for the
     category name + issue count + severity chips, causing wrapping/overlap.
     Single column on mobile; border logic adjusted since there's no longer
     a "right neighbor" or a "last row of 2" to account for. */
  .cat-grid {
    grid-template-columns: 1fr;
  }

  .cat-cell {
    border-right: none;
  }

  .cat-cell:nth-last-child(-n+2) {
    border-bottom: 1px solid var(--border);
  }

  .cat-cell:last-child {
    border-bottom: none;
  }

  /* Risk categories header + cells */
  .risk-cat-header {
    font-size: 13px;
    padding: 13px 16px 11px;
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .risk-counts {
    flex-wrap: wrap;
  }

  .risk-count-badge {
    font-size: 12px;
    padding: 3px 9px;
  }

  .cat-name {
    font-size: 12px;
  }

  .cat-status {
    font-size: 13px !important;
  }

  /* Domain overview / policy rows */
  .ci-icon {
    font-size: 16px;
    width: 22px;
  }

  .ci-label {
    font-size: 14px;
  }

  .ci-value {
    font-size: 14px;
  }

  .info-tip-btn {
    width: 17px;
    height: 17px;
  }

  .info-tip-btn svg {
    width: 16px;
    height: 16px;
  }

  .info-tip-bubble {
    font-size: 13px;
    width: calc(100vw - 64px);
    max-width: 300px;
  }

  /* Risk distribution donut + legend */
  .donut-wrap {
    width: 170px;
    height: 170px;
  }

  .donut-wrap canvas {
    width: 170px !important;
    height: 170px !important;
  }

  .rl-label {
    font-size: 13px;
  }

  .rl-count {
    font-size: 13px;
  }

  /* Active risks list */
  .risk-title {
    font-size: 14px;
  }

  .risk-desc {
    font-size: 13px;
  }

  .sev-badge {
    font-size: 12px;
    padding: 3px 9px;
  }

  .risk-detail-label {
    font-size: 13px;
  }

  .risk-detail-text {
    font-size: 13px;
  }

  .risk-hostname {
    font-size: 12px;
  }

  /* Services page */
  .assurance-hero-title {
    font-size: 19px;
  }

  .assurance-hero-sub {
    font-size: 14px;
  }

  .assurance-hero-badge {
    font-size: 13px;
  }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
}

#dashboardScreen {
  overflow: hidden;
}

.page-view {
  overflow-y: auto;
  flex: 1;
}