/* /ratings — outside-in security rating page.
   Reuses the redesign theme variables (--ink, --ink-2/3, --surface-2,
   --border-color, --r-md, --ok/--warn/--danger). */

.rt-hero {
    display: flex;
    gap: 24px;
    align-items: stretch;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--r-md, 12px);
    padding: 22px 24px;
    margin: 0 0 26px;
    flex-wrap: wrap;
}

/* Ring-gauge score — mirrors the dashboard's Security-score presentation. */
.rt-score-big { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; flex: 1; }
.rt-ring { width: 156px; height: 156px; flex: 0 0 156px; position: relative; }
.rt-ring svg { width: 156px; height: 156px; display: block; }
.rt-ring-track { stroke: var(--border-color); }
.rt-ring-arc { stroke: var(--gc, var(--accent, #3b82f6)); transition: stroke-dashoffset .6s ease; }
.rt-ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.rt-ring-grade { font: 700 60px/1 var(--sans); letter-spacing: -0.04em; color: var(--ink); }
.rt-ring-num { font: 500 13px/1 var(--mono, monospace); color: var(--ink-2); margin-top: 6px; letter-spacing: 0.02em; }
.rt-ring-num .of { color: var(--ink-3); margin-left: 2px; font-weight: 400; }

.rt-score-meta { display: flex; flex-direction: column; justify-content: center; gap: 10px; flex: 1; min-width: 0; }
.rt-tier { display: inline-flex; align-items: center; font: 600 15px/1 var(--sans); color: var(--ink-2); }
.rt-tier::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 8px; opacity: .85; }
.rt-tier[data-tier="Excellent"], .rt-tier[data-tier="Strong"] { color: var(--ok); }
.rt-tier[data-tier="Adequate"] { color: var(--warn); }
.rt-tier[data-tier="Needs work"] { color: #C2410C; }
.rt-tier[data-tier="At risk"] { color: var(--danger); }
.rt-meta-line { font-size: 13px; color: var(--ink-3); }
.rt-meta-line a { color: var(--accent, #3b82f6); text-decoration: none; }
.rt-meta-line a:hover { text-decoration: underline; }

.rt-hero-stats { display: flex; gap: 30px; flex-wrap: wrap; margin-top: 2px; }
.rt-hero-stats > div { display: flex; flex-direction: column; }
.rt-stat-n { font-size: 22px; font-weight: 700; color: var(--ink); }
.rt-stat-l { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }

.rt-domains-h { font-size: 15px; color: var(--ink-2); margin: 0 0 12px; }
.rt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
    gap: 14px;
}

.rt-card {
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--r-md, 12px);
    padding: 15px 16px;
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.rt-card-na { opacity: .62; }
.rt-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rt-card-label { font-size: 14px; font-weight: 600; color: var(--ink); }

.rt-chip {
    font-family: var(--mono, monospace);
    font-size: 12px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 999px;
    color: var(--gc, #6b7280);
    background: color-mix(in srgb, var(--gc, #6b7280) 15%, transparent);
}
.rt-card-bar { height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--ink-3) 28%, transparent); overflow: hidden; }
.rt-card-bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--gc, var(--ink-3)); }
.rt-card-detail { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }
.rt-card-foot { font-size: 11.5px; color: var(--ink-3); }

/* Grade color ramp — matches the site's gradeChip palette. */
.g-a { --gc: #0E9F6E; }
.g-b { --gc: #3F9142; }
.g-c { --gc: #B45309; }
.g-d { --gc: #C2410C; }
.g-f { --gc: #DC2626; }
.g-na { --gc: #6b7280; }

/* Priority actions table */
.rt-domains { display: block; margin-bottom: 8px; }
.rt-actions { margin: 36px 0 26px; }
.rt-count {
    font-size: 12px; font-weight: 700; color: var(--ink-3);
    background: color-mix(in srgb, var(--ink-3) 18%, transparent);
    padding: 1px 8px; border-radius: 999px; margin-left: 6px;
}
.rt-act-wrap {
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--r-md, 12px);
    overflow-x: auto;
}
.rt-act-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rt-act-table th {
    text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
    color: var(--ink-3); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.rt-act-table td { padding: 10px 14px; border-bottom: 1px solid color-mix(in srgb, var(--border-color) 55%, transparent); color: var(--ink-2); vertical-align: top; }
.rt-act-table tr:last-child td { border-bottom: none; }
.rt-act-domain { color: var(--ink); font-weight: 600; white-space: nowrap; }
.rt-act-target { font-family: var(--mono, monospace); font-size: 12px; color: var(--ink); word-break: break-all; }
.rt-act-age { white-space: nowrap; color: var(--ink-3); }

.rt-sev {
    border: 1px solid var(--border-color); border-radius: 999px; display: inline-flex;
    font-size: 0.64rem; font-weight: 800; line-height: 1; padding: 4px 7px;
    text-transform: uppercase; width: fit-content; white-space: nowrap;
}
/* Unified severity pill (matches /vip-protection .vip-risk; high+medium => warn). */
.rt-sev.sev-crit { background: color-mix(in srgb, var(--danger) 8%, var(--bg-primary)); border-color: color-mix(in srgb, var(--danger) 44%, var(--border-color)); color: var(--danger); }
.rt-sev.sev-high, .rt-sev.sev-med { background: color-mix(in srgb, var(--warn) 8%, var(--bg-primary)); border-color: color-mix(in srgb, var(--warn) 42%, var(--border-color)); color: var(--warn); }
.rt-sev.sev-low { background: color-mix(in srgb, var(--ok) 8%, var(--bg-primary)); border-color: color-mix(in srgb, var(--ok) 32%, var(--border-color)); color: var(--ok); }

/* Priority badge (P1 most urgent) and asset-value tag */
.rt-note { margin: -4px 0 12px; font-size: 12px; color: var(--ink-3); }
.rt-prio {
    display: inline-block; font-family: var(--mono, monospace); font-size: 11.5px; font-weight: 800;
    padding: 2px 8px; border-radius: 6px;
    color: var(--pc); background: color-mix(in srgb, var(--pc) 15%, transparent);
}
.pri-hi  { --pc: #DC2626; } /* P1-2 */
.pri-mid { --pc: #B45309; } /* P3-4 */
.pri-lo  { --pc: #6b7280; } /* P5-6 */
/* Asset value uses the site accent (blue) so it reads as "importance", distinct from red/orange severity. */
.rt-asset {
    display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .03em; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
    color: var(--vc, #6b7280); background: color-mix(in srgb, var(--vc, #6b7280) 15%, transparent);
}
.val-key  { --vc: var(--accent, #3b82f6); }
.val-high { --vc: var(--accent, #3b82f6); }
.val-medium, .val-low, .val-idle { --vc: #6b7280; }

.rt-empty-sm { padding: 18px; background: var(--surface-2); border: 1px solid var(--border-color); border-radius: var(--r-md, 12px); color: var(--ink-3); font-size: 13px; }

/* Clickable affordances — full-border hover on cards, row highlight on the table. */
.rt-clickable { cursor: pointer; }
.rt-card.rt-clickable { transition: border-color .12s ease, background .12s ease; }
.rt-card.rt-clickable:hover { border-color: var(--accent, #6ea8fe); background: color-mix(in srgb, var(--ink-3) 8%, var(--surface-2)); }
.rt-card.rt-clickable:focus-visible { outline: 2px solid var(--accent, #6ea8fe); outline-offset: 2px; }
tr.rt-clickable:hover td { background: color-mix(in srgb, var(--ink-3) 12%, transparent); }
tr.rt-clickable:focus-visible { outline: 2px solid var(--accent, #6ea8fe); outline-offset: -2px; }

.rt-empty {
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--r-md, 12px);
    padding: 40px 28px;
    text-align: center;
}
.rt-empty h2 { margin: 0 0 8px; color: var(--ink); font-size: 18px; }
.rt-empty p { margin: 0 auto; color: var(--ink-3); font-size: 14px; max-width: 460px; }

@media (max-width: 560px) {
    .rt-hero { flex-direction: column; }
    .rt-grade { min-width: 0; }
}

/* Trend sparkline in the hero */
.rt-trend { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--ink-2); font-size: 12.5px; }
.rt-trend-label b { color: var(--ink); }
.rt-trend-empty { color: var(--ink-3); }
.rt-spark { color: var(--accent, #6ea8fe); opacity: .9; }

/* Action Plan tools */
.rt-tools { float: right; display: inline-flex; gap: 8px; }
.rt-btn {
    font: 600 12px/1 var(--sans);
    color: var(--ink-2); background: var(--surface-2);
    border: 1px solid var(--border-color); border-radius: 7px;
    padding: 6px 11px; cursor: pointer;
}
.rt-btn:hover { border-color: var(--accent, #6ea8fe); color: var(--ink); }

/* Print: isolate the rating + action plan into a clean report */
@media print {
    .side, .dash-nav, .navbar, nav, .rt-tools, .rt-clickable { display: none !important; }
    .dash, .dash-main { display: block !important; margin: 0 !important; }
    .rt-card, .rt-act-wrap, .rt-hero { break-inside: avoid; }
    body { background: #fff !important; color: #000 !important; }
}

/* ── Ransomware Susceptibility Index card ─────────────────────────── */
.rt-ransomware { margin: 0 0 20px; }
.rt-ransomware:empty { display: none; }
.rt-rsi { border: 1px solid var(--border-color); border-radius: 12px; padding: 18px 20px; background: var(--surface, var(--bg-secondary)); }
.rt-rsi-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.rt-rsi-eyebrow { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); font-weight: 600; }
.rt-rsi-score { display: flex; align-items: baseline; gap: 8px; margin-top: 5px; }
.rt-rsi-score b { font-size: 2rem; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.rt-rsi-score > span { color: var(--ink-3); font-size: 0.9rem; }
.rt-rsi-tier { display: inline-block; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border-color); }
.rt-rsi-low .rt-rsi-tier { color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); border-color: color-mix(in srgb, var(--ok) 32%, var(--border-color)); }
.rt-rsi-moderate .rt-rsi-tier { color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); border-color: color-mix(in srgb, var(--warn) 40%, var(--border-color)); }
.rt-rsi-high .rt-rsi-tier, .rt-rsi-critical .rt-rsi-tier { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); border-color: color-mix(in srgb, var(--danger) 44%, var(--border-color)); }
.rt-rsi-factors { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rt-rsi-factors li { display: flex; align-items: flex-start; gap: 9px; font-size: 0.88rem; color: var(--ink-2); line-height: 1.45; }
.rt-rsi-clean { color: var(--ok); }
.rt-rsi-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; background: var(--ink-3); }
.rt-rsi-dot-critical { background: var(--danger); }
.rt-rsi-dot-high { background: var(--sev-high); }
.rt-rsi-dot-medium { background: var(--warn); }
.rt-rsi-note { margin: 0; font-size: 0.72rem; color: var(--ink-3); line-height: 1.5; }
/* Drill-down endpoints under an RSI factor (infostealer login hosts). */
.rt-rsi-eps { margin-top: 8px; }
.rt-rsi-eps summary { font-size: 0.74rem; color: var(--accent, #2563EB); cursor: pointer; width: fit-content; }
.rt-rsi-ep { display: flex; align-items: center; gap: 10px; padding: 4px 0; border-top: 1px solid var(--border-color); font-size: 0.78rem; }
.rt-rsi-ep code { color: var(--ink); word-break: break-all; }
.rt-rsi-ep-brand { color: var(--ink-3); font-size: 0.72rem; }
.rt-rsi-ep-occ { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }

/* Dollar risk quantification — probable annual loss, presented as a labeled
   modeled range with the likelihood x magnitude inputs shown. */
.rt-crq { border: 1px solid var(--border-color); border-radius: 12px; padding: 18px 20px; background: var(--surface, var(--bg-secondary)); }
.rt-crq-main { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px; }
.rt-crq-lead { min-width: 0; }
.rt-crq-eyebrow { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); font-weight: 600; }
.rt-crq-range { display: flex; align-items: baseline; gap: 10px; margin-top: 6px; font-size: 2.1rem; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }
.rt-crq-dash { font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); }
.rt-crq-point { margin-top: 8px; font-size: 0.82rem; color: var(--ink-2); }
.rt-crq-point b { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.rt-crq-calc { display: flex; align-items: center; gap: 14px; }
.rt-crq-term { display: flex; flex-direction: column; gap: 3px; text-align: center; }
.rt-crq-term-n { font-size: 1.35rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink); }
.rt-crq-term-l { font-size: 0.68rem; color: var(--ink-3); line-height: 1.3; }
.rt-crq-op { font-size: 1.15rem; font-weight: 600; color: var(--ink-3); }
.rt-crq-note { margin: 14px 0 0; font-size: 0.72rem; color: var(--ink-3); line-height: 1.5; }
@media (max-width: 640px) {
    .rt-crq-main { flex-direction: column; align-items: flex-start; }
    .rt-crq-calc { align-self: stretch; justify-content: space-between; }
}

/* Remediation performance — open backlog, aging, SLA, time-to-close. */
.rt-rem { border: 1px solid var(--border-color); border-radius: 12px; padding: 18px 20px; background: var(--surface, var(--bg-secondary)); }
.rt-rem-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.rt-rem-eyebrow { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); font-weight: 600; }
.rt-rem-sub { font-size: 0.72rem; color: var(--ink-3); }
.rt-rem-stats { display: flex; flex-wrap: wrap; gap: 14px 30px; margin-bottom: 16px; }
.rt-rem-stat { display: flex; flex-direction: column; gap: 3px; }
.rt-rem-n { font-size: 1.7rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink); }
.rt-rem-u { font-size: 0.9rem; font-weight: 600; color: var(--ink-3); margin-left: 1px; }
.rt-rem-na { color: var(--ink-3); font-weight: 600; }
.rt-rem-l { font-size: 0.72rem; color: var(--ink-3); }
.rt-rem-breach .rt-rem-n { color: var(--danger); }
.rt-rem-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-2, var(--bg-secondary)); margin-bottom: 10px; }
.rt-rem-seg { display: block; height: 100%; }
.rt-rem-seg.age-fresh, .rt-rem-legend i.age-fresh { background: var(--ok); }
.rt-rem-seg.age-warn, .rt-rem-legend i.age-warn { background: var(--warn); }
.rt-rem-seg.age-aging, .rt-rem-legend i.age-aging { background: var(--sev-high, #EA580C); }
.rt-rem-seg.age-stale, .rt-rem-legend i.age-stale { background: var(--danger); }
.rt-rem-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; }
.rt-rem-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; color: var(--ink-2); }
.rt-rem-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.rt-rem-legend b { color: var(--ink); font-variant-numeric: tabular-nums; }
.rt-rem-note { margin: 0; font-size: 0.72rem; color: var(--ink-3); line-height: 1.5; }

/* Board-metric direction-of-travel sparkline (RSI / dollar-risk / SLA cards).
   Coloured by direction: higher is worse for all three. */
.rt-mspark { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border-color); color: var(--ink-3); }
.rt-mspark-l { font-size: 0.72rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.rt-mspark .rt-spark { flex: 0 0 auto; }
.rt-mspark.worse { color: var(--danger); }
.rt-mspark.better { color: var(--ok); }

/* Locked depth: the rating itself is free, the analysis below it is Business.
   Styled as an offer, not an error, so it reads as "here is what you get next"
   rather than "something went wrong". */
.rt-locked {
    padding: 22px 24px;
    border: 1px dashed var(--border, rgba(148,163,184,0.42));
    border-radius: 12px;
    background: var(--surface-2, rgba(148,163,184,0.06));
}

.rt-locked .rt-domains-h { margin: 0 0 8px; }

.rt-locked-blurb {
    margin: 0 0 16px;
    max-width: 60ch;
    font: 400 13px/1.6 var(--sans);
    color: var(--ink-2, #475569);
}

.rt-locked-cta { text-decoration: none; }

.rt-trend-locked {
    font: 400 12px/1.5 var(--sans);
    color: var(--ink-3, #64748b);
}

.rt-trend-locked a { color: inherit; text-decoration: underline; }
