/* ---- 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: #4E008E;
  --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; }
/* 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; }
.hint { margin: 6px 24px 0; font-size: 12px; color: #777; }
.hint code { background: #f2f2f5; padding: 1px 5px; border-radius: 4px; }
.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; }
.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: #34C759; } .flag.amber { background: #FFCC00; } .flag.red { background: #FF3B30; }
.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 ---- */
.login-screen { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #3a1f5e 0%, var(--stc-purple) 55%, #6b3fa0 100%); }
.login-card { background: #fff; border-radius: 14px; box-shadow: 0 18px 60px rgba(0,0,0,.35); padding: 34px 36px; width: 340px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login-card .logo { align-self: center; }
.login-card h2 { margin: 0; color: var(--stc-purple); font-size: 20px; }
.login-sub { margin: 0 0 6px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.login-card input { padding: 10px 12px; font-size: 14px; }
.login-btn { padding: 10px; font-size: 14px; color: #fff; }
.login-error { min-height: 16px; margin: 0; font-size: 12px; color: var(--red); }
.login-back { background: none; border: none; padding: 0; font-size: 12px; color: var(--muted); cursor: pointer; font-family: inherit; }
.login-back:hover, .login-back:focus-visible { color: var(--stc-purple); outline: none; }
#otp-code { text-align: center; letter-spacing: 8px; font-size: 20px; font-weight: 700; }

/* ---- 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; }
.view-only-banner { margin: 8px 24px 0; padding: 8px 14px; font-size: 12px; color: var(--stc-purple); background: #efeaf7; border: 1px solid var(--border); border-radius: 8px; }

/* === 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: #4E008E; padding-bottom: 5px; border-bottom: 3px solid #4E008E; align-self: flex-start; }
#view-cost .cost-subtitle { margin: 0; font-size: 12px; font-weight: 600; color: #808080; }
#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: #4E008E; font-weight: 600; color: #4E008E; min-width: 220px; }
#view-cost .cost-note { margin: -8px 0 14px; }
#view-cost .cost-tbl thead th { background: #F3E5FF; color: #4E008E; border-bottom: 2px solid #4E008E; }
#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, #FF3B30 0%, #FF9500 28%, #FFCC00 50%, #9BE15D 72%, #34C759 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(78,0,142,.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: #F3E5FF; color: #4E008E; font-weight: 800; }
#view-scorecard .sc-box-bench { background: #808080; color: #fff; font-weight: 600; }
#view-scorecard .sc-box-local { background: #80E5FF; color: #123; 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: #80E5FF; 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: #F3E5FF; 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: #808080; 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-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); }
.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: #f3e5ff; color: var(--stc-purple); border: 1px solid #d9b8f5; }
.cat-Red { background: #fde8e8; color: #b3261e; border: 1px solid #f5b8b8; }
.cat-Green { background: #e6f6ec; color: #1d7a43; border: 1px solid #b2e2c5; }
.cat-Yellow { background: #fdf6dd; color: #8a6d00; border: 1px solid #f0df9a; }
.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 #4E008E) === */
:root { --cal-accent: #4E008E; }
.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(78,0,142,.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(78,0,142,.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, #34C759 0%, #9BE15D 28%, #FFCC00 50%, #FF9500 72%, #FF3B30 100%); }

/* KPI engine: collapsible valid-identifiers list */
.kpi-ids { margin: 6px 0; }
.kpi-ids summary { cursor: pointer; color: var(--stc-purple, #4E008E); 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, #4E008E); padding: 0 8px 2px 0; }
.hm-tbl th.hm-grp { text-align: center; font-size: 13px; color: var(--stc-purple, #4E008E); padding-bottom: 2px; }
.hm-tbl th.hm-pcol { font-size: 11px; color: #808080; 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: #808080; 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; }
/* Viewer role: blur locked tabs behind a magenta lock (magenta = RUN button bg) */
.view.locked { position: relative; min-height: 320px; }
.view.locked > *:not(.lock-overlay) { filter: blur(7px); pointer-events: none; user-select: none; }
.lock-overlay { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; padding-top: 64px; background: rgba(255,255,255,0.35); }
.lock-overlay svg { width: 46px; height: 46px; color: var(--stc-magenta); }
.lock-overlay span { margin-top: 10px; color: var(--stc-magenta); font-weight: 600; font-size: 13px; }
