/* Taager Control Tower skin (v1.4.0) — loaded AFTER style.css, overrides tokens + components. */
:root {
  --radius: 14px; --radius-sm: 9px; --ease: cubic-bezier(.2,.7,.2,1);
  --accent: #2dd4a8; --accent-ink: #04251d;
  --bg: #04070b; --bg2: #070b11; --panel: #0b111a; --panel2: #0f1722; --panel3: #141e2c;
  --line: #17212e; --line-light: #223044; --line2: #223044;
  --text: #f6f8fb; --text2: #aab6c6; --text-dim: #74839a; --dim: #4f5d71;
  --blue: #2dd4a8; --purple: #a78bfa; --green: #34d399; --red: #fb7185; --orange: #fbbf24;
  --info: #60a5fa;
}
body { background: radial-gradient(900px 380px at 85% -10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%), var(--bg) fixed; font-size: 14px; line-height: 1.45; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---- sidebar ---- */
.sidebar { width: 248px; background: color-mix(in srgb, var(--bg2) 90%, transparent); backdrop-filter: blur(14px); border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.sidebar::before { display: none; }
.sidebar-brand { padding: 18px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.brand-title { display: flex; align-items: center; gap: 10px; background: none; padding: 0; font-size: 15px; font-weight: 700; letter-spacing: -.01em; color: var(--text); -webkit-text-fill-color: var(--text); }
.brand-title::before { content: "T"; width: 34px; height: 34px; flex: none; border-radius: 11px; display: grid; place-items: center; font-weight: 800; color: var(--accent-ink); background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #000)); box-shadow: 0 6px 16px -8px var(--accent); }
.sidebar-nav { padding: 14px 10px; gap: 2px; overflow-y: auto; }
.nav-item { position: relative; gap: 10px; padding: 9px 11px; border-radius: 10px; border-left: 0 !important; color: var(--text2); font-weight: 500; transition: background .15s var(--ease), color .15s var(--ease), transform .12s var(--ease); }
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item:active { transform: translateY(1px) scale(.99); }
.nav-item.active { background: color-mix(in srgb, var(--accent) 13%, var(--panel)); color: var(--text); border-radius: 10px; }
.nav-item.active::before { content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--accent); }
.nav-icon { width: 8px; height: 8px; border-radius: 50%; background: var(--line2); flex: none; transition: .2s var(--ease); }
.nav-item.active .nav-icon, .nav-item:hover .nav-icon { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.nav-submenu { padding-left: 22px; border-left: 1px solid var(--line); margin-left: 15px; gap: 2px; }
.nav-item-sub { position: relative; padding: 7px 10px; border-radius: 8px; color: var(--text-dim); font-weight: 500; transition: .15s var(--ease); }
.nav-item-sub:hover { background: var(--panel); color: var(--text); }
.nav-item-sub:active { transform: translateY(1px); }
.nav-item-sub.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); font-weight: 600; }
.sidebar-footer { padding: 12px 14px; border-top: 1px solid var(--line); }

/* ---- topbar ---- */
.topbar { background: color-mix(in srgb, var(--bg2) 82%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); padding: 0 28px; min-height: 64px; position: sticky; top: 0; z-index: 20; }
.topbar-title h1 { font-size: 19px; font-weight: 650; letter-spacing: -.01em; }
.ticker { border-color: var(--line); }
.ticker-track { color: var(--accent); }
.content { padding: 24px 28px 60px; }

/* ---- buttons: Control Tower look + press feel ---- */
.btn, .btn-primary, .btn-outline { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel); color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; transition: background .15s var(--ease), border-color .15s var(--ease), transform .12s var(--ease), filter .15s var(--ease), box-shadow .15s var(--ease); white-space: nowrap; box-shadow: none; }
.btn:hover, .btn-outline:hover { background: var(--panel3); border-color: color-mix(in srgb, var(--accent) 38%, var(--line2)); transform: none; box-shadow: none; }
.btn:active, .btn-primary:active, .btn-outline:active { transform: translateY(1px) scale(.985); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); box-shadow: 0 8px 20px -10px var(--accent); transform: none; }
.btn.small, .btn.sm { min-height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.danger { background: color-mix(in srgb, var(--red) 14%, var(--panel)); border-color: color-mix(in srgb, var(--red) 40%, var(--line2)); color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text2); }
.btn[disabled], .btn.disabled { opacity: .45; pointer-events: none; }
.segmented-btn { border-radius: 8px; transition: .15s var(--ease); }
.segmented-btn:active { transform: translateY(1px); }
.segmented-btn.active { background: var(--accent) !important; color: var(--accent-ink) !important; border-color: var(--accent) !important; }

/* ---- inputs ---- */
select, input[type=text], input[type=search], input[type=number], input[type=date], input[type=password], input[type=email], textarea, .form-input { border-radius: 9px; border: 1px solid var(--line2); background: var(--panel); color: var(--text); transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
select:hover, input:hover { border-color: color-mix(in srgb, var(--accent) 30%, var(--line2)); }
select:focus, input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); outline: none; }
.filter-group select { border-radius: 9px; min-height: 36px; }

/* ---- cards / panels / tables ---- */
.hover-glow, .metric-card, .panel, .summary-panel, .seg-section-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 12px 32px -18px rgba(0,0,0,.7); transition: border-color .2s var(--ease), transform .2s var(--ease); }
.metric-card:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); transform: translateY(-2px); }
.metric-card.highlight-card { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 9%, var(--panel)), var(--panel)); }
.metric-title { color: var(--text-dim); font-weight: 600; letter-spacing: .02em; }
.metric-value { letter-spacing: -.02em; }
.data-table th { background: var(--panel2); color: var(--text-dim); font-weight: 600; letter-spacing: .03em; border-bottom: 1px solid var(--line); }
.data-table th.sorted { color: var(--accent); }
.data-table tbody tr { transition: background .12s var(--ease); }
.data-table tbody tr:hover td { background: color-mix(in srgb, var(--accent) 6%, var(--panel2)); }
.table-responsive { border-radius: 12px; }
.badge-outline, .badge-status, .seg-badge { border-radius: 20px; }
.progress-bar { border-radius: 10px; background: var(--panel3); }
.toast { border-radius: 12px; border: 1px solid var(--line2); background: var(--panel2); }
.text-blue { color: var(--accent) !important; }
.view-section { transition: opacity .3s var(--ease), transform .3s var(--ease); }
.spinner { border-top-color: var(--accent) !important; }

/* ---- Control Tower additions (tower.js) ---- */
.tw-page { max-width: 1180px; display: flex; flex-direction: column; gap: 18px; }
.tw-head h2 { font-size: 20px; margin: 0 0 4px; letter-spacing: -.01em; }
.tw-head p { margin: 0; color: var(--text-dim); font-size: 13px; }
.tw-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 0 12px 32px -20px rgba(0,0,0,.7); }
.tw-card h3 { margin: 0 0 12px; font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.tw-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tw-muted { color: var(--text-dim); font-size: 12px; }
.tw-pill { white-space: nowrap; flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text2); }
.tw-pill.good { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, var(--line2)); }
.tw-pill.warn { color: var(--orange); border-color: color-mix(in srgb, var(--orange) 40%, var(--line2)); }
.tw-pill.bad { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--line2)); }
.tw-tgt { display: flex; flex-direction: column; gap: 10px; }
.tw-tgt-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.tw-tgt b { font-size: 14px; }
.tw-drop { border: 1.5px dashed var(--line2); border-radius: 12px; padding: 14px; text-align: center; color: var(--text-dim); font-size: 12px; cursor: pointer; transition: .15s var(--ease); }
.tw-drop:hover, .tw-drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); color: var(--text); }
.tw-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tw-table th { text-align: left; font-size: 11px; letter-spacing: .04em; color: var(--text-dim); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tw-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tw-table select, .tw-table input { min-height: 32px; padding: 0 8px; width: 100%; }
.tw-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 14px; }
.tw-check { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 5px 8px; border-radius: 8px; cursor: pointer; transition: background .12s; }
.tw-check:hover { background: var(--panel2); }
.tw-check input { accent-color: var(--accent); width: 15px; height: 15px; }
.tw-check.grp { font-weight: 700; grid-column: 1 / -1; margin-top: 8px; color: var(--text); border-bottom: 1px solid var(--line); border-radius: 0; }
.tw-banner { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 9000; display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 14px; background: var(--panel2); border: 1px solid color-mix(in srgb, var(--orange) 50%, var(--line2)); box-shadow: 0 18px 40px -16px rgba(0,0,0,.8); font-size: 13px; }
.tw-msg { font-size: 12px; min-height: 16px; }
.tw-msg.ok { color: var(--green); } .tw-msg.err { color: var(--red); }
@media (max-width: 860px) { .sidebar { width: 200px; } .content { padding: 16px; } }
.tw-off { display: none !important; }

/* ---- hubs (tabs inside one sidebar item) ---- */
.tw-hub .nav-caret { display: none !important; }
.tw-hub + .nav-submenu { display: none !important; }
.tw-tabs { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 18px; }
.tw-tabgroup { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.tw-tab { border: 0; background: transparent; color: var(--text2); font-weight: 600; font-size: 13px; padding: 8px 14px; border-radius: 9px; cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease), transform .12s var(--ease), box-shadow .15s var(--ease); }
.tw-tab:hover { background: var(--panel2); color: var(--text); }
.tw-tab:active { transform: translateY(1px) scale(.985); }
.tw-tab.on { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 14px -6px var(--accent); }

/* ---- Performance Merchant's: calmer layout ---- */
#viewMerchantPerformance > section + section, #viewAcmPerformance > section + section { margin-top: 20px; }
#viewMerchantPerformance .panel, #viewAcmPerformance .panel { padding: 0; overflow: hidden; }
#viewMerchantPerformance .panel-head-modern, #viewAcmPerformance .panel-head-modern { padding: 16px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--panel2), var(--panel)); }
#viewMerchantPerformance .panel-title-wrapper h2 { font-size: 15px; letter-spacing: -.01em; }
#viewMerchantPerformance .table-responsive { padding: 0 8px 8px; }
#viewMerchantPerformance .data-table th { position: sticky; top: 0; z-index: 1; }
#viewMerchantPerformance .data-table td, #viewMerchantPerformance .data-table th { padding-top: 11px; padding-bottom: 11px; }
#viewMerchantPerformance .summary-panel, #viewAcmPerformance .summary-panel { padding: 20px; }
#viewMerchantPerformance .table-controls input { min-height: 36px; padding: 0 12px; }

/* ---- Merchants toolbar + stats (Control Tower style) ---- */
.tw-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.tw-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.tw-stat span { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-dim); font-weight: 600; }
.tw-stat b { font-size: 20px; letter-spacing: -.02em; }
.tw-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.tw-grow { flex: 1; }
.tw-search input { min-width: 280px; min-height: 36px; padding: 0 12px; }

/* ---- pinned sidebar footer (Control Tower layout) ---- */
.sidebar { position: sticky; top: 0; height: 100vh; }
.sidebar-nav { flex: 1; min-height: 0; overflow-y: auto; }
.sidebar-footer { display: flex; flex-direction: column; gap: 12px; flex: none; text-transform: none; letter-spacing: 0; font-family: var(--font, 'Inter', sans-serif); }
#sidebarStatus, #sidebarUpdated, #sidebarVersion { order: 1; font-family: 'JetBrains Mono', monospace; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
#sidebarVersion { margin-top: 0 !important; }
#twViewAs { order: 2; }
#authUserBadge { order: 3; }
#twViewAs label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
#twViewAs label span { color: var(--text-dim); font-weight: 500; }
#twViewAs select { width: 100%; min-height: 40px; padding: 0 10px; border-radius: 12px; background: var(--panel); }
.auth-profile { padding: 0 !important; margin: 0 !important; border: 0 !important; gap: 11px !important; }
.auth-avatar { width: 38px !important; height: 38px !important; font-size: 13px !important; background: linear-gradient(145deg, #fb7185, #f43f5e) !important; }
.auth-profile-name { font-size: 14px !important; font-weight: 650 !important; color: var(--text) !important; }
.auth-profile-role { font-family: var(--font, 'Inter', sans-serif) !important; text-transform: none !important; letter-spacing: 0 !important; font-size: 12px !important; color: var(--text-dim) !important; margin-top: 1px !important; }
.auth-logout-icon { border-color: var(--line2) !important; border-radius: 9px !important; width: 30px !important; height: 30px !important; }

/* ---- Merchants: calmer stats strip (one card, 4 cells) ---- */
.tw-stats { display: grid !important; grid-template-columns: repeat(4, 1fr); gap: 0 !important; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 18px !important; overflow: hidden; }
.tw-stat { background: transparent !important; border: 0 !important; border-radius: 0 !important; padding: 14px 18px !important; border-right: 1px solid var(--line) !important; }
.tw-stat:last-child { border-right: 0 !important; }
.tw-stat b { font-size: 22px !important; }
@media (max-width: 900px) { .tw-stats { grid-template-columns: repeat(2, 1fr); } }
#viewMerchantPerformance .data-table th, #viewMerchantPerformance .data-table td { font-size: 12.5px; padding-left: 9px !important; padding-right: 9px !important; white-space: nowrap; }
#viewMerchantPerformance .table-responsive { overflow-x: auto; }
.topbar-actions #downloadBtn { }

/* ---- Alerts bell + toast + Alerts Centre ---- */
.tw-bellwrap { position: relative; }
.tw-bell { width: 40px; padding: 0 !important; position: relative; }
.tw-badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 20px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.tw-pop { position: absolute; right: 0; top: 46px; width: 380px; max-height: 70vh; display: flex; flex-direction: column; background: var(--panel2); border: 1px solid var(--line2); border-radius: 14px; box-shadow: 0 24px 50px -16px rgba(0,0,0,.85); z-index: 9500; overflow: hidden; }
.tw-pop.tw-off { display: none !important; }
.tw-pop-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.tw-pop-list { overflow-y: auto; }
.tw-note { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.tw-note:hover { background: var(--panel3); }
.tw-note.unread { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.tw-note .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--green); }
.tw-note .dot.warn { background: var(--orange); } .tw-note .dot.bad { background: var(--red); }
.tw-note-title { font-weight: 650; font-size: 13px; } .tw-note-text { font-size: 12px; color: var(--text2); margin-top: 3px; white-space: pre-wrap; }
.tw-note-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; font-size: 11px; color: var(--text-dim); }
.tw-empty { padding: 28px; text-align: center; color: var(--text-dim); }
.tw-toast { position: fixed; right: 20px; bottom: 20px; z-index: 9999; padding: 11px 16px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line2); box-shadow: 0 18px 40px -16px rgba(0,0,0,.8); font-size: 13px; transition: opacity .4s; }
.tw-toast.bad { border-color: color-mix(in srgb, var(--red) 50%, var(--line2)); } .tw-toast.out { opacity: 0; }
.tw-form { display: flex; flex-direction: column; gap: 16px; }
.tw-field > label:first-child { display: block; font-size: 12px; font-weight: 650; color: var(--text2); margin-bottom: 6px; }
.tw-field textarea { resize: vertical; }
.tw-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; } .tw-chips.dis, .tw-people.dis { opacity: .4; pointer-events: none; }
.tw-chip { padding: 6px 12px; border-radius: 20px; border: 1px solid var(--line2); background: var(--panel); font-size: 12px; font-weight: 600; cursor: pointer; transition: .15s var(--ease); }
.tw-chip.on { background: color-mix(in srgb, var(--accent) 16%, var(--panel)); border-color: var(--accent); color: var(--text); }
.tw-people { max-height: 190px; overflow-y: auto; border: 1px solid var(--line2); border-radius: 10px; padding: 6px; margin-top: 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):not([type=hidden]), textarea { background: var(--panel); color: var(--text); border: 1px solid var(--line2); border-radius: 9px; }

/* ---- simple sidebar status ---- */
#twViewAs.on select { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
#twStatus { order: 1; display: grid; grid-template-columns: 1fr auto; column-gap: 8px; row-gap: 2px; align-items: center; }
#twStatus #sidebarStatus { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-family: var(--font, 'Inter', sans-serif) !important; font-size: 12.5px !important; font-weight: 600; text-transform: none !important; letter-spacing: 0 !important; color: var(--text2); }
#twStatus #sidebarStatus::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent); flex: none; }
#twStatus.warn #sidebarStatus::before { background: var(--orange); box-shadow: 0 0 0 3px color-mix(in srgb, var(--orange) 20%, transparent); }
#twStatus #sidebarUpdated, #twStatus #sidebarVersion { font-family: var(--font, 'Inter', sans-serif) !important; font-size: 11px !important; text-transform: none !important; letter-spacing: 0 !important; color: var(--text-dim); margin: 0 !important; }
#twStatus #sidebarUpdated:empty { display: none; }

/* ---- per-table Export CSV ---- */
.tw-exp { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; margin-left: 10px; border-radius: 9px; border: 1px solid var(--line2); background: var(--panel); color: var(--text2); font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .12s var(--ease); }
.tw-exp:hover { background: var(--panel3); color: var(--text); border-color: color-mix(in srgb, var(--accent) 45%, var(--line2)); }
.tw-exp:hover svg { color: var(--accent); }
.tw-exp:active { transform: translateY(1px) scale(.98); }
.tw-exp.busy { opacity: .6; pointer-events: none; }
.panel-head-modern > .tw-exp { margin-left: auto; align-self: center; }
.table-controls { display: flex; align-items: center; }
.panel-head-modern { align-items: center; }
.panel-head-modern .table-controls { flex-wrap: nowrap !important; flex: none; }
.panel-head-modern .panel-title-wrapper { min-width: 0; flex: 1 1 auto; }

/* Export CSV pinned to the top-right corner of every table panel header */
.panel-head-modern { position: relative; }
.panel-head-modern:has(> .tw-exp) { flex-wrap: wrap; gap: 10px 14px; }
.panel-head-modern:has(> .tw-exp) .panel-title-wrapper { flex: 1 1 280px; max-width: none; }
.panel-head-modern:has(> .tw-exp) > .table-controls { flex: 0 0 auto; width: auto; margin-left: auto; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 0; flex-wrap: wrap !important; }
.panel-head-modern .table-controls input, .panel-head-modern .table-controls select { min-height: 38px; box-sizing: border-box; }
.ticker { display: none !important; }
.panel-head-modern > .tw-exp { position: static !important; margin: 0 0 0 4px !important; align-self: center; flex: none; }

/* sidebar icons (CT style) */
.nav-item .nav-icon { width: 18px !important; height: 18px !important; border-radius: 0 !important; background: none !important; box-shadow: none !important; display: grid; place-items: center; color: var(--text-dim); }
.nav-item .nav-icon svg { transition: transform .2s var(--ease); }
.nav-item:hover .nav-icon { color: var(--text); }
.nav-item:hover .nav-icon svg { transform: scale(1.1); }
.nav-item.active .nav-icon { color: var(--accent); }
.nav-item { font-size: 14px; letter-spacing: -.005em; }
.sidebar-nav .nav-caret { display: grid; place-items: center; font-size: 0; color: var(--text-dim); transition: transform .2s var(--ease), color .15s; }
.sidebar-nav .nav-item:hover .nav-caret { color: var(--text); }
.sidebar-nav .nav-caret.rotate { transform: rotate(180deg); }

.brand-title .bt-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; line-height: 1.1; color: var(--text); -webkit-text-fill-color: var(--text); }
.brand-title .bt-name small { display: block; font-weight: 500; color: var(--muted, var(--text-dim)); -webkit-text-fill-color: currentColor; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; margin-top: 3px; }

/* ===== v1.7.0: CT-style tabs, people table, matrix, alerts, drawer, settings ===== */
.tw-uts { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.tw-ut { background: none; border: 0; color: var(--text-dim); font-weight: 600; font-size: 14px; padding: 12px 18px; cursor: pointer; position: relative; font-family: inherit; transition: color .15s; }
.tw-ut:hover { color: var(--text); }
.tw-ut.on { color: var(--text); }
.tw-ut.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; }
.tw-ubadge { background: var(--red); color: #fff; font-size: 10px; border-radius: 20px; padding: 1px 6px; margin-left: 4px; }
.tw-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tw-grow { flex: 1; }
.tw-ch { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.tw-ch h3 { margin: 0 0 3px; font-size: 16px; }
.tw-scroll { overflow-x: auto; }
.tw-person { display: flex; align-items: center; gap: 12px; }
.tw-av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #04121f; flex: none; }
.tw-pn { font-weight: 650; font-size: 14px; }
.tw-people-t td { padding: 11px 10px; }
.tw-people-t th { text-transform: uppercase; }
.tw-rolechip { appearance: none; -webkit-appearance: none; border: 0 !important; border-radius: 20px; font-weight: 700; font-size: 12px; color: #04121f !important; padding: 4px 12px !important; width: auto !important; min-height: 26px !important; cursor: pointer; }
.tw-rolechip option { color: var(--text); background: var(--panel2); }
.tw-addrow { padding: 12px; margin-bottom: 10px; background: var(--panel2); border-radius: 10px; }
.tw-matrix th.c, .tw-matrix td.c { text-align: center; }
.tw-matrix tr.tw-grp td { font-weight: 700; background: color-mix(in srgb, var(--panel2) 70%, transparent); }
.tw-matrix td.tw-sub { padding-left: 28px; color: var(--text2); }
.tw-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; flex: none; }
.tw-sw { position: relative; display: inline-block; width: 36px; height: 20px; }
.tw-sw input { opacity: 0; width: 0; height: 0; position: absolute; }
.tw-sw span { position: absolute; inset: 0; background: var(--line2); border-radius: 20px; transition: .18s var(--ease); cursor: pointer; }
.tw-sw span::before { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .18s var(--ease); }
.tw-sw input:checked + span { background: var(--accent); }
.tw-sw input:checked + span::before { transform: translateX(16px); background: var(--accent-ink); }
.tw-sw input:disabled + span { opacity: .55; cursor: not-allowed; }
.tw-rolegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.tw-rolecard { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--panel2); transition: .15s var(--ease); }
.tw-rolecard:hover { border-color: var(--line-light); transform: translateY(-1px); }
.tw-rolecard.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--panel2)); }
.tw-rolecard .tw-dot { width: 12px; height: 12px; margin: 0; }
.tw-savebar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.tw-timeline { display: flex; flex-direction: column; }
.tw-tl { display: flex; align-items: flex-start; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.tw-tl:last-child { border-bottom: 0; }
.tw-tl-main { flex: 1; min-width: 0; }
.tw-tl-main p { margin: 4px 0 4px; color: var(--text2); font-size: 13px; }
.tw-tl-act { display: flex; gap: 8px; align-items: center; flex: none; }
.tw-sevbar { width: 3px; align-self: stretch; min-height: 38px; border-radius: 3px; background: var(--info); flex: none; }
.tw-sevbar.warn { background: var(--orange); } .tw-sevbar.bad { background: var(--red); } .tw-sevbar.good { background: var(--accent); }
.tw-new { font-size: 10px; font-weight: 800; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); padding: 2px 7px; border-radius: 6px; margin-left: 6px; }
.tw-tlic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--panel2); border: 1px solid var(--line); flex: none; }
.tw-empty { text-align: center; color: var(--text-dim); padding: 36px 0; }
.tw-empty-ic { font-size: 30px; margin-bottom: 6px; }
.tw-rule { display: grid; grid-template-columns: auto 1.3fr 2fr 90px 110px; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 1100px) { .tw-rule { grid-template-columns: auto 1fr; } }
.tw-mini { display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; border: 1px solid var(--line2); color: var(--text-dim); cursor: pointer; margin: 2px 3px 2px 0; transition: .12s; }
.tw-mini.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 60%, var(--line2)); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tw-num { min-height: 36px; padding: 0 10px; width: 100%; max-width: 110px; }
.tw-sevsel { min-height: 34px; padding: 0 8px; }
.tw-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.tw-field { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.tw-field label { font-size: 12px; font-weight: 650; color: var(--text2); }
/* ACM drawer */
.tw-drawer { position: fixed; inset: 0; z-index: 900; pointer-events: none; }
.tw-dback { position: absolute; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(3px); opacity: 0; transition: opacity .2s; }
.tw-dpanel { position: absolute; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--bg2); border-left: 1px solid var(--line); transform: translateX(100%); transition: transform .22s var(--ease); display: flex; flex-direction: column; box-shadow: -30px 0 80px rgba(0,0,0,.6); }
.tw-drawer.open { pointer-events: auto; } .tw-drawer.open .tw-dback { opacity: 1; } .tw-drawer.open .tw-dpanel { transform: none; }
.tw-dhead { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.tw-dhead h3 { margin: 0 0 3px; font-size: 20px; }
.tw-x { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel); color: var(--text); cursor: pointer; }
.tw-x:hover { background: var(--panel2); }
.tw-dbody { padding: 18px 24px 28px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.tw-dstats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tw-dstat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tw-dstat span { font-size: 10px; font-weight: 700; letter-spacing: .06em; color: var(--text-dim); }
.tw-dstat b { display: block; font-size: 22px; margin-top: 4px; }
.tw-prov { font-size: 12px; color: var(--orange); background: color-mix(in srgb, var(--orange) 10%, transparent); border: 1px solid color-mix(in srgb, var(--orange) 30%, transparent); border-radius: 10px; padding: 8px 12px; }
.tw-tg { margin-bottom: 12px; }
.tw-tg-h { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; }
.tw-mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text2); }
.tw-bar { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; }
.tw-bar i { display: block; height: 100%; border-radius: 8px; background: var(--orange); transition: width .4s var(--ease); }
.tw-bar i.good { background: var(--accent); } .tw-bar i.bad { background: var(--red); }
.tw-score { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; border-top: 1px solid var(--line); }
.tw-score b { font-size: 20px; color: var(--accent); }
.tw-chart { width: 100%; height: auto; }
.tw-grid { stroke: var(--line); stroke-dasharray: 3 4; } .tw-ax { fill: var(--text-dim); font-size: 10px; }
.tw-line { fill: none; stroke: var(--accent); stroke-width: 2; } .tw-area { fill: color-mix(in srgb, var(--accent) 16%, transparent); } .tw-dotc { fill: var(--bg2); stroke: var(--accent); stroke-width: 1.6; }
.tw-table th.r, .tw-table td.r { text-align: right; }
.tw-clickrows tr { cursor: pointer; }
.tw-clickrows tr:hover td { background: color-mix(in srgb, var(--accent) 7%, transparent); }

/* chart hover + edit-user modal (v1.7.1) */
.tw-chartwrap { position: relative; }
.tw-chartwrap .tw-vline { stroke: var(--text-dim); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.tw-chartwrap .tw-hdot { fill: var(--accent); stroke: var(--bg2); stroke-width: 2.5; opacity: 0; }
.tw-chartwrap.hov .tw-vline, .tw-chartwrap.hov .tw-hdot { opacity: 1; }
.tw-chartwrap svg { cursor: crosshair; }
.tw-tip { position: absolute; transform: translateX(-50%); pointer-events: none; background: var(--panel3); border: 1px solid var(--line-light); border-radius: 10px; padding: 7px 12px; font-size: 12px; white-space: nowrap; opacity: 0; transition: opacity .12s; box-shadow: 0 10px 28px -10px rgba(0,0,0,.8); z-index: 2; }
.tw-tip b { font-size: 15px; margin-right: 4px; }
.tw-tip span { display: block; color: var(--text-dim); margin-top: 1px; }
.tw-chartwrap.hov .tw-tip { opacity: 1; }
.tw-prow { cursor: pointer; }
.tw-prow:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.tw-modal { position: fixed; inset: 0; z-index: 950; display: grid; place-items: center; }
.tw-mback { position: absolute; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); }
.tw-mbox { position: relative; width: min(680px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--line-light); border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.7); animation: twPop .18s var(--ease); }
@keyframes twPop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.tw-mhead { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.tw-mhead h3 { margin: 0; font-size: 17px; }
.tw-mbody { padding: 18px 22px; }
.tw-mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.tw-mbody input, .tw-mbody select { min-height: 42px; padding: 0 12px; width: 100%; }
.tw-mfoot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); }
@media (max-width: 560px) { .tw-mgrid { grid-template-columns: 1fr; } }

/* modal actions must wrap inside the box (Worker Sync Status) */
.modal-content .modal-actions { flex-wrap: wrap; justify-content: flex-start; }
#syncStatusModal .modal-actions { gap: 10px; }
.modal-content .modal-actions .btn { white-space: nowrap; }
#syncStatusClose { margin-left: auto; }
.tw-kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
.tw-kv span { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 3px; }
.tw-kv b { font-size: 15px; }

/* ===== v1.8.0 Commercial redesign (commercial.js) ===== */
.nav-hub-child { display: none !important; }
.cx-legacy { display: none !important; }
.cx-ok { --c: #34d399; } .cx-warn { --c: #fbbf24; } .cx-bad { --c: #fb7185; } .cx-na { --c: #74839a; }
.cx-chip { font-style: normal; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); white-space: nowrap; }
#tcNew, #cxCm3 { display: flex; flex-direction: column; gap: 16px; }
.cx-bar-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.cx-pills { display: flex; gap: 6px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); padding: 4px; border-radius: 12px; }
.cx-pill { border: 0; background: transparent; color: var(--text2); padding: 7px 14px; border-radius: 9px; font-weight: 600; font-size: 13px; cursor: pointer; transition: .15s var(--ease); }
.cx-pill:hover { color: var(--text); background: var(--panel2); }
.cx-pill.on { background: color-mix(in srgb, var(--accent) 18%, var(--panel2)); color: var(--text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.cx-range { display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 13px; }
.cx-hero { display: grid; grid-template-columns: 260px 1fr; gap: 14px; }
.cx-score { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.cx-ring { width: 130px; height: 130px; } .cx-ring-bg { fill: none; stroke: var(--line2); stroke-width: 9; }
.cx-ring-fg { fill: none; stroke: var(--c); stroke-width: 9; stroke-linecap: round; transition: stroke-dasharray .5s var(--ease); }
.cx-ring-n { fill: var(--text); font-size: 26px; font-weight: 800; } .cx-ring-s { fill: var(--text-dim); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.cx-score-t { display: flex; flex-direction: column; gap: 6px; align-items: center; } .cx-score-t b { font-size: 16px; } .cx-score-t small { color: var(--text-dim); font-size: 12px; line-height: 1.4; }
.cx-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.cx-kpi { background: var(--panel); border: 1px solid var(--line); border-top: 2px solid var(--c); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.cx-kpi-h { display: flex; justify-content: space-between; align-items: center; color: var(--text2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.cx-kpi-v { font-size: 30px; font-weight: 800; letter-spacing: -.02em; } .cx-kpi-f { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); }
.cx-bar { position: relative; height: 8px; background: var(--line); border-radius: 8px; overflow: hidden; } .cx-bar.sm { height: 6px; }
.cx-bar b { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 8px; transition: width .5s var(--ease); }
.cx-bar u { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text-dim); transform: translateX(-2px); }
.cx-sec-t { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text2); margin-top: 6px; } .cx-sec-t small { text-transform: none; letter-spacing: 0; color: var(--text-dim); font-weight: 500; margin-left: 8px; }
.cx-minis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.cx-mini { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.cx-mini span { font-size: 12px; color: var(--text-dim); } .cx-mini b { font-size: 20px; } .cx-mini em { font-style: normal; font-size: 11.5px; color: var(--text-dim); }
.cx-row { cursor: pointer; } .cx-row:hover td { background: var(--panel2); } .cx-row.cx-on td { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.cx-hero2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.cx-tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.cx-tile.cx-ok, .cx-tile.cx-bad { border-top: 2px solid var(--c); } .cx-tile span { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; } .cx-tile b { font-size: 24px; font-weight: 800; } .cx-tile small { color: var(--text-dim); font-size: 12px; }
.cx-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cx-card { padding: 14px 16px; } .cx-card-h { font-weight: 700; margin-bottom: 10px; } .cx-card-h small { color: var(--text-dim); font-weight: 500; margin-left: 6px; }
.cx-crow { display: grid; grid-template-columns: 1.3fr 1.5fr 60px; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); } .cx-crow:last-child { border: 0; }
.cx-crow span small { display: block; color: var(--text-dim); font-size: 11px; } .cx-crow em { font-style: normal; text-align: right; font-weight: 700; }
.cx-lrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 8px; } .cx-lrow:hover { background: var(--panel2); }
.cx-lrow:last-child { border: 0; } .cx-lrow b { display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; } .cx-lrow small { color: var(--text-dim); font-size: 11px; }
.cx-lr { display: flex; align-items: center; gap: 8px; text-align: right; flex: none; } .cx-lr b { max-width: none; } .cx-empty { color: var(--text-dim); padding: 16px; text-align: center; }
#cm3apTableBody tr { cursor: pointer; } #cm3apTableBody tr:hover td { background: var(--panel2); }
@media (max-width: 900px) { .cx-hero, .cx-grid2 { grid-template-columns: 1fr; } }
#cxCm3 { margin-bottom: 16px; margin-top: 16px; }

.cx-cats { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 12px; }
.cx-cat { background: var(--panel); border: 1px solid var(--line); border-top: 2px solid var(--c); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.cx-cat.cx-gt { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 9%, var(--panel2)), var(--panel)); }
.cx-cat-h { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; } .cx-cat-h b { font-size: 14px; }
.cx-cat-s { font-size: 30px; font-weight: 800; letter-spacing: -.02em; display: flex; align-items: baseline; gap: 6px; } .cx-cat-s small { font-size: 11px; color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.cx-cat-f { display: flex; justify-content: space-between; gap: 6px; font-size: 11.5px; color: var(--text-dim); flex-wrap: wrap; }
.cx-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; } .cx-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); display: inline-block; margin-left: 8px; }
.cx-bar.xs { height: 4px; margin-top: 4px; }
.cx-matrix th:first-child, .cx-matrix td:first-child { position: sticky; left: 0; background: var(--panel); z-index: 1; min-width: 170px; }
.cx-matrix td.cx-cell { text-align: right; vertical-align: top; padding-top: 9px; padding-bottom: 9px; min-width: 130px; }
.cx-cell b { display: block; font-size: 14px; } .cx-cell span { display: block; font-size: 11px; color: var(--text-dim); }
.cx-grp td { background: color-mix(in srgb, var(--accent) 7%, var(--panel2)) !important; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text2); padding: 7px 14px !important; }
.cx-gt-h { color: var(--accent) !important; }
@media (max-width: 1300px) { .cx-cats { grid-template-columns: repeat(3, 1fr); } }
.cx-cat-h { flex-wrap: nowrap !important; } .cx-cat-h .cx-chip { font-size: 10px; padding: 2px 7px; } .cx-cat-h b { font-size: 13px; white-space: nowrap; }

/* ===== v1.9.0 icon buttons + light theme ===== */
.tw-iconbtn { width: 40px; height: 40px; padding: 0 !important; display: inline-grid; place-items: center; border-radius: 12px; }
.tw-iconbtn:hover svg { color: var(--accent); }
.tw-iconbtn.spin svg { animation: twspin .8s linear infinite; } @keyframes twspin { to { transform: rotate(360deg); } }
html[data-theme="light"] {
  --bg: #f3f6fb; --bg2: #ffffff; --panel: #ffffff; --panel2: #f7f9fd; --panel3: #edf1f8;
  --line: #e3e8f1; --line-light: #d3dae8; --line2: #d3dae8;
  --text: #0e1a2e; --text2: #44526b; --text-dim: #6a7791; --dim: #93a0b7;
  --accent: #0ea58a; --accent-ink: #ffffff;
  --blue: #0ea58a; --purple: #7c5cf0; --green: #0f9d6b; --red: #e0444b; --orange: #d98a0a; --info: #2f7de1;
  color-scheme: light;
}
html[data-theme="light"] body { background: radial-gradient(900px 380px at 85% -10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%), var(--bg) fixed; }
html[data-theme="light"] select, html[data-theme="light"] .form-input { color-scheme: light; }
html[data-theme="light"] ::-webkit-scrollbar-thumb { border-color: var(--bg); }
html[data-theme="light"] .panel, html[data-theme="light"] .metric-card, html[data-theme="light"] .cx-kpi, html[data-theme="light"] .cx-cat, html[data-theme="light"] .cx-tile, html[data-theme="light"] .cx-mini { box-shadow: 0 1px 2px rgba(16, 32, 64, .05), 0 6px 18px -10px rgba(16, 32, 64, .12); }
html[data-theme="light"] .nav-item:hover, html[data-theme="light"] .nav-item-sub:hover, html[data-theme="light"] .btn-outline:hover { background: var(--panel3); }
html[data-theme="light"] .btn-outline:hover { border-color: var(--line-light); }
html[data-theme="light"] .table-controls input, html[data-theme="light"] .table-controls select, html[data-theme="light"] .rt-feedback-input,
html[data-theme="light"] .summary-progress-wrapper, html[data-theme="light"] .segmented, html[data-theme="light"] .progress-bar, html[data-theme="light"] .progress-bar.lg { background-color: var(--panel2) !important; color: var(--text); }
html[data-theme="light"] .segmented-btn { color: var(--text2); } html[data-theme="light"] .segmented-btn:hover { color: var(--text); }
html[data-theme="light"] .segmented-btn.active { color: #fff; }
html[data-theme="light"] .data-table th, html[data-theme="light"] .st-summary-table th { background: var(--panel3) !important; color: var(--text2) !important; }
html[data-theme="light"] .data-table td { color: var(--text); border-color: var(--line); }
html[data-theme="light"] .data-table tbody tr:hover td { background: var(--panel2) !important; }
html[data-theme="light"] .st-summary-table tr.st-grand-total td { background: var(--panel3); }
html[data-theme="light"] .modal { background: rgba(15, 27, 46, .35); }
html[data-theme="light"] .modal-content { background: var(--panel); border-color: var(--line); color: var(--text); }
html[data-theme="light"] .lb-rank { background: var(--panel3); color: var(--text); }
html[data-theme="light"] .sidebar { background: #ffffff; }
html[data-theme="light"] .brand-title { color: var(--text); }
html[data-theme="light"] .status-pill, html[data-theme="light"] #authUserBadge { color: var(--text); }
html[data-theme="light"] ::-webkit-scrollbar-track { background: transparent; }
html[data-theme="light"] .presence-pill { background: var(--panel) !important; border-color: var(--line2) !important; }
html[data-theme="light"] .presence-count { color: var(--text) !important; } html[data-theme="light"] .presence-label { color: var(--text-dim) !important; }
html[data-theme="light"] .presence-panel { background: var(--panel) !important; border-color: var(--line2) !important; color: var(--text) !important; }
html[data-theme="light"] .cm3ap-select, html[data-theme="light"] .filter-select, html[data-theme="light"] select { background-color: var(--panel) !important; color: var(--text) !important; border: 1px solid var(--line2); }

/* ---------- Supply Chain (v1.9.0) ---------- */
.sc-src { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-dim); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 8px 6px 12px; }
.sc-dot { width: 8px; height: 8px; border-radius: 50%; background: #fbbf24; box-shadow: 0 0 0 3px rgba(251,191,36,.18); } .sc-dot.live { background: #34d399; box-shadow: 0 0 0 3px rgba(52,211,153,.2); }
.sc-link { border: 0; background: var(--line); color: var(--text); font: inherit; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; cursor: pointer; } .sc-link:hover { background: var(--accent); color: #fff; }
.sc-err { margin-top: 8px; color: #fb7185; font-size: 12.5px; }
.sc-hdr { font-size: 13.5px; color: var(--text-dim); font-weight: 500; }
.sc-stk { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: center; margin: 9px 0; }
.sc-stk-l { font-weight: 600; font-size: 13px; display: flex; flex-direction: column; } .sc-stk-l small, .sc-dl small { color: var(--text-dim); font-weight: 500; font-size: 11.5px; }
.sc-stk-b { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: var(--line); gap: 2px; } .sc-stk-b i { display: block; height: 100%; }
.sc-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--text-dim); } .sc-legend span { display: inline-flex; align-items: center; gap: 6px; } .sc-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sc-drow { display: grid; grid-template-columns: 150px 1fr 90px; gap: 12px; align-items: center; margin: 10px 0; font-size: 13px; }
.sc-dl { font-weight: 600; display: flex; flex-direction: column; } .sc-drow em { font-style: normal; font-weight: 700; text-align: right; display: flex; flex-direction: column; } .sc-drow em small { color: var(--text-dim); font-weight: 500; font-size: 11.5px; }
.sc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 14px 0; }
.sc-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; } .sc-filters input[type=search], .sc-filters select { background: var(--panel-2, var(--panel)); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 13px; }
.sc-filters input[type=search] { min-width: 220px; }
.sc-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.sc-acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 14px 0; }
.sc-act { text-align: left; font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: .15s; }
.sc-act:hover { border-color: var(--accent); transform: translateY(-1px); } .sc-act.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.sc-act span { font-size: 12px; color: var(--text-dim); } .sc-act-n { font-size: 22px; font-weight: 800; margin-top: 6px; } .sc-act small { color: var(--text-dim); font-size: 12px; }
.sc-note { margin: 10px 0; padding: 10px 14px; border-radius: 10px; background: var(--panel); border: 1px dashed var(--line-light, var(--line)); color: var(--text-dim); font-size: 13px; }
.sc-p { color: var(--text-dim); font-size: 13.5px; line-height: 1.5; } .sc-merr { color: #fb7185; font-size: 12.5px; min-height: 16px; margin-top: 6px; }
.sc-mact { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
#scModal .tw-mbox { padding: 22px; } #scModal h3 { margin: 0 0 8px; }
html[data-theme="light"] .sc-link:hover { color: #fff; }
@media (max-width: 700px) { .sc-stk, .sc-drow { grid-template-columns: 1fr; } }
.sc-chk input[type=checkbox] { min-width: 0 !important; width: 16px; height: 16px; padding: 0; margin: 0; accent-color: var(--accent); background: none; box-shadow: none; }
.sc-filters { margin-left: 0; justify-content: flex-start; }
.sc-filters { width: 100%; } .sc-filters select { max-width: 160px; } .sc-filters input[type=search] { min-width: 180px; } .sc-chk { white-space: nowrap; }
html[data-theme="light"] .toast { background: #059669; color: #fff; border: 1px solid #047857; box-shadow: 0 10px 28px rgba(5,150,105,.28); backdrop-filter: none; }
/* light theme — presence popover */
html[data-theme="light"] .presence-panel-title, html[data-theme="light"] .presence-row-name { color: var(--text) !important; }
html[data-theme="light"] .presence-panel-header { border-bottom-color: var(--line) !important; }
html[data-theme="light"] .presence-row:hover { background: var(--bg2, #f1f5f9) !important; }
html[data-theme="light"] .presence-panel-sub, html[data-theme="light"] .presence-row-email, html[data-theme="light"] .presence-empty { color: var(--text-dim) !important; }
html[data-theme="light"] .presence-pill:hover { border-color: var(--line-light, var(--line2)) !important; }

/* light theme – remaining contrast fixes */
html[data-theme="light"] .auth-profile-name { color: var(--text) !important; }
html[data-theme="light"] .auth-profile-role { color: var(--text-dim) !important; }
html[data-theme="light"] .auth-error { color: #dc2626 !important; }
html[data-theme="light"] .st-status-label.orange { color: #b45309 !important; }
html[data-theme="light"] .st-status-label.yellow { color: #a16207 !important; }
html[data-theme="light"] .st-status-label.green { color: #047857 !important; }
html[data-theme="light"] .st-status-label.purple { color: #6d28d9 !important; }
html[data-theme="light"] .st-status-label.gray { color: #64748b !important; }
html[data-theme="light"] .cx-chip.cx-ok { color: #047857 !important; }
html[data-theme="light"] p[style*="252,165,165"], html[data-theme="light"] [style*="rgb(252, 165, 165)"] { color: #dc2626 !important; }
html[data-theme="light"] .error-state p { color: #b91c1c !important; }
html[data-theme="light"] .badge-status.decline, html[data-theme="light"] .badge-status.turned-negative, html[data-theme="light"] .badge-status.stayed-negative, html[data-theme="light"] .contr-pill.bad, html[data-theme="light"] .text-change.negative { color: #b91c1c !important; }
.sc-plan { width: 130px; text-align: right; background: transparent; color: var(--text); border: 1px solid transparent; border-bottom: 1px dashed var(--line-light, var(--line)); border-radius: 6px; padding: 4px 6px; font: inherit; font-variant-numeric: tabular-nums; min-width: 0 !important; }
.sc-plan:hover, .sc-plan:focus { border-color: var(--line-light, var(--line)); outline: none; background: var(--panel); }
/* hub groups (Marketplace): top row = groups, second row = tabs of the active group */
.tw-tabs { flex-direction: column; align-items: flex-start; gap: 10px; }
.tw-grps { background: transparent; border: 0; padding: 0; gap: 8px; }
.tw-tab.tw-grp { border: 1px solid var(--line); background: var(--panel); font-size: 12.5px; letter-spacing: .2px; padding: 7px 16px; border-radius: 999px; }
.tw-tab.tw-grp.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ===== Light theme: form controls (typed text, placeholders, autofill, options) ===== */
html[data-theme="light"] input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]):not([type=file]):not([type=button]):not([type=submit]),
html[data-theme="light"] textarea,
html[data-theme="light"] select { color: #0f172a !important; -webkit-text-fill-color: #0f172a !important; caret-color: #0f172a; background-color: #ffffff; border-color: #cbd5e1; }
html[data-theme="light"] input::placeholder, html[data-theme="light"] textarea::placeholder { color: #94a3b8 !important; -webkit-text-fill-color: #94a3b8 !important; opacity: 1; }
html[data-theme="light"] select option, html[data-theme="light"] select optgroup { color: #0f172a; background: #ffffff; }
html[data-theme="light"] input:-webkit-autofill, html[data-theme="light"] input:-webkit-autofill:focus, html[data-theme="light"] textarea:-webkit-autofill {
  -webkit-text-fill-color: #0f172a !important; caret-color: #0f172a; box-shadow: 0 0 0 1000px #ffffff inset !important; transition: background-color 9999s; }
html[data-theme="light"] input:disabled, html[data-theme="light"] select:disabled, html[data-theme="light"] textarea:disabled { color: #64748b !important; -webkit-text-fill-color: #64748b !important; background-color: #f1f5f9; }
/* login overlay is its own dark card: keep it self-consistent in either theme */
html[data-theme="light"] .auth-form input:not(#a):not(#b):not(#c):not(#d), html[data-theme="light"] .auth-form select:not(#a):not(#b):not(#c):not(#d) {
  color: #fafafa !important; -webkit-text-fill-color: #fafafa !important; caret-color: #fafafa; background-color: #09090b !important; background: #09090b !important; border-color: #27272a; }
html[data-theme="light"] .auth-form input::placeholder { color: #71717a !important; -webkit-text-fill-color: #71717a !important; }
html[data-theme="light"] .auth-form select option { color: #fafafa; background: #18181b; }
html[data-theme="light"] .auth-form input:-webkit-autofill { -webkit-text-fill-color: #fafafa !important; box-shadow: 0 0 0 1000px #09090b inset !important; }


/* ---- Planner DOH (Supply Chain) ---- */
.doh-kpis { margin-bottom: 16px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)) !important; }
.doh-filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin: 16px 0 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(148,163,184,.06); }
.doh-filters label { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--text-dim, #94a3b8); }
.doh-filters label > span:first-child { flex-basis: 100%; text-transform: uppercase; }
.doh-filters label > span:not(:first-child) { font-weight: 500; }
.doh-filters input[type="number"], .doh-filters input[type="search"] { padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 13px; width: 84px; }
.doh-filters input[type="search"] { width: 240px; align-self: flex-end; }
.doh-filters label:has(input[type="checkbox"]) { flex-wrap: nowrap; gap: 6px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; text-transform: none; font-size: 12px; }
#viewDohPlanner .table-responsive { max-height: 68vh; overflow: auto; border-radius: 10px; }
#viewDohPlanner #dohTable thead th { position: sticky; top: 0; z-index: 2; background: var(--panel, var(--bg)); }
#viewDohPlanner #dohTable tbody tr:hover { background: rgba(148,163,184,.08); }

/* ---- Segmentation Panel polish ---- */
#segKpiGrid { margin-bottom: 4px; }
.seg-kpi .metric-value { margin-bottom: 8px; }
.seg-kpi-sub { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; }
.seg-bar { height: 6px; border-radius: 99px; background: rgba(148,163,184,.18); overflow: hidden; }
.seg-bar i { display: block; height: 100%; border-radius: 99px; }
.seg-bar-good { background: #10b981; } .seg-bar-warn { background: #f59e0b; } .seg-bar-bad { background: #ef4444; }
.seg-pill { display: inline-block; min-width: 56px; text-align: center; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; }
.seg-pill-good { background: rgba(16,185,129,.16); color: #10b981; }
.seg-pill-warn { background: rgba(245,158,11,.16); color: #d97706; }
.seg-pill-bad { background: rgba(239,68,68,.16); color: #ef4444; }
.seg-sections-grid .seg-section-card, .seg-total-card { border-top: 3px solid var(--seg-accent, #8b5cf6) !important; overflow: hidden; }
.seg-section-card .data-table tbody tr:hover, .seg-total-card .data-table tbody tr:hover { background: rgba(148,163,184,.08); }
.seg-section-card .data-table thead th, .seg-total-card .data-table thead th { background: rgba(148,163,184,.07); }

/* ---- Over View (v1.13): hero ring + tiles, funnel, average order value ---- */
.ov-hero { display: grid; grid-template-columns: 330px 1fr; margin-bottom: 16px; background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 7%, var(--panel)), var(--panel) 60%) !important; }
.ov-hero-l { padding: 22px 18px 20px; display: flex; flex-direction: column; align-items: center; gap: 14px; border-right: 1px solid var(--line); }
.ov-eq { display: flex; align-items: center; gap: 12px; }
.ov-eq > i { font-style: normal; color: var(--text-dim); font-size: 18px; }
.ov-chip { min-width: 92px; padding: 8px 12px; border: 1px solid var(--line-light); border-radius: 12px; text-align: center; background: var(--panel); display: flex; flex-direction: column; gap: 2px; }
.ov-chip span { font-size: 11px; font-weight: 700; color: var(--text-dim); }
.ov-chip b { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.ov-chip small { font-size: 10.5px; color: var(--text-dim); }
.ov-hero-r { display: grid; grid-template-columns: 1fr 1fr; }
.ov-tile { padding: 18px 22px 12px; display: flex; flex-direction: column; gap: 4px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); min-width: 0; }
.ov-tile:nth-child(2n) { border-right: 0; } .ov-tile:nth-last-child(-n+2) { border-bottom: 0; }
.ov-lbl { font-size: 12px; font-weight: 700; color: var(--text-dim); }
.ov-val { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.ov-sub { font-size: 12px; color: var(--text-dim); }
.ov-spark { margin-top: auto; padding-top: 8px; max-width: 220px; }
.ov-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; margin-bottom: 16px; align-items: stretch; }
.ov-row > .panel { min-width: 0; }
.ov-funnel { padding: 6px 4px 4px; display: flex; flex-direction: column; gap: 22px; }
.ov-fun-top { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.ov-fun-bar { height: 16px; border-radius: 99px; background: var(--panel3); overflow: hidden; }
.ov-fun-bar i { display: block; height: 100%; border-radius: 99px; transition: width .5s var(--ease); }
.ov-fun-row small { display: block; margin-top: 6px; font-size: 12px; color: var(--text-dim); }
.ov-aov { padding: 4px 4px 0; }
.ov-aov-v { font-size: 36px; font-weight: 800; letter-spacing: -.03em; margin-bottom: 4px; }
.ov-spark-wide { max-width: none; padding: 4px 0 10px; }
.ov-aov-rows > div { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.ov-aov-rows span { color: var(--text-dim); }
@media (max-width: 1100px) { .ov-hero { grid-template-columns: 1fr; } .ov-hero-l { border-right: 0; border-bottom: 1px solid var(--line); } .ov-row { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .ov-hero-r { grid-template-columns: 1fr; } .ov-tile { border-right: 0 !important; } }
.chart-empty { height: 100%; display: grid; place-items: center; color: var(--text-dim); font-size: 13px; }
