/* Template Redisoft 1.0.0 adaptation for IEXE. Existing dashboard behavior is retained. */
:root {
  color-scheme: light;
  --primary: #001e42;
  --accent: #0018ff;
  --accent-strong: #2d44ac;
  --iexe-turquoise: #00ffe8;
  --background: #f2f6fb;
  --surface: #ffffff;
  --text: #132e50;
  --muted: #5c7089;
  --border: #dce5ef;
  --neon: #006c78;
  --bg: var(--background);
  --bg-deep: var(--primary);
  --panel: var(--surface);
  --panel-strong: var(--surface);
  --panel-soft: #f7f9fd;
  --shadow: 0 4px 22px #001e4208;
  --glow: none;
  --success: #176044;
  --success-bg: #e8f6ef;
  --warning: #805400;
  --warning-bg: #fff4df;
  --danger: #a52b35;
  --danger-bg: #fcecec;
  --sidebar-text: #ffffff;
  --accent-text: #ffffff;
}
html { scroll-padding-top: 24px; }
body { background: var(--background); font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 14px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
code, pre, .code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline-color: var(--accent); }
.page-shell, .dashboard-page .page-shell { width: 100%; max-width: 1800px; margin: 0 auto; padding: 0 28px 20px; gap: 24px; z-index: auto; }
.workspace { min-width: 0; }
.side { background: var(--primary); padding: 28px 18px 22px; z-index: 40; gap: 0; }
.brand { color: #fff; gap: 12px; min-height: 62px; text-decoration: none; }
.brand .brand-logo { width: 52px; height: 60px; flex: 0 0 52px; object-fit: contain; }
.brand-text { display: grid; gap: 2px; letter-spacing: 0; }
.brand-text strong { font-size: 21px; line-height: 1.1; }
.brand-text small { color: #c0d3eb; font-size: 11px; font-weight: 500; }
.brand .mark { color: var(--primary); background: var(--iexe-turquoise); font-size: 16px; }
.nav { margin-top: 10px; flex: 0 0 auto; overflow: visible; }
.nav-heading { display: block; padding: 0 14px 12px; color: #a4bedc; font-size: 10px; font-weight: 700; letter-spacing: .14em; }
.nav-brand-logo { padding-bottom: 20px; }
.nav-brand-logo img { display: block; width: 112px; height: 34px; object-fit: contain; }
.header-brand-logo { display: block; width: 86px; height: 30px; object-fit: contain; padding: 6px 10px; margin-bottom: 7px; background: var(--primary); border-radius: 6px; }
.nav a, .nav button { display: flex; align-items: center; gap: 13px; width: 100%; padding: 12px 14px; margin: 5px 0; border: 0; border-radius: 10px; background: transparent; color: #e4edf8; font: inherit; font-weight: 550; text-align: left; white-space: nowrap; cursor: pointer; }
.nav a.active { background: var(--iexe-turquoise); color: var(--primary); font-weight: 750; }
.nav a:not(.active):hover, .nav button:hover { background: #ffffff12; color: #fff; outline: none; }
.nav-icon svg { display: block; width: 20px; height: 20px; }
.nav-footer { color: #b5cae4; display: flex; align-items: center; gap: 8px; font-size: 10px; letter-spacing: .1em; margin-top: auto; padding-top: 24px; }
.sidebar-online-dot { height: 6px; width: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--iexe-turquoise); }
.side-toggle { color: var(--primary); background: #fff; border-color: var(--border); top: 24px; }
.sidebar-status { margin-top: auto; padding-top: 24px; min-height: 0; overflow-y: auto; }
.sidebar-status .service-status-card { display: block; position: relative; padding: 16px 12px; background: #ffffff08; border: 1px solid #ffffff1f; border-radius: 12px; box-shadow: none; min-width: 0; max-width: none; color: #fff; }
.sidebar-status .service-status-dot { position: absolute; top: 20px; right: 14px; }
.sidebar-status .service-status-title { color: #c4d8ef; font-size: 10px; letter-spacing: .12em; }
.sidebar-status .service-status-text { color: #fff; font-size: 12px; padding-right: 10px; }
.sidebar-status .service-token-list { margin-top: 12px; gap: 7px; }
.sidebar-status .service-token-row { padding: 8px; border: 1px solid #ffffff0f; border-radius: 8px; background: #ffffff08; }
.sidebar-status .service-token-copy strong { font-size: 11px; color: #fff; }
.sidebar-status .service-token-copy span, .sidebar-status .service-token-copy small { color: #c2d4eb; font-size: 10px; overflow-wrap: anywhere; }
.sidebar-status .meta-connect-button { color: var(--iexe-turquoise); font-size: 11px; border-color: #00ffe847; background: #00ffe80b; width: 100%; }
.shell.collapsed .brand-logo, .shell.collapsed .sidebar-status, .shell.collapsed .nav-heading, .shell.collapsed .nav-footer { display: none; }
.shell.collapsed .brand { justify-content: center; }
.shell.collapsed .nav button { justify-content: center; padding-left: 8px; padding-right: 8px; }
.topbar { display: flex; position: relative; top: auto; height: auto; min-height: 100px; gap: 16px; margin: 0 -28px; padding: 20px 28px; border-width: 0 0 1px; border-radius: 0; background: var(--surface); box-shadow: none; }
.topbar .header-status { display: flex; align-items: flex-start; flex: 0 1 420px; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #f7f9fd; box-shadow: none; min-width: 0; }
.header-status > div { display: grid; grid-template-columns: minmax(120px,1fr) minmax(160px,1.2fr); column-gap: 12px; min-width: 0; width: 100%; }
.header-status .service-status-dot { margin-top: 5px; flex-shrink: 0; }
.header-status .service-status-title { grid-column: 1; font-size: 9px; color: var(--muted); }
.header-status .service-status-text { grid-column: 1; font-size: 11px; color: var(--primary); }
.header-status .service-token-list { grid-column: 2; grid-row: 1 / span 3; margin: 0; gap: 6px; }
.header-status .service-token-row { padding: 0; background: none; border: 0; border-radius: 0; gap: 7px; }
.header-status .service-token-copy strong { color: var(--primary); font-size: 10px; }
.header-status .service-token-copy span, .header-status .service-token-copy small { font-size: 9px; color: var(--muted); overflow-wrap: anywhere; }
.header-status .meta-connect-button { grid-column: 1; justify-self: start; margin-top: 5px; padding: 3px 7px; min-height: 25px; font-size: 10px; border-color: #bfdfdd; color: var(--neon); background: #e6f7f6; }
.header-status .meta-connect-button.is-unconfigured { color: var(--warning); background: var(--warning-bg); border-color: #f0d7a2; }
.brand-lockup { flex: 1; gap: 10px; }
.dashboard-page .topbar h1 { font-size: 23px; line-height: 1.25; letter-spacing: -.65px; color: var(--primary); }
.eyebrow, .section-kicker, .status-kicker, .user-label, .metric-label { color: var(--muted); font-size: 10px; letter-spacing: .1em; }
.topbar .eyebrow { margin-bottom: 4px; }
.topbar-right { flex-wrap: nowrap; gap: 12px; }
.user-session-group { display: flex; align-items: center; gap: 12px; }
.user-card { padding: 0; border: 0; background: none; box-shadow: none; border-radius: 0; min-width: 0; }
.user-card strong { font-size: 12px; }
.user-card p { font-size: 11px; color: var(--muted); }
.user-label { display: none; }
.session-presence-button, .logout-icon-button { width: 36px; height: 36px; border-radius: 10px; box-shadow: none; border: 1px solid var(--border); background: #f7f9fd; color: var(--primary); }
.logout-icon-button { color: var(--danger); background: var(--danger-bg); border-color: #f4d9de; }
.card { margin-top: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: visible; }
h2 { font-size: 19px; line-height: 1.3; letter-spacing: -.35px; color: var(--primary); }
.main-column { gap: 22px; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; padding: 0; overflow: visible; }
.metric-card { min-width: 0; min-height: 148px; padding: 18px; border-top: 3px solid var(--accent); gap: 10px; box-shadow: var(--shadow); }
.metric-label { color: var(--muted); }
.metric-number { color: var(--primary); font-size: 32px; }
.metric-number-compact { font-size: 24px; }
.metric-percent { min-height: 24px; padding: 4px 9px; background: #edf4fc; color: #355a81; border-color: #e1eaf5; font-size: 10px; backdrop-filter: none; }
.metric-note { font-size: 11px; }
.interactive-metric:hover { box-shadow: 0 8px 24px #001e4210; border-color: var(--accent); }
.control-card, .table-card { padding: 22px; }
.toolbar { margin: 0; gap: 12px; }
.dashboard-filters { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-top: 20px; }
#filter-search { grid-column: span 2; }
.date-range-row { grid-column: 1 / -1; }
.date-range-group { max-width: 700px; }
.input { background: var(--surface); color: var(--text); border-color: var(--border); border-radius: 9px; min-height: 43px; font-size: 12px; }
.input::placeholder { color: #7a8ba1; }
.input:focus { border-color: var(--accent); }
.button { border-radius: 9px; padding: 11px 16px; min-height: 43px; font-size: 12px; }
.button.primary { background: var(--accent); color: #fff; }
.button:hover:not(:disabled) { box-shadow: 0 4px 14px #0018ff16; }
.button.secondary, .button.ghost { border-color: var(--border); background: var(--surface); color: var(--primary); }
.button.secondary:hover:not(:disabled), .button.ghost:hover:not(:disabled) { background: #edf4fc; color: var(--primary); border-color: #b7cbe3; }
.multi-select-panel { border-color: var(--border); background: var(--surface); border-radius: 12px; box-shadow: 0 12px 36px #001e421a; }
.multi-select-option { background: #f7f9fd; border-color: var(--border); border-radius: 9px; }
.multi-select-option:hover { background: #edf4fc; border-color: #b7cbe3; }
.selected-pill, .multi-select-badge { background: #e6f7f6; color: var(--neon); border-color: #bfdfdd; }
.selected-pill-close { color: var(--neon); }
.inline-banner { background: var(--warning-bg); color: var(--warning); border-color: #f0d7a2; font-size: 12px; }
.table-wrap { border-radius: 10px; border-color: var(--border); margin-top: 16px; }
.dashboard-table thead th, .stats-table thead th { color: #516b87; background: #f2f6fb; padding: 13px 12px; border-bottom: 1px solid var(--border); }
.dashboard-table tbody tr { background: #fff; }
.dashboard-table tbody tr:nth-child(even) { background: #f8fafd; }
.dashboard-table tbody tr:hover { background: #f0f6fd; }
.dashboard-table td, .stats-table td { border-color: #e6edf5; color: var(--text); font-size: 12px; }
.table-scroll-hint { font-size: 11px; }
.table-wrap::-webkit-scrollbar-track, .stats-table-wrap::-webkit-scrollbar-track { background: #edf2f8; }
.table-wrap::-webkit-scrollbar-thumb, .stats-table-wrap::-webkit-scrollbar-thumb { background: #bacbdf; border-color: #edf2f8; }
.pill { color: #355a81; background: #edf4fc; border-color: #d6e3f2; font-size: 10px; min-height: 26px; margin: 0; padding: 4px 9px; }
.pill.success { color: var(--success); background: var(--success-bg); border-color: #bde3cf; }
.pill.error { color: var(--danger); background: var(--danger-bg); border-color: #efc7cc; }
.pill.info { color: var(--neon); background: #e6f7f6; border-color: #bfdfdd; }
.stage-event-pill:hover { color: var(--primary); border-color: #adc4df; background: #e5eef9; }
.flash { background: var(--surface); }
.flash.error { color: var(--danger); background: var(--danger-bg); }
.flash.warning { color: var(--warning); background: var(--warning-bg); }
.flash.success { color: var(--success); background: var(--success-bg); }
.loader-card { background: var(--surface); color: var(--primary); border-color: var(--border); }
.modal-backdrop { background: #001e4275; }
.modal-card { background: var(--surface); box-shadow: 0 24px 80px #001e4230; overflow: auto; }
.stage-chart-legend-item, .session-presence-status, .session-presence-item, .status-panel { background: #f7f9fd; border-color: var(--border); }
.stage-chart-legend-item:hover, .stage-chart-legend-item.is-active { background: #edf4fc; border-color: #b7cbe3; box-shadow: none; }
.stage-chart-track { stroke: #e5edf6; }
.chart-tooltip { background: var(--surface); border-color: var(--border); box-shadow: 0 12px 36px #001e4220; }
.chart-tooltip-title { color: var(--primary); }
.json-viewer { background: #f4f7fb; border-color: var(--border); color: var(--text); }
.stats-table-wrap { border-color: var(--border); }
.stats-table { background: var(--surface); }
.footer { color: var(--muted); font-size: 10px; padding: 4px 0; flex-wrap: wrap; }
/* Keep chart canvases dark so their existing white SVG/Plotly labels remain readable. */
.funnel-focus-card, .funnel-plot-wrap, .stats-chart-shell { --text: #fff; --muted: #d6dee2; --neon: #00ffe8; color: #fff; }
.stats-chart-head h2 { color: #fff; }
.funnel-focus-card .helper-text, .stats-chart-shell .helper-text { color: #d6dee2; }
.guest-shell .page-shell { padding: 0; max-width: none; gap: 0; }
.login { min-height: calc(100dvh - 50px); }
.login .hero { background: var(--primary); color: #fff; padding: 44px 56px; gap: 60px; }
.login-brand { display: flex; align-items: center; gap: 16px; font-size: 20px; font-weight: 700; }
.login-brand img { width: 60px; height: 72px; object-fit: contain; }
.login-message .eyebrow { color: var(--iexe-turquoise); letter-spacing: .13em; }
.login-message h1 { font-size: clamp(32px,4.3vw,60px); line-height: 1.1; margin-top: 18px; letter-spacing: -1.8px; }
.login-message p { margin-top: 24px; font-size: 16px; }
.login-stages { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; }
.login-stages span { color: #d8e8f9; border: 1px solid #ffffff30; padding: 6px 12px; border-radius: 8px; font-size: 11px; }
.login-brand-footer { font-size: 11px; letter-spacing: .08em; color: #aec6e0; }
.loginbox { min-height: 0; padding: 48px 32px; }
.panel { width: min(440px,100%); padding: 36px; border-radius: 20px; box-shadow: var(--shadow); }
.login-panel-logo { width: 90px; height: 60px; padding: 10px; border-radius: 10px; background: var(--primary); object-fit: contain; display: block; margin-bottom: 26px; }
.panel .eyebrow { color: var(--accent-strong); }
.panel h2 { font-size: 28px; margin-top: 8px; }
.panel .lede { font-size: 13px; line-height: 1.7; margin-top: 12px; }
.panel .hero-actions { display: grid; gap: 16px; margin-top: 26px; }
.panel .google { margin-top: 0; width: 100%; }
.panel .helper-text { font-size: 11px; }
.is-guest .footer { min-height: 50px; justify-content: center; background: var(--surface); padding: 12px 20px; border-top: 1px solid var(--border); }
.flash-stack { padding-top: 16px; }
@media(min-width:1600px) { .metrics-grid { grid-template-columns: repeat(7,minmax(0,1fr)); } }
@media(max-width:1100px) {
  .topbar { flex-wrap: wrap; }
  .topbar .header-status { order: 3; flex-basis: 100%; }
  .metrics-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .topbar-right .user-card p { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
  .dashboard-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .modal-header-split { grid-template-columns: minmax(0,1fr); }
}
@media(max-width:800px) {
  .shell .side { display: none; }
  .shell.mobile-open .side { display: flex; height: 100dvh; }
  .shell.mobile-open .brand-text { display: grid; }
  .shell.mobile-open .brand-logo { display: block; }
  .shell.mobile-open .sidebar-status { display: block; }
  .shell.mobile-open .nav-heading, .shell.mobile-open .nav-footer { display: block; }
  .shell.mobile-open .nav button { justify-content: flex-start; padding: 12px 14px; }
  .page-shell, .dashboard-page .page-shell { padding: 0 18px 18px; gap: 18px; }
  .topbar { margin: 0 -18px; padding: 16px 18px; min-height: 80px; gap: 12px; }
  .topbar .header-status { margin-top: 2px; }
  .dashboard-page .topbar h1 { font-size: 17px; }
  .topbar .eyebrow { font-size: 9px; }
  .topbar .user-card { display: none; }
  .topbar-right { gap: 8px; }
  .user-session-group { gap: 0; }
  .menu-toggle { flex: 0 0 34px; width: 34px; height: 34px; }
  .menu-toggle svg { width: 18px; height: 18px; }
  .metrics-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
  .metric-card { min-height: 135px; padding: 14px 10px; }
  .control-card, .table-card { padding: 18px; }
  .date-range-row { grid-template-columns: 1fr; }
  .date-range-row .button { justify-self: stretch; }
  .modal-card { padding: 22px; }
  .login .hero { display: none; }
  .loginbox { padding: 32px 18px; min-height: calc(100dvh - 72px); }
  .panel { padding: 30px 24px; }
}
@media(max-width:480px) {
  .header-status > div { grid-template-columns: minmax(0,1fr) minmax(0,1.2fr); }
  .metrics-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-filters { grid-template-columns: minmax(0,1fr); }
  #filter-search, .date-range-row { grid-column: 1; }
  .date-range-group { grid-template-columns: minmax(0,1fr); }
  .toolbar { align-items: flex-start; }
  .pagination-bar { gap: 6px; }
  .pagination-bar .button { padding: 8px 10px; }
  .topbar-right { gap: 6px; }
  .session-presence-button, .logout-icon-button { width: 31px; height: 31px; border-radius: 8px; }
  .modal-shell { padding: 12px; }
  .modal-header { padding-right: 68px; }
  .modal-close { top: 16px; right: 16px; padding: 8px 10px; }
}
