/* ---- stc Forward corporate typeface (self-hosted) ---- */
@font-face { font-family: 'STC Forward'; src: url('/fonts/STCForward-Thin.ttf') format('truetype'); font-weight: 100; font-style: normal; font-display: swap; }
@font-face { font-family: 'STC Forward'; src: url('/fonts/STCForward-ThinItalic.ttf') format('truetype'); font-weight: 100; font-style: italic; font-display: swap; }
@font-face { font-family: 'STC Forward'; src: url('/fonts/STCForward-Light.ttf') format('truetype'); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: 'STC Forward'; src: url('/fonts/STCForward-LightItalic.ttf') format('truetype'); font-weight: 300; font-style: italic; font-display: swap; }
@font-face { font-family: 'STC Forward'; src: url('/fonts/STCForward-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'STC Forward'; src: url('/fonts/STCForward-Italic.ttf') format('truetype'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'STC Forward'; src: url('/fonts/STCForward-Medium.ttf') format('truetype'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'STC Forward'; src: url('/fonts/STCForward-MediumItalic.ttf') format('truetype'); font-weight: 500; font-style: italic; font-display: swap; }
@font-face { font-family: 'STC Forward'; src: url('/fonts/STCForward-Bold.ttf') format('truetype'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'STC Forward'; src: url('/fonts/STCForward-BoldItalic.ttf') format('truetype'); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: 'STC Forward'; src: url('/fonts/STCForward-ExtraBold.ttf') format('truetype'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'STC Forward'; src: url('/fonts/STCForward-ExtraBoldItalic.ttf') format('truetype'); font-weight: 800; font-style: italic; font-display: swap; }

:root {
  --stc-purple: #4F008C;
  --stc-magenta: #c8378c;
  --bg: #f5f4f8;
  --card: #ffffff;
  --ink: #23202b;
  --muted: #6f6a7d;
  --green: #1a9e54;
  --amber: #d99400;
  --red: #d43a3a;
  --border: #e3e0ea;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'STC Forward', "Segoe UI", system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--ink); }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; background: var(--stc-purple); color: #fff; }
.brand { display: flex; gap: 14px; align-items: center; }
.logo { background: var(--stc-magenta); font-weight: 800; font-size: 20px; padding: 8px 12px; border-radius: 8px; }
h1 { font-size: 18px; margin: 0; }
.sub { margin: 2px 0 0; font-size: 12px; opacity: .8; }
.actions { display: flex; gap: 8px; }
.btn { border: 1px solid rgba(255,255,255,.4); background: transparent; color: #fff; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.btn.primary { background: var(--stc-magenta); border-color: var(--stc-magenta); font-weight: 600; }
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .5; cursor: wait; }
/* Statement Explorer view switcher (P&L / BS / CF / Key indicators).
   Owner directive 2026-09-17: these buttons inherit the .btn base, which was
   designed for the DARK purple header (transparent bg, white text, faint white
   border) — on the white Explorer card the unselected tabs were INVISIBLE and
   the selected tab used the off-spec magenta fill. Restyle both states to the
   exact Overview filter-chip language: unselected = light grey pill
   (#E7EBEF/#5F6B76, 1px #D3DAE0 border), selected = lavender pill
   (#E2D2F5 = embed chip var(--lav2), stc purple #4F008C bold text), no dark or
   bright fills. Sizing matches the Overview primary chips (px-3.5 py-2, 12px). */
.stmt-tabs { display: flex; gap: 6px; margin: 0 0 10px; flex-wrap: wrap; }
.stmt-tab { padding: 8px 14px; font-size: 12px; font-weight: 500; border-radius: 999px; background: #E7EBEF; color: #5F6B76; border: 1px solid #D3DAE0; }
.stmt-tab.active { background: #E2D2F5; color: #4F008C; border-color: #E2D2F5; font-weight: 700; }
.stmt-tab:hover { filter: none; }
/* Offline copies: the relabeled RUN slot is a read-only status badge, not an action. */
.btn.offline-badge { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.28); color: rgba(255,255,255,.85); font-weight: 400; cursor: default; opacity: 1; }
.btn.offline-badge:hover { filter: none; }
.banner { padding: 10px 24px; font-size: 13px; background: #e8f4ec; color: var(--green); border-bottom: 1px solid var(--border); white-space: pre-wrap; }
.banner.warn { background: #fdf3e0; color: var(--amber); }
.banner.err { background: #fbe6e6; color: var(--red); }
.hidden { display: none !important; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 16px; margin: 16px 24px 0; padding: 14px 16px; }
/* The filter bar now lives inside the Statement Explorer view, directly above
   the table — drop the shell-header side margins so it aligns with the table. */
#view-explorer > .filters { margin: 0 0 14px; }
.filters label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
select, input { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: #fff; }
button, input, select, textarea { font-family: inherit; }
.tabs { display: flex; gap: 4px; padding: 0 24px; margin-top: 14px; flex-wrap: wrap; }
.tab { border: 1px solid var(--border); border-bottom: none; background: #ece9f2; padding: 9px 16px; border-radius: 8px 8px 0 0; cursor: pointer; font-size: 13px; }
.tab.active { background: var(--card); font-weight: 600; color: var(--stc-purple); }
main { margin: 0 24px 32px; }
.view { background: var(--card); border: 1px solid var(--border); border-radius: 0 10px 10px 10px; padding: 20px; min-height: 300px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: right; }
th:first-child, td:first-child { text-align: left; }
thead th { background: #f3f0f8; color: var(--stc-purple); font-weight: 600; position: sticky; top: 0; }
.flag { display: inline-block; width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
/* Same shades as the scorecard scale gradient */
.flag.green { background: #00C48C; } .flag.amber { background: #FFDD40; } .flag.red { background: #FF375E; }
.missing { color: var(--muted); font-style: italic; }
.n-note { font-size: 11px; color: var(--muted); }
.basis-tag { font-size: 10px; font-variant: small-caps; letter-spacing: .04em; color: var(--muted); background: #f3f0f8; border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; margin-left: 4px; white-space: nowrap; }
.chart-wrap { position: relative; height: 380px; margin-bottom: 20px; }
.popover { position: fixed; z-index: 50; background: #fff; border: 1px solid var(--stc-purple); border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.2); padding: 14px 16px; max-width: 360px; font-size: 12px; }
.popover h4 { margin: 0 0 6px; color: var(--stc-purple); }
.popover dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; }
.popover dt { color: var(--muted); } .popover dd { margin: 0; word-break: break-all; }
tr.line-row { cursor: pointer; }
tr.line-row:hover { background: #f6f2fb; }
form.manual { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; padding: 16px; }
form.manual .full { grid-column: 1 / -1; }
form.manual label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
form.manual h3 { grid-column: 1 / -1; margin: 10px 0 0; color: var(--stc-purple); font-size: 14px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.manual-actions { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; }
form.manual .fact-row { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
form.manual .fact-row label.wide { grid-column: span 2; }
form.manual .fact-row .manual-actions { grid-column: 1 / -1; }
.note { font-size: 12px; color: var(--muted); padding: 8px 16px; }
/* KPI engine */
#kpis-body .btn { border-color: var(--border); color: var(--stc-purple); padding: 4px 10px; font-size: 12px; }
#kpis-body .btn.primary { background: var(--stc-magenta); border-color: var(--stc-magenta); color: #fff; }
#kpis-body code { background: #f3f0f8; padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.kpi-actions { white-space: nowrap; }
.mono-line { font-family: 'STC Forward', "Segoe UI", system-ui, sans-serif; font-size: 11px; line-height: 1.7; background: #f8f6fc; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; word-break: break-word; }
form.manual.kpi-add { margin-top: 18px; border-top: 2px solid var(--stc-purple); }
form.manual.kpi-add input, form.manual.kpi-add select { font-size: 13px; }

/* ---- auth / login ---- */
/* ---- Splash (visual parity with the mobile app: full-bleed stc purple + TPM motion) ---- */
#splash-screen { position: fixed; inset: 0; z-index: 200; background: #4F008C; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; user-select: none; transition: opacity .46s ease, transform .46s ease; }
#splash-screen.splash-out { opacity: 0; transform: scale(1.04); pointer-events: none; }
.splash-glow { position: absolute; width: 288px; height: 288px; border-radius: 9999px; pointer-events: none; background: radial-gradient(circle, rgba(255,255,255,.35) 0%, rgba(255,255,255,0) 65%); animation: splashGlow 2.4s ease-in-out infinite alternate; }
.splash-word { position: relative; color: #fff; font-weight: 800; letter-spacing: -0.025em; line-height: 1; font-size: 88px; animation: splashWord .7s ease both; white-space: nowrap; }
.splash-word span { font-weight: 300; color: rgba(255,255,255,.6); font-size: .65em; }
.splash-line { position: relative; margin-top: 40px; height: 3px; width: 112px; border-radius: 9999px; background: rgba(255,255,255,.2); overflow: hidden; }
.splash-line-fill { position: absolute; inset: 0; border-radius: 9999px; background: #fff; transform-origin: left; transform: scaleX(0); animation: splashLine 2.4s linear forwards; }
.splash-skip { position: absolute; bottom: 32px; font-size: 10px; color: rgba(255,255,255,.4); letter-spacing: .025em; }
@keyframes splashLine { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes splashWord { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes splashGlow { from { opacity: .5; transform: scale(.9); } to { opacity: 1; transform: scale(1.05); } }
@media (max-width: 480px) { .splash-word { font-size: 64px; } }
/* ---- Auth screens (Sign in + two-factor) — 1:1 clone of the mobile app's Login
   component (tpm-bench-mobile/src/App.tsx): same gradient, card, copy, colors,
   spacing. Rendered as a centered phone-width (384px) column on desktop. ---- */
.login-screen { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(160deg, #4F008C, #2D0152); padding: 0 24px; overflow-y: auto; }
.auth-col { width: 100%; max-width: 384px; display: flex; flex-direction: column; margin: auto; }
.auth-brand { text-align: center; margin-bottom: 32px; }
.auth-wordmark { font-size: 30px; line-height: 36px; font-weight: 700; color: #fff; letter-spacing: -0.025em; }
.auth-wordmark span { font-weight: 300; color: rgba(255,255,255,.6); font-size: .65em; }
.auth-tagline { margin-top: 4px; font-size: 12px; line-height: 16px; color: #e9d5ff; }
.login-card { background: #fff; border-radius: 24px; box-shadow: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1); padding: 24px; width: 100%; box-sizing: border-box; }
.auth-card-title { font-size: 14px; line-height: 20px; font-weight: 700; color: #1f2937; margin: 0 0 16px; }
.auth-card-title-tight { margin-bottom: 4px; }
.auth-label { display: block; font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: .025em; color: #6b7280; margin: 0 0 4px; }
.login-card input { display: block; width: 100%; box-sizing: border-box; border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 20px; margin: 0 0 12px; outline: none; background: #fff; color: #1f2937; }
.login-card input:focus { border-color: #4F008C; }
.login-card input::placeholder { color: #9ca3af; }
#login-password { margin-bottom: 0; }
.pw-wrap { position: relative; margin-bottom: 20px; }
.pw-wrap input { padding-right: 40px; }
.pw-eye { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; padding: 2px; display: flex; align-items: center; color: #9ca3af; cursor: pointer; }
.pw-eye:hover, .pw-eye:focus-visible { color: #6b7280; outline: none; }
#otp-code { text-align: center; letter-spacing: .5em; font-size: 24px; line-height: 32px; font-weight: 700; padding: 12px; margin-bottom: 20px; }
.login-error { margin: 0 0 12px; font-size: 11px; line-height: 1.375; color: #dc2626; }
.login-error:empty { display: none; }
.login-btn { display: block; width: 100%; border-radius: 12px; padding: 12px 0; font-size: 14px; line-height: 20px; font-weight: 700; color: #fff; background: #4F008C; border: none; cursor: pointer; margin: 0; }
.login-btn:hover { filter: brightness(1.08); }
.login-btn:disabled { opacity: .4; cursor: default; }
.login-sub { margin: 0 0 16px; font-size: 11px; line-height: 16px; color: #6b7280; }
.login-back { display: block; background: none; border: none; padding: 0; margin: 12px 0 0; width: 100%; font-size: 11px; line-height: 16px; color: #9ca3af; cursor: pointer; font-family: inherit; text-align: center; }
.login-back:hover, .login-back:focus-visible { color: #6b7280; outline: none; }
.auth-foot { margin: 12px 0 0; text-align: center; font-size: 10px; line-height: 16px; color: #d8b4fe; }

/* ---- two-factor (TOTP) setup modal ---- */
.totp-card { max-width: 520px; }
.totp-note { font-size: 13px; color: var(--muted); line-height: 1.6; margin: 0 0 12px; }
.totp-status-line { font-size: 13px; color: var(--ink); margin: 0 0 14px; }
.totp-qr-wrap { display: flex; justify-content: center; margin: 4px 0 16px; }
.totp-qr-wrap canvas { width: 216px; height: 216px; border: 1px solid var(--border); border-radius: 12px; background: #fff; padding: 0; }
.totp-manual { margin: 0 0 14px; border: 1px solid var(--border); border-radius: 8px; background: #f8f6fc; }
.totp-manual summary { cursor: pointer; font-size: 13px; color: var(--ink); font-weight: 600; padding: 10px 12px; user-select: none; list-style-position: inside; }
.totp-manual[open] summary { border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.totp-manual .totp-secret-row { padding: 0 12px; }
.totp-manual .totp-note { padding: 0 12px; }
.totp-manual .totp-url { margin: 0 12px 12px; }
.totp-manual .totp-secret { background: #fff; }
.totp-manual .totp-url { background: #fff; }
.totp-secret-row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 12px; }
.totp-secret { flex: 1; font-family: 'STC Forward', "Segoe UI", system-ui, sans-serif; font-size: 15px; font-weight: 700; letter-spacing: 2px; background: #f8f6fc; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; word-break: break-all; user-select: all; }
.totp-url { display: block; font-family: 'STC Forward', "Segoe UI", system-ui, sans-serif; font-size: 11px; background: #f8f6fc; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; word-break: break-all; margin-bottom: 12px; user-select: all; }
.totp-confirm-form { display: flex; gap: 8px; }
.totp-confirm-form input { flex: 1; padding: 10px 12px; font-size: 16px; text-align: center; letter-spacing: 6px; font-weight: 700; }
.totp-success { font-size: 13px; color: var(--green, #1a7f4b); line-height: 1.6; margin: 12px 0 0; }
.user-chip { font-size: 12px; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3); border-radius: 14px; padding: 5px 12px; align-self: center; white-space: nowrap; }
.user-chip .role-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--stc-magenta); border-radius: 8px; padding: 1px 7px; margin-left: 6px; }
.user-chip .role-badge.viewer { background: #7a6f96; }
.confidential-tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #fff; background: var(--red); border-radius: 8px; padding: 2px 9px; margin-left: 10px; vertical-align: middle; }

/* === TAB: COST (owned by cost-structure redesign) === */
#view-cost { font-family: 'STC Forward','Segoe UI',system-ui,sans-serif; }
#view-cost .cost-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
#view-cost .cost-head-text { display: flex; flex-direction: column; gap: 2px; }
#view-cost .cost-title { margin: 0; font-size: 17px; font-weight: 700; color: #4F008C; padding-bottom: 5px; border-bottom: 3px solid #4F008C; align-self: flex-start; }
#view-cost .cost-subtitle { margin: 0; font-size: 12px; font-weight: 600; color: #8E9AA0; }
#view-cost .cost-kpi-picker { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
#view-cost .cost-kpi-picker select { border-color: #4F008C; font-weight: 600; color: #4F008C; min-width: 220px; }
#view-cost .cost-note { margin: -8px 0 14px; }
#view-cost .cost-tbl thead th { background: #EDE3F7; color: #4F008C; border-bottom: 2px solid #4F008C; }
#view-cost .cost-tbl tbody tr:hover { background: #F8F4FC; }

/* === TAB: SCORECARD (owned by scorecard slider/bullet redesign) === */
#view-scorecard { font-family: 'STC Forward','Segoe UI',system-ui,sans-serif; }
#view-scorecard .sc-legend { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin: 10px 0 18px; font-size: 12.5px; color: #333; }
#view-scorecard .sc-legend span { display: inline-flex; align-items: center; gap: 6px; }
#view-scorecard .sc-sw { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
#view-scorecard .sc-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
#view-scorecard .sc-kpi-picker { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 0 0 6px 46px; }
#view-scorecard .sc-kpi-picker select { padding: 6px 10px; font-size: 13px; border: 1px solid var(--stc-purple); border-radius: 8px; background: #fff; color: var(--stc-purple); font-weight: 600; }
#view-scorecard .sc-sliders { display: flex; flex-direction: column; gap: 0; margin-bottom: 26px; }
#view-scorecard .sc-slider { padding: 26px 46px 34px; border-bottom: 1px solid #E5E5E5; }
#view-scorecard .sc-slider:nth-child(even) { background: #F8F9FA; }
#view-scorecard .sc-kpi-name { font-weight: 600; font-size: 12.5px; color: #666; margin-bottom: 6px; display: flex; align-items: baseline; gap: 8px; }
#view-scorecard .sc-kpi-name .sc-n { font-weight: 400; font-size: 10.5px; color: #999; margin-left: auto; }
#view-scorecard .sc-canvas { position: relative; }
#view-scorecard .sc-zones { display: flex; pointer-events: none; margin-bottom: 6px; }
#view-scorecard .sc-zones span { flex: 1; font-size: 12.5px; font-style: italic; color: #909090; }
#view-scorecard .sc-zones span:nth-child(1) { text-align: left; }
#view-scorecard .sc-zones span:nth-child(2) { text-align: center; }
#view-scorecard .sc-zones span:nth-child(3) { text-align: right; }
#view-scorecard .sc-row { position: relative; height: 26px; }
/* smooth entrance animations (replay on every KPI/filter change, like the column chart's) */
@keyframes scTrackGrow { from { transform: scaleX(0); opacity: .4; } to { transform: scaleX(1); opacity: 1; } }
@keyframes scMarkerPop { 0% { transform: translate(-50%,-50%) scale(0); } 70% { transform: translate(-50%,-50%) scale(1.25); } 100% { transform: translate(-50%,-50%) scale(1); } }
@keyframes scFadeDown { from { opacity: 0; transform: translateX(-50%) translateY(-8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes scFadeUp { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
#view-scorecard .sc-track { position: relative; height: 14px; border-radius: 999px; background: linear-gradient(90deg, #FF375E 0%, #FF6A39 28%, #FFDD40 50%, #00C48C 72%, #1BCED8 100%); box-shadow: inset 0 1px 3px rgba(0,0,0,.18); margin: 6px 0; transform-origin: left center; animation: scTrackGrow .55s cubic-bezier(.22,.8,.35,1) both; }
#view-scorecard .sc-marker { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 22px; height: 22px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); z-index: 3; animation: scMarkerPop .5s cubic-bezier(.22,.8,.35,1) .35s both; transition: left .45s ease, background .45s ease; }
#view-scorecard .sc-connector { position: absolute; top: 50%; height: 0; border-top: 2px dashed rgba(79,0,140,.45); transform: translateY(-50%); z-index: 2; }
#view-scorecard .sc-callout-top, #view-scorecard .sc-callout-bottom { position: absolute; top: 0; transform: translateX(-50%); z-index: 4; transition: left .45s ease; }
#view-scorecard .sc-callout-top { animation: scFadeDown .4s ease .15s both; }
#view-scorecard .sc-callout-bottom { animation: scFadeUp .4s ease .25s both; }
#view-scorecard .sc-box { display: inline-block; white-space: nowrap; border-radius: 9px; padding: 3px 10px; font-size: 12.5px; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
#view-scorecard .sc-box-stc { background: #EDE3F7; color: #4F008C; font-weight: 800; }
#view-scorecard .sc-box-bench { background: #8E9AA0; color: #fff; font-weight: 600; }
#view-scorecard .sc-box-local { background: #149BA2; color: #fff; font-weight: 600; }
#view-scorecard .sc-callout-bottom .sc-box-local::after { content: ''; position: absolute; left: 50%; top: -5px; transform: translateX(-50%); border: 5px solid transparent; border-bottom-color: #149BA2; border-top: 0; }
#view-scorecard .sc-callout-top .sc-box-stc::after { content: ''; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%); border: 5px solid transparent; border-top-color: #EDE3F7; border-bottom: 0; }

#view-scorecard .sc-callout-bottom .sc-box-bench::after { content: ''; position: absolute; left: 50%; top: -5px; transform: translateX(-50%); border: 5px solid transparent; border-bottom-color: #8E9AA0; border-top: 0; }
#view-scorecard .sc-callout-top .sc-box, #view-scorecard .sc-callout-bottom .sc-box { position: relative; }
#view-scorecard .sc-missing .sc-nodata { font-size: 12px; color: #999; font-style: italic; padding: 8px 0; }
#view-scorecard .sc-missing { padding: 10px 46px; }
/* === TAB: SCORECARD end === */

/* === Settings menu + IR calendar === */
.settings-wrap { position: relative; }
.btn.icon { padding: 8px 10px; display: inline-flex; align-items: center; justify-content: center; }
.btn.icon.dark { border-color: var(--border); color: var(--muted); }
.settings-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 250px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(35,32,43,.18); padding: 6px; z-index: 60; font-family: 'STC Forward', "Segoe UI", system-ui, sans-serif; }
.settings-menu .menu-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; }
.settings-menu .menu-item { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; background: none; border: none; border-radius: 7px; padding: 8px 10px; font-size: 13.5px; color: var(--ink); cursor: pointer; font-family: inherit; }
.settings-menu .menu-item:hover, .settings-menu .menu-item:focus-visible { background: #f3f0f8; color: var(--stc-purple); outline: none; }
.settings-menu .menu-sub { font-size: 11.5px; color: var(--muted); font-weight: 400; }
/* Settings → Defaults (mirrors mobile Settings → DEFAULTS) */
.settings-menu .menu-defaults { cursor: default; gap: 6px; }
.settings-menu .menu-defaults:hover { background: none; color: var(--ink); }
.settings-menu .def-label { display: flex; flex-direction: column; gap: 2px; width: 100%; font-size: 12px; color: var(--muted); font-weight: 500; }
.settings-menu .def-select { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--card); color: var(--ink); font-size: 13px; font-family: inherit; cursor: pointer; }
.settings-menu .def-select:focus { border-color: var(--stc-purple); outline: none; box-shadow: 0 0 0 2px rgba(79,0,140,.12); }
.settings-menu .menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }

.modal-overlay { position: fixed; inset: 0; background: rgba(35,32,43,.45); display: flex; align-items: flex-start; justify-content: center; padding: 48px 16px; z-index: 70; overflow-y: auto; }
.modal-card { background: var(--card); border-radius: 12px; box-shadow: 0 16px 48px rgba(35,32,43,.3); max-width: 860px; width: 100%; padding: 20px 24px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; font-size: 18px; color: var(--stc-purple); }
.accounts-card { max-width: 640px; }
.accounts-note { font-size: 12.5px; color: var(--muted); margin: 8px 0 14px; }
.accounts-body table.accounts-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.accounts-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 2px solid var(--stc-purple); padding: 4px 8px 6px 0; }
.accounts-table td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--border); vertical-align: middle; }
.accounts-table td.accounts-user { font-weight: 600; }
.accounts-table td.accounts-2fa, .accounts-table td.accounts-count { text-align: center; }
.accounts-table th:nth-child(3), .accounts-table th:nth-child(5) { text-align: center; }
.accounts-yes { color: var(--green); font-weight: 700; }
.accounts-no { color: var(--muted); }
.accounts-never { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; background: #fde8e8; color: var(--red); }
.accounts-table .role-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--stc-magenta); color: #fff; border-radius: 8px; padding: 2px 8px; }
.accounts-table .role-badge.viewer { background: #7a6f96; }
.calendar-note { font-size: 12.5px; color: var(--muted); margin: 8px 0 14px; }
.calendar-body .cal-month { margin-bottom: 18px; }
.calendar-body .cal-month h3 { margin: 0 0 8px; font-size: 14px; color: var(--stc-purple); border-bottom: 2px solid var(--stc-purple); padding-bottom: 4px; }
.calendar-body table { font-size: 13px; }
.calendar-body th, .calendar-body td { text-align: left; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; color: #fff; }
.tag.confirmed { background: var(--green); }
.tag.estimated { background: var(--amber); }
.tag.event-call { background: var(--stc-magenta); }
.tag.event-results { background: var(--stc-purple); }
.cal-note { font-size: 11.5px; color: var(--muted); }
.tag.pending { background: var(--muted); }

/* Outlook-style category chips + list */
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.cat-chip { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.cat-Purple { background: #EDE3F7; color: var(--stc-purple); border: 1px solid #D8BEF2; }
.cat-Red { background: #FFE3E9; color: #C40F3C; border: 1px solid #FFB3C2; }
.cat-Green { background: #D9F7EC; color: #00795A; border: 1px solid #8FE5C6; }
.cat-Yellow { background: #FFF7D6; color: #8A7200; border: 1px solid #F2E192; }
.cal-list { list-style: none; margin: 0; padding: 0; }
.cal-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.cal-item:hover, .cal-item:focus-visible { background: #f3f0f8; outline: none; }
.cal-item-subject { flex: 1; min-width: 0; color: var(--ink); }
.cal-item-when { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* Outlook-style details panel */
.calendar-details { margin-bottom: 16px; }
.cal-details-card { border: 1px solid var(--border); border-left: 5px solid var(--stc-purple); border-radius: 10px; padding: 14px 18px; background: #fbfaff; }
.cal-details-card.cat-border-Red { border-left-color: #b3261e; }
.cal-details-card.cat-border-Green { border-left-color: #1d7a43; }
.cal-details-card.cat-border-Yellow { border-left-color: #d9b800; }
.cal-details-card.cat-border-Purple { border-left-color: var(--stc-purple); }
.cal-details-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.cal-details-head h3 { margin: 0 0 10px; font-size: 15px; color: var(--stc-purple); }
.cal-row { display: flex; gap: 12px; padding: 4px 0; font-size: 13px; }
.cal-label { flex: 0 0 150px; font-weight: 700; color: var(--muted); }
.cal-value { flex: 1; min-width: 0; }
.cal-row-desc .cal-value { line-height: 1.5; }
.cal-desc-line { margin-bottom: 3px; }
.cal-details-actions { margin-top: 12px; }

/* === IR calendar: mobile-style Day/Week/Month/Year layout (accent = STC purple #4F008C) === */
:root { --cal-accent: #4F008C; }
.calendar-card { max-width: 560px; max-height: 88vh; overflow-y: auto; background: #faf9fc; }
.cal-seg { display: flex; gap: 4px; background: #ece9f2; border-radius: 999px; padding: 4px; margin: 4px 0 16px; }
.cal-seg-btn { flex: 1; border: none; background: transparent; border-radius: 999px; padding: 8px 10px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; font-family: inherit; }
.cal-seg-btn.active { background: #fff; color: var(--cal-accent); font-weight: 700; border: 1.5px solid var(--cal-accent); box-shadow: 0 1px 4px rgba(79,0,140,.18); }
.cal-head2 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cal-title { margin: 0; font-size: 19px; font-weight: 700; color: var(--ink); }
.cal-nav { display: flex; gap: 6px; }
.cal-chev { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: #fff; color: var(--cal-accent); font-size: 18px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.cal-chev:hover { background: #f3eefb; border-color: var(--cal-accent); }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.cal-weekdays span { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 4px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day { border: none; background: #fff; border-radius: 10px; min-height: 44px; padding: 5px 2px 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; font-family: inherit; color: var(--ink); }
.cal-day:hover { background: #f3eefb; }
.cal-day.other { background: transparent; color: #b9b4c4; }
.cal-day.other .cal-dots { opacity: .45; }
.cal-day-num { font-size: 13px; font-weight: 500; }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--cal-accent); }
.cal-day.today .cal-day-num { color: var(--cal-accent); font-weight: 800; }
.cal-day.selected { background: var(--cal-accent); color: #fff; }
.cal-day.selected .cal-day-num { color: #fff; font-weight: 800; }
.cal-day.selected .cal-dot { background: #fff !important; }
.cal-dots { display: flex; gap: 2px; min-height: 6px; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.cal-year-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.cal-mini-month { border: 1px solid var(--border); background: #fff; border-radius: 12px; padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; font-family: inherit; }
.cal-mini-month:hover { border-color: var(--cal-accent); background: #f7f2fc; }
.cal-mini-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.cal-mini-count { font-size: 11.5px; font-weight: 700; color: var(--cal-accent); min-height: 14px; }
.cal-events-card { background: #f0edf5; border-radius: 16px; padding: 14px 14px 10px; margin-top: 16px; }
.cal-events-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.cal-events-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.cal-count { background: var(--cal-accent); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 8px; }
.cal-events-sub { font-size: 12px; color: var(--muted); margin-left: auto; }
.cal-empty { margin: 4px 0 8px; }
.cal-day-sep { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 8px 2px 6px; }
.cal-ev-card { display: flex; align-items: stretch; background: #fff; border-radius: 12px; margin-bottom: 8px; cursor: pointer; box-shadow: 0 1px 3px rgba(35,32,43,.08); overflow: hidden; }
.cal-ev-card:hover, .cal-ev-card:focus-visible { box-shadow: 0 3px 10px rgba(79,0,140,.16); outline: none; }
.cal-ev-bar { flex: 0 0 5px; background: var(--ev-color); }
.cal-ev-main { padding: 10px 12px; min-width: 0; flex: 1; }
.cal-ev-subject { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.cal-ev-time { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cal-ev-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cal-ev-ticker { font-size: 11.5px; font-weight: 700; color: var(--cal-accent); background: #f3eefb; border-radius: 8px; padding: 1px 8px; }
.cal-undated { border-top: 1px dashed #d8d3e2; margin-top: 10px; padding-top: 2px; }
@media (max-width: 560px) {
  .calendar-card { max-width: 100%; padding: 14px 14px; }
  .modal-overlay { padding: 16px 8px; }
}

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .actions { flex-wrap: wrap; }
  .modal-card { padding: 14px 16px; }
}

/* ---- What's new banner ---- */
.whatsnew { margin: 10px 24px 0; background: #fff; border: 1px solid var(--border); border-left: 5px solid var(--stc-purple); border-radius: 10px; box-shadow: 0 1px 3px rgba(35,32,43,.08); overflow: hidden; }
.whatsnew-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px 4px; }
.whatsnew-title { font-size: 13.5px; font-weight: 700; color: var(--stc-purple); }
.whatsnew-dismiss { border: none; background: none; cursor: pointer; font-size: 12px; color: var(--muted); padding: 4px 6px; border-radius: 6px; }
.whatsnew-dismiss:hover, .whatsnew-dismiss:focus-visible { background: #f3eefb; color: var(--stc-purple); outline: none; }
.whatsnew-list { list-style: none; margin: 0; padding: 4px 14px 12px; }
.whatsnew-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed #eceaf2; align-items: flex-start; }
.whatsnew-item:last-child { border-bottom: none; padding-bottom: 0; }
.whatsnew-icon { flex: 0 0 auto; font-size: 15px; line-height: 1.4; }
.whatsnew-body { min-width: 0; }
.whatsnew-item-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.whatsnew-item-title a { color: var(--stc-purple); text-decoration: none; }
.whatsnew-item-title a:hover { text-decoration: underline; }
.whatsnew-item-detail { font-size: 12px; color: var(--muted); margin-top: 1px; }
.whatsnew-date { flex: 0 0 auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; padding-top: 2px; }
.whatsnew-kind { display: inline-block; font-size: 10.5px; font-weight: 700; border-radius: 8px; padding: 0 7px; margin-left: 6px; vertical-align: 1px; }
.whatsnew-kind.ingestion { background: #e8f4ec; color: var(--green); }
.whatsnew-kind.calendar { background: #f3eefb; color: var(--stc-purple); }
.whatsnew-kind.system { background: #fdf3e0; color: var(--amber); }
#btn-whatsnew { position: relative; }
.whatsnew-badge { position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--stc-magenta); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
@media (max-width: 720px) {
  .whatsnew { margin: 10px 12px 0; }
  .whatsnew-item { flex-wrap: wrap; }
  .whatsnew-date { width: 100%; padding-top: 0; order: 3; }
}

/* Refresh button spin */
@keyframes refreshSpin { to { transform: rotate(360deg); } }
#btn-refresh.spinning svg { animation: refreshSpin .8s linear infinite; }
#btn-refresh:disabled { opacity: .6; cursor: default; }

/* Lower-is-better KPIs (cost structure, investment): green on the left */
#view-scorecard .sc-track.sc-track-lower { background: linear-gradient(90deg, #1BCED8 0%, #00C48C 28%, #FFDD40 50%, #FF6A39 72%, #FF375E 100%); }

/* KPI engine: collapsible valid-identifiers list */
.kpi-ids { margin: 6px 0; }
.kpi-ids summary { cursor: pointer; color: var(--stc-purple, #4F008C); font-size: 12.5px; font-weight: 600; user-select: none; }
.kpi-ids[open] summary { margin-bottom: 4px; }

/* scorecard per-cohort flag dots */
#view-scorecard td.flagcell { width: 28px; text-align: center; }

/* scorecard scale min/max end labels */
#view-scorecard .sc-minmax { display: flex; justify-content: space-between; font-size: 11px; color: #B8B8B8; margin: 0 2px -2px; user-select: none; }


/* Overview heatmaps — one unified table: KPI | local cells | gap | GCC cells */
.hm-wrap { display: flex; gap: 14px; margin-top: 18px; align-items: flex-start; overflow-x: auto; }
.hm-unified { width: 100%; }
.hm-unified .hm-tbl { width: 100%; table-layout: fixed; }
.hm-tbl { border-collapse: collapse; }
.hm-tbl th { padding: 2px 3px; }
.hm-tbl th.hm-khead { width: 150px; text-align: left; font-size: 14px; color: var(--stc-purple, #4F008C); padding: 0 8px 2px 0; }
.hm-tbl th.hm-grp { text-align: center; font-size: 13px; color: var(--stc-purple, #4F008C); padding-bottom: 2px; }
.hm-tbl th.hm-pcol { font-size: 11px; color: #8E9AA0; font-weight: 600; white-space: nowrap; text-align: center; overflow: hidden; }
.hm-gap { width: 28px; min-width: 28px; border: none !important; background: transparent !important; }
.hm-cell { height: 28px; border: none; text-align: center; font-size: 10px; color: #B0B0B0; cursor: default; }
.hm-cell.hm-val { font-size: 10.5px; font-weight: 600; color: rgba(0,0,0,0.72); white-space: nowrap; overflow: hidden; }
.hm-na { background: #F1F1F1; }
.hm-zero { background: #E9E9E9; color: #8E9AA0; font-weight: 600; }
.hm-klabel { width: 150px; font-size: 11px; color: #404040; white-space: nowrap; height: 28px; text-align: left; padding: 0 10px 0 2px; border-top: 1px solid transparent; border-bottom: 1px solid transparent; }
.hm-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 3px; }
.sc-title-sub { font-size: 0.72em; font-weight: 500; color: #606060; }

/* === Overview tab redesign (reference layout): top cards, scorecard table, heatmap panels === */
#view-scorecard .ov-top { display: grid; grid-template-columns: minmax(260px, 1fr) 2fr; gap: 14px; margin: 6px 0 16px; align-items: stretch; }
#view-scorecard .ov-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(35,32,43,.06); }
#view-scorecard .ov-card-title { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: var(--stc-purple); }
#view-scorecard .ov-legend-card .sc-legend { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; margin: 0; }
#view-scorecard .ov-kpi-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
#view-scorecard .ov-kpi-head .ov-card-title { margin: 0; }
#view-scorecard .sc-kpi-select { padding: 6px 10px; font-size: 13px; border: 1px solid var(--stc-purple); border-radius: 8px; background: #fff; color: var(--stc-purple); font-weight: 600; max-width: 100%; }
#view-scorecard .ov-kpi-card .sc-sliders { margin-bottom: 0; }
#view-scorecard .ov-kpi-card .sc-slider { padding: 26px 30px 30px; border-bottom: none; }
#view-scorecard .ov-kpi-card .sc-slider:nth-child(even) { background: transparent; }
#view-scorecard .ov-kpi-card .sc-missing { padding: 10px 30px; }

/* Scorecard table: purple header, full width, horizontal scroll + sticky first column on narrow screens */
#view-scorecard .ov-table-card { padding: 0; overflow: hidden; }
#view-scorecard .sc-table-wrap { overflow-x: auto; }
#view-scorecard .sc-tbl { width: 100%; min-width: 620px; }
#view-scorecard .sc-tbl thead th { background: var(--stc-purple); color: #fff; font-weight: 600; border-bottom: none; }
#view-scorecard .sc-tbl tbody tr:hover { background: #F8F4FC; }
#view-scorecard .sc-tbl th:first-child, #view-scorecard .sc-tbl td:first-child { position: sticky; left: 0; z-index: 2; background: #fff; }
#view-scorecard .sc-tbl thead th:first-child { background: var(--stc-purple); z-index: 3; }
#view-scorecard .sc-tbl td.sc-ncell { white-space: nowrap; }
#view-scorecard .sc-tbl td.sc-ncell .flag { margin-left: 7px; vertical-align: -1px; }
#view-scorecard .ov-table-card .n-note { padding: 10px 16px 12px; margin: 0; }

/* Heatmaps: legend strip + shared KPI label column + two panels (equal cell widths, no borders) */
#view-scorecard .hm-legend-strip { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin: 22px 0 12px; font-size: 12px; color: #404040; }
#view-scorecard .hm-legend-strip span { display: inline-flex; align-items: center; gap: 6px; }
#view-scorecard .hm-legend-note { color: var(--muted); font-size: 11px; }
#view-scorecard .hm-key-na { background: #F1F1F1; border: 1px solid #ddd; }
#view-scorecard .hm-panels { display: flex; gap: 16px; align-items: flex-start; }
#view-scorecard .hm-kcol { flex: 0 0 150px; min-width: 0; }
#view-scorecard .hm-kcol-head { height: 22px; font-size: 13px; font-weight: 700; color: var(--stc-purple); display: flex; align-items: center; }
#view-scorecard .hm-kcol-sub { height: 26px; }
#view-scorecard .hm-kcol .hm-klabel { height: 28px; display: flex; align-items: center; font-size: 11px; color: #404040; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#view-scorecard .hm-panel { flex: 1 1 0; min-width: 0; }
#view-scorecard .hm-panel-title { height: 22px; font-size: 13px; font-weight: 700; color: var(--stc-purple); text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#view-scorecard .hm-panel .hm-tbl { width: 100%; table-layout: fixed; border-collapse: collapse; }
#view-scorecard .hm-panel .hm-tbl thead th { background: transparent; color: #8E9AA0; position: static; }
#view-scorecard .hm-panel .hm-pcol { height: 26px; font-size: 11px; font-weight: 600; text-align: center; padding: 2px 3px; }
#view-scorecard .hm-panel .hm-cell { height: 28px; padding: 0 2px; border: none; text-align: center; box-sizing: border-box; }
#view-scorecard .hm-panel .hm-tbl td.hm-klabel { height: 28px; padding-top: 0; padding-bottom: 0; box-sizing: border-box; }
#view-scorecard .hm-mob { display: none; }
#view-scorecard .hm-klabel-h { width: 110px; }

/* Mobile / narrow: keep Legend + KPI cards SIDE BY SIDE in one compact row
   (owner reference); legend becomes a narrow left column, slider card takes the
   rest. Heatmap panels still stack; table keeps sticky-column scroll. */
@media (max-width: 860px) {
  #view-scorecard .ov-top { grid-template-columns: minmax(120px, 34%) 1fr; gap: 10px; }
  #view-scorecard .ov-card { padding: 10px 12px; }
  #view-scorecard .ov-legend-card .sc-legend { gap: 6px; font-size: 11px; }
}
@media (max-width: 720px) {
  #view-scorecard .ov-top { gap: 8px; margin: 4px 0 12px; }
  #view-scorecard .ov-card { padding: 9px 10px; border-radius: 10px; }
  #view-scorecard .ov-card-title { font-size: 12.5px; margin-bottom: 7px; }
  #view-scorecard .ov-legend-card .sc-legend { gap: 5px; font-size: 10.5px; line-height: 1.25; }
  #view-scorecard .ov-legend-card .sc-legend span { flex-wrap: wrap; }
  #view-scorecard .ov-kpi-head .ov-card-title { font-size: 12.5px; }
  #view-scorecard .sc-kpi-select { font-size: 11.5px; padding: 4px 7px; max-width: 46%; }
  #view-scorecard .ov-kpi-card .sc-slider { padding: 24px 8px 28px; }
  #view-scorecard .ov-kpi-card .sc-missing { padding: 10px 8px; }
  #view-scorecard .hm-panels { flex-direction: column; }
  #view-scorecard .hm-kcol { display: none; }
  #view-scorecard .hm-panel { flex: none; width: 100%; }
  #view-scorecard .hm-mob { display: table-cell; }
  #view-scorecard .hm-panel .hm-klabel { width: 96px; max-width: 96px; font-size: 10.5px; color: #404040; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; padding: 0 6px 0 0; }
  #view-scorecard .hm-klabel-h { width: 96px; }
  #view-scorecard .hm-panel .hm-tbl { min-width: 0; }
  #view-scorecard .hm-scroll { overflow-x: auto; }
  /* Scorecard table: ALL six columns fit the viewport — no horizontal scroll */
  #view-scorecard .sc-table-wrap { overflow-x: visible; }
  #view-scorecard .sc-tbl { min-width: 0; table-layout: fixed; font-size: 10.5px; }
  #view-scorecard .sc-tbl th, #view-scorecard .sc-tbl td { padding: 4px 3px; }
  #view-scorecard .sc-tbl thead th { font-size: 10px; white-space: normal; line-height: 1.25; }
  #view-scorecard .sc-tbl th:nth-child(1), #view-scorecard .sc-tbl td:nth-child(1) { width: 32%; }
  #view-scorecard .sc-tbl th:nth-child(4), #view-scorecard .sc-tbl th:nth-child(6) { width: 11%; }
  #view-scorecard .sc-tbl td:first-child { white-space: normal; line-height: 1.25; }
  #view-scorecard .sc-tbl th:first-child, #view-scorecard .sc-tbl td:first-child { position: static; }
  #view-scorecard .sc-tbl td { overflow: hidden; }
  #view-scorecard .sc-tbl td.sc-ncell .flag { margin-left: 3px; width: 9px; height: 9px; }
}
@media (max-width: 420px) {
  #view-scorecard .ov-top { grid-template-columns: minmax(104px, 32%) 1fr; gap: 6px; }
  #view-scorecard .ov-card { padding: 8px 8px; }
  #view-scorecard .ov-legend-card .sc-legend { font-size: 10px; }
  #view-scorecard .sc-sw { width: 11px; height: 11px; }
  #view-scorecard .sc-dot { width: 9px; height: 9px; }
  #view-scorecard .ov-kpi-card .sc-slider { padding: 22px 6px 26px; }
  #view-scorecard .sc-kpi-select { font-size: 11px; padding: 4px 6px; }
  #view-scorecard .sc-box { font-size: 11px; padding: 2px 7px; }
  #view-scorecard .sc-zones span { font-size: 10.5px; }
  #view-scorecard .sc-minmax { font-size: 10px; }
}

/* === home-v2 viewport fit (pure CSS, no JS sizing) ===
   While the scorecard view is active, pin the whole shell to the viewport and
   let the iframe flex-fill whatever height remains below the topbar, hint,
   banners and tab bar. Banner show/hide, window resize and orientation change
   are absorbed by the flex layout itself — renderHomeV2() no longer measures
   or polls anything. Other tabs keep normal document flow and page scroll. */
body:has(#view-scorecard:not(.hidden)) {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body:has(#view-scorecard:not(.hidden)) #app-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
body:has(#view-scorecard:not(.hidden)) main {
  flex: 1;
  min-height: 0;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
}
#view-scorecard {
  flex: 1;
  min-height: 0; /* overrides the generic .view min-height:300px on short windows */
  display: flex;
  flex-direction: column;
}
#home-v2-frame {
  flex: 1;
  min-height: 0 !important; /* overrides the inline min-height:70vh fallback */
  width: 100%;
}

/* Shell tab switch: view fades/rises in. display:none -> block on tab change
   replays the animation automatically. Transform/opacity only — the flex
   layout and iframe measurement are untouched. */
@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.view { animation: viewIn 0.28s ease-out; }
@media (prefers-reduced-motion: reduce) {
  .view { animation: none !important; }
}

/* ---- Onboarding tour (tour.js) — stc-purple spotlight over a dimmed backdrop ---- */
.tour-overlay { position: fixed; inset: 0; z-index: 10000; }
.tour-dim {
  position: absolute; inset: 0;
  background: rgba(20, 8, 34, 0.62);
  animation: tourFadeIn 0.25s ease-out;
}
.tour-ring {
  position: absolute;
  display: none;
  border-radius: 16px;
  pointer-events: none;
  box-shadow:
    0 0 0 9999px rgba(20, 8, 34, 0.62),
    0 0 0 2px rgba(168, 110, 220, 0.95),
    0 0 22px 5px rgba(79, 0, 140, 0.55);
  transition: left 0.3s ease, top 0.3s ease, width 0.3s ease, height 0.3s ease;
}
.tour-card {
  position: absolute;
  max-width: 340px;
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 12px 32px rgba(20, 8, 34, 0.35);
  animation: tourTipIn 0.25s ease-out;
}
.tour-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.tour-title { font-size: 13px; font-weight: 700; color: #1F2937; }
.tour-count { font-size: 10px; font-weight: 600; color: #9CA3AF; }
.tour-body { font-size: 12px; line-height: 1.45; color: #6B7280; margin-bottom: 12px; }
.tour-foot { display: flex; align-items: center; gap: 8px; }
.tour-dots { display: flex; gap: 4px; flex: 1; }
.tour-dot { height: 5px; border-radius: 999px; transition: all 0.25s ease; }
.tour-skip {
  background: none; border: none; padding: 4px 6px;
  font-size: 12px; color: #9CA3AF; cursor: pointer;
}
.tour-skip:hover { color: #6B7280; }
.tour-next {
  border: none; cursor: pointer;
  font-size: 12px; font-weight: 700; color: #fff;
  background: #4F008C;
  padding: 7px 16px; border-radius: 999px;
  transition: transform 0.12s ease, background 0.15s ease;
}
.tour-next:hover { background: #5f14a0; }
.tour-next:active { transform: scale(0.95); }
@keyframes tourFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes tourTipIn {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tour-dim, .tour-card { animation: none !important; }
  .tour-ring, .tour-dot, .tour-next { transition: none !important; }
}

/* ==== Right-side sidebars (Account / Settings) — 2026-09-20 header reorg,
   neumorphism redesign (owner reference image): light stc-purple→white gradient
   panel, soft outer shadow, rounded corners; line-art icons + labels; ACTIVE =
   stc-purple pill (never magenta); sub-blocks = soft white rounded containers;
   collapsible to a 64px icon-only rail. transform/opacity/width animations;
   reduced-motion honored below. ==== */
.sb-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(20,8,34,.5); opacity: 1; transition: opacity .22s ease; }
.sb-backdrop.hidden { display: block !important; opacity: 0; pointer-events: none; }
.sb-panel { position: fixed; top: 14px; right: 14px; bottom: 14px; z-index: 90; width: 320px; max-width: 92vw; background: linear-gradient(160deg, #F3EDF9 0%, #FAF8FD 45%, #FFFFFF 100%); border: 1px solid rgba(79,0,140,.08); border-radius: 24px; box-shadow: -18px 0 50px rgba(35,20,60,.22), -2px 2px 8px rgba(79,0,140,.06), inset 0 1px 0 rgba(255,255,255,.85); transform: translateX(0); opacity: 1; transition: transform .24s cubic-bezier(.22,.8,.35,1), opacity .24s ease, width .24s cubic-bezier(.22,.8,.35,1); display: flex; flex-direction: column; font-family: 'STC Forward', "Segoe UI", system-ui, sans-serif; overflow: hidden; }
.sb-panel.hidden { display: flex !important; transform: translateX(calc(100% + 20px)); opacity: 0; pointer-events: none; visibility: hidden; transition: transform .24s cubic-bezier(.22,.8,.35,1), opacity .24s ease, visibility 0s .24s; }
.sb-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; border-bottom: 1px solid rgba(79,0,140,.10); }
.sb-title { font-size: 15px; font-weight: 700; color: var(--stc-purple); letter-spacing: -.01em; flex: 1; }
.sb-collapse { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; border: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--stc-purple); background: #fff; box-shadow: 2px 2px 6px rgba(79,0,140,.14), -2px -2px 6px rgba(255,255,255,.9); transition: box-shadow .18s ease, transform .18s ease; }
.sb-collapse:hover { box-shadow: 3px 3px 8px rgba(79,0,140,.2), -2px -2px 6px rgba(255,255,255,.9); }
.sb-collapse:active { box-shadow: inset 2px 2px 5px rgba(79,0,140,.18), inset -2px -2px 5px rgba(255,255,255,.9); }
.sb-collapse svg { transition: transform .24s ease; }
.sb-collapse.is-collapsed svg { transform: rotate(180deg); }
.sb-body { overflow-y: auto; overflow-x: hidden; padding: 10px 12px 20px; }
.sb-user { padding: 6px 8px 10px; }
/* user-chip inside the sidebar: soft white neumorphic container */
.sb-user .user-chip { background: #fff; border: 1px solid rgba(79,0,140,.10); color: var(--stc-purple); font-weight: 600; box-shadow: 3px 3px 8px rgba(79,0,140,.10), -3px -3px 8px rgba(255,255,255,.9); }
.sb-panel .menu-label { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #8B7FA8; padding: 12px 12px 5px; transition: opacity .18s ease; }
.sb-panel .menu-item { display: flex; flex-direction: row; align-items: center; gap: 11px; width: 100%; text-align: left; background: none; border: none; border-radius: 12px; padding: 10px 12px; font-size: 13.5px; color: #3A3348; cursor: pointer; font-family: inherit; transition: background .16s ease, box-shadow .16s ease, color .16s ease; }
.sb-panel .menu-item:hover, .sb-panel .menu-item:focus-visible { background: #fff; color: var(--stc-purple); outline: none; box-shadow: 3px 3px 9px rgba(79,0,140,.12), -3px -3px 9px rgba(255,255,255,.9); }
.sb-panel .menu-item:active { box-shadow: inset 2px 2px 6px rgba(79,0,140,.14), inset -2px -2px 6px rgba(255,255,255,.85); }
.sb-panel .menu-item.active { background: var(--stc-purple); color: #fff; box-shadow: 4px 4px 12px rgba(79,0,140,.32), -2px -2px 8px rgba(255,255,255,.7); }
.sb-panel .menu-item.active:hover, .sb-panel .menu-item.active:focus-visible { background: var(--stc-purple); color: #fff; }
.sb-panel .menu-item.active .menu-sub { color: rgba(255,255,255,.72); }
.sb-ico { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 20px; }
.sb-label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; transition: opacity .16s ease; }
.sb-panel .menu-sub { font-size: 11.5px; color: var(--muted); font-weight: 400; }
/* sub-blocks (Defaults selects, Appearance toggle) = soft white rounded containers */
.sb-panel .menu-defaults { cursor: default; display: flex; flex-direction: column; align-items: stretch; gap: 8px; background: #fff; border-radius: 16px; padding: 12px; box-shadow: 4px 4px 12px rgba(79,0,140,.10), -4px -4px 12px rgba(255,255,255,.95), inset 0 1px 0 rgba(255,255,255,.8); margin: 4px 2px; width: calc(100% - 4px); }
.sb-panel .menu-defaults:hover { background: #fff; color: var(--ink); box-shadow: 4px 4px 12px rgba(79,0,140,.10), -4px -4px 12px rgba(255,255,255,.95); }
.sb-panel .def-label { display: flex; flex-direction: column; gap: 2px; width: 100%; font-size: 12px; color: var(--muted); font-weight: 500; }
.sb-panel .def-select { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: #FBFAFD; color: var(--ink); font-size: 13px; font-family: inherit; cursor: pointer; box-shadow: inset 1px 1px 3px rgba(79,0,140,.07); }
.sb-panel .def-select:focus { border-color: var(--stc-purple); outline: none; box-shadow: 0 0 0 2px rgba(79,0,140,.12); }
.sb-panel .menu-sep { height: 1px; background: rgba(79,0,140,.08); margin: 8px 6px; }
/* collapsed icon-only rail (reference: left rail) */
.sb-panel.sb-collapsed { width: 64px; }
.sb-panel.sb-collapsed .sb-head { padding: 14px 10px 12px; justify-content: center; }
.sb-panel.sb-collapsed .sb-title, .sb-panel.sb-collapsed .sb-close,
.sb-panel.sb-collapsed .menu-label, .sb-panel.sb-collapsed .menu-sep,
.sb-panel.sb-collapsed .sb-user, .sb-panel.sb-collapsed .menu-defaults { display: none; }
.sb-panel.sb-collapsed .sb-body { padding: 10px 8px 20px; }
.sb-panel.sb-collapsed .menu-item { justify-content: center; padding: 11px 0; border-radius: 14px; gap: 0; }
.sb-panel.sb-collapsed .sb-label { display: none; }
.sb-panel.sb-collapsed .sb-ico { width: 22px; }
.sb-panel.sb-collapsed .sb-ico svg { width: 19px; height: 19px; }
/* theme toggle switch (stc purple track, no magenta) */
.theme-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; cursor: pointer; font-size: 13.5px; color: var(--ink); }
.theme-row .menu-sub { display: block; }
.theme-switch { position: relative; flex: 0 0 auto; display: inline-flex; }
.theme-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.theme-track { width: 40px; height: 22px; border-radius: 999px; background: #D3DAE0; transition: background .18s ease; display: inline-block; position: relative; }
.theme-thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .18s ease; }
.theme-switch input:checked + .theme-track { background: var(--stc-purple); }
.theme-switch input:checked + .theme-track .theme-thumb { transform: translateX(18px); }
.theme-switch input:focus-visible + .theme-track { box-shadow: 0 0 0 2px rgba(79,0,140,.35); }
@media (prefers-reduced-motion: reduce) {
  .sb-panel, .sb-panel.hidden, .sb-backdrop { transition: none !important; }
  .theme-track, .theme-thumb { transition: none !important; }
  .sb-collapse, .sb-collapse svg, .sb-label, .sb-panel .menu-label, .sb-panel .menu-item { transition: none !important; }
}

/* ==== Dark-mode sidebar adaptation (neumorphic surface on the dark palette;
   purple active pills preserved) ==== */
html.dark .sb-panel { background: linear-gradient(160deg, #241B38 0%, #1B1626 55%, #171221 100%); border-color: rgba(168,110,220,.14); box-shadow: -18px 0 50px rgba(0,0,0,.55), -2px 2px 8px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.06); }
html.dark .sb-head { border-bottom-color: rgba(168,110,220,.16); }
html.dark .sb-title { color: #D8BEF2; }
html.dark .sb-collapse { background: #2A2140; color: #D8BEF2; box-shadow: 2px 2px 6px rgba(0,0,0,.5), -2px -2px 6px rgba(255,255,255,.05); }
html.dark .sb-collapse:active { box-shadow: inset 2px 2px 5px rgba(0,0,0,.5), inset -2px -2px 5px rgba(255,255,255,.05); }
html.dark .sb-panel .menu-label { color: #8B84A8; }
html.dark .sb-panel .menu-item { color: #D9D3E8; }
html.dark .sb-panel .menu-item:hover, html.dark .sb-panel .menu-item:focus-visible { background: #2A2140; color: #E2D2F5; box-shadow: 3px 3px 9px rgba(0,0,0,.5), -3px -3px 9px rgba(255,255,255,.04); }
html.dark .sb-panel .menu-item:active { box-shadow: inset 2px 2px 6px rgba(0,0,0,.5), inset -2px -2px 6px rgba(255,255,255,.04); }
html.dark .sb-panel .menu-item.active { background: var(--stc-purple); color: #fff; box-shadow: 4px 4px 12px rgba(79,0,140,.5); }
html.dark .sb-panel .menu-item.active:hover { background: var(--stc-purple); color: #fff; }
html.dark .sb-panel .menu-defaults { background: #221C30; box-shadow: 4px 4px 12px rgba(0,0,0,.45), -4px -4px 12px rgba(255,255,255,.04), inset 0 1px 0 rgba(255,255,255,.05); }
html.dark .sb-panel .menu-defaults:hover { background: #221C30; box-shadow: 4px 4px 12px rgba(0,0,0,.45), -4px -4px 12px rgba(255,255,255,.04); }
html.dark .sb-panel .def-select { background: #1B1626; border-color: #3A3348; color: #F2EFF9; box-shadow: inset 1px 1px 3px rgba(0,0,0,.4); }
html.dark .sb-panel .menu-sep { background: rgba(168,110,220,.12); }
html.dark .sb-user .user-chip { background: #2A2140; border-color: rgba(168,110,220,.2); color: #D8BEF2; box-shadow: 3px 3px 8px rgba(0,0,0,.45), -3px -3px 8px rgba(255,255,255,.04); }

/* ==== Dark mode (desktop shell) — toggled by html.dark, persisted in
   localStorage tpm-shell-theme. Purple header language + purple/teal accents
   preserved; backgrounds shift to the same dark palette as the embedded
   Overview (index.css .dark) so shell and frame read as one surface. ==== */
html.dark { color-scheme: dark; }
html.dark body { background: #121017; color: #F2EFF9; }
html.dark { --bg: #121017; --card: #1B1626; --ink: #F2EFF9; --muted: #A79FBE; --border: #3A3348; }
html.dark .topbar { background: #3A0068; } /* deeper purple at night; brand stays purple */
html.dark .tab { background: #221C30; color: #A79FBE; border-color: var(--border); }
html.dark .tab.active { background: var(--card); color: #D8BEF2; }
html.dark thead th { background: #241B38; color: #D8BEF2; }
html.dark select, html.dark input { background: #221C30; color: #F2EFF9; border-color: #3A3348; }
html.dark .banner { background: #14301F; color: #4ADE80; border-bottom-color: var(--border); }
html.dark .banner.warn { background: #3A2E12; color: #F2B84B; }
html.dark .banner.err { background: #3B1616; color: #F27B7B; }
html.dark .mono-line, html.dark #kpis-body code { background: #241B38; border-color: var(--border); color: #D9D3E8; }
html.dark .popover { background: #1B1626; border-color: #8b5cc2; color: #F2EFF9; box-shadow: 0 10px 28px rgba(0,0,0,.6); }
html.dark .popover h4 { color: #D8BEF2; }
html.dark tr.line-row:hover { background: #241B38; }
html.dark .modal-card { background: #1B1626; box-shadow: 0 16px 48px rgba(0,0,0,.6); }
html.dark .modal-head h2, html.dark form.manual h3 { color: #D8BEF2; }
html.dark .calendar-card { background: #161221; }
html.dark .cal-seg { background: #221C30; }
html.dark .cal-seg-btn.active { background: #2A2140; color: #D8BEF2; }
html.dark .cal-chev, html.dark .cal-day, html.dark .cal-mini-month, html.dark .cal-ev-card { background: #1B1626; color: #F2EFF9; border-color: var(--border); }
html.dark .cal-day.other { background: transparent; color: #5A5470; }
html.dark .cal-day:hover, html.dark .cal-chev:hover, html.dark .cal-mini-month:hover { background: #241B38; }
html.dark .cal-events-card { background: #221C30; }
html.dark .cal-ev-ticker { background: #2A2140; color: #D8BEF2; }
html.dark .cal-details-card { background: #1B1626; }
html.dark .cal-item:hover, html.dark .cal-item:focus-visible { background: #241B38; }
html.dark .whatsnew { background: #1B1626; box-shadow: 0 8px 20px rgba(0,0,0,.5); }
html.dark .whatsnew-dismiss:hover, html.dark .whatsnew-dismiss:focus-visible { background: #241B38; color: #D8BEF2; }
html.dark .whatsnew-item { border-bottom-color: #2A2338; }
html.dark .whatsnew-kind.ingestion { background: #14301F; }
html.dark .whatsnew-kind.calendar { background: #2A2140; }
html.dark .whatsnew-kind.system { background: #3A2E12; }
html.dark .theme-track { background: #3A3348; }
html.dark .btn.icon.dark { border-color: var(--border); color: var(--muted); }
html.dark .hm-na { background: #2A2338; }
html.dark .hm-zero { background: #241F33; color: #8B84A8; }
html.dark .hm-klabel, html.dark #view-scorecard .hm-kcol .hm-klabel, html.dark .hm-legend-strip { color: #C9C4D6; }
html.dark .hm-key-na { background: #2A2338; border-color: #3A3348; }
html.dark .hm-cell { color: #8B84A8; }
html.dark .hm-cell.hm-val { color: rgba(255,255,255,.85); }
html.dark #view-scorecard .sc-kpi-picker select, html.dark #view-scorecard .sc-kpi-select { background: #221C30; color: #D8BEF2; }
html.dark #view-scorecard .sc-slider:nth-child(even) { background: #161221; }
html.dark #view-scorecard .sc-slider { border-bottom-color: #2A2338; }
html.dark #view-scorecard .sc-kpi-name { color: #A79FBE; }
html.dark #view-scorecard .sc-zones span, html.dark #view-scorecard .sc-minmax { color: #6B6488; }
html.dark #view-scorecard .sc-box-stc { background: #3A2154; color: #E2D2F5; }
html.dark #view-scorecard .sc-tbl tbody tr:hover { background: #241B38; }
html.dark #view-scorecard .sc-tbl th:first-child, html.dark #view-scorecard .sc-tbl td:first-child { background: #1B1626; }
html.dark #view-scorecard .sc-tbl thead th:first-child { background: var(--stc-purple); }
html.dark .ov-card { background: #1B1626; }
html.dark .stmt-tab { background: #221C30; color: #A79FBE; border-color: #3A3348; }
html.dark .stmt-tab.active { background: #3A2154; color: #E2D2F5; border-color: #3A2154; }
html.dark #home-v2-frame { background: #121017 !important; }
html.dark .totp-manual, html.dark .totp-secret, html.dark .totp-url { background: #241B38; border-color: var(--border); color: #D9D3E8; }
html.dark .totp-qr-wrap canvas { background: #fff; } /* QR stays scannable */
html.dark .accounts-never { background: #3B1616; }
html.dark #view-cost .cost-title { color: #D8BEF2; border-bottom-color: #8b5cc2; }
html.dark #view-cost .cost-tbl thead th { background: #2A2140; color: #D8BEF2; border-bottom-color: #8b5cc2; }
html.dark #view-cost .cost-tbl tbody tr:hover { background: #241B38; }
html.dark #view-cost .cost-kpi-picker select { border-color: #8b5cc2; color: #D8BEF2; }
html.dark .tour-card { background: #1B1626; }
html.dark .tour-title { color: #F2EFF9; }
html.dark .tour-body { color: #A79FBE; }
.sb-panel .menu-item:disabled { opacity: .55; cursor: default; }
#btn-refresh.spinning { opacity: .55; }

/* ==== Shell-wide neumorphism (2026-09-20, owner-confirmed extension of the
   sidebar redesign) — one soft-UI design system for every shell-owned surface:
   light stc-purple→white gradients (#F3EDF9→#FFFFFF family), 16–24px radii,
   soft layered shadows, raised white sub-containers, purple (never magenta)
   active pills. Visual only — no id/handler changes. Shadow changes are
   instant; the only animated property is transform (press scale), zeroed under
   prefers-reduced-motion. The Overview embed iframe keeps its own contract. ==== */

/* main content surfaces */
.view { background: linear-gradient(160deg, #FAF8FD 0%, #FFFFFF 55%); border: 1px solid rgba(79,0,140,.08); border-radius: 0 16px 16px 16px; box-shadow: 8px 8px 22px rgba(79,0,140,.07), -4px -4px 16px rgba(255,255,255,.85); }
.filters.card, #manual-body.card { background: linear-gradient(160deg, #F3EDF9 0%, #FFFFFF 70%); border: 1px solid rgba(79,0,140,.09); border-radius: 16px; box-shadow: 5px 5px 16px rgba(79,0,140,.08), -4px -4px 14px rgba(255,255,255,.9), inset 0 1px 0 rgba(255,255,255,.8); }
.tab { border-color: rgba(79,0,140,.10); background: linear-gradient(180deg, #F1EAF7, #ECE9F2); }
.tab.active { background: linear-gradient(180deg, #FAF8FD, #FFFFFF); box-shadow: 4px 0 12px rgba(79,0,140,.06); }

/* raised containers for shell-owned cards */
.mono-line { background: #FFFFFF; border: 1px solid rgba(79,0,140,.08); border-radius: 12px; box-shadow: 3px 3px 10px rgba(79,0,140,.07), -3px -3px 10px rgba(255,255,255,.9); }
.whatsnew { background: linear-gradient(160deg, #F7F2FC 0%, #FFFFFF 65%); border: 1px solid rgba(79,0,140,.10); border-left: 5px solid var(--stc-purple); border-radius: 14px; box-shadow: 0 8px 20px rgba(79,0,140,.10); }
.whatsnew-dismiss:hover, .whatsnew-dismiss:focus-visible { background: #fff; box-shadow: 2px 2px 6px rgba(79,0,140,.12), -2px -2px 6px rgba(255,255,255,.9); }
.popover { border-radius: 14px; border: 1px solid rgba(79,0,140,.35); box-shadow: 0 10px 28px rgba(35,20,60,.22); }

/* inputs / selects: soft inset, purple focus ring */
select, input { border: 1px solid rgba(79,0,140,.14); border-radius: 9px; background: #FBFAFD; box-shadow: inset 1px 1px 3px rgba(79,0,140,.06); }
select:focus, input:focus { border-color: var(--stc-purple); outline: none; box-shadow: inset 1px 1px 3px rgba(79,0,140,.06), 0 0 0 2px rgba(79,0,140,.14); }
.login-card input { box-shadow: inset 1px 1px 3px rgba(79,0,140,.05); }

/* shell content buttons: raised white default, hover raise, press inset+scale.
   Topbar .btn (on purple) intentionally untouched. */
main .btn, .modal-card .btn, .popover .btn, form.manual .btn, #kpis-body .btn {
  background: #FBFAFD; border: 1px solid rgba(79,0,140,.14); color: var(--stc-purple);
  border-radius: 10px; box-shadow: 2px 2px 7px rgba(79,0,140,.10), -2px -2px 7px rgba(255,255,255,.9);
  transition: transform .12s ease;
}
main .btn:hover, .modal-card .btn:hover, .popover .btn:hover, form.manual .btn:hover, #kpis-body .btn:hover {
  filter: none; box-shadow: 3px 3px 10px rgba(79,0,140,.14), -3px -3px 10px rgba(255,255,255,.95);
}
main .btn:active, .modal-card .btn:active, form.manual .btn:active, #kpis-body .btn:active {
  transform: scale(.97); box-shadow: inset 2px 2px 6px rgba(79,0,140,.14), inset -2px -2px 6px rgba(255,255,255,.85);
}
/* primary actions: stc purple pill (replaces magenta fills in shell content) */
#kpis-body .btn.primary, form.manual .btn.primary, .modal-card .btn.primary {
  background: var(--stc-purple); border-color: var(--stc-purple); color: #fff;
  box-shadow: 3px 3px 10px rgba(79,0,140,.28), -2px -2px 8px rgba(255,255,255,.7);
}
#kpis-body .btn.primary:hover, form.manual .btn.primary:hover, .modal-card .btn.primary:hover { filter: none; background: #5C0FA3; }
#kpis-body .btn.primary:active, form.manual .btn.primary:active, .modal-card .btn.primary:active { transform: scale(.97); box-shadow: inset 2px 2px 6px rgba(0,0,0,.3); }
/* statement explorer switcher: lavender active pill gets the soft-shadow lift */
.stmt-tab { transition: transform .12s ease; }
.stmt-tab:hover { box-shadow: 2px 2px 7px rgba(79,0,140,.10), -2px -2px 7px rgba(255,255,255,.9); }
.stmt-tab:active { transform: scale(.97); }
.stmt-tab.active { box-shadow: 3px 3px 10px rgba(79,0,140,.16), -2px -2px 8px rgba(255,255,255,.9); }

/* modals / dialogs: gradient surface, 20px radius, layered shadow */
.modal-card { background: linear-gradient(160deg, #F3EDF9 0%, #FFFFFF 50%); border: 1px solid rgba(79,0,140,.10); border-radius: 20px; box-shadow: 0 20px 60px rgba(35,20,60,.28), inset 0 1px 0 rgba(255,255,255,.85); }
.calendar-card { background: linear-gradient(160deg, #F3EDF9 0%, #FFFFFF 55%); }
.cal-seg { background: #EDE6F5; box-shadow: inset 2px 2px 5px rgba(79,0,140,.10), inset -2px -2px 5px rgba(255,255,255,.8); }
.cal-seg-btn.active { box-shadow: 2px 2px 7px rgba(79,0,140,.16), -2px -2px 7px rgba(255,255,255,.9); }
.cal-day { box-shadow: 2px 2px 6px rgba(79,0,140,.06), -2px -2px 6px rgba(255,255,255,.8); }
.cal-day.selected { box-shadow: 3px 3px 10px rgba(79,0,140,.32); }
.cal-mini-month { box-shadow: 2px 2px 8px rgba(79,0,140,.07), -2px -2px 8px rgba(255,255,255,.85); }
.cal-mini-month:hover { box-shadow: 3px 3px 10px rgba(79,0,140,.14), -3px -3px 10px rgba(255,255,255,.9); }
.cal-ev-card { box-shadow: 3px 3px 10px rgba(79,0,140,.08), -3px -3px 10px rgba(255,255,255,.85); }
.cal-ev-card:hover, .cal-ev-card:focus-visible { box-shadow: 4px 4px 14px rgba(79,0,140,.16), -3px -3px 10px rgba(255,255,255,.9); }
.cal-details-card { background: linear-gradient(160deg, #FBF9FE, #FFFFFF); box-shadow: 3px 3px 12px rgba(79,0,140,.08); }
.cal-chev { box-shadow: 2px 2px 6px rgba(79,0,140,.10), -2px -2px 6px rgba(255,255,255,.9); }
.cal-events-card { background: #F3EEF8; box-shadow: inset 2px 2px 6px rgba(79,0,140,.07), inset -2px -2px 6px rgba(255,255,255,.7); }
.totp-manual { background: #FBFAFD; box-shadow: inset 1px 1px 4px rgba(79,0,140,.06); }
.totp-secret, .totp-url { background: #fff; box-shadow: inset 1px 1px 3px rgba(79,0,140,.07); }
.accounts-never { box-shadow: inset 1px 1px 3px rgba(180,30,30,.12); }
.login-card { box-shadow: 0 20px 40px -8px rgba(20,8,34,.35), 0 8px 16px -8px rgba(20,8,34,.25), inset 0 1px 0 rgba(255,255,255,.9); }
.tour-card { background: linear-gradient(160deg, #F7F2FC, #FFFFFF); box-shadow: 0 14px 36px rgba(20,8,34,.32), inset 0 1px 0 rgba(255,255,255,.9); }
.tour-next { box-shadow: 2px 2px 8px rgba(79,0,140,.3); }

@media (prefers-reduced-motion: reduce) {
  main .btn, .modal-card .btn, .popover .btn, form.manual .btn, #kpis-body .btn, .stmt-tab { transition: none !important; }
  main .btn:active, .modal-card .btn:active, form.manual .btn:active, #kpis-body .btn:active, .stmt-tab:active { transform: none !important; }
}

/* ---- dark palette adaptation (mirrors the sidebar adaptation) ---- */
html.dark .view { background: linear-gradient(160deg, #1E1830 0%, #1B1626 55%); border-color: rgba(168,110,220,.12); box-shadow: 8px 8px 22px rgba(0,0,0,.45), -4px -4px 16px rgba(255,255,255,.03); }
html.dark .filters.card, html.dark #manual-body.card { background: linear-gradient(160deg, #241B38 0%, #1B1626 60%); border-color: rgba(168,110,220,.14); box-shadow: 5px 5px 16px rgba(0,0,0,.45), -4px -4px 14px rgba(255,255,255,.03), inset 0 1px 0 rgba(255,255,255,.05); }
html.dark .tab { background: linear-gradient(180deg, #241D36, #221C30); border-color: rgba(168,110,220,.14); }
html.dark .tab.active { background: linear-gradient(180deg, #241B38, #1B1626); box-shadow: 4px 0 12px rgba(0,0,0,.4); }
html.dark .mono-line { background: #221C30; border-color: rgba(168,110,220,.12); box-shadow: 3px 3px 10px rgba(0,0,0,.4), -3px -3px 10px rgba(255,255,255,.03); }
html.dark .whatsnew { background: linear-gradient(160deg, #241B38 0%, #1B1626 60%); border-color: rgba(168,110,220,.16); border-left-color: #8b5cc2; box-shadow: 5px 5px 16px rgba(0,0,0,.45); }
html.dark .whatsnew-dismiss:hover, html.dark .whatsnew-dismiss:focus-visible { background: #2A2140; box-shadow: 2px 2px 6px rgba(0,0,0,.45); }
html.dark .popover { background: #1B1626; box-shadow: 8px 8px 24px rgba(0,0,0,.55); }
html.dark select, html.dark input { background: #171221; border-color: #3A3348; box-shadow: inset 1px 1px 3px rgba(0,0,0,.45); }
html.dark select:focus, html.dark input:focus { border-color: #8b5cc2; box-shadow: inset 1px 1px 3px rgba(0,0,0,.45), 0 0 0 2px rgba(139,92,194,.25); }
html.dark main .btn, html.dark .modal-card .btn, html.dark .popover .btn, html.dark form.manual .btn, html.dark #kpis-body .btn {
  background: #2A2140; border-color: rgba(168,110,220,.18); color: #D8BEF2;
  box-shadow: 2px 2px 7px rgba(0,0,0,.45), -2px -2px 7px rgba(255,255,255,.04);
}
html.dark main .btn:hover, html.dark .modal-card .btn:hover, html.dark #kpis-body .btn:hover { box-shadow: 3px 3px 10px rgba(0,0,0,.55), -3px -3px 10px rgba(255,255,255,.05); }
html.dark main .btn:active, html.dark .modal-card .btn:active, html.dark #kpis-body .btn:active { box-shadow: inset 2px 2px 6px rgba(0,0,0,.5), inset -2px -2px 6px rgba(255,255,255,.04); }
html.dark #kpis-body .btn.primary, html.dark form.manual .btn.primary, html.dark .modal-card .btn.primary {
  background: var(--stc-purple); border-color: var(--stc-purple); color: #fff; box-shadow: 3px 3px 10px rgba(79,0,140,.5);
}
html.dark #kpis-body .btn.primary:hover, html.dark form.manual .btn.primary:hover, html.dark .modal-card .btn.primary:hover { background: #5C0FA3; }
html.dark .stmt-tab:hover { box-shadow: 2px 2px 7px rgba(0,0,0,.45); }
html.dark .stmt-tab.active { box-shadow: 3px 3px 10px rgba(0,0,0,.5); }
html.dark .modal-card { background: linear-gradient(160deg, #241B38 0%, #1B1626 55%); border-color: rgba(168,110,220,.16); box-shadow: 0 20px 60px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.05); }
html.dark .calendar-card { background: linear-gradient(160deg, #241B38 0%, #171221 60%); }
html.dark .cal-seg { background: #1B1626; box-shadow: inset 2px 2px 5px rgba(0,0,0,.45), inset -2px -2px 5px rgba(255,255,255,.03); }
html.dark .cal-seg-btn.active { background: #2A2140; box-shadow: 2px 2px 7px rgba(0,0,0,.5); }
html.dark .cal-day { background: #1B1626; box-shadow: 2px 2px 6px rgba(0,0,0,.4), -2px -2px 6px rgba(255,255,255,.03); }
html.dark .cal-day.selected { background: var(--stc-purple); box-shadow: 3px 3px 10px rgba(79,0,140,.5); }
html.dark .cal-mini-month { background: #1B1626; box-shadow: 2px 2px 8px rgba(0,0,0,.4), -2px -2px 8px rgba(255,255,255,.03); }
html.dark .cal-ev-card { background: #1B1626; box-shadow: 3px 3px 10px rgba(0,0,0,.4), -3px -3px 10px rgba(255,255,255,.03); }
html.dark .cal-details-card { background: #1B1626; box-shadow: 3px 3px 12px rgba(0,0,0,.45); }
html.dark .cal-chev { background: #2A2140; box-shadow: 2px 2px 6px rgba(0,0,0,.45), -2px -2px 6px rgba(255,255,255,.04); }
html.dark .cal-events-card { background: #171221; box-shadow: inset 2px 2px 6px rgba(0,0,0,.45), inset -2px -2px 6px rgba(255,255,255,.03); }
html.dark .totp-manual { background: #1B1626; box-shadow: inset 1px 1px 4px rgba(0,0,0,.45); }
html.dark .totp-secret, html.dark .totp-url { background: #171221; box-shadow: inset 1px 1px 3px rgba(0,0,0,.45); }
html.dark .tour-card { background: linear-gradient(160deg, #241B38, #1B1626); box-shadow: 0 14px 36px rgba(0,0,0,.6); }
html.dark .login-card { background: #1B1626; }
html.dark .login-card input { background: #171221; color: #F2EFF9; border-color: #3A3348; }
html.dark .login-card .auth-card-title, html.dark .auth-card-title { color: #F2EFF9; }
html.dark .login-card input:focus { border-color: #8b5cc2; }

/* ==== Export popup modal (2026-09-20) — card-tile options per owner reference:
   centered modal, dimmed backdrop, ✕ close, 3 group tiles in a row (rounded,
   soft shadows, purple accent when selected) + revealed sub-option buttons ==== */
.export-card { max-width: 640px; background: linear-gradient(160deg, #FAF8FD, #FFFFFF); border-radius: 20px; box-shadow: 0 14px 40px rgba(35,32,43,.28); padding: 22px 24px; }
.export-hint { margin: 4px 0 16px; font-size: 12.5px; color: var(--muted); }
.export-groups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.export-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 18px 12px 14px; background: #fff; border: 2px solid transparent; border-radius: 16px; cursor: pointer; font-family: inherit; color: var(--ink); box-shadow: 4px 4px 12px rgba(79,0,140,.10), -4px -4px 12px rgba(255,255,255,.95), inset 0 1px 0 rgba(255,255,255,.8); transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.export-tile svg { color: var(--stc-purple); }
.export-tile-title { font-size: 13.5px; font-weight: 700; color: var(--stc-purple); }
.export-tile-sub { font-size: 11.5px; line-height: 1.45; color: var(--muted); }
.export-tile:hover, .export-tile:focus-visible { transform: translateY(-2px); box-shadow: 6px 8px 18px rgba(79,0,140,.16), -4px -4px 12px rgba(255,255,255,.95); outline: none; }
.export-tile:active { transform: scale(.98); box-shadow: inset 2px 2px 6px rgba(79,0,140,.12), inset -2px -2px 6px rgba(255,255,255,.9); }
.export-tile.selected { border-color: var(--stc-purple); background: #FBFAFD; box-shadow: 6px 8px 18px rgba(79,0,140,.18), inset 0 1px 0 rgba(255,255,255,.9); }
.export-subpanel { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; padding: 14px; background: rgba(79,0,140,.04); border-radius: 14px; box-shadow: inset 2px 2px 6px rgba(79,0,140,.07), inset -2px -2px 6px rgba(255,255,255,.85); }
.export-subpanel.hidden { display: none; }
.export-action { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 16px; background: #FBFAFD; border: 1px solid var(--border); border-radius: 12px; font-size: 13px; font-weight: 600; color: var(--stc-purple); cursor: pointer; font-family: inherit; box-shadow: 3px 3px 8px rgba(79,0,140,.10), -3px -3px 8px rgba(255,255,255,.95); transition: transform .16s ease, box-shadow .16s ease; }
.export-action-sub { font-size: 11px; font-weight: 400; color: var(--muted); }
.export-action:hover, .export-action:focus-visible { transform: translateY(-1px); box-shadow: 4px 6px 12px rgba(79,0,140,.16); outline: none; }
.export-action:active { transform: scale(.97); box-shadow: inset 2px 2px 5px rgba(79,0,140,.12); }
.sb-chev { margin-left: auto; color: var(--muted); font-size: 15px; line-height: 1; }
@media (max-width: 640px) {
  .export-groups { grid-template-columns: 1fr; }
  .export-tile { flex-direction: row; text-align: left; align-items: flex-start; }
  .export-tile .export-tile-sub { display: block; }
}
html.dark .export-card { background: linear-gradient(160deg, #241B38, #1B1626); box-shadow: 0 14px 40px rgba(0,0,0,.55); }
html.dark .export-hint { color: #8B84A8; }
html.dark .export-tile { background: #221C30; color: #D9D3E8; box-shadow: 4px 4px 12px rgba(0,0,0,.45), -4px -4px 12px rgba(255,255,255,.04), inset 0 1px 0 rgba(255,255,255,.05); }
html.dark .export-tile:hover, html.dark .export-tile:focus-visible { box-shadow: 6px 8px 18px rgba(0,0,0,.55), -4px -4px 12px rgba(255,255,255,.04); }
html.dark .export-tile:active { box-shadow: inset 2px 2px 6px rgba(0,0,0,.5), inset -2px -2px 6px rgba(255,255,255,.04); }
html.dark .export-tile.selected { border-color: #A86EDC; background: #2A2140; }
html.dark .export-tile-title, html.dark .export-action { color: #D8BEF2; }
html.dark .export-tile svg { color: #D8BEF2; }
html.dark .export-tile-sub, html.dark .export-action-sub { color: #8B84A8; }
html.dark .export-subpanel { background: rgba(0,0,0,.18); box-shadow: inset 2px 2px 6px rgba(0,0,0,.4), inset -2px -2px 6px rgba(255,255,255,.03); }
html.dark .export-action { background: #2A2140; border-color: #3A3348; box-shadow: 3px 3px 8px rgba(0,0,0,.45), -3px -3px 8px rgba(255,255,255,.04); }
html.dark .export-action:active { box-shadow: inset 2px 2px 5px rgba(0,0,0,.5); }
@media (prefers-reduced-motion: reduce) {
  .export-tile, .export-action { transition: none; }
  .export-tile:hover, .export-action:hover { transform: none; }
  .export-tile:active, .export-action:active { transform: none; }
}

/* nested Home PDF scope panel inside the Export modal (2026-09-20) */
.export-subpanel.export-nested { flex-direction: column; align-items: stretch; gap: 8px; width: 100%; margin-top: 2px; background: rgba(79,0,140,.07); }
.export-nested-title { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 2px 2px; }
.export-subpanel.export-nested .export-action { width: 100%; }
html.dark .export-subpanel.export-nested { background: rgba(0,0,0,.28); }

/* in-modal Home PDF custom picker (2026-09-20, one-window escalation) */
.export-custom-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.export-custom-title { font-size: 14px; font-weight: 700; color: var(--stc-purple); }
.export-custom-body { max-height: 46vh; overflow-y: auto; padding: 2px 4px 2px 2px; }
.export-pick-section { margin-top: 14px; }
.export-pick-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.export-pick-title { font-size: 12px; font-weight: 700; color: var(--ink); }
.export-pick-note { font-size: 10.5px; color: var(--muted); }
.export-pick-stmt { display: flex; justify-content: space-between; align-items: center; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 8px 0 4px; }
.export-pick-right { display: inline-flex; align-items: center; gap: 8px; }
.export-selectall { padding: 2px 10px; font-size: 10px; font-weight: 600; }
.export-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.export-chip { padding: 5px 12px; border-radius: 999px; font-size: 11px; font-weight: 500; font-family: inherit; cursor: pointer; background: #EEF0F4; color: #5F6B76; border: 1px solid #D3DAE0; transition: transform .14s ease, box-shadow .14s ease, background .14s ease; }
.export-chip:hover { transform: translateY(-1px); }
.export-chip.on { background: #EFE6F8; color: var(--stc-purple); border-color: rgba(79,0,140,.35); font-weight: 700; box-shadow: 2px 2px 6px rgba(79,0,140,.12), -2px -2px 6px rgba(255,255,255,.9); }
.export-go { margin-top: 16px; width: 100%; padding: 12px; border: none; border-radius: 999px; background: var(--stc-purple); color: #fff; font-size: 13.5px; font-weight: 700; font-family: inherit; cursor: pointer; box-shadow: 4px 4px 12px rgba(79,0,140,.35); transition: transform .14s ease, box-shadow .14s ease; }
.export-go:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 5px 7px 16px rgba(79,0,140,.4); }
.export-go:active:not(:disabled) { transform: scale(.98); }
.export-go:disabled { opacity: .4; cursor: default; }
html.dark .export-custom-title { color: #D8BEF2; }
html.dark .export-pick-title { color: #D9D3E8; }
html.dark .export-chip { background: #2A2140; color: #B5ACCC; border-color: #3A3348; }
html.dark .export-chip.on { background: #3A2A55; color: #E2D2F5; border-color: rgba(168,110,220,.45); box-shadow: 2px 2px 6px rgba(0,0,0,.45); }

/* Benchmark Assessment PPTX picker (batch 29) */
.export-pptx-body { max-height: 50vh; }
.export-pptx-row { display: grid; grid-template-columns: 1.6fr .7fr 1fr 1fr 1fr; gap: 6px; align-items: center; padding: 3px 2px; }
.export-pptx-row.export-pptx-head { font-size: 10.5px; font-weight: 700; color: var(--stc-charcoal,#1d252d); opacity: .65; text-transform: uppercase; letter-spacing: .03em; }
.export-pptx-label { font-size: 12.5px; font-weight: 600; }
.export-pptx-fy { font-size: 12px; font-weight: 700; color: var(--stc-purple,#4f008c); text-align: right; padding-right: 4px; }
.export-pptx-row input { width: 100%; padding: 5px 8px; border: 1px solid #d7dce1; border-radius: 8px; font-size: 12px; font-family: inherit; }
.export-pptx-row input:focus { outline: 2px solid rgba(79,0,140,.35); border-color: var(--stc-purple,#4f008c); }
