:root {
  --navy: #1a3686;
  --navy-900: #10245f;
  --navy-800: #152f78;
  --navy-100: #e9eefc;
  --cyan: #13b7d6;
  --teal: #00a8a8;
  --green: #19a66a;
  --green-dark: #0f7c51;
  --yellow: #ffd22e;
  --amber: #e6a113;
  --red: #d64545;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-soft: #f8faff;
  --ink: #17213a;
  --muted: #6d7890;
  --line: #dde5f2;
  --line-strong: #c9d5e8;
  --shadow: 0 18px 45px rgba(26, 54, 134, 0.09);
  --shadow-hover: 0 22px 60px rgba(26, 54, 134, 0.17);
  --radius: 16px;
  --radius-sm: 12px;
  --ease: 0.3s ease-in-out;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(180deg, #f8faff 0%, var(--bg) 42%);
  color: var(--ink);
  font-family: Cairo, Tajawal, "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

.navigation-progress {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 1000;
  width: 0;
  height: 3px;
  pointer-events: none;
  background: linear-gradient(90deg, var(--cyan), var(--yellow), var(--green));
  box-shadow: 0 6px 16px rgba(19, 183, 214, 0.28);
  opacity: 0;
}

body.is-navigating .navigation-progress {
  width: 82%;
  opacity: 1;
  transition: width 0.55s ease, opacity 0.2s ease;
}

body.is-navigating .shell {
  opacity: 0.72;
  transform: translateY(2px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

body.is-guest {
  display: grid;
  place-items: center;
  overflow-x: hidden;
  background:
    linear-gradient(135deg, rgba(26, 54, 134, 0.04), transparent 32%),
    linear-gradient(180deg, #fbfcff 0%, var(--bg) 100%);
}

body.is-guest .shell {
  width: min(100% - 36px, 520px);
  margin: 0 auto;
  animation: guestPageEntrance 0.9s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

a,
button,
input,
select,
textarea,
.metric,
.panel,
.table-panel,
.outage-card,
.flash,
.pill,
.status-badge,
.side-status {
  transition: all var(--ease);
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

code {
  color: var(--navy);
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(26, 54, 134, 0.03);
}

textarea:focus,
input:focus,
select:focus {
  outline: 3px solid rgba(19, 183, 214, 0.18);
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px rgba(19, 183, 214, 0.18);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: 276px;
  padding: 22px;
  overflow-y: auto;
  background: var(--navy);
  color: #fff;
  box-shadow: 14px 0 38px rgba(16, 36, 95, 0.18);
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0 24%, transparent 24% 100%),
    linear-gradient(160deg, transparent 0 58%, rgba(19, 183, 214, 0.16) 58% 100%);
}

.side-brand,
.side-nav,
.side-status,
.side-logout {
  position: relative;
  z-index: 1;
}

.side-brand {
  margin-bottom: 26px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.16);
}

.brand-mark img {
  display: block;
  width: 42px;
  height: auto;
}

.brand-copy strong,
.brand-copy small,
.brand strong,
.brand small {
  display: block;
}

.brand-copy strong {
  color: #fff;
  font-size: 17px;
  line-height: 1.15;
}

.brand-copy small,
.side-brand small {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 700;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 14px;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 800;
}

.side-nav a:hover,
.side-nav a.active {
  transform: scale(1.02);
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.15);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.side-nav a.active .nav-icon {
  background: var(--yellow);
  color: var(--navy);
}

.side-status {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: auto;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
}

.side-status.offline .status-dot,
.live-chip.offline span:first-child {
  background: var(--red);
  box-shadow: 0 0 0 6px rgba(214, 69, 69, 0.16);
}

.side-status.warning .status-dot,
.side-status.away .status-dot,
.live-chip.warning span:first-child,
.live-chip.away span:first-child {
  background: var(--amber);
  box-shadow: 0 0 0 6px rgba(230, 161, 19, 0.18);
}

.side-status strong,
.side-status small {
  display: block;
}

.side-status small {
  color: rgba(255, 255, 255, 0.68);
  font-weight: 700;
}

.status-dot {
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(25, 166, 106, 0.18);
}

.side-logout .icon-button {
  width: 100%;
  min-height: 44px;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}

.app-frame {
  min-height: 100vh;
  margin-left: 276px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 32px;
  border-bottom: 1px solid rgba(221, 229, 242, 0.86);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(16px);
}

.topbar-kicker,
.topbar-title {
  display: block;
}

.topbar-kicker {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.topbar-title {
  color: var(--navy);
  font-size: 18px;
  font-weight: 900;
}

.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid rgba(25, 166, 106, 0.22);
  border-radius: 999px;
  padding: 0 13px;
  background: #edf9f4;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
}

.live-chip.warning,
.live-chip.away {
  border-color: rgba(230, 161, 19, 0.25);
  background: #fff8e6;
  color: #805a00;
}

.live-chip.offline {
  border-color: rgba(214, 69, 69, 0.22);
  background: #fff0f0;
  color: #9b2c2c;
}

.live-chip.pending {
  border-color: var(--line);
  background: #eef2f7;
  color: #58657c;
}

.live-chip span:first-child {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.live-chip .chip-label {
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
}

.shell {
  width: min(1460px, calc(100% - 48px));
  margin: 28px auto 54px;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.flash {
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow);
}

.flash.success {
  border-color: rgba(25, 166, 106, 0.24);
  background: #edf9f4;
  color: var(--green-dark);
}

.flash.error,
.alert {
  border-color: rgba(214, 69, 69, 0.24);
  background: #fff0f0;
  color: var(--red);
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.hero-heading {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(221, 229, 242, 0.82);
  border-radius: 20px;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(26, 54, 134, 0.08), rgba(19, 183, 214, 0.08)),
    #fff;
  box-shadow: var(--shadow);
}

.hero-heading::after {
  content: "";
  position: absolute;
  inset: auto 24px 0 auto;
  width: 140px;
  height: 86px;
  opacity: 0.09;
  background: url("assets/khazna-loader.gif") center / contain no-repeat;
  pointer-events: none;
}

.page-heading > * {
  position: relative;
  z-index: 1;
}

.page-heading h1 {
  margin: 4px 0 0;
  color: var(--navy);
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: 0;
}

.page-heading .muted {
  max-width: 720px;
  margin: 8px 0 0;
}

.eyebrow {
  margin: 0;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.muted,
.refresh-line,
.hint {
  color: var(--muted);
}

.refresh-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  margin: 12px 0 0;
  border-radius: 999px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.74);
  font-size: 12px;
  font-weight: 800;
}

.refresh-line::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 5px rgba(19, 183, 214, 0.14);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.metric,
.panel,
.table-panel,
.login-panel {
  border: 1px solid rgba(221, 229, 242, 0.9);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel,
.table-panel {
  content-visibility: auto;
  contain-intrinsic-size: 320px;
}

.metric {
  position: relative;
  min-height: 132px;
  overflow: hidden;
  padding: 20px;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--navy);
}

.metric::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 18px;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: var(--navy-100);
}

.metric-total::before,
.metric-total::after {
  background: var(--navy);
}

.metric-active::before,
.metric-active::after {
  background: var(--cyan);
}

.metric-success::before,
.metric-success::after {
  background: var(--green);
}

.metric-handover::before,
.metric-handover::after {
  background: var(--yellow);
}

.metric:hover,
.panel:hover,
.table-panel:hover,
.outage-card:hover {
  transform: scale(1.01);
  box-shadow: var(--shadow-hover);
}

.metric-label,
.metric span {
  display: block;
  max-width: calc(100% - 50px);
  color: var(--muted);
  font-weight: 900;
}

.metric strong {
  display: block;
  margin-top: 12px;
  color: var(--navy);
  font-size: 38px;
  line-height: 1;
}

.metric small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-weight: 700;
}

.stat-pulse {
  animation: statPulse 0.75s ease;
}

.filters {
  display: grid;
  grid-template-columns: 150px 150px 190px 210px minmax(220px, 1fr) auto auto;
  gap: 13px;
  align-items: end;
  margin: 22px 0;
  padding: 16px;
  border: 1px solid rgba(221, 229, 242, 0.92);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
  gap: 16px;
  margin-bottom: 20px;
}

.reply-grid {
  align-items: start;
}

.admin-form {
  display: grid;
  gap: 14px;
}

.admin-form form,
.settings-form {
  display: grid;
  gap: 14px;
}

.settings-form {
  max-width: 1040px;
}

.settings-form h2 {
  margin-top: 6px;
}

.settings-action-cell {
  align-self: end;
  display: flex;
  justify-content: flex-start;
  padding-bottom: 2px;
}

.preset-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: 8px 0 18px;
}

.preset-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.preset-card strong,
.preset-card span {
  display: block;
}

.preset-card span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  margin-top: 4px;
}

.preset-card.active {
  border-color: var(--cyan);
  background: #eefbff;
}

.form-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
  align-items: end;
}

.schedule-row {
  grid-template-columns: minmax(180px, 0.7fr) minmax(260px, 1fr);
}

.time-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.daily-schedule {
  display: grid;
  gap: 10px;
}

.day-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.5fr) minmax(280px, 1fr) minmax(110px, auto);
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(26, 54, 134, 0.04), rgba(0, 178, 169, 0.04));
  box-shadow: 0 12px 26px rgba(20, 38, 86, 0.05);
}

.day-name {
  color: var(--navy);
  font-size: 14px;
  font-weight: 900;
}

.day-hours {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.day-closed {
  justify-content: flex-end;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.check-label input {
  width: 19px;
  min-height: 19px;
  accent-color: var(--navy);
}

.hint {
  margin: -8px 0 4px;
  font-size: 12px;
}

.preview-text {
  max-width: 420px;
  white-space: pre-wrap;
}

.small-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.keyword-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-width: 300px;
  margin-top: 9px;
}

.keyword-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef7ff;
  color: var(--navy);
  font-size: 12px;
  font-weight: 900;
}

.danger {
  color: var(--red);
}

.admin-list {
  display: grid;
  gap: 14px;
}

.outage-card {
  display: grid;
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.outage-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.outage-head strong {
  color: var(--navy);
  font-size: 16px;
}

.outage-page-note,
.outage-runtime-note {
  margin-top: -4px;
}

.outage-auto-disable {
  align-self: end;
  min-height: 44px;
}

.outage-window-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  align-items: end;
}

.outage-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: -4px;
}

.outage-actions,
.settings-redirect-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.save-status {
  min-height: 20px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.save-status.success {
  color: var(--green);
}

.save-status.error {
  color: var(--red);
}

.admin-tools-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.diagnostic-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.diagnostic-summary {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #f8fbff;
  color: var(--ink);
  margin-bottom: 12px;
}

.diagnostic-summary p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.diagnostic-results,
.admin-users-list,
.diagnostic-history-list {
  display: grid;
  gap: 10px;
}

.diagnostic-check {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
}

.diagnostic-check.pass {
  border-color: rgba(25, 166, 106, 0.28);
}

.diagnostic-check.fail {
  border-color: rgba(214, 69, 69, 0.32);
}

.diagnostic-check.skip {
  border-color: rgba(88, 107, 145, 0.28);
}

.diagnostic-check-head,
.diagnostic-history-row,
.admin-user-row,
.admin-user-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.diagnostic-check-head span {
  font-size: 11px;
  font-weight: 900;
  color: var(--muted);
}

.diagnostic-check pre {
  max-height: 260px;
  overflow: auto;
  margin: 10px 0 0;
  padding: 10px;
  border-radius: 10px;
  background: #0f172a;
  color: #e5edf8;
  font-size: 12px;
  white-space: pre-wrap;
}

.diagnostic-history {
  margin-top: 16px;
}

.section-head.compact {
  align-items: center;
  margin-bottom: 10px;
}

.section-head.compact h3 {
  margin: 0;
}

.diagnostic-history-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}

.diagnostic-history-row small {
  display: block;
  color: var(--muted);
  font-weight: 800;
  margin-top: 3px;
}

.admin-user-form {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.user-form-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-user-row {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
}

.admin-user-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 800;
}

.user-setup-box {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(19, 183, 214, 0.32);
  border-radius: 14px;
  padding: 14px;
  background: #f2fcff;
  margin: 12px 0;
}

.settings-redirect-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.settings-redirect-card h2 {
  margin-top: 0;
}

.scenario-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.scenario-manager {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) minmax(420px, 0.9fr);
  gap: 20px;
  min-height: calc(100vh - 210px);
  margin-top: 20px;
}

.scenario-filters,
.scenario-editor-panel {
  padding: 20px;
}

.scenario-list-panel {
  background: #fbfcfd;
}

.scenario-test-box {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.scenario-test-box h4 {
  margin: 0;
  color: var(--navy);
}

.scenario-test-result {
  min-height: 38px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: #fff;
}

.scenario-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.scenario-card:hover,
.scenario-card.active {
  border-color: var(--primary);
  box-shadow: 0 14px 34px rgba(26, 54, 134, 0.10);
  transform: translateY(-1px);
}

.scenario-card-head,
.scenario-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.scenario-card strong {
  color: var(--navy);
  font-size: 14px;
}

.scenario-card p {
  margin: 9px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.scenario-card-meta {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.scenario-card-meta span,
.scenario-flow-note {
  border: 1px solid rgba(211, 222, 241, 0.9);
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--navy);
  background: #f8fbff;
  font-size: 11px;
  font-weight: 900;
}

.scenario-editor-panel[hidden] {
  display: none !important;
}

.scenario-editor-panel {
  padding: 0;
}

.scenario-editor-panel form {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.scenario-check {
  margin: 10px 0 0;
}

.scenario-flow-note {
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 5px;
  line-height: 1.45;
}

.scenario-flow-note span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.scenario-workflow-builder {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.scenario-workflow-nodes {
  display: grid;
  gap: 9px;
}

.scenario-workflow-node {
  display: grid;
  grid-template-columns: 28px minmax(82px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.scenario-workflow-node span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #eef7ff;
  color: var(--navy);
  font-weight: 900;
  font-size: 12px;
}

.scenario-workflow-node strong {
  color: var(--navy);
  font-size: 13px;
}

.scenario-workflow-node small {
  color: var(--muted);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.scenario-editor-actions {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.scenario-preview-panel {
  margin-top: 20px;
  padding: 18px;
}

.scenario-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.scenario-preview-header h3 {
  margin: 0 0 4px;
  color: var(--navy);
}

.scenario-preview-header small {
  color: var(--muted);
  font-weight: 800;
}

.scenario-preview-controls {
  display: flex;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.scenario-preview-controls label:first-child {
  min-width: min(260px, 100%);
}

.scenario-chat-log {
  height: 360px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8fb;
  padding: 16px;
}

.scenario-chat-row {
  display: flex;
  margin-bottom: 12px;
}

.scenario-chat-row.customer {
  justify-content: flex-end;
}

.scenario-chat-row.bot,
.scenario-chat-row.system {
  justify-content: flex-start;
}

.scenario-chat-bubble {
  max-width: min(760px, 78%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  background: #fff;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 10px 22px rgba(14, 30, 64, 0.06);
}

.scenario-chat-row.customer .scenario-chat-bubble {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.scenario-chat-row.system .scenario-chat-bubble {
  background: #fff8e6;
  color: #7a5300;
  border-color: #f4df9c;
}

.scenario-chat-bubble small {
  display: block;
  margin-bottom: 5px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  color: inherit;
  opacity: 0.7;
}

.scenario-chat-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.scenario-chat-options span {
  border: 1px solid rgba(211, 222, 241, 0.95);
  border-radius: 999px;
  padding: 5px 9px;
  background: #f8fbff;
  color: var(--navy);
  font-size: 11px;
  font-weight: 900;
}

.scenario-preview-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.scenario-preview-form textarea {
  min-height: 54px;
  resize: vertical;
}

@media (max-width: 1180px) {
  .scenario-manager {
    grid-template-columns: 1fr;
  }

  .scenario-preview-form {
    grid-template-columns: 1fr;
  }

  .scenario-chat-bubble {
    max-width: 92%;
  }
}

.narrow {
  max-width: 780px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

input,
select {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(26, 54, 134, 0.03);
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.link-button,
.disabled-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 900;
  white-space: nowrap;
}

.primary-button {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 12px 26px rgba(26, 54, 134, 0.18);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover,
.link-button:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-hover);
}

.primary-button:hover {
  background: var(--navy-900);
}

.secondary-button,
.link-button {
  background: #eaf9fb;
  color: var(--navy);
  border-color: rgba(19, 183, 214, 0.24);
}

.secondary-button:hover,
.link-button:hover {
  background: #dff6fa;
  border-color: rgba(19, 183, 214, 0.42);
}

.ghost-button,
.icon-button {
  background: #fff;
  color: var(--navy);
  border-color: var(--line);
}

.ghost-button:hover,
.icon-button:hover {
  border-color: var(--line-strong);
}

.disabled-button {
  background: #eef2f7;
  color: #8893a8;
  border-color: var(--line);
  cursor: not-allowed;
}

.wide-action {
  width: fit-content;
}

.admin-form .wide-action,
.runtime-actions .wide-action {
  width: fit-content;
  max-width: 240px;
  min-height: 42px;
  height: 42px;
  align-self: start;
  padding: 0 20px;
}

.split,
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.panel,
.table-panel {
  padding: 20px;
}

.panel h2,
.table-heading h2 {
  margin: 0 0 15px;
  color: var(--navy);
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

.bar-row + .bar-row {
  margin-top: 15px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  font-weight: 800;
}

.bar-label strong {
  color: var(--navy);
}

.bar-track {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f9;
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--teal));
}

.bar-track.status span {
  background: linear-gradient(90deg, var(--navy), var(--cyan));
}

.table-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.table-heading span {
  color: var(--muted);
  font-weight: 800;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  min-width: 1100px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 13px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

tbody tr {
  transition: all var(--ease);
}

tbody tr:hover {
  background: #f8fbff;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

.actions,
.heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef2f7;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-active_bot,
.status-rating {
  background: #e9f9f2;
  color: var(--green-dark);
}

.status-bot_resolved,
.status-closed,
.status-timeout_closed {
  background: var(--navy-100);
  color: var(--navy);
}

.status-agent_handover,
.status-agent_closed {
  background: #fff6d8;
  color: #946800;
}

.status-error,
.status-bot_unavailable,
.status-high {
  background: #fff0f0;
  color: var(--red);
}

.status-medium {
  background: #fff8e6;
  color: #805a00;
}

.status-low {
  background: #eef2f7;
  color: #58657c;
}

.sla-row-high {
  background: rgba(214, 69, 69, 0.04) !important;
}

.sla-row-medium {
  background: rgba(230, 161, 19, 0.03) !important;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.status-card {
  display: grid;
  gap: 18px;
}

.status-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.status-card-head h2 {
  margin-bottom: 6px;
}

.status-card-head .muted {
  margin: 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-badge.online {
  background: #e9f9f2;
  color: var(--green-dark);
}

.status-badge.offline {
  background: #eef2f7;
  color: #58657c;
}

.status-badge.warning {
  background: #fff8e6;
  color: #805a00;
}

.status-badge.away {
  background: #eaf9fb;
  color: var(--navy);
}

.runtime-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.runtime-facts div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  background: var(--surface-soft);
}

.runtime-facts dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.runtime-facts dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-weight: 900;
}

.runtime-actions {
  display: grid;
  gap: 12px;
  align-content: start;
}

.warning-text {
  margin: 0;
  padding: 13px 14px;
  border: 1px solid rgba(230, 161, 19, 0.25);
  border-radius: var(--radius-sm);
  background: #fff8e6;
  color: #805a00;
  font-weight: 700;
}

.safety-panel {
  max-width: 1040px;
}

.safety-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.security-panel {
  display: grid;
  gap: 18px;
  margin-bottom: 20px;
}

.security-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.security-head h2 {
  margin-bottom: 6px;
}

.security-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.security-grid form,
.security-grid label {
  min-width: 0;
}

.security-code {
  display: flex;
  gap: 10px;
  align-items: end;
}

.setup-key {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
}

.safety-list li + li {
  margin-top: 9px;
}

.confirm-modal {
  width: min(520px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow-hover);
}

.confirm-modal::backdrop {
  background: rgba(16, 36, 95, 0.36);
  backdrop-filter: blur(4px);
}

.confirm-modal form {
  display: grid;
  gap: 14px;
  padding: 24px;
}

.confirm-modal h2,
.confirm-modal p {
  margin: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  max-width: 380px;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  background: var(--navy);
  color: #fff;
  box-shadow: var(--shadow-hover);
}

.toast.error {
  background: var(--red);
}

.empty {
  padding: 36px;
  color: var(--muted);
  text-align: center;
}

.login-layout {
  display: grid;
  width: 100%;
  min-height: 100vh;
  align-items: center;
  padding: 22px 0;
}

.loader-frame {
  display: grid;
  place-items: center;
  width: 160px;
  min-height: 78px;
  border: 1px solid rgba(26, 54, 134, 0.1);
  border-radius: 22px;
  background: linear-gradient(180deg, #fff 0%, #f7f9ff 100%);
  box-shadow:
    0 16px 36px rgba(26, 54, 134, 0.12),
    0 0 0 8px rgba(26, 54, 134, 0.035);
  animation: logoFloat 4.6s ease-in-out infinite;
}

.login-loader-gif {
  display: block;
  width: 130px;
  max-width: 82%;
  height: auto;
}

.admin-title {
  margin: 12px 0 0;
  color: var(--navy);
  font-size: 26px;
  font-weight: 900;
  line-height: 1.08;
}

.admin-subtitle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  width: fit-content;
  margin-top: 10px;
  border: 1px solid rgba(19, 183, 214, 0.18);
  border-radius: 999px;
  padding: 0 14px;
  background: #eefbfe;
  color: var(--navy);
  font-size: 12px;
  font-weight: 900;
}

.login-panel {
  position: relative;
  display: grid;
  gap: 15px;
  width: min(500px, 100%);
  overflow: hidden;
  padding: 32px;
  backdrop-filter: blur(12px);
  border-radius: 26px;
  box-shadow:
    0 28px 70px rgba(26, 54, 134, 0.13),
    0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.login-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--navy), var(--cyan), var(--yellow));
}

.login-panel::after {
  content: "";
  position: absolute;
  inset: 5px 18px auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(26, 54, 134, 0.14), transparent);
}

.login-identity {
  display: grid;
  justify-items: center;
  padding: 2px 0 8px;
  text-align: center;
}

.login-brand {
  display: grid;
  gap: 8px;
  padding-top: 4px;
  text-align: left;
}

.login-panel h1 {
  margin: 3px 0 4px;
  color: var(--navy);
  font-size: 24px;
  line-height: 1.16;
}

.login-panel .muted {
  margin: 0;
}

.otp-field {
  display: grid;
  gap: 8px;
}

.otp-input {
  text-align: center;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.login-security-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-weight: 800;
}

.details {
  display: grid;
  gap: 12px;
  margin: 0;
}

.details div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
}

.details dt {
  color: var(--muted);
  font-weight: 900;
}

.details dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.transcript-panel {
  margin-bottom: 20px;
}

.transcript {
  display: grid;
  gap: 12px;
}

.bubble {
  width: min(760px, 100%);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px 18px 18px 6px;
  background: var(--surface-soft);
}

.bubble.bot,
.bubble.private_note {
  margin-left: auto;
  border-radius: 18px 18px 6px 18px;
  background: #eaf9fb;
}

.bubble.user {
  background: #f7faff;
}

.bubble-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.bubble p {
  margin: 0;
  white-space: pre-wrap;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(48, 193, 204, 0.35);
  background: rgba(48, 193, 204, 0.12);
  color: var(--brand-dark);
  font-weight: 800;
  text-transform: capitalize;
}

.flow-trace-panel,
.replay-panel {
  min-width: 0;
}

.flow-trace-list,
.replay-output {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
}

.flow-trace-row {
  display: grid;
  grid-template-columns: 150px minmax(120px, 1fr) minmax(90px, 0.8fr);
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.flow-trace-row time,
.flow-trace-row small {
  color: var(--muted);
  font-size: 0.8rem;
}

.flow-trace-row small {
  grid-column: 2 / -1;
}

.replay-message {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(246, 249, 255, 0.85);
}

.replay-message.customer {
  background: rgba(48, 193, 204, 0.1);
}

.replay-message.bot {
  background: rgba(25, 53, 119, 0.08);
}

.replay-message strong {
  display: block;
  margin-bottom: 6px;
  color: var(--brand-dark);
}

.replay-message p {
  margin: 0;
  white-space: pre-wrap;
}

.animate-in {
  opacity: 0;
  transform: translateY(16px);
}

.animate-in.is-visible {
  animation: fadeSlideUp 0.62s ease forwards;
  animation-delay: var(--reveal-delay, 0ms);
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes statPulse {
  0% {
    transform: scale(1);
  }
  42% {
    transform: scale(1.08);
    color: var(--cyan);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes guestPageEntrance {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
    filter: blur(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes logoFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes brandSweep {
  0%,
  100% {
    transform: translateX(-18%);
    opacity: 0.48;
  }
  50% {
    transform: translateX(18%);
    opacity: 0.82;
  }
}

@keyframes chartCardIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes emptyStateIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .animate-in {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 1180px) {
  .metrics,
  .split,
  .detail-grid,
  .status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters,
  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-tools-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .sidebar {
    position: static;
    width: auto;
    min-height: auto;
    border-radius: 0 0 24px 24px;
  }

  .side-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .side-status {
    margin-top: 18px;
  }

  .app-frame {
    margin-left: 0;
  }

  .topbar {
    padding: 0 18px;
  }

  .shell {
    width: min(100% - 28px, 1460px);
    margin-top: 20px;
  }

  .page-heading,
  .table-heading,
  .heading-actions,
  .status-card-head,
  .outage-head {
    align-items: stretch;
    flex-direction: column;
  }

  .heading-actions {
    justify-content: flex-start;
  }

  .metrics,
  .split,
  .detail-grid,
  .status-grid,
  .filters,
  .admin-grid,
  .admin-tools-grid,
  .outage-window-row,
  .user-form-row,
  .form-row,
  .runtime-facts,
  .security-grid {
    grid-template-columns: 1fr;
  }

  .security-head,
  .security-code {
    align-items: stretch;
    flex-direction: column;
  }

  .day-row,
  .day-hours {
    grid-template-columns: 1fr;
  }

  .day-closed {
    justify-content: flex-start;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .icon-button,
  .link-button,
  .disabled-button,
  .wide-action {
    width: 100%;
    max-width: none;
  }

  .details div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .login-layout {
    grid-template-columns: 1fr;
  }

  .loader-frame {
    width: 152px;
    min-height: 74px;
  }

  .admin-title {
    font-size: 25px;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 13px;
  }

  .sidebar {
    padding: 18px;
  }

  .side-nav {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
  }

  .live-chip {
    width: fit-content;
  }

  .hero-heading,
  .panel,
  .table-panel,
  .login-panel {
    padding: 18px;
  }

  .loader-frame {
    width: 144px;
    min-height: 70px;
  }

  .login-loader-gif {
    width: 118px;
  }

  .admin-title {
    font-size: 24px;
  }

  .page-heading h1,
  .login-panel h1 {
    font-size: 26px;
  }

  .metric strong {
    font-size: 34px;
  }

  .bubble-meta {
    flex-direction: column;
    gap: 3px;
  }
}

/* ═══════════════════════════════════════════════════════════
   CX ANALYTICS DASHBOARD — New styles (appended, no existing rules modified)
   ═══════════════════════════════════════════════════════════ */

/* Analytics Rule note */
.analytics-rule {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(230,161,19,0.12);
  color: #7a4e00;
  font-size: 12px;
  font-weight: 800;
}

/* Live badge */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid transparent;
}
.live-badge-ok {
  background: #edf9f4;
  border-color: rgba(25,166,106,0.22);
  color: var(--green-dark);
}
.live-badge-loading, .live-badge-pending {
  background: #eef2f7;
  border-color: var(--line);
  color: #58657c;
}
.live-badge-error {
  background: #fff0f0;
  border-color: rgba(214,69,69,0.22);
  color: var(--red);
}
.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex: 0 0 8px;
}
.live-badge-ok .live-dot { background: var(--green); animation: livePulse 2s infinite; }
.live-badge-loading .live-dot, .live-badge-pending .live-dot { background: #aab0c0; }
.live-badge-error .live-dot { background: var(--red); }

@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(25,166,106,0.4); }
  50%       { box-shadow: 0 0 0 5px rgba(25,166,106,0); }
}

/* Range tabs */
.range-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--navy-100);
}
.range-tab {
  min-height: 30px;
  padding: 0 14px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--navy);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.18s;
}
.range-tab.active, .range-tab:hover {
  background: var(--navy);
  color: #fff;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.kpi-card {
  position: relative;
  overflow: hidden;
  min-height: 118px;
  padding: 18px 18px 14px;
  border: 1px solid rgba(221,229,242,0.9);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: all var(--ease);
}
.kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--navy);
}
.kpi-card:hover { transform: scale(1.015); box-shadow: var(--shadow-hover); }
.kpi-total::before    { background: var(--navy); }
.kpi-customers::before{ background: var(--cyan); }
.kpi-answer::before   { background: var(--green); }
.kpi-frt::before      { background: var(--amber); }
.kpi-resolution::before { background: #8a67c8; }
.kpi-handling::before { background: #e87040; }
.kpi-open::before     { background: var(--yellow); }
.kpi-sessions::before { background: var(--teal); }
.kpi-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.kpi-value {
  display: block;
  margin-top: 8px;
  color: var(--navy);
  font-size: 32px;
  line-height: 1;
  font-weight: 900;
}
.kpi-sub {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

/* Charts */
.charts-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
  margin: 18px 0;
}
.charts-row-2 {
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
}
.chart-panel {
  position: relative;
  overflow: hidden;
  height: 360px;
  padding: 18px 18px 16px;
  border: 1px solid rgba(221,229,242,0.9);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,255,0.96)),
    var(--surface);
  box-shadow:
    0 18px 42px rgba(26,54,134,0.08),
    inset 0 1px 0 rgba(255,255,255,0.9);
  display: flex;
  flex-direction: column;
  transition: all var(--ease);
  animation: chartCardIn 0.72s cubic-bezier(0.2, 0.9, 0.2, 1) both;
  animation-delay: var(--reveal-delay, 0ms);
}
.chart-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--navy), var(--cyan), var(--yellow));
}
.chart-panel::after {
  content: "";
  position: absolute;
  inset: 48px 18px 18px;
  z-index: 0;
  pointer-events: none;
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(26,54,134,0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(26,54,134,0.035) 1px, transparent 1px);
  background-size: 72px 100%, 100% 54px;
  mask-image: linear-gradient(180deg, transparent 0, #000 16%, #000 86%, transparent 100%);
}
.chart-panel:hover {
  transform: translateY(-3px);
  box-shadow:
    0 26px 62px rgba(26,54,134,0.14),
    inset 0 1px 0 rgba(255,255,255,0.9);
}
.chart-panel h2 {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--navy);
  letter-spacing: 0;
}
.chart-panel h2::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 6px rgba(19,183,214,0.12);
}
.chart-panel canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100% !important;
  height: 286px !important;
  max-height: 286px;
  flex: 0 0 286px;
}
.chart-panel-empty canvas {
  opacity: 0.18;
  filter: saturate(0.72);
}
.chart-empty-state {
  position: absolute;
  inset: 76px 30px 30px;
  z-index: 3;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
  border: 1px dashed rgba(26,54,134,0.18);
  border-radius: 16px;
  background: rgba(255,255,255,0.74);
  text-align: center;
  backdrop-filter: blur(6px);
  animation: emptyStateIn 0.45s ease both;
}
.chart-empty-state[hidden] {
  display: none !important;
}
.chart-empty-state span {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(26,54,134,0.12), rgba(19,183,214,0.14));
  box-shadow: inset 0 -10px 0 rgba(19,183,214,0.12);
}
.chart-empty-state strong {
  color: var(--navy);
  font-size: 14px;
  font-weight: 900;
}
.chart-empty-state small {
  max-width: 260px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.kpi-escalation-panel {
  align-items: stretch;
}
.escalation-big {
  font-size: 42px;
  font-weight: 900;
  color: var(--amber);
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-escalation-panel canvas {
  height: 210px !important;
  max-height: 210px;
  flex-basis: 210px;
}

/* Workforce */
.workforce-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0;
}
.workforce-panel { padding: 0; }
.workforce-panel .table-heading { padding: 16px 18px 0; }
.workforce-panel h2 { margin: 0; font-size: 15px; }
.workforce-panel .table-wrap { padding: 0 0 10px; }

/* CSAT */
.csat-section { margin: 14px 0; }
.csat-panel { padding: 20px; }
.csat-panel h2 { margin: 0 0 14px; font-size: 15px; color: var(--navy); }
.csat-kpis {
  display: flex;
  gap: 20px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.csat-kpi {
  display: flex;
  flex-direction: column;
  min-width: 100px;
}
.csat-kpi span { color: var(--muted); font-size: 12px; font-weight: 900; }
.csat-kpi strong { font-size: 26px; color: var(--navy); line-height: 1.1; }
.csat-kpi small { color: var(--muted); font-size: 11px; }
.csat-dist-bars { display: grid; gap: 6px; max-width: 480px; }
.csat-bar-row {
  display: grid;
  grid-template-columns: 28px 1fr 34px;
  align-items: center;
  gap: 8px;
}
.csat-star { font-size: 12px; font-weight: 800; color: var(--amber); }
.csat-bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--navy-100);
  overflow: hidden;
}
.csat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  border-radius: 999px;
  transition: width 0.5s ease;
  min-width: 2px;
}
.csat-count { font-size: 12px; font-weight: 800; color: var(--muted); text-align: right; }

/* Responsive adjustments */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .charts-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts-row-2 { grid-template-columns: 1fr; }
  .workforce-grid { grid-template-columns: 1fr; }
  .chart-panel { height: 340px; }
  .chart-panel canvas {
    height: 266px !important;
    max-height: 266px;
    flex-basis: 266px;
  }
}
@media (max-width: 760px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts-row { grid-template-columns: 1fr; }
  .chart-panel {
    height: 320px;
    padding: 16px;
  }
  .chart-panel canvas {
    height: 244px !important;
    max-height: 244px;
    flex-basis: 244px;
  }
  .chart-empty-state {
    inset: 70px 22px 24px;
  }
}


/* CX Funnel Panels */
.cx-funnels-row { margin-bottom: 24px; }
.funnel-panel { padding: 20px; }
.funnel-stats { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; }
.f-stat { flex: 1; text-align: center; padding: 12px; background: #f8fafc; border-radius: 12px; border: 1px solid var(--border); }
.f-stat .label { display: block; font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.f-stat strong { display: block; font-size: 20px; font-weight: 800; color: var(--navy); }
.f-stat.clickable { cursor: pointer; transition: transform 0.1s, border-color 0.2s; }
.f-stat.clickable:hover { border-color: var(--primary); transform: translateY(-2px); }
.f-stat.clickable:active { transform: translateY(0); }

/* Amin AI Assistant */
.ai-assistant {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1200;
  pointer-events: none;
}
.ai-assistant-toggle,
.ai-assistant-close,
.ai-assistant-form button,
.ai-assistant-suggestions button {
  font: inherit;
}
.ai-assistant-toggle {
  pointer-events: auto;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background:
    linear-gradient(135deg, var(--navy), #1b58a6 54%, var(--cyan));
  box-shadow: 0 18px 42px rgba(26,54,134,0.26), 0 0 0 8px rgba(19,183,214,0.10);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.ai-assistant-toggle span {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.16);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}
.ai-assistant-toggle:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 56px rgba(26,54,134,0.34), 0 0 0 9px rgba(19,183,214,0.12);
}
.ai-assistant-panel {
  pointer-events: auto;
  position: absolute;
  right: 0;
  bottom: 76px;
  width: min(430px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 112px));
  border: 1px solid rgba(211,222,241,0.92);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,251,255,0.98));
  box-shadow: 0 26px 72px rgba(15,35,80,0.22);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform-origin: bottom right;
  animation: aiPanelIn 0.28s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}
.ai-assistant-panel[hidden] {
  display: none !important;
}
.ai-assistant-header {
  padding: 15px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(221,229,242,0.9);
  background: linear-gradient(90deg, rgba(26,54,134,0.06), rgba(19,183,214,0.07));
}
.ai-assistant-header strong {
  display: block;
  color: var(--navy);
  font-size: 15px;
  font-weight: 900;
}
.ai-assistant-header small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  margin-top: 2px;
}
.ai-assistant-close {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(26,54,134,0.12);
  border-radius: 50%;
  background: #fff;
  color: var(--navy);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}
.ai-assistant-suggestions {
  padding: 12px 14px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border-bottom: 1px solid rgba(221,229,242,0.75);
}
.ai-assistant-suggestions button {
  border: 1px solid rgba(26,54,134,0.12);
  border-radius: 999px;
  background: #fff;
  color: var(--navy);
  padding: 8px 11px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}
.ai-assistant-suggestions button:hover {
  border-color: rgba(19,183,214,0.6);
  background: rgba(19,183,214,0.08);
}
.ai-assistant-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px;
  display: grid;
  align-content: start;
  gap: 12px;
}
.ai-message {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  animation: aiMessageIn 0.24s ease both;
}
.ai-message.user {
  grid-template-columns: minmax(0, 1fr) 34px;
}
.ai-message.user .ai-avatar {
  grid-column: 2;
  grid-row: 1;
  background: var(--navy);
}
.ai-message.user .ai-bubble {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  background: var(--navy);
  color: #fff;
  border-color: transparent;
}
.ai-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}
.ai-bubble {
  max-width: 100%;
  border: 1px solid rgba(221,229,242,0.92);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  box-shadow: 0 8px 24px rgba(26,54,134,0.06);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.ai-line + .ai-line {
  margin-top: 5px;
}
.ai-bullet {
  padding-left: 10px;
}
.ai-message.thinking .ai-bubble {
  color: var(--muted);
  background:
    linear-gradient(90deg, rgba(255,255,255,0.96), rgba(239,247,255,0.96), rgba(255,255,255,0.96));
  background-size: 220% 100%;
  animation: aiThinking 1.1s ease-in-out infinite;
}
.ai-message.error .ai-bubble {
  border-color: rgba(218,60,60,0.28);
  background: rgba(255,245,245,0.96);
}
.ai-meta {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}
.ai-assistant-form {
  padding: 12px;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 74px;
  gap: 8px;
  border-top: 1px solid rgba(221,229,242,0.9);
  background: rgba(255,255,255,0.98);
}
.ai-assistant-form select {
  height: 44px;
  border: 1px solid rgba(26,54,134,0.14);
  border-radius: 8px;
  padding: 0 8px;
  color: var(--navy);
  background: #fff;
  outline: none;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
}
.ai-assistant-form textarea {
  width: 100%;
  min-height: 44px;
  max-height: 120px;
  resize: none;
  border: 1px solid rgba(26,54,134,0.14);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  background: #fff;
  outline: none;
  font: inherit;
  font-size: 13px;
  line-height: 1.35;
}
.ai-assistant-form textarea:focus {
  border-color: rgba(19,183,214,0.7);
  box-shadow: 0 0 0 3px rgba(19,183,214,0.12);
}
.ai-assistant-form select:focus {
  border-color: rgba(19,183,214,0.7);
  box-shadow: 0 0 0 3px rgba(19,183,214,0.12);
}
.ai-assistant-form button {
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--navy), #1b58a6);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}
.ai-assistant-form button:disabled,
.ai-assistant-form textarea:disabled {
  opacity: 0.62;
  cursor: wait;
}
@keyframes aiPanelIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes aiMessageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes aiThinking {
  0% { background-position: 0% 50%; }
  100% { background-position: 220% 50%; }
}
@media (max-width: 760px) {
  .ai-assistant {
    right: 16px;
    bottom: 16px;
  }
  .ai-assistant-panel {
    right: -8px;
    bottom: 72px;
    width: calc(100vw - 32px);
    height: min(560px, calc(100vh - 96px));
  }
}

/* Premium Khazna rail motion: delayed hover intent, calm reveal, no jitter. */
@media (min-width: 921px) {
  body.is-authenticated,
  body.page-dashboard {
    --rail-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --rail-label-delay: 120ms;
  }

  body.is-authenticated .sidebar,
  body.page-dashboard .sidebar {
    isolation: isolate;
    will-change: width, padding, box-shadow;
    background:
      radial-gradient(circle at 28px 30px, rgba(255, 255, 255, 0.18), transparent 42px),
      linear-gradient(145deg, rgba(255,255,255,0.13) 0 13%, transparent 13% 100%),
      linear-gradient(180deg, #061a5f 0%, #0a2b82 50%, #075ba1 100%) !important;
    transition:
      width 520ms var(--rail-ease),
      padding 520ms var(--rail-ease),
      box-shadow 420ms ease,
      background-position 620ms var(--rail-ease) !important;
  }

  body.is-authenticated .sidebar::after,
  body.page-dashboard .sidebar::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    background:
      linear-gradient(90deg, rgba(255,255,255,0.08), transparent 42%),
      radial-gradient(circle at 80% 14%, rgba(64, 216, 224, 0.16), transparent 34%);
    transition: opacity 460ms ease;
  }

  body.is-authenticated .sidebar:hover:not(.is-expanded):not(:focus-within),
  body.page-dashboard .sidebar:hover:not(.is-expanded):not(:focus-within) {
    width: var(--rail-width) !important;
    padding: 14px 7px !important;
    box-shadow: 10px 0 28px rgba(8, 31, 98, 0.18) !important;
  }

  body.is-authenticated .sidebar.is-expanded,
  body.is-authenticated .sidebar:focus-within,
  body.page-dashboard .sidebar.is-expanded,
  body.page-dashboard .sidebar:focus-within {
    width: var(--rail-open-width) !important;
    padding: 18px 14px !important;
    box-shadow:
      22px 0 60px rgba(8, 31, 98, 0.28),
      inset 1px 0 0 rgba(255,255,255,0.16) !important;
  }

  body.is-authenticated .sidebar.is-expanded::after,
  body.is-authenticated .sidebar:focus-within::after,
  body.page-dashboard .sidebar.is-expanded::after,
  body.page-dashboard .sidebar:focus-within::after {
    opacity: 1;
  }

  body.is-authenticated .side-brand,
  body.page-dashboard .side-brand,
  body.is-authenticated .side-nav a,
  body.page-dashboard .side-nav a,
  body.is-authenticated .side-status,
  body.page-dashboard .side-status {
    transition:
      width 500ms var(--rail-ease),
      gap 420ms var(--rail-ease),
      padding 420ms var(--rail-ease),
      background-color 220ms ease,
      border-color 220ms ease,
      box-shadow 220ms ease,
      transform 220ms ease !important;
  }

  body.is-authenticated .brand-mark,
  body.page-dashboard .brand-mark {
    transform: translateZ(0);
    transition:
      width 480ms var(--rail-ease),
      height 480ms var(--rail-ease),
      flex-basis 480ms var(--rail-ease),
      box-shadow 260ms ease,
      transform 260ms ease !important;
  }

  body.is-authenticated .sidebar.is-expanded .brand-mark,
  body.is-authenticated .sidebar:focus-within .brand-mark,
  body.page-dashboard .sidebar.is-expanded .brand-mark,
  body.page-dashboard .sidebar:focus-within .brand-mark {
    transform: translateZ(0);
  }

  body.is-authenticated .brand-copy,
  body.page-dashboard .brand-copy,
  body.is-authenticated .side-nav a > span:not(.nav-icon),
  body.page-dashboard .side-nav a > span:not(.nav-icon),
  body.is-authenticated .side-status div,
  body.page-dashboard .side-status div {
    filter: blur(2px);
    transition:
      max-width 500ms var(--rail-ease),
      opacity 260ms ease,
      transform 500ms var(--rail-ease),
      filter 260ms ease !important;
    transition-delay: 0ms, 0ms, 0ms, 0ms !important;
  }

  body.is-authenticated .sidebar:hover:not(.is-expanded):not(:focus-within) .brand-copy,
  body.page-dashboard .sidebar:hover:not(.is-expanded):not(:focus-within) .brand-copy,
  body.is-authenticated .sidebar:hover:not(.is-expanded):not(:focus-within) .side-nav a > span:not(.nav-icon),
  body.page-dashboard .sidebar:hover:not(.is-expanded):not(:focus-within) .side-nav a > span:not(.nav-icon),
  body.is-authenticated .sidebar:hover:not(.is-expanded):not(:focus-within) .side-status div,
  body.page-dashboard .sidebar:hover:not(.is-expanded):not(:focus-within) .side-status div {
    max-width: 0 !important;
    opacity: 0 !important;
    transform: translateX(-8px) !important;
    filter: blur(2px) !important;
  }

  body.is-authenticated .sidebar.is-expanded .brand-copy,
  body.is-authenticated .sidebar:focus-within .brand-copy,
  body.page-dashboard .sidebar.is-expanded .brand-copy,
  body.page-dashboard .sidebar:focus-within .brand-copy,
  body.is-authenticated .sidebar.is-expanded .side-nav a > span:not(.nav-icon),
  body.is-authenticated .sidebar:focus-within .side-nav a > span:not(.nav-icon),
  body.page-dashboard .sidebar.is-expanded .side-nav a > span:not(.nav-icon),
  body.page-dashboard .sidebar:focus-within .side-nav a > span:not(.nav-icon),
  body.is-authenticated .sidebar.is-expanded .side-status div,
  body.is-authenticated .sidebar:focus-within .side-status div,
  body.page-dashboard .sidebar.is-expanded .side-status div,
  body.page-dashboard .sidebar:focus-within .side-status div {
    max-width: 190px !important;
    opacity: 1 !important;
    transform: translateX(0) !important;
    filter: blur(0) !important;
    transition-delay: var(--rail-label-delay), var(--rail-label-delay), var(--rail-label-delay), var(--rail-label-delay) !important;
  }

  body.is-authenticated .side-nav a:hover,
  body.page-dashboard .side-nav a:hover {
    transform: translateX(1px);
    background: rgba(255, 255, 255, 0.12) !important;
  }

  body.is-authenticated .side-nav a.active,
  body.page-dashboard .side-nav a.active {
    background: linear-gradient(135deg, rgba(255,255,255,0.22), rgba(255,255,255,0.1)) !important;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.18),
      0 10px 24px rgba(0, 0, 0, 0.1) !important;
  }
}

/* Executive dashboard refresh */
.exec-page { display: grid; gap: 16px; }
.exec-hero, .exec-toolbar, .guardrail-banner, .panel-header, .kpi-topline,
.metric-popup-actions, .metric-popup-filters { display: flex; align-items: center; }
.exec-hero { justify-content: space-between; gap: 18px; margin-bottom: 2px; }
.exec-hero h1 { margin: 4px 0; color: var(--navy-900); font-size: 32px; line-height: 1.1; }
.exec-toolbar { justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.exec-filter-panel {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr)) auto auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid rgba(221,229,242,0.95);
  border-radius: 8px;
  background: rgba(255,255,255,0.88);
  box-shadow: 0 12px 30px rgba(26,54,134,0.06);
}
.exec-filter-panel label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}
.exec-filter-panel input,
.exec-filter-panel select {
  min-height: 38px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}
.exec-filter-panel .primary-button,
.exec-filter-panel .ghost-button {
  min-height: 38px;
}
.guardrail-banner {
  justify-content: space-between; gap: 14px; border: 1px solid rgba(230,161,19,0.32);
  border-radius: 8px; padding: 12px 16px; background: #fff8e4; color: var(--navy-900);
  box-shadow: 0 12px 28px rgba(230,161,19,0.08);
}
.guardrail-icon {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px;
  background: var(--yellow); color: var(--navy-900); font-weight: 900;
}
.guardrail-banner strong, .guardrail-banner span { display: block; }
.guardrail-banner span { color: var(--muted); font-size: 12px; font-weight: 800; }
.guardrail-banner a, .panel-header a { color: var(--navy); font-weight: 900; }
.exec-kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 12px; }
.exec-kpi-card {
  position: relative; display: grid; gap: 8px; min-height: 150px; border: 1px solid rgba(221,229,242,0.95);
  border-radius: 8px; padding: 16px; background: var(--surface); color: var(--ink);
  text-align: left; box-shadow: 0 14px 36px rgba(26,54,134,0.08); overflow: hidden;
}
.exec-kpi-card:hover, .exec-kpi-card.active {
  transform: translateY(-2px); border-color: rgba(19,183,214,0.5);
  box-shadow: 0 18px 48px rgba(26,54,134,0.16);
}
.exec-kpi-card.active { outline: 3px solid rgba(19,183,214,0.12); }
.exec-kpi-card strong { color: var(--navy-900); font-size: 28px; line-height: 1; }
.exec-kpi-card small { min-height: 34px; color: var(--muted); font-size: 11px; font-weight: 800; }
.kpi-topline { justify-content: space-between; gap: 8px; color: var(--navy); font-size: 12px; font-weight: 900; }
.kpi-topline i {
  display: grid; place-items: center; width: 18px; height: 18px; border: 1px solid var(--line-strong);
  border-radius: 50%; color: var(--muted); font-style: normal; font-size: 11px;
}
.sparkline { width: 100%; height: 34px; }
.sparkline polyline, .metric-popup-chart polyline {
  stroke: var(--cyan); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
}
.sparkline .spark-fill {
  fill: rgba(19, 183, 214, 0.12);
  stroke: none;
}
.sparkline .red-line, .risk-card .sparkline polyline { stroke: var(--red); }
.sparkline .spark-fill.red-line, .risk-card .sparkline .spark-fill { fill: rgba(214, 69, 69, 0.1); }
.sparkline .amber-line, .amber-card .sparkline polyline { stroke: var(--amber); }
.sparkline .spark-fill.amber-line, .amber-card .sparkline .spark-fill { fill: rgba(230, 161, 19, 0.1); }
.exec-insight-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.exec-insight-strip article, .exec-panel {
  border: 1px solid rgba(221,229,242,0.95); border-radius: 8px; background: var(--surface);
  box-shadow: 0 14px 36px rgba(26,54,134,0.08);
}
.exec-insight-strip article {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: start; padding: 14px;
}
.insight-number {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 999px;
  background: var(--navy); color: #fff; font-weight: 900;
}
.exec-insight-strip strong { color: var(--navy-900); }
.exec-insight-strip p { margin: 4px 0 0; color: var(--muted); font-size: 12px; font-weight: 800; }
.exec-insight-strip a { color: var(--navy); font-size: 12px; font-weight: 900; }
.exec-visual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.8fr) minmax(320px, 0.85fr);
  gap: 14px;
}
.exec-chart-surface {
  position: relative;
  min-height: 242px;
  border: 1px solid rgba(221,229,242,0.95);
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,251,255,0.94));
}
.exec-chart-surface svg {
  width: 100%;
  height: 230px;
  overflow: visible;
}
.exec-chart-grid line {
  stroke: rgba(156, 174, 204, 0.32);
  stroke-width: 1;
}
.exec-chart-grid .exec-chart-vgrid {
  stroke: rgba(156, 174, 204, 0.16);
}
.exec-chart-grid text,
.exec-chart-labels text,
.exec-chart-caption {
  fill: #71809c;
  font-size: 11px;
  font-weight: 800;
}
.exec-chart-labels text {
  text-anchor: middle;
}
.exec-chart-caption {
  text-anchor: end;
  fill: #54668d;
  font-size: 10px;
  text-transform: uppercase;
}
.exec-volume-area {
  fill: url(#execTrendArea);
  stroke: none;
}
.exec-volume-line {
  fill: none;
  stroke: url(#execTrendLine);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 8px 12px rgba(23, 184, 214, 0.18));
}
.exec-volume-dot {
  fill: #fff;
  stroke: #13b7d6;
  stroke-width: 2;
  cursor: pointer;
  transition: r 140ms ease, stroke-width 140ms ease, filter 140ms ease;
}
.exec-volume-hit {
  fill: rgba(19, 183, 214, 0);
  pointer-events: all;
  cursor: crosshair;
  transition: fill 140ms ease;
}
.exec-volume-hit:hover,
.exec-volume-hit:focus {
  fill: rgba(19, 183, 214, 0.055);
  outline: none;
}
.exec-volume-dot:hover,
.exec-volume-dot:focus {
  r: 6;
  stroke-width: 3;
  outline: none;
  filter: drop-shadow(0 8px 12px rgba(19, 183, 214, 0.28));
}
.exec-hover-tooltip {
  position: absolute;
  z-index: 8;
  min-width: 178px;
  max-width: 220px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px;
  background: linear-gradient(180deg, #061a5f, #0a2b82);
  color: #fff;
  box-shadow: 0 18px 42px rgba(6, 26, 95, 0.28);
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
.exec-hover-tooltip.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.exec-hover-tooltip span,
.exec-hover-tooltip small,
.exec-hover-tooltip em {
  display: block;
}
.exec-hover-tooltip span {
  color: rgba(255,255,255,0.72);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.exec-hover-tooltip strong {
  display: block;
  margin-top: 3px;
  color: #fff;
  font-size: 18px;
  line-height: 1.2;
}
.exec-hover-tooltip small,
.exec-hover-tooltip em {
  margin-top: 5px;
  color: rgba(255,255,255,0.76);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}
.exec-donut-wrap {
  display: grid;
  grid-template-columns: 174px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  min-height: 242px;
}
.exec-donut {
  position: relative;
  display: grid;
  place-items: center;
  width: 174px;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(221,229,242,0.95), 0 18px 42px rgba(26,54,134,0.1);
}
.exec-donut::after {
  content: "";
  position: absolute;
  inset: 34px;
  border-radius: inherit;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(221,229,242,0.9);
}
.exec-donut strong,
.exec-donut span {
  position: relative;
  z-index: 1;
  display: block;
  text-align: center;
}
.exec-donut strong {
  color: var(--navy-900);
  font-size: 24px;
  line-height: 1;
}
.exec-donut span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}
.exec-legend {
  display: grid;
  gap: 10px;
}
.exec-legend div {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.exec-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--cyan);
}
.exec-legend strong {
  color: var(--navy-900);
}
.exec-bars {
  display: grid;
  gap: 12px;
  min-height: 242px;
}
.exec-bars article {
  display: grid;
  gap: 7px;
}
.exec-bars article div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--navy);
  font-size: 12px;
  font-weight: 900;
}
.exec-bars strong {
  color: var(--navy-900);
}
.exec-bars small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.exec-bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef8;
}
.exec-bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  animation: execBarIn 520ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}
@keyframes execBarIn {
  from { width: 0; }
}
.exec-two-col { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.85fr); gap: 14px; }
.exec-ops-row { grid-template-columns: minmax(0, 1fr) minmax(380px, 0.72fr); }
.exec-panel { padding: 16px; }
.panel-header { justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-header h2 { margin: 0; color: var(--navy-900); font-size: 18px; }
.panel-header span { color: var(--muted); font-size: 12px; font-weight: 900; }
.journey-track { display: grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); gap: 10px; }
.journey-track div {
  position: relative; min-height: 92px; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; background: var(--surface-soft);
}
.journey-track div:not(:last-child)::after {
  content: ""; position: absolute; top: 44px; right: -10px; z-index: 2; width: 18px; height: 2px; background: var(--line-strong);
}
.journey-track span, .flow-health-list span { display: block; color: var(--muted); font-size: 11px; font-weight: 900; }
.journey-track strong { display: block; margin-top: 6px; color: var(--navy); font-size: 23px; }
.journey-track small { color: var(--muted); font-size: 11px; font-weight: 800; }
.flow-health-list { display: grid; gap: 14px; }
.flow-health-list div { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.flow-health-list progress {
  grid-column: 1 / -1; width: 100%; height: 8px; overflow: hidden; border: none; border-radius: 999px; background: var(--line);
}
.flow-health-list progress::-webkit-progress-bar { background: var(--line); }
.flow-health-list progress::-webkit-progress-value { border-radius: 999px; background: linear-gradient(90deg, var(--navy), var(--cyan)); }
.compact-table table { font-size: 12px; }
.compact-table th, .compact-table td { padding: 10px 9px; }
.risk-pill {
  display: inline-flex; align-items: center; min-height: 24px; border-radius: 999px; padding: 0 9px; font-size: 11px; font-weight: 900;
}
.risk-pill.low { background: #edf9f4; color: var(--green-dark); }
.risk-pill.medium { background: #fff8e4; color: #8a5a00; }
.risk-pill.high { background: #fff0f0; color: var(--red); }
.slim-filters { grid-template-columns: 150px 150px 180px 180px minmax(180px, 1fr) auto auto; margin: 0 0 14px; box-shadow: none; }
.metric-overlay {
  position: fixed; inset: 0; z-index: 70; background: rgba(16,36,95,0.16);
  backdrop-filter: blur(2px); opacity: 0; transition: opacity 180ms ease;
}
.metric-overlay.show { opacity: 1; }
.metric-popup {
  position: fixed; top: 96px; right: 34px; z-index: 80; width: min(520px, calc(100vw - 38px));
  max-height: calc(100vh - 128px); overflow: auto; border: 1px solid rgba(221,229,242,0.98);
  border-radius: 8px; padding: 18px; background: rgba(255,255,255,0.98);
  box-shadow: 0 28px 90px rgba(16,36,95,0.26); opacity: 0; transform: translateY(8px) scale(0.96);
  transition: opacity 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}
.metric-popup.show { opacity: 1; transform: translateY(0) scale(1); }
.metric-popup-close {
  position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 30px; height: 30px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); font-weight: 900;
}
.metric-popup-head span { color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.metric-popup-head h2 { margin: 5px 38px 6px 0; color: var(--navy-900); font-size: 22px; }
.metric-popup-head strong { display: block; color: var(--navy); font-size: 34px; line-height: 1; }
.metric-popup-tabs {
  display: inline-flex; gap: 4px; margin: 16px 0; border: 1px solid var(--line); border-radius: 999px; padding: 4px; background: var(--surface-soft);
}
.metric-popup-tabs button {
  min-height: 28px; border: none; border-radius: 999px; padding: 0 12px; background: transparent;
  color: var(--muted); font-size: 12px; font-weight: 900;
}
.metric-popup-tabs button.active { background: var(--navy); color: #fff; }
.metric-popup-section {
  display: none;
  animation: metricPanelIn 180ms ease both;
}
.metric-popup-section.active {
  display: block;
}
.metric-popup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.metric-popup-grid div {
  min-height: 72px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--surface-soft);
}
.metric-popup-grid span { display: block; color: var(--muted); font-size: 11px; font-weight: 900; }
.metric-popup-grid strong { display: block; margin-top: 5px; color: var(--navy-900); font-size: 12px; }
.metric-popup-filters { gap: 7px; flex-wrap: wrap; margin: 14px 0; }
.metric-popup-filters span {
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 9px; background: #fff;
  color: var(--muted); font-size: 11px; font-weight: 900;
}
.metric-popup-summary,
.metric-popup-export-note {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fbff;
}
.metric-popup-summary strong,
.metric-popup-export-note strong {
  color: var(--navy-900);
  font-size: 13px;
}
.metric-popup-summary p,
.metric-popup-export-note span {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.metric-popup-chart {
  height: 106px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 10px;
  background: linear-gradient(180deg, #fff, var(--surface-soft));
}
.metric-popup-chart svg { width: 100%; height: 86px; }
.metric-popup-actions { justify-content: flex-end; gap: 10px; margin-top: 14px; }
.metric-trend-grid,
.metric-drill-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.metric-trend-grid article,
.metric-drill-grid a {
  display: grid;
  gap: 5px;
  min-height: 80px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.metric-trend-grid span,
.metric-drill-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}
.metric-trend-grid strong,
.metric-drill-grid strong {
  color: var(--navy);
  font-size: 16px;
}
.metric-trend-grid small {
  color: var(--muted);
  font-weight: 800;
}
.metric-drill-grid {
  margin-top: 12px;
}
.metric-drill-grid a:hover {
  border-color: rgba(19, 183, 214, 0.52);
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(16, 36, 95, 0.1);
}
@keyframes metricPanelIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 1280px) {
  .exec-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .exec-filter-panel { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .exec-visual-grid { grid-template-columns: 1fr 1fr; }
  .exec-trend-panel { grid-column: 1 / -1; }
  .journey-track { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .journey-track div::after { display: none; }
}
@media (max-width: 960px) {
  .exec-hero, .guardrail-banner, .exec-two-col, .exec-ops-row, .exec-insight-strip, .exec-visual-grid { grid-template-columns: 1fr; }
  .exec-hero, .guardrail-banner { align-items: flex-start; }
  .exec-trend-panel { grid-column: auto; }
  .exec-donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .metric-trend-grid,
  .metric-drill-grid {
    grid-template-columns: 1fr;
  }
  .exec-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exec-filter-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-popup { top: 74px; right: 16px; }
}
@media (max-width: 640px) {
  .exec-kpi-grid, .exec-filter-panel, .journey-track, .metric-popup-grid, .slim-filters { grid-template-columns: 1fr; }
}

/* Mobile presentation polish */
@media (max-width: 680px) {
  html,
  body {
    overflow-x: hidden;
  }

  body.is-authenticated {
    background: #f6f8fd;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 60;
    width: 100%;
    max-height: none;
    padding: 12px 12px 10px;
    border-radius: 0 0 18px 18px;
    overflow: hidden;
  }

  .side-brand {
    margin-bottom: 10px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  .brand-mark img {
    width: 32px;
  }

  .brand-copy strong {
    font-size: 15px;
  }

  .brand-copy small {
    font-size: 11px;
  }

  .side-nav {
    display: flex;
    gap: 8px;
    margin: 0 -12px;
    padding: 0 12px 2px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .side-nav::-webkit-scrollbar {
    display: none;
  }

  .side-nav a {
    flex: 0 0 auto;
    scroll-snap-align: start;
    min-width: max-content;
    min-height: 40px;
    border-radius: 999px;
    padding: 0 12px;
    white-space: nowrap;
    font-size: 12px;
  }

  .nav-icon {
    width: 24px;
    height: 24px;
    font-size: 11px;
  }

  .side-status,
  .side-logout {
    display: none;
  }

  .topbar {
    position: sticky;
    top: 92px;
    z-index: 50;
    min-height: auto;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(221, 229, 242, 0.85);
    background: rgba(246, 248, 253, 0.94);
    backdrop-filter: blur(12px);
  }

  .topbar-title {
    font-size: 16px;
  }

  .shell {
    width: min(100% - 20px, 1460px);
    margin-top: 12px;
  }

  .exec-page {
    gap: 12px;
  }

  .exec-hero {
    display: grid;
    gap: 12px;
  }

  .exec-hero h1 {
    font-size: 26px;
  }

  .exec-hero .muted {
    font-size: 12px;
  }

  .exec-toolbar {
    justify-content: flex-start;
    width: 100%;
  }

  .exec-toolbar .live-badge,
  .exec-toolbar .secondary-button {
    width: 100%;
    justify-content: center;
  }

  .range-tabs {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    border-radius: 8px;
    scrollbar-width: none;
  }

  .range-tabs::-webkit-scrollbar {
    display: none;
  }

  .range-tab {
    flex: 1 0 auto;
  }

  .guardrail-banner {
    display: grid;
    grid-template-columns: 38px 1fr;
    align-items: start;
    border-radius: 8px;
    padding: 12px;
  }

  .guardrail-banner a {
    grid-column: 1 / -1;
    display: inline-flex;
    justify-content: center;
    border: 1px solid rgba(230, 161, 19, 0.26);
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff;
  }

  .exec-kpi-grid {
    grid-template-columns: 1fr;
  }

  .exec-kpi-card {
    min-height: 128px;
    padding: 14px;
  }

  .exec-kpi-card strong {
    font-size: 30px;
  }

  .exec-insight-strip article {
    grid-template-columns: 32px 1fr;
  }

  .exec-insight-strip a {
    grid-column: 2;
  }

  .exec-panel {
    padding: 14px;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .journey-track {
    grid-template-columns: 1fr;
  }

  .journey-track div {
    min-height: 76px;
  }

  .journey-track strong {
    font-size: 25px;
  }

  .table-wrap {
    margin: 0 -4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap table {
    min-width: 680px;
  }

  .compact-table table {
    min-width: 560px;
  }

  .slim-filters {
    padding: 12px;
  }

  .slim-filters .primary-button,
  .slim-filters .secondary-button,
  .slim-filters .ghost-button {
    width: 100%;
  }

  .metric-overlay {
    background: rgba(16, 36, 95, 0.22);
    backdrop-filter: blur(3px);
  }

  .metric-popup {
    inset: auto 0 0 0;
    width: 100%;
    max-height: 88vh;
    border-radius: 18px 18px 0 0;
    padding: 16px 14px 18px;
    transform: translateY(100%) scale(1);
  }

  .metric-popup.show {
    transform: translateY(0) scale(1);
  }

  .metric-popup-head h2 {
    font-size: 20px;
  }

  .metric-popup-head strong {
    font-size: 32px;
  }

  .metric-popup-tabs {
    display: flex;
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    scrollbar-width: none;
  }

  .metric-popup-tabs::-webkit-scrollbar {
    display: none;
  }

  .metric-popup-tabs button {
    flex: 1 0 auto;
  }

  .metric-popup-grid {
    grid-template-columns: 1fr;
  }

  .metric-popup-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .metric-popup-actions .primary-button,
  .metric-popup-actions .secondary-button {
    width: 100%;
  }

  .ai-assistant {
    right: 12px;
    bottom: 12px;
  }
}

/* Approved visual direction for the Executive Overview page */
.page-dashboard .topbar {
  display: none;
}

.page-dashboard .app-frame {
  margin-left: 246px;
}

.page-dashboard .sidebar {
  width: 246px;
  padding: 20px 16px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.08) 0 20%, transparent 20% 100%),
    linear-gradient(158deg, #092064 0%, #12348d 55%, #0e5b9d 100%);
}

.page-dashboard .side-brand {
  margin-bottom: 28px;
}

.page-dashboard .brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255,255,255,0.98);
}

.page-dashboard .brand-mark img {
  width: 38px;
}

.page-dashboard .brand-copy strong {
  font-size: 16px;
}

.page-dashboard .brand-copy small {
  font-size: 11px;
}

.page-dashboard .side-nav {
  gap: 7px;
}

.page-dashboard .side-nav a {
  min-height: 44px;
  border-radius: 10px;
  padding: 0 12px;
  color: rgba(255,255,255,0.86);
  box-shadow: none;
}

.page-dashboard .side-nav a:hover,
.page-dashboard .side-nav a.active {
  transform: none;
  background: rgba(66, 112, 220, 0.58);
  border-color: rgba(255,255,255,0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 10px 28px rgba(0,0,0,0.12);
}

.page-dashboard .nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  color: #fff;
  font-size: 12px;
}

.page-dashboard .side-nav a.active .nav-icon {
  background: var(--yellow);
  color: var(--navy-900);
}

.page-dashboard .side-status {
  border-radius: 10px;
  background: rgba(255,255,255,0.12);
}

.page-dashboard .side-logout .icon-button {
  border-radius: 999px;
}

.page-dashboard .shell {
  width: min(100% - 48px, 1540px);
  margin-top: 24px;
}

.page-dashboard .exec-hero {
  padding: 4px 0 8px;
}

.page-dashboard .exec-hero h1 {
  color: #082064;
  font-size: 30px;
  letter-spacing: 0;
}

.page-dashboard .exec-toolbar .secondary-button,
.page-dashboard .guardrail-banner a,
.page-dashboard .panel-header a {
  border-radius: 8px;
}

.page-dashboard .exec-kpi-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.page-dashboard .exec-kpi-card {
  min-height: 168px;
  padding: 16px 16px 12px;
  border-color: #dce6f5;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.page-dashboard .exec-kpi-card::after {
  position: absolute;
  top: 18px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #eef7ff;
  color: var(--navy);
  font-size: 16px;
  font-weight: 900;
}

.page-dashboard .exec-kpi-card[data-metric="automation_coverage"]::after { content: "AI"; background: #edf3ff; color: var(--navy); }
.page-dashboard .exec-kpi-card[data-metric="bot_resolved"]::after { content: "OK"; background: #eaf8f1; color: var(--green-dark); }
.page-dashboard .exec-kpi-card[data-metric="handoff_rate"]::after { content: "CX"; background: #f4efff; color: #6c4bd8; }
.page-dashboard .exec-kpi-card[data-metric="verification_success"]::after { content: "V"; background: #eaf9fb; color: #098ba0; }
.page-dashboard .exec-kpi-card[data-metric="salary_completion"]::after { content: "$"; background: #f1fffb; color: var(--teal); }
.page-dashboard .exec-kpi-card[data-metric="csat"]::after { content: "*"; background: #fff8e4; color: var(--amber); }

.page-dashboard .kpi-topline {
  padding-right: 44px;
}

.page-dashboard .exec-kpi-card strong {
  margin-top: 2px;
  font-size: 30px;
}

.page-dashboard .sparkline {
  align-self: end;
  height: 36px;
  margin-top: 4px;
}

.page-dashboard .exec-insight-strip article,
.page-dashboard .exec-panel {
  border-color: #dce6f5;
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(26,54,134,0.06);
}

.page-dashboard .journey-track div {
  border-radius: 8px;
  background: #f8faff;
}

.page-dashboard .table-wrap {
  border-radius: 8px;
}

.page-dashboard .metric-popup {
  border-radius: 10px;
}

@media (max-width: 1380px) {
  .page-dashboard .exec-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .page-dashboard .app-frame {
    margin-left: 0;
  }

  .page-dashboard .sidebar {
    width: 100%;
  }

  .page-dashboard .shell {
    width: min(100% - 20px, 1540px);
  }
}

/* Final command-center alignment: closer to the approved 3x3 concept */
body.page-dashboard {
  overflow-x: hidden;
  background:
    radial-gradient(circle at 78% 4%, rgba(19, 183, 214, 0.09), transparent 30%),
    linear-gradient(180deg, #fbfdff 0%, #f4f7fc 46%, #eef3fb 100%);
}

body.page-dashboard::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 246px;
  z-index: 18;
  height: 3px;
  pointer-events: none;
  background: linear-gradient(90deg, #13b7d6 0%, #ffd22e 62%, #19a66a 100%);
}

.page-dashboard .topbar {
  display: none !important;
}

.page-dashboard .app-frame {
  margin-left: 246px;
}

.page-dashboard .sidebar {
  width: 246px;
  padding: 22px 16px;
  background:
    linear-gradient(132deg, rgba(255, 255, 255, 0.13) 0 17%, transparent 17% 100%),
    linear-gradient(157deg, #061d5f 0%, #12348d 56%, #0f5b9b 100%);
  box-shadow: 16px 0 42px rgba(8, 31, 98, 0.2);
}

.page-dashboard .sidebar::before {
  background:
    linear-gradient(138deg, transparent 0 46%, rgba(255, 255, 255, 0.08) 46% 56%, transparent 56% 100%),
    linear-gradient(160deg, transparent 0 64%, rgba(19, 183, 214, 0.23) 64% 100%);
}

.page-dashboard .side-brand {
  margin-bottom: 24px;
}

.page-dashboard .brand-mark {
  width: 52px;
  height: 52px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.18);
}

.page-dashboard .brand-mark img {
  width: 38px;
}

.page-dashboard .brand-copy strong {
  font-size: 17px;
  letter-spacing: 0;
}

.page-dashboard .brand-copy small {
  color: rgba(255, 255, 255, 0.76);
  font-size: 11px;
}

.page-dashboard .side-nav {
  gap: 8px;
}

.page-dashboard .side-nav a {
  min-height: 43px;
  border-radius: 10px;
  padding: 0 12px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  box-shadow: none;
}

.page-dashboard .side-nav a:hover,
.page-dashboard .side-nav a.active {
  transform: none;
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 12px 28px rgba(0, 0, 0, 0.1);
}

.page-dashboard .nav-icon {
  width: 26px;
  height: 26px;
  flex-basis: 26px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 11px;
}

.page-dashboard .side-nav a.active .nav-icon {
  background: #ffd22e;
  color: #061d5f;
}

.page-dashboard .side-status {
  border-radius: 10px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.12);
}

.page-dashboard .side-status strong {
  font-size: 13px;
}

.page-dashboard .side-status small {
  font-size: 11px;
}

.page-dashboard .side-logout .icon-button {
  min-height: 40px;
  border-radius: 999px;
}

.page-dashboard .shell {
  width: min(100% - 46px, 1540px);
  margin-top: 22px;
}

.page-dashboard .exec-page {
  gap: 14px;
}

.page-dashboard .exec-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 0 8px;
}

.page-dashboard .exec-hero .eyebrow {
  margin-bottom: 4px;
  color: #13a9be;
  font-size: 12px;
  letter-spacing: 0;
}

.page-dashboard .exec-hero h1 {
  margin: 0 0 6px;
  color: #071f62;
  font-size: clamp(30px, 2.6vw, 40px);
  line-height: 1;
}

.page-dashboard .exec-hero .muted {
  color: #7a86a0;
  font-size: 13px;
}

.page-dashboard .exec-toolbar {
  gap: 10px;
  padding-bottom: 2px;
}

.page-dashboard .exec-refresh-button {
  min-width: 116px;
  border-color: rgba(19, 183, 214, 0.34);
  background: linear-gradient(180deg, #ffffff 0%, #f4fbff 100%);
  color: #173678;
  box-shadow: 0 12px 26px rgba(16, 36, 95, 0.08);
}

.page-dashboard .exec-refresh-button:hover,
.page-dashboard .exec-refresh-button:focus {
  border-color: rgba(19, 183, 214, 0.72);
  background: linear-gradient(180deg, #f8fdff 0%, #eaf8ff 100%);
  box-shadow: 0 16px 34px rgba(19, 183, 214, 0.16);
}

.page-dashboard .exec-refresh-button:disabled {
  cursor: wait;
  opacity: 0.78;
}

.page-dashboard .live-badge,
.page-dashboard .range-tabs,
.page-dashboard .secondary-button,
.page-dashboard .ghost-button,
.page-dashboard .primary-button {
  min-height: 38px;
  border-radius: 999px;
}

.page-dashboard .range-tabs {
  padding: 4px;
  background: #edf2ff;
  border: 0;
}

.page-dashboard .range-tab {
  min-height: 30px;
  border-radius: 999px;
  padding: 0 15px;
  color: #50649d;
}

.page-dashboard .range-tab.active {
  background: #5064a6;
  color: #fff;
  box-shadow: 0 10px 22px rgba(26, 54, 134, 0.18);
}

.range-label-short {
  display: none;
}

.page-dashboard .guardrail-banner {
  min-height: 64px;
  padding: 12px 16px;
  border-color: rgba(230, 161, 19, 0.42);
  background: linear-gradient(90deg, #fff8df 0%, #fffdf7 100%);
  box-shadow: 0 12px 30px rgba(230, 161, 19, 0.08);
}

.page-dashboard .guardrail-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #ffd84d;
  color: #071f62;
}

.page-dashboard .guardrail-banner strong,
.page-dashboard .guardrail-banner a {
  color: #1d367f;
}

.page-dashboard .guardrail-banner span {
  color: #7d8798;
}

.page-dashboard .exec-kpi-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.page-dashboard .exec-kpi-card {
  min-height: 172px;
  padding: 15px 16px 12px;
  border: 1px solid #dce6f5;
  border-radius: 8px;
  background:
    radial-gradient(circle at 88% 26%, rgba(19, 183, 214, 0.08), transparent 24%),
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 16px 42px rgba(16, 36, 95, 0.075);
}

.page-dashboard .exec-kpi-card:hover,
.page-dashboard .exec-kpi-card.active {
  transform: translateY(-3px);
  border-color: rgba(19, 183, 214, 0.52);
  box-shadow: 0 22px 58px rgba(16, 36, 95, 0.14);
}

.page-dashboard .exec-kpi-card::after {
  top: 44px;
  right: 16px;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  font-size: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.page-dashboard .kpi-topline {
  min-height: 22px;
  padding-right: 0;
  color: #425895;
  font-size: 11px;
}

.page-dashboard .kpi-topline i {
  border-color: #cad8ef;
  color: #7b89a5;
  background: #fff;
}

.page-dashboard .exec-kpi-card strong {
  max-width: calc(100% - 48px);
  margin: 3px 0 0;
  color: #10245f;
  font-size: 30px;
}

.page-dashboard .exec-kpi-card small {
  max-width: calc(100% - 48px);
  min-height: 36px;
  color: #7a86a0;
  font-size: 11px;
  line-height: 1.35;
}

.page-dashboard .sparkline {
  position: absolute;
  right: 16px;
  bottom: 11px;
  left: 16px;
  width: calc(100% - 32px);
  height: 38px;
}

.page-dashboard .sparkline polyline,
.page-dashboard .sparkline line {
  stroke-width: 3.2;
}

.page-dashboard .ops-command-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 12px;
  align-items: start;
}

.page-dashboard .ops-stack {
  display: grid;
  gap: 12px;
}

.page-dashboard .ops-control-card,
.page-dashboard .ops-router-card,
.page-dashboard .ops-volume-card,
.page-dashboard .ops-times-card,
.page-dashboard .ops-live-queues-card {
  overflow: hidden;
}

.page-dashboard .ops-control-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #dce6f5;
  border-radius: 10px;
  background: #f7faff;
}

.page-dashboard .ops-control-tile {
  min-height: 104px;
  padding: 16px 14px;
  border-right: 1px solid #dce6f5;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.page-dashboard .ops-control-tile:last-child {
  border-right: 0;
}

.page-dashboard .ops-control-tile span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #50649d;
  font-size: 11px;
  font-weight: 900;
}

.page-dashboard .ops-control-tile span::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 5px rgba(23, 184, 214, 0.1);
}

.page-dashboard .ops-control-tile strong {
  display: block;
  margin: 10px 0 3px;
  color: #10245f;
  font-size: 20px;
  line-height: 1.1;
}

.page-dashboard .ops-control-tile small {
  color: #7a86a0;
  font-size: 11px;
  font-weight: 800;
}

.page-dashboard .ops-control-tile.good {
  background: linear-gradient(180deg, #effaf4 0%, #ffffff 100%);
}

.page-dashboard .ops-control-tile.good span,
.page-dashboard .ops-control-tile.good strong {
  color: #118255;
}

.page-dashboard .ops-control-tile.maintenance {
  background: linear-gradient(180deg, #fff9ea 0%, #ffffff 100%);
}

.page-dashboard .ops-control-tile.maintenance span,
.page-dashboard .ops-control-tile.maintenance strong {
  color: #a76400;
}

.page-dashboard .ops-control-tile.outage {
  background: linear-gradient(180deg, #fff1f1 0%, #ffffff 100%);
}

.page-dashboard .ops-control-tile.outage span,
.page-dashboard .ops-control-tile.outage strong {
  color: #d64545;
}

.page-dashboard .ops-control-tile.human {
  background: linear-gradient(180deg, #f4f7ff 0%, #ffffff 100%);
}

.page-dashboard .ops-control-tile.human span,
.page-dashboard .ops-control-tile.human strong {
  color: #1d367f;
}

.page-dashboard .ops-router-wrap {
  display: grid;
  grid-template-columns: 178px 1fr;
  gap: 18px;
  align-items: center;
  min-height: 214px;
}

.page-dashboard .ops-router-donut {
  position: relative;
  display: grid;
  place-items: center;
  width: 172px;
  height: 172px;
  border-radius: 50%;
  background: conic-gradient(#18316f 0% 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5), 0 18px 40px rgba(19, 37, 90, 0.12);
}

.page-dashboard .ops-router-donut::after {
  content: "";
  position: absolute;
  inset: 42px;
  border-radius: inherit;
  background: #fff;
  box-shadow: inset 0 0 0 1px #e2eaf6;
}

.page-dashboard .ops-router-donut strong,
.page-dashboard .ops-router-donut span {
  position: relative;
  z-index: 1;
  color: #10245f;
}

.page-dashboard .ops-router-donut strong {
  font-size: 28px;
  line-height: 1;
}

.page-dashboard .ops-router-donut span {
  margin-top: 42px;
  color: #7a86a0;
  font-size: 11px;
  font-weight: 900;
}

.page-dashboard .ops-router-legend {
  display: grid;
  gap: 10px;
}

.page-dashboard .ops-router-legend div {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  color: #506080;
  font-size: 12px;
  font-weight: 800;
}

.page-dashboard .ops-router-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.page-dashboard .ops-router-legend strong {
  color: #10245f;
  font-size: 12px;
}

.page-dashboard .ops-router-legend em {
  color: #7a86a0;
  font-style: normal;
}

.page-dashboard .ops-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: -2px 0 10px;
}

.page-dashboard .ops-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #506080;
  font-size: 12px;
  font-weight: 800;
}

.page-dashboard .ops-chart-legend i {
  width: 18px;
  height: 3px;
  border-radius: 999px;
}

.page-dashboard .ops-chart-legend .blue {
  background: #1d4ed8;
}

.page-dashboard .ops-chart-legend .cyan {
  background: #17b8d6;
}

.page-dashboard .ops-chart-surface {
  position: relative;
  min-height: 220px;
  border: 1px solid #dce6f5;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.page-dashboard .ops-chart-surface svg {
  display: block;
  width: 100%;
  height: 220px;
}

.page-dashboard .ops-chart-grid line {
  stroke: #e4ebf7;
  stroke-width: 1;
}

.page-dashboard .ops-chart-grid text,
.page-dashboard .ops-chart-labels text,
.page-dashboard .ops-chart-empty {
  fill: #7a86a0;
  font-size: 11px;
  font-weight: 900;
  text-anchor: middle;
}

.page-dashboard .ops-chart-grid text {
  text-anchor: end;
}

.page-dashboard .ops-chart-empty {
  text-anchor: middle;
}

.page-dashboard .ops-line {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page-dashboard .ops-line.total {
  stroke: #1d4ed8;
}

.page-dashboard .ops-line.resolved {
  stroke: #17b8d6;
  stroke-dasharray: 8 8;
}

.page-dashboard .ops-chart-dot {
  fill: #fff;
  stroke: #17b8d6;
  stroke-width: 3;
  transition: r 160ms ease, filter 160ms ease;
}

.page-dashboard .ops-chart-dot.active {
  r: 6;
  filter: drop-shadow(0 6px 10px rgba(23, 184, 214, 0.3));
}

.page-dashboard .ops-bar {
  rx: 4px;
}

.page-dashboard .ops-bar.response {
  fill: #1d4ed8;
}

.page-dashboard .ops-bar.resolution {
  fill: #17b8d6;
}

.page-dashboard .ops-chart-hit {
  fill: transparent;
  outline: none;
  cursor: crosshair;
}

.page-dashboard .ops-chart-tooltip {
  position: absolute;
  z-index: 8;
  min-width: 176px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #071f62;
  color: #fff;
  box-shadow: 0 18px 38px rgba(7, 31, 98, 0.28);
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.page-dashboard .ops-chart-tooltip.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.page-dashboard .ops-chart-tooltip span,
.page-dashboard .ops-chart-tooltip small {
  display: block;
  color: rgba(255, 255, 255, 0.74);
  font-size: 11px;
  font-weight: 800;
}

.page-dashboard .ops-chart-tooltip strong {
  display: block;
  margin: 3px 0;
  color: #fff;
  font-size: 14px;
}

.page-dashboard .sla-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 66px;
  justify-content: center;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.page-dashboard .sla-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.page-dashboard .sla-chip.good {
  background: #eaf8f1;
  color: #118255;
}

.page-dashboard .sla-chip.warning {
  background: #fff5dc;
  color: #a76400;
}

.page-dashboard .sla-chip.critical {
  background: #fff0f0;
  color: #d64545;
}

.page-dashboard .exec-insight-strip {
  gap: 12px;
}

.page-dashboard .exec-insight-strip article,
.page-dashboard .exec-panel {
  border-color: #dce6f5;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 42px rgba(16, 36, 95, 0.07);
}

.page-dashboard .exec-insight-strip article {
  min-height: 90px;
  padding: 16px;
}

.page-dashboard .insight-number {
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  background: #5267a8;
}

.page-dashboard .exec-two-col {
  grid-template-columns: minmax(0, 2fr) minmax(320px, 0.92fr);
  gap: 12px;
}

.page-dashboard .exec-panel {
  padding: 16px;
}

.page-dashboard .panel-header {
  margin-bottom: 12px;
}

.page-dashboard .panel-header h2 {
  color: #1b337b;
  font-size: 18px;
}

.page-dashboard .journey-track {
  gap: 10px;
}

.page-dashboard .journey-track div {
  min-height: 98px;
  border-color: #dce6f5;
  border-radius: 8px;
  background: #f8faff;
}

.page-dashboard .journey-track div::after {
  right: -12px;
  color: #9aabcb;
}

.page-dashboard .flow-health-list progress {
  height: 8px;
}

.page-dashboard .table-wrap {
  border-color: #dce6f5;
  border-radius: 8px;
}

.page-dashboard table th {
  color: #7a86a0;
  font-size: 11px;
}

.page-dashboard table td {
  color: #435072;
  font-size: 12px;
}

.page-dashboard .metric-overlay.show {
  background: rgba(7, 31, 98, 0.18);
  backdrop-filter: blur(4px);
}

.page-dashboard .metric-popup {
  top: 104px;
  right: 34px;
  width: min(430px, calc(100vw - 42px));
  border: 1px solid #dce6f5;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 30px 90px rgba(7, 31, 98, 0.28);
  transform: translateY(12px) scale(0.94);
}

.page-dashboard .metric-popup.show {
  transform: translateY(0) scale(1);
}

.page-dashboard .metric-popup::before {
  content: "";
  position: absolute;
  top: -9px;
  right: 78px;
  width: 16px;
  height: 16px;
  border-left: 1px solid #dce6f5;
  border-top: 1px solid #dce6f5;
  background: rgba(255, 255, 255, 0.98);
  transform: rotate(45deg);
}

.page-dashboard .metric-popup-tabs {
  border-radius: 8px;
}

.page-dashboard .metric-popup-grid div,
.page-dashboard .metric-popup-chart {
  border-color: #dce6f5;
  border-radius: 8px;
}

@media (max-width: 1380px) {
  .page-dashboard .exec-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .page-dashboard .exec-two-col,
  .page-dashboard .exec-ops-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  body.page-dashboard::before {
    left: 0;
  }

  .page-dashboard .app-frame {
    margin-left: 0;
  }

  .page-dashboard .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    max-height: none;
    padding: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .page-dashboard .sidebar::-webkit-scrollbar {
    display: none;
  }

  .page-dashboard .side-brand,
  .page-dashboard .side-status,
  .page-dashboard .side-logout {
    display: none;
  }

  .page-dashboard .side-nav {
    display: flex;
    gap: 8px;
    min-width: max-content;
  }

  .page-dashboard .side-nav a {
    flex: 0 0 auto;
    min-height: 38px;
    border-radius: 999px;
    white-space: nowrap;
  }

  .page-dashboard .shell {
    width: min(100% - 20px, 1540px);
    margin-top: 14px;
  }
}

@media (max-width: 1180px) {
  .page-dashboard .ops-command-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-dashboard .ops-control-tiles,
  .page-dashboard .ops-router-wrap {
    grid-template-columns: 1fr;
  }

  .page-dashboard .ops-control-tile {
    border-right: 0;
    border-bottom: 1px solid #dce6f5;
  }

  .page-dashboard .ops-control-tile:last-child {
    border-bottom: 0;
  }

  .page-dashboard .ops-router-donut {
    width: 156px;
    height: 156px;
    margin: 0 auto;
  }

  .page-dashboard .ops-router-donut::after {
    inset: 38px;
  }

  .page-dashboard .ops-chart-surface,
  .page-dashboard .ops-chart-surface svg {
    min-height: 190px;
    height: 190px;
  }
}

@media (max-width: 680px) {
  html,
  body.page-dashboard {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .page-dashboard .exec-page {
    gap: 12px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .page-dashboard .shell {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    overflow-x: hidden;
  }

  .page-dashboard .exec-page > *,
  .page-dashboard .exec-two-col,
  .page-dashboard .exec-ops-row,
  .page-dashboard .exec-panel,
  .page-dashboard .exec-kpi-grid,
  .page-dashboard .exec-insight-strip {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .page-dashboard .exec-hero {
    display: grid;
    gap: 12px;
    align-items: start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .page-dashboard .exec-hero > div,
  .page-dashboard .exec-hero .muted {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal !important;
  }

  .page-dashboard .exec-hero h1 {
    font-size: 28px;
  }

  .page-dashboard .exec-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .page-dashboard .exec-toolbar .live-badge,
  .page-dashboard .exec-toolbar .secondary-button {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    justify-content: center;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .page-dashboard .live-badge .live-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page-dashboard .range-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px;
    width: min(360px, calc(100dvw - 20px));
    min-width: 0;
    max-width: min(360px, calc(100dvw - 20px));
    overflow: hidden;
  }

  .page-dashboard .range-tab {
    flex: none !important;
    width: auto;
    min-width: 0;
    padding: 0 2px;
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .page-dashboard .range-label-full {
    display: none;
  }

  .page-dashboard .range-label-short {
    display: inline;
  }

  .page-dashboard .guardrail-banner {
    display: grid;
    grid-template-columns: auto 1fr;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow: visible;
  }

  .page-dashboard .guardrail-banner > div {
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal !important;
  }

  .page-dashboard .guardrail-banner span {
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  .page-dashboard .guardrail-banner a {
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
    text-align: center;
    white-space: normal;
  }

  .page-dashboard .exec-kpi-grid,
  .page-dashboard .exec-insight-strip,
  .page-dashboard .journey-track,
  .page-dashboard .metric-popup-grid,
  .page-dashboard .metric-trend-grid,
  .page-dashboard .metric-drill-grid,
  .page-dashboard .slim-filters {
    grid-template-columns: 1fr;
  }

  .page-dashboard .exec-kpi-card {
    min-height: 142px;
  }

  .page-dashboard .metric-popup {
    inset: auto 0 0 0;
    width: 100%;
    max-height: 88vh;
    border-radius: 18px 18px 0 0;
    transform: translateY(100%) scale(1);
  }

  .page-dashboard .metric-popup::before {
    display: none;
  }
}

/* Premium desktop rail: compact by default, expands smoothly on hover/focus. */
@media (min-width: 921px) {
  body.is-authenticated {
    --sidebar-expanded: 276px;
    --sidebar-collapsed: 84px;
  }

  body.page-dashboard {
    --sidebar-expanded: 246px;
    --sidebar-collapsed: 84px;
  }

  body.is-authenticated::before {
    left: var(--sidebar-collapsed);
  }

  body.is-authenticated .app-frame,
  body.page-dashboard .app-frame {
    margin-left: var(--sidebar-collapsed) !important;
  }

  body.is-authenticated .sidebar,
  body.page-dashboard .sidebar {
    width: var(--sidebar-collapsed) !important;
    padding: 20px 14px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
    transition:
      width 0.34s cubic-bezier(0.22, 1, 0.36, 1),
      padding 0.34s cubic-bezier(0.22, 1, 0.36, 1),
      box-shadow 0.34s ease,
      transform 0.34s ease;
    will-change: width;
  }

  body.is-authenticated .sidebar::-webkit-scrollbar {
    display: none;
  }

  body.is-authenticated .sidebar:hover,
  body.is-authenticated .sidebar:focus-within,
  body.is-authenticated .sidebar.is-expanded,
  body.page-dashboard .sidebar:hover,
  body.page-dashboard .sidebar:focus-within,
  body.page-dashboard .sidebar.is-expanded {
    width: var(--sidebar-expanded) !important;
    padding: 22px 16px;
    box-shadow: 22px 0 58px rgba(8, 31, 98, 0.28);
  }

  body.is-authenticated .side-brand,
  body.page-dashboard .side-brand {
    justify-content: center;
    width: 100%;
    min-height: 54px;
    margin-bottom: 24px;
    gap: 0;
    transition: gap 0.28s ease;
  }

  body.is-authenticated .sidebar:hover .side-brand,
  body.is-authenticated .sidebar:focus-within .side-brand,
  body.is-authenticated .sidebar.is-expanded .side-brand,
  body.page-dashboard .sidebar:hover .side-brand,
  body.page-dashboard .sidebar:focus-within .side-brand,
  body.page-dashboard .sidebar.is-expanded .side-brand {
    justify-content: flex-start;
    gap: 12px;
  }

  body.is-authenticated .brand-mark,
  body.page-dashboard .brand-mark {
    flex: 0 0 52px;
    transform-origin: center;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease;
  }

  body.is-authenticated .sidebar:hover .brand-mark,
  body.is-authenticated .sidebar:focus-within .brand-mark,
  body.is-authenticated .sidebar.is-expanded .brand-mark,
  body.page-dashboard .sidebar:hover .brand-mark,
  body.page-dashboard .sidebar:focus-within .brand-mark,
  body.page-dashboard .sidebar.is-expanded .brand-mark {
    transform: scale(1.03);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
  }

  body.is-authenticated .brand-copy,
  body.page-dashboard .brand-copy,
  body.is-authenticated .side-nav a > span:not(.nav-icon),
  body.page-dashboard .side-nav a > span:not(.nav-icon),
  body.is-authenticated .side-status div,
  body.page-dashboard .side-status div {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    transform: translateX(-8px);
    transition:
      max-width 0.32s cubic-bezier(0.22, 1, 0.36, 1),
      opacity 0.22s ease,
      transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  }

  body.is-authenticated .sidebar:hover .brand-copy,
  body.is-authenticated .sidebar:focus-within .brand-copy,
  body.is-authenticated .sidebar.is-expanded .brand-copy,
  body.page-dashboard .sidebar:hover .brand-copy,
  body.page-dashboard .sidebar:focus-within .brand-copy,
  body.page-dashboard .sidebar.is-expanded .brand-copy {
    max-width: 170px;
    opacity: 1;
    transform: translateX(0);
  }

  body.is-authenticated .side-nav,
  body.page-dashboard .side-nav {
    gap: 9px;
  }

  body.is-authenticated .side-nav a,
  body.page-dashboard .side-nav a {
    justify-content: center;
    gap: 0;
    min-height: 46px;
    padding: 0;
    overflow: hidden;
    border-radius: 14px;
    transition:
      background 0.24s ease,
      border-color 0.24s ease,
      box-shadow 0.24s ease,
      gap 0.28s ease,
      padding 0.28s ease,
      transform 0.24s ease;
  }

  body.is-authenticated .sidebar:hover .side-nav a,
  body.is-authenticated .sidebar:focus-within .side-nav a,
  body.is-authenticated .sidebar.is-expanded .side-nav a,
  body.page-dashboard .sidebar:hover .side-nav a,
  body.page-dashboard .sidebar:focus-within .side-nav a,
  body.page-dashboard .sidebar.is-expanded .side-nav a {
    justify-content: flex-start;
    gap: 11px;
    padding: 0 12px;
  }

  body.is-authenticated .sidebar:hover .side-nav a > span:not(.nav-icon),
  body.is-authenticated .sidebar:focus-within .side-nav a > span:not(.nav-icon),
  body.is-authenticated .sidebar.is-expanded .side-nav a > span:not(.nav-icon),
  body.page-dashboard .sidebar:hover .side-nav a > span:not(.nav-icon),
  body.page-dashboard .sidebar:focus-within .side-nav a > span:not(.nav-icon),
  body.page-dashboard .sidebar.is-expanded .side-nav a > span:not(.nav-icon) {
    max-width: 180px;
    opacity: 1;
    transform: translateX(0);
  }

  body.is-authenticated .nav-icon,
  body.page-dashboard .nav-icon {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
  }

  body.is-authenticated .side-status,
  body.page-dashboard .side-status {
    justify-content: center;
    gap: 0;
    min-height: 50px;
    padding: 12px 0;
    overflow: hidden;
    border-radius: 14px;
    transition: gap 0.28s ease, padding 0.28s ease, background 0.24s ease;
  }

  body.is-authenticated .sidebar:hover .side-status,
  body.is-authenticated .sidebar:focus-within .side-status,
  body.is-authenticated .sidebar.is-expanded .side-status,
  body.page-dashboard .sidebar:hover .side-status,
  body.page-dashboard .sidebar:focus-within .side-status,
  body.page-dashboard .sidebar.is-expanded .side-status {
    justify-content: flex-start;
    gap: 11px;
    padding: 14px;
  }

  body.is-authenticated .sidebar:hover .side-status div,
  body.is-authenticated .sidebar:focus-within .side-status div,
  body.is-authenticated .sidebar.is-expanded .side-status div,
  body.page-dashboard .sidebar:hover .side-status div,
  body.page-dashboard .sidebar:focus-within .side-status div,
  body.page-dashboard .sidebar.is-expanded .side-status div {
    max-width: 180px;
    opacity: 1;
    transform: translateX(0);
  }

  body.is-authenticated .side-logout .icon-button,
  body.page-dashboard .side-logout .icon-button {
    position: relative;
    display: grid;
    place-items: center;
    width: 48px;
    min-width: 48px;
    min-height: 44px;
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
    border-radius: 14px;
    font-size: 0;
    transition: width 0.28s ease, border-radius 0.28s ease, font-size 0.16s ease;
  }

  body.is-authenticated .side-logout .icon-button::before,
  body.page-dashboard .side-logout .icon-button::before {
    content: "S";
    color: #fff;
    font-size: 13px;
    font-weight: 900;
  }

  body.is-authenticated .sidebar:hover .side-logout .icon-button,
  body.is-authenticated .sidebar:focus-within .side-logout .icon-button,
  body.is-authenticated .sidebar.is-expanded .side-logout .icon-button,
  body.page-dashboard .sidebar:hover .side-logout .icon-button,
  body.page-dashboard .sidebar:focus-within .side-logout .icon-button,
  body.page-dashboard .sidebar.is-expanded .side-logout .icon-button {
    width: 100%;
    border-radius: 999px;
    font-size: 13px;
  }

  body.is-authenticated .sidebar:hover .side-logout .icon-button::before,
  body.is-authenticated .sidebar:focus-within .side-logout .icon-button::before,
  body.is-authenticated .sidebar.is-expanded .side-logout .icon-button::before,
  body.page-dashboard .sidebar:hover .side-logout .icon-button::before,
  body.page-dashboard .sidebar:focus-within .side-logout .icon-button::before,
  body.page-dashboard .sidebar.is-expanded .side-logout .icon-button::before {
    content: "";
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.is-authenticated .sidebar,
  body.is-authenticated .sidebar *,
  body.page-dashboard .sidebar,
  body.page-dashboard .sidebar * {
    transition-duration: 0.01ms !important;
  }
}

/* Presentation-safe sidebar: readable by default while the page UI is being reviewed. */
@media (min-width: 921px) {
  body.is-authenticated .app-frame {
    margin-left: 276px !important;
  }

  body.page-dashboard .app-frame {
    margin-left: 246px !important;
  }

  body.is-authenticated::before {
    left: 276px;
  }

  body.page-dashboard::before {
    left: 246px;
  }

  body.is-authenticated .sidebar {
    width: 276px !important;
    padding: 22px;
  }

  body.page-dashboard .sidebar {
    width: 246px !important;
    padding: 22px 16px;
  }

  body.is-authenticated .side-brand,
  body.page-dashboard .side-brand {
    justify-content: flex-start;
    gap: 12px;
  }

  body.is-authenticated .brand-copy,
  body.page-dashboard .brand-copy,
  body.is-authenticated .side-nav a > span:not(.nav-icon),
  body.page-dashboard .side-nav a > span:not(.nav-icon),
  body.is-authenticated .side-status div,
  body.page-dashboard .side-status div {
    max-width: 190px;
    opacity: 1;
    overflow: visible;
    transform: none;
  }

  body.is-authenticated .side-nav a,
  body.page-dashboard .side-nav a {
    justify-content: flex-start;
    gap: 11px;
    padding: 0 12px;
  }

  body.is-authenticated .side-status,
  body.page-dashboard .side-status {
    justify-content: flex-start;
    gap: 11px;
    padding: 14px;
  }

  body.is-authenticated .side-logout .icon-button,
  body.page-dashboard .side-logout .icon-button {
    width: 100%;
    min-width: 0;
    font-size: 13px;
    border-radius: 999px;
  }

  body.is-authenticated .side-logout .icon-button::before,
  body.page-dashboard .side-logout .icon-button::before {
    display: none;
  }
}

/* Final Khazna rail direction: icon-only by default, full labels on hover/focus. */
@media (min-width: 921px) {
  body.is-authenticated {
    --rail-width: 56px;
    --rail-open-width: 276px;
  }

  body.page-dashboard {
    --rail-width: 50px;
    --rail-open-width: 246px;
  }

  body.is-authenticated::before,
  body.page-dashboard::before {
    left: var(--rail-width) !important;
  }

  body.is-authenticated .app-frame,
  body.page-dashboard .app-frame {
    margin-left: var(--rail-width) !important;
  }

  body.is-authenticated .sidebar,
  body.page-dashboard .sidebar {
    width: var(--rail-width) !important;
    padding: 14px 7px !important;
    overflow-x: hidden;
    overflow-y: auto;
    border-radius: 0;
    background:
      linear-gradient(150deg, rgba(255,255,255,0.12) 0 12%, transparent 12% 100%),
      linear-gradient(180deg, #06206a 0%, #0b3188 54%, #094c98 100%) !important;
    box-shadow: 10px 0 28px rgba(8, 31, 98, 0.18);
    transition:
      width 0.34s cubic-bezier(0.22, 1, 0.36, 1),
      padding 0.34s cubic-bezier(0.22, 1, 0.36, 1),
      box-shadow 0.34s ease !important;
  }

  body.is-authenticated .sidebar:hover,
  body.is-authenticated .sidebar:focus-within,
  body.is-authenticated .sidebar.is-expanded,
  body.page-dashboard .sidebar:hover,
  body.page-dashboard .sidebar:focus-within,
  body.page-dashboard .sidebar.is-expanded {
    width: var(--rail-open-width) !important;
    padding: 18px 14px !important;
    box-shadow: 20px 0 54px rgba(8, 31, 98, 0.26);
  }

  body.is-authenticated .side-brand,
  body.page-dashboard .side-brand {
    display: flex;
    justify-content: center !important;
    gap: 0 !important;
    min-height: 34px;
    margin-bottom: 18px !important;
  }

  body.is-authenticated .sidebar:hover .side-brand,
  body.is-authenticated .sidebar:focus-within .side-brand,
  body.is-authenticated .sidebar.is-expanded .side-brand,
  body.page-dashboard .sidebar:hover .side-brand,
  body.page-dashboard .sidebar:focus-within .side-brand,
  body.page-dashboard .sidebar.is-expanded .side-brand {
    justify-content: flex-start !important;
    gap: 12px !important;
  }

  body.is-authenticated .brand-mark,
  body.page-dashboard .brand-mark {
    width: 34px !important;
    height: 34px !important;
    flex: 0 0 34px !important;
    border: 1px solid rgba(255,255,255,0.58) !important;
    border-radius: 8px !important;
    background: rgba(255,255,255,0.98) !important;
    box-shadow: 0 10px 24px rgba(0,0,0,0.16) !important;
    transition:
      width 0.28s ease,
      height 0.28s ease,
      flex-basis 0.28s ease,
      transform 0.28s ease,
      box-shadow 0.28s ease !important;
  }

  body.is-authenticated .sidebar:hover .brand-mark,
  body.is-authenticated .sidebar:focus-within .brand-mark,
  body.is-authenticated .sidebar.is-expanded .brand-mark,
  body.page-dashboard .sidebar:hover .brand-mark,
  body.page-dashboard .sidebar:focus-within .brand-mark,
  body.page-dashboard .sidebar.is-expanded .brand-mark {
    width: 48px !important;
    height: 48px !important;
    flex-basis: 48px !important;
    transform: scale(1.02);
  }

  body.is-authenticated .brand-mark img,
  body.page-dashboard .brand-mark img {
    width: 25px !important;
  }

  body.is-authenticated .sidebar:hover .brand-mark img,
  body.is-authenticated .sidebar:focus-within .brand-mark img,
  body.is-authenticated .sidebar.is-expanded .brand-mark img,
  body.page-dashboard .sidebar:hover .brand-mark img,
  body.page-dashboard .sidebar:focus-within .brand-mark img,
  body.page-dashboard .sidebar.is-expanded .brand-mark img {
    width: 37px !important;
  }

  body.is-authenticated .brand-copy,
  body.page-dashboard .brand-copy,
  body.is-authenticated .side-nav a > span:not(.nav-icon),
  body.page-dashboard .side-nav a > span:not(.nav-icon),
  body.is-authenticated .side-status div,
  body.page-dashboard .side-status div {
    max-width: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    transform: translateX(-8px) !important;
    transition:
      max-width 0.32s cubic-bezier(0.22, 1, 0.36, 1),
      opacity 0.2s ease,
      transform 0.3s cubic-bezier(0.22, 1, 0.36, 1) !important;
  }

  body.is-authenticated .sidebar:hover .brand-copy,
  body.is-authenticated .sidebar:focus-within .brand-copy,
  body.is-authenticated .sidebar.is-expanded .brand-copy,
  body.page-dashboard .sidebar:hover .brand-copy,
  body.page-dashboard .sidebar:focus-within .brand-copy,
  body.page-dashboard .sidebar.is-expanded .brand-copy,
  body.is-authenticated .sidebar:hover .side-nav a > span:not(.nav-icon),
  body.is-authenticated .sidebar:focus-within .side-nav a > span:not(.nav-icon),
  body.is-authenticated .sidebar.is-expanded .side-nav a > span:not(.nav-icon),
  body.page-dashboard .sidebar:hover .side-nav a > span:not(.nav-icon),
  body.page-dashboard .sidebar:focus-within .side-nav a > span:not(.nav-icon),
  body.page-dashboard .sidebar.is-expanded .side-nav a > span:not(.nav-icon),
  body.is-authenticated .sidebar:hover .side-status div,
  body.is-authenticated .sidebar:focus-within .side-status div,
  body.is-authenticated .sidebar.is-expanded .side-status div,
  body.page-dashboard .sidebar:hover .side-status div,
  body.page-dashboard .sidebar:focus-within .side-status div,
  body.page-dashboard .sidebar.is-expanded .side-status div {
    max-width: 190px !important;
    opacity: 1 !important;
    transform: translateX(0) !important;
  }

  body.is-authenticated .side-nav,
  body.page-dashboard .side-nav {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 7px !important;
  }

  body.is-authenticated .side-nav a,
  body.page-dashboard .side-nav a {
    justify-content: center !important;
    gap: 0 !important;
    width: 36px !important;
    min-height: 36px !important;
    margin: 0 auto;
    padding: 0 !important;
    border-radius: 8px !important;
    color: rgba(255,255,255,0.86) !important;
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    transition:
      width 0.3s cubic-bezier(0.22, 1, 0.36, 1),
      gap 0.28s ease,
      padding 0.28s ease,
      background 0.2s ease,
      border-color 0.2s ease,
      box-shadow 0.2s ease,
      color 0.2s ease !important;
  }

  body.is-authenticated .side-nav a:hover,
  body.is-authenticated .side-nav a.active,
  body.page-dashboard .side-nav a:hover,
  body.page-dashboard .side-nav a.active {
    background: rgba(255,255,255,0.14) !important;
    border-color: rgba(255,255,255,0.16) !important;
    color: #fff !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.14) !important;
  }

  body.is-authenticated .sidebar:hover .side-nav a,
  body.is-authenticated .sidebar:focus-within .side-nav a,
  body.is-authenticated .sidebar.is-expanded .side-nav a,
  body.page-dashboard .sidebar:hover .side-nav a,
  body.page-dashboard .sidebar:focus-within .side-nav a,
  body.page-dashboard .sidebar.is-expanded .side-nav a {
    justify-content: flex-start !important;
    gap: 11px !important;
    width: 100% !important;
    padding: 0 12px !important;
    margin: 0;
  }

  body.is-authenticated .nav-icon,
  body.page-dashboard .nav-icon,
  body.is-authenticated .side-nav a.active .nav-icon,
  body.page-dashboard .side-nav a.active .nav-icon {
    display: grid !important;
    place-items: center !important;
    width: 22px !important;
    height: 22px !important;
    flex: 0 0 22px !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: currentColor !important;
  }

  body.is-authenticated .nav-icon svg,
  body.page-dashboard .nav-icon svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  body.is-authenticated .side-status,
  body.page-dashboard .side-status {
    justify-content: center !important;
    width: 36px;
    min-height: 36px;
    margin: auto auto 10px !important;
    padding: 0 !important;
    border-radius: 8px !important;
    background: rgba(255,255,255,0.09) !important;
    transition: width 0.3s ease, gap 0.28s ease, padding 0.28s ease !important;
  }

  body.is-authenticated .sidebar:hover .side-status,
  body.is-authenticated .sidebar:focus-within .side-status,
  body.is-authenticated .sidebar.is-expanded .side-status,
  body.page-dashboard .sidebar:hover .side-status,
  body.page-dashboard .sidebar:focus-within .side-status,
  body.page-dashboard .sidebar.is-expanded .side-status {
    justify-content: flex-start !important;
    width: 100%;
    gap: 11px !important;
    padding: 14px !important;
    margin-bottom: 12px !important;
  }

  body.is-authenticated .side-logout,
  body.page-dashboard .side-logout {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.22s ease, transform 0.28s ease;
  }

  body.is-authenticated .sidebar:hover .side-logout,
  body.is-authenticated .sidebar:focus-within .side-logout,
  body.is-authenticated .sidebar.is-expanded .side-logout,
  body.page-dashboard .sidebar:hover .side-logout,
  body.page-dashboard .sidebar:focus-within .side-logout,
  body.page-dashboard .sidebar.is-expanded .side-logout {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  body.is-authenticated .side-logout .icon-button,
  body.page-dashboard .side-logout .icon-button {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    font-size: 13px;
    border-radius: 999px;
  }

  body.is-authenticated .side-logout .icon-button::before,
  body.page-dashboard .side-logout .icon-button::before {
    display: none !important;
  }

  body.is-authenticated .shell,
  body.page-dashboard .shell {
    width: min(100% - 34px, 1540px) !important;
  }
}

/* Premium metric insight popup */
.page-dashboard .metric-overlay.show {
  background:
    radial-gradient(circle at 72% 18%, rgba(31, 199, 216, 0.16), transparent 32%),
    rgba(6, 22, 68, 0.24);
  backdrop-filter: blur(7px);
}

.page-dashboard .metric-popup {
  width: min(540px, calc(100vw - 42px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(189, 207, 235, 0.95);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.99), rgba(247,250,255,0.98));
  box-shadow:
    0 32px 90px rgba(6, 22, 68, 0.26),
    0 1px 0 rgba(255,255,255,0.8) inset;
  transform: translateY(16px) scale(0.96);
  transition:
    opacity 220ms ease,
    transform 340ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 220ms ease;
}

.page-dashboard .metric-popup.show {
  transform: translateY(0) scale(1);
}

.page-dashboard .metric-popup::before {
  display: none;
}

.page-dashboard .metric-popup-head {
  position: relative;
  min-height: 132px;
  padding: 22px 22px 18px;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 26%, rgba(31, 199, 216, 0.32), transparent 26%),
    linear-gradient(135deg, #071a5f 0%, #0d2f89 58%, #0a70a8 100%);
}

.page-dashboard .metric-popup-head::after {
  content: "";
  position: absolute;
  right: -42px;
  bottom: -78px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: rgba(255,255,255,0.09);
}

.page-dashboard .metric-popup-head span,
.page-dashboard .metric-popup-head h2,
.page-dashboard .metric-popup-head strong {
  position: relative;
  z-index: 1;
}

.page-dashboard .metric-popup-head span {
  color: rgba(255,255,255,0.72);
  letter-spacing: 0.08em;
}

.page-dashboard .metric-popup-head h2 {
  margin: 8px 48px 10px 0;
  color: #fff;
  font-size: 24px;
  letter-spacing: 0;
}

.page-dashboard .metric-popup-head strong {
  color: #fff;
  font-size: 42px;
  text-shadow: 0 12px 34px rgba(0,0,0,0.24);
}

.page-dashboard .metric-popup-close {
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-color: rgba(255,255,255,0.28);
  border-radius: 12px;
  background: rgba(255,255,255,0.14);
  color: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,0.16);
  backdrop-filter: blur(8px);
}

.page-dashboard .metric-popup-close:hover,
.page-dashboard .metric-popup-close:focus {
  background: rgba(255,255,255,0.22);
  transform: translateY(-1px);
}

.page-dashboard .metric-popup-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 14px 16px 16px;
  border: 1px solid #d8e4f5;
  border-radius: 14px;
  padding: 5px;
  background: #eef4ff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.86);
}

.page-dashboard .metric-popup-tabs button {
  min-height: 34px;
  border-radius: 10px;
  color: #677694;
  font-size: 12px;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.page-dashboard .metric-popup-tabs button.active {
  background: linear-gradient(135deg, #173678, #2454b8);
  color: #fff;
  box-shadow: 0 10px 22px rgba(23, 54, 120, 0.24);
}

.page-dashboard .metric-popup-section {
  padding: 0 16px 18px;
}

.page-dashboard .metric-popup-grid {
  gap: 10px;
}

.page-dashboard .metric-popup-grid div {
  min-height: 84px;
  border-color: #d8e4f5;
  border-radius: 14px;
  padding: 13px;
  background:
    linear-gradient(180deg, #fff, #f7faff);
  box-shadow: 0 10px 24px rgba(16, 36, 95, 0.05);
}

.page-dashboard .metric-popup-grid span {
  color: #73819f;
  font-size: 11px;
}

.page-dashboard .metric-popup-grid strong {
  color: #10245f;
  font-size: 13.5px;
  line-height: 1.45;
}

.page-dashboard .metric-popup-mini-chart {
  position: relative;
  margin: 12px 0;
  padding: 13px 14px 10px;
  border: 1px solid #d8e4f5;
  border-radius: 16px;
  background:
    radial-gradient(circle at 88% 6%, rgba(31, 199, 216, 0.18), transparent 30%),
    linear-gradient(180deg, #fff, #f7faff);
  box-shadow: 0 14px 30px rgba(16, 36, 95, 0.07);
}

.page-dashboard .metric-popup-mini-chart > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.page-dashboard .metric-popup-mini-chart span {
  color: #73819f;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-dashboard .metric-popup-mini-chart strong {
  color: #10245f;
  font-size: 12.5px;
  font-weight: 900;
  text-align: right;
}

.page-dashboard .metric-popup-mini-chart svg {
  display: block;
  width: 100%;
  height: 132px;
  overflow: visible;
}

.page-dashboard .metric-chart-grid line {
  stroke: #dfe8f6;
  stroke-width: 1;
}

.page-dashboard .metric-chart-grid text,
.page-dashboard .metric-chart-labels text,
.page-dashboard .metric-chart-empty {
  fill: #56678a;
  font-size: 10px;
  font-weight: 800;
  text-anchor: middle;
}

.page-dashboard .metric-chart-empty {
  fill: #73819f;
  font-size: 12px;
  font-weight: 900;
}

.page-dashboard .metric-chart-grid text {
  text-anchor: end;
}

.page-dashboard .metric-chart-line {
  fill: none;
  stroke: url(#metricPopupLine);
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 8px 10px rgba(23, 54, 120, 0.18));
}

.page-dashboard .metric-chart-dot {
  fill: #fff;
  stroke: #18a9c4;
  stroke-width: 2.4;
  pointer-events: none;
  transition: transform 160ms ease, stroke 160ms ease, fill 160ms ease;
  transform-box: fill-box;
  transform-origin: center;
}

.page-dashboard .metric-chart-dot.active {
  fill: #e9fbff;
  stroke: #173678;
  transform: scale(1.18);
}

.page-dashboard .metric-chart-hit {
  fill: transparent;
  stroke: transparent;
  cursor: crosshair;
  pointer-events: all;
}

.page-dashboard .metric-chart-tooltip {
  position: absolute;
  z-index: 8;
  min-width: 156px;
  max-width: 180px;
  padding: 10px 11px;
  border: 1px solid rgba(24, 169, 196, 0.24);
  border-radius: 13px;
  background:
    linear-gradient(135deg, rgba(7, 26, 95, 0.96), rgba(13, 47, 137, 0.94));
  color: #fff;
  box-shadow: 0 18px 42px rgba(6, 22, 68, 0.22);
  opacity: 0;
  transform: translateY(7px) scale(0.97);
  pointer-events: none;
  transition: opacity 150ms ease, transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.page-dashboard .metric-chart-tooltip.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.page-dashboard .metric-chart-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 10px;
  height: 10px;
  background: rgba(13, 47, 137, 0.94);
  border-right: 1px solid rgba(24, 169, 196, 0.24);
  border-bottom: 1px solid rgba(24, 169, 196, 0.24);
  transform: translateX(-50%) rotate(45deg);
}

.page-dashboard .metric-chart-tooltip span,
.page-dashboard .metric-chart-tooltip small {
  display: block;
  color: rgba(255,255,255,0.72);
  font-size: 10px;
  font-weight: 900;
}

.page-dashboard .metric-chart-tooltip strong {
  display: block;
  margin: 4px 0;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
}

.page-dashboard .metric-popup-summary,
.page-dashboard .metric-popup-export-note {
  border-color: rgba(31, 199, 216, 0.28);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(31, 199, 216, 0.09), rgba(255,255,255,0.9));
}

.page-dashboard .metric-popup-summary strong,
.page-dashboard .metric-popup-export-note strong {
  color: #10245f;
  font-size: 13px;
}

.page-dashboard .metric-popup-summary p,
.page-dashboard .metric-popup-export-note span {
  color: #60708f;
  line-height: 1.55;
}

.page-dashboard .metric-popup-filters span {
  border-color: #d8e4f5;
  background: #fff;
  box-shadow: 0 8px 18px rgba(16, 36, 95, 0.05);
}

.page-dashboard .metric-popup-chart {
  height: 128px;
  border-color: #d8e4f5;
  border-radius: 14px;
  background:
    linear-gradient(180deg, #fff, #f7faff);
  box-shadow: 0 10px 24px rgba(16, 36, 95, 0.05);
}

.page-dashboard .metric-popup-chart svg {
  height: 108px;
}

.page-dashboard .metric-trend-grid article,
.page-dashboard .metric-drill-grid a {
  border: 1px solid #d8e4f5;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(16, 36, 95, 0.05);
}

@media (max-width: 680px) {
  .page-dashboard .metric-popup {
    border-radius: 22px 22px 0 0;
  }

  .page-dashboard .metric-popup-head {
    min-height: 116px;
    padding: 20px 18px 16px;
  }

  .page-dashboard .metric-popup-tabs {
    grid-template-columns: repeat(4, max-content);
    overflow-x: auto;
  }
}

/* Final premium motion override: this must stay after all sidebar rules. */
@media (min-width: 921px) {
  body.is-authenticated,
  body.page-dashboard {
    --rail-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --rail-label-delay: 120ms;
  }

  body.is-authenticated .sidebar,
  body.page-dashboard .sidebar {
    isolation: isolate;
    will-change: width, padding, box-shadow;
    background:
      radial-gradient(circle at 28px 30px, rgba(255,255,255,0.17), transparent 42px),
      linear-gradient(145deg, rgba(255,255,255,0.13) 0 13%, transparent 13% 100%),
      linear-gradient(180deg, #061a5f 0%, #0a2b82 50%, #075ba1 100%) !important;
    transition:
      width 520ms var(--rail-ease),
      padding 520ms var(--rail-ease),
      box-shadow 420ms ease,
      background-position 620ms var(--rail-ease) !important;
  }

  body.is-authenticated .sidebar::after,
  body.page-dashboard .sidebar::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    background:
      linear-gradient(90deg, rgba(255,255,255,0.08), transparent 42%),
      radial-gradient(circle at 80% 14%, rgba(64,216,224,0.16), transparent 34%);
    transition: opacity 460ms ease;
  }

  body.is-authenticated .sidebar:hover:not(.is-expanded):not(:focus-within),
  body.page-dashboard .sidebar:hover:not(.is-expanded):not(:focus-within) {
    width: var(--rail-width) !important;
    padding: 14px 7px !important;
    box-shadow: 10px 0 28px rgba(8, 31, 98, 0.18) !important;
  }

  body.is-authenticated .sidebar.is-expanded,
  body.is-authenticated .sidebar:focus-within,
  body.page-dashboard .sidebar.is-expanded,
  body.page-dashboard .sidebar:focus-within {
    width: var(--rail-open-width) !important;
    padding: 18px 14px !important;
    box-shadow: 22px 0 60px rgba(8,31,98,0.28), inset 1px 0 0 rgba(255,255,255,0.16) !important;
  }

  body.is-authenticated .sidebar.is-expanded::after,
  body.is-authenticated .sidebar:focus-within::after,
  body.page-dashboard .sidebar.is-expanded::after,
  body.page-dashboard .sidebar:focus-within::after {
    opacity: 1;
  }

  body.is-authenticated .side-brand,
  body.page-dashboard .side-brand,
  body.is-authenticated .side-nav a,
  body.page-dashboard .side-nav a,
  body.is-authenticated .side-status,
  body.page-dashboard .side-status {
    transition:
      width 500ms var(--rail-ease),
      gap 420ms var(--rail-ease),
      padding 420ms var(--rail-ease),
      background-color 220ms ease,
      border-color 220ms ease,
      box-shadow 220ms ease,
      transform 220ms ease !important;
  }

  body.is-authenticated .brand-mark,
  body.page-dashboard .brand-mark {
    transform: translateZ(0) !important;
    transition:
      width 480ms var(--rail-ease),
      height 480ms var(--rail-ease),
      flex-basis 480ms var(--rail-ease),
      box-shadow 260ms ease,
      transform 260ms ease !important;
  }

  body.is-authenticated .brand-copy,
  body.page-dashboard .brand-copy,
  body.is-authenticated .side-nav a > span:not(.nav-icon),
  body.page-dashboard .side-nav a > span:not(.nav-icon),
  body.is-authenticated .side-status div,
  body.page-dashboard .side-status div {
    filter: blur(2px);
    transition:
      max-width 500ms var(--rail-ease),
      opacity 260ms ease,
      transform 500ms var(--rail-ease),
      filter 260ms ease !important;
    transition-delay: 0ms !important;
  }

  body.is-authenticated .sidebar:hover:not(.is-expanded):not(:focus-within) .brand-copy,
  body.page-dashboard .sidebar:hover:not(.is-expanded):not(:focus-within) .brand-copy,
  body.is-authenticated .sidebar:hover:not(.is-expanded):not(:focus-within) .side-nav a > span:not(.nav-icon),
  body.page-dashboard .sidebar:hover:not(.is-expanded):not(:focus-within) .side-nav a > span:not(.nav-icon),
  body.is-authenticated .sidebar:hover:not(.is-expanded):not(:focus-within) .side-status div,
  body.page-dashboard .sidebar:hover:not(.is-expanded):not(:focus-within) .side-status div {
    max-width: 0 !important;
    opacity: 0 !important;
    transform: translateX(-8px) !important;
    filter: blur(2px) !important;
  }

  body.is-authenticated .sidebar.is-expanded .brand-copy,
  body.is-authenticated .sidebar:focus-within .brand-copy,
  body.page-dashboard .sidebar.is-expanded .brand-copy,
  body.page-dashboard .sidebar:focus-within .brand-copy,
  body.is-authenticated .sidebar.is-expanded .side-nav a > span:not(.nav-icon),
  body.is-authenticated .sidebar:focus-within .side-nav a > span:not(.nav-icon),
  body.page-dashboard .sidebar.is-expanded .side-nav a > span:not(.nav-icon),
  body.page-dashboard .sidebar:focus-within .side-nav a > span:not(.nav-icon),
  body.is-authenticated .sidebar.is-expanded .side-status div,
  body.is-authenticated .sidebar:focus-within .side-status div,
  body.page-dashboard .sidebar.is-expanded .side-status div,
  body.page-dashboard .sidebar:focus-within .side-status div {
    max-width: 190px !important;
    opacity: 1 !important;
    transform: translateX(0) !important;
    filter: blur(0) !important;
    transition-delay: var(--rail-label-delay) !important;
  }

  body.is-authenticated .side-nav a:hover,
  body.page-dashboard .side-nav a:hover {
    transform: translateX(1px);
    background: rgba(255,255,255,0.12) !important;
  }

  body.is-authenticated .side-nav a.active,
  body.page-dashboard .side-nav a.active {
    background: linear-gradient(135deg, rgba(255,255,255,0.22), rgba(255,255,255,0.1)) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 10px 24px rgba(0,0,0,0.1) !important;
  }
}

/* Stable premium rail override: fixed icon rail, expansion overlays content without vertical jump. */
@media (min-width: 921px) {
  body.is-authenticated,
  body.page-dashboard {
    --rail-width: 64px !important;
    --rail-open-width: 276px !important;
    --stable-rail-ease: cubic-bezier(0.16, 1, 0.3, 1);
  }

  body.is-authenticated .app-frame,
  body.page-dashboard .app-frame {
    margin-left: var(--rail-width) !important;
    transition: none !important;
  }

  body.is-authenticated::before,
  body.page-dashboard::before {
    left: var(--rail-width) !important;
  }

  body.is-authenticated .sidebar,
  body.page-dashboard .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: var(--rail-width) !important;
    min-width: var(--rail-width) !important;
    height: 100vh !important;
    padding: 14px 10px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    overflow: hidden !important;
    transform: none !important;
    box-sizing: border-box !important;
    will-change: width, box-shadow;
    transition:
      width 420ms var(--stable-rail-ease),
      min-width 420ms var(--stable-rail-ease),
      box-shadow 320ms ease,
      border-color 320ms ease !important;
  }

  body.is-authenticated .sidebar.is-expanded,
  body.is-authenticated .sidebar:focus-within,
  body.page-dashboard .sidebar.is-expanded,
  body.page-dashboard .sidebar:focus-within {
    width: var(--rail-open-width) !important;
    min-width: var(--rail-open-width) !important;
    padding: 14px 12px !important;
    box-shadow: 28px 0 70px rgba(8, 31, 98, 0.26), inset 1px 0 0 rgba(255,255,255,0.15) !important;
  }

  body.is-authenticated .side-brand,
  body.page-dashboard .side-brand {
    min-height: 44px !important;
    height: 44px !important;
    width: 44px !important;
    margin: 0 auto 6px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    border-radius: 12px !important;
    transition:
      width 420ms var(--stable-rail-ease),
      margin 420ms var(--stable-rail-ease),
      padding 420ms var(--stable-rail-ease),
      background-color 260ms ease,
      box-shadow 260ms ease !important;
  }

  body.is-authenticated .sidebar.is-expanded .side-brand,
  body.is-authenticated .sidebar:focus-within .side-brand,
  body.page-dashboard .sidebar.is-expanded .side-brand,
  body.page-dashboard .sidebar:focus-within .side-brand {
    width: 100% !important;
    margin: 0 0 6px !important;
    padding: 0 4px !important;
    justify-content: flex-start !important;
  }

  body.is-authenticated .brand-mark,
  body.page-dashboard .brand-mark {
    width: 40px !important;
    height: 40px !important;
    flex: 0 0 40px !important;
    border-radius: 11px !important;
    transform: none !important;
    transition: box-shadow 240ms ease, transform 240ms ease !important;
  }

  body.is-authenticated .brand-mark img,
  body.page-dashboard .brand-mark img {
    width: 28px !important;
    height: auto !important;
    display: block !important;
  }

  body.is-authenticated .brand-copy,
  body.page-dashboard .brand-copy {
    min-width: 0 !important;
    max-width: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    transform: translateX(-8px) !important;
    filter: blur(1px) !important;
    transition:
      max-width 360ms var(--stable-rail-ease),
      opacity 220ms ease,
      transform 360ms var(--stable-rail-ease),
      filter 220ms ease !important;
  }

  body.is-authenticated .sidebar.is-expanded .brand-copy,
  body.is-authenticated .sidebar:focus-within .brand-copy,
  body.page-dashboard .sidebar.is-expanded .brand-copy,
  body.page-dashboard .sidebar:focus-within .brand-copy {
    max-width: 190px !important;
    opacity: 1 !important;
    transform: translateX(0) !important;
    filter: blur(0) !important;
    transition-delay: 90ms !important;
  }

  body.is-authenticated .side-nav,
  body.page-dashboard .side-nav {
    display: flex !important;
    flex-direction: column !important;
    gap: 7px !important;
    width: 100% !important;
  }

  body.is-authenticated .side-nav a,
  body.page-dashboard .side-nav a {
    width: 40px !important;
    min-height: 40px !important;
    height: 40px !important;
    margin: 0 auto !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    border-radius: 11px !important;
    transform: none !important;
    transition:
      width 360ms var(--stable-rail-ease),
      padding 360ms var(--stable-rail-ease),
      margin 360ms var(--stable-rail-ease),
      background-color 220ms ease,
      box-shadow 220ms ease !important;
  }

  body.is-authenticated .sidebar.is-expanded .side-nav a,
  body.is-authenticated .sidebar:focus-within .side-nav a,
  body.page-dashboard .sidebar.is-expanded .side-nav a,
  body.page-dashboard .sidebar:focus-within .side-nav a {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 12px !important;
    justify-content: flex-start !important;
    gap: 12px !important;
  }

  body.is-authenticated .nav-icon,
  body.page-dashboard .nav-icon {
    width: 22px !important;
    min-width: 22px !important;
    height: 22px !important;
  }

  body.is-authenticated .side-nav a > span:not(.nav-icon),
  body.page-dashboard .side-nav a > span:not(.nav-icon),
  body.is-authenticated .side-status div,
  body.page-dashboard .side-status div,
  body.is-authenticated .side-logout,
  body.page-dashboard .side-logout {
    max-width: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    transform: translateX(-8px) !important;
    filter: blur(1px) !important;
    transition:
      max-width 360ms var(--stable-rail-ease),
      opacity 220ms ease,
      transform 360ms var(--stable-rail-ease),
      filter 220ms ease !important;
  }

  body.is-authenticated .sidebar.is-expanded .side-nav a > span:not(.nav-icon),
  body.is-authenticated .sidebar:focus-within .side-nav a > span:not(.nav-icon),
  body.page-dashboard .sidebar.is-expanded .side-nav a > span:not(.nav-icon),
  body.page-dashboard .sidebar:focus-within .side-nav a > span:not(.nav-icon),
  body.is-authenticated .sidebar.is-expanded .side-status div,
  body.is-authenticated .sidebar:focus-within .side-status div,
  body.page-dashboard .sidebar.is-expanded .side-status div,
  body.page-dashboard .sidebar:focus-within .side-status div,
  body.is-authenticated .sidebar.is-expanded .side-logout,
  body.is-authenticated .sidebar:focus-within .side-logout,
  body.page-dashboard .sidebar.is-expanded .side-logout,
  body.page-dashboard .sidebar:focus-within .side-logout {
    max-width: 190px !important;
    opacity: 1 !important;
    transform: translateX(0) !important;
    filter: blur(0) !important;
    transition-delay: 90ms !important;
  }

  body.is-authenticated .side-status,
  body.page-dashboard .side-status {
    min-height: 42px !important;
    height: 42px !important;
    width: 40px !important;
    margin: auto auto 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    border-radius: 11px !important;
    transition:
      width 360ms var(--stable-rail-ease),
      padding 360ms var(--stable-rail-ease),
      margin 360ms var(--stable-rail-ease),
      box-shadow 220ms ease !important;
  }

  body.is-authenticated .sidebar.is-expanded .side-status,
  body.is-authenticated .sidebar:focus-within .side-status,
  body.page-dashboard .sidebar.is-expanded .side-status,
  body.page-dashboard .sidebar:focus-within .side-status {
    width: 100% !important;
    margin: auto 0 0 !important;
    padding: 0 12px !important;
    justify-content: flex-start !important;
  }

  body.is-authenticated .side-logout,
  body.page-dashboard .side-logout {
    width: 100% !important;
    margin: 8px 0 0 !important;
  }
}

/* Cross-page premium QA polish: calmer scrollbars, tables, and page containment. */
body.is-authenticated,
body.page-dashboard {
  overflow-x: hidden;
}

body.is-authenticated .shell,
body.page-dashboard .shell {
  overflow-x: clip;
}

body.is-authenticated *::-webkit-scrollbar,
body.page-dashboard *::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

body.is-authenticated *::-webkit-scrollbar-track,
body.page-dashboard *::-webkit-scrollbar-track {
  background: rgba(231, 238, 250, 0.65);
  border-radius: 999px;
}

body.is-authenticated *::-webkit-scrollbar-thumb,
body.page-dashboard *::-webkit-scrollbar-thumb {
  min-height: 44px;
  border: 2px solid rgba(231, 238, 250, 0.65);
  border-radius: 999px;
  background: linear-gradient(180deg, #9db3dc, #6e88c4);
}

body.is-authenticated *::-webkit-scrollbar-thumb:hover,
body.page-dashboard *::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #7f99cf, #496bb3);
}

body.is-authenticated .table-wrap,
body.page-dashboard .table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border-radius: 14px;
  scrollbar-gutter: stable;
}

body.is-authenticated table,
body.page-dashboard table {
  border-collapse: separate;
  border-spacing: 0;
}

body.is-authenticated th,
body.page-dashboard th {
  white-space: nowrap;
}

body.is-authenticated td,
body.page-dashboard td {
  vertical-align: middle;
}

body.is-authenticated .page-heading,
body.is-authenticated .hero-panel,
body.page-dashboard .page-heading,
body.page-dashboard .hero-panel {
  position: relative;
  overflow: hidden;
}

body.is-authenticated .page-heading::after,
body.is-authenticated .hero-panel::after,
body.page-dashboard .page-heading::after,
body.page-dashboard .hero-panel::after {
  content: "";
  position: absolute;
  inset: 0 0 auto auto;
  width: min(380px, 38%);
  height: 100%;
  pointer-events: none;
  background:
    radial-gradient(circle at 72% 18%, rgba(31, 199, 216, 0.13), transparent 34%),
    linear-gradient(135deg, transparent, rgba(26, 54, 134, 0.035));
}

body.is-authenticated .page-heading > *,
body.is-authenticated .hero-panel > *,
body.page-dashboard .page-heading > *,
body.page-dashboard .hero-panel > * {
  position: relative;
  z-index: 1;
}

@media (max-width: 920px) {
  body.is-authenticated,
  body.page-dashboard {
    overflow-x: hidden;
  }

  body.is-authenticated .shell,
  body.page-dashboard .shell {
    width: min(100% - 24px, 100%) !important;
    margin-inline: auto !important;
  }

  body.is-authenticated .topbar,
  body.page-dashboard .topbar {
    position: sticky;
    top: 0;
    z-index: 12;
  }
}
