.topbar {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px 20px;
  background: #fff;
}

.topbar.chat-mode {
  padding-bottom: 16px;
  border-bottom: 1px solid #eef2f7;
}

.title-group {
  min-width: 0;
  max-width: 100%;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 10px;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(var(--theme-primary-rgb, 58, 124, 165), 0.12), rgba(59, 130, 246, 0.08));
  color: var(--theme-primary-active);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.topbar h1 {
  color: #0f172a;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
}

.topbar p {
  margin-top: 6px;
  max-width: 720px;
  color: #64748b;
  font-size: 14px;
  line-height: 1.5;
}

.top-actions {
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.range-combo {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.range-shell {
  height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border: 1px solid #d7e0ea;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.range-meta {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-right: 1px solid #e2e8f0;
  color: #334155;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.range-meta .mdi {
  color: var(--theme-primary);
}

.range-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding-left: 3px;
}

.range-tabs button {
  height: 34px;
  min-width: 54px;
  padding: 0 14px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.range-tabs button:hover:not(.active) {
  background: #f1f5f9;
  color: #334155;
}

.range-tabs button.active {
  background: var(--theme-primary);
  color: #fff;
  box-shadow: 0 6px 14px rgba(var(--theme-primary-rgb, 58, 124, 165), .18);
}

.custom-range-wrap {
  position: relative;
}

.dashboard-switch-wrap {
  width: 190px;
  flex: 0 0 190px;
  height: 44px;
  display: flex;
  align-items: center;
}

.dashboard-switch-select {
  width: 100%;
}

.dashboard-switch-select :deep(.el-select__wrapper) {
  height: 44px;
  min-height: 44px;
  border-radius: 4px;
  background: #f8fbfd;
  box-shadow:
    0 0 0 2px rgba(var(--theme-primary-rgb, 58, 124, 165), .48) inset,
    0 1px 2px rgba(15, 23, 42, .05);
}

.dashboard-switch-select :deep(.el-select__wrapper:hover) {
  background: #f3f9fd;
  box-shadow:
    0 0 0 2px rgba(var(--theme-primary-rgb, 58, 124, 165), .72) inset,
    0 0 0 3px rgba(var(--theme-primary-rgb, 58, 124, 165), .08);
}

.dashboard-switch-select :deep(.el-select__wrapper.is-focused) {
  background: #ffffff;
  box-shadow:
    0 0 0 2px var(--theme-primary) inset,
    0 0 0 3px rgba(var(--theme-primary-rgb, 58, 124, 165), .14);
}

.dashboard-switch-select :deep(.el-select__placeholder),
.dashboard-switch-select :deep(.el-select__selected-item) {
  color: #1e293b;
  font-size: 13px;
  font-weight: 800;
}

.custom-range-btn {
  height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid #d7e0ea;
  border-radius: 4px;
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.custom-range-btn:hover,
.custom-range-btn.active {
  border-color: rgba(var(--theme-primary-rgb, 58, 124, 165), .34);
  background: #f5fbff;
  color: var(--theme-primary-active);
}

.calendar-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 336px;
  z-index: 40;
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #d7e0ea;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, .16);
}

.calendar-popover header,
.calendar-popover footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.calendar-popover header strong {
  color: #0f172a;
  font-size: 15px;
}

.calendar-popover header button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #64748b;
}

.date-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.date-fields label {
  display: grid;
  gap: 6px;
}

.date-fields span {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.date-fields input {
  width: 100%;
  height: 38px;
  padding: 0 9px;
  border: 1px solid #d7e0ea;
  border-radius: 4px;
  color: #0f172a;
  font-size: 13px;
}

.ghost-btn,
.apply-btn {
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 750;
}

.ghost-btn {
  border: 1px solid #d7e0ea;
  background: #fff;
  color: #334155;
}

.apply-btn {
  border: 0;
  background: var(--theme-primary);
  color: #fff;
}

.apply-btn:disabled {
  cursor: not-allowed;
  background: #cbd5e1;
}

.kpi-chips {
  min-width: 0;
  max-width: 100%;
  display: flex;
  gap: 10px;
}

.detail-topbar-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-kpi-chips {
  justify-content: flex-end;
  gap: 8px;
}

.detail-kpi-chip {
  min-width: 112px;
  padding: 6px 10px;
  gap: 1px 8px;
}

.detail-kpi-chip .chip-value {
  font-size: 16px;
  font-weight: 820;
  letter-spacing: 0;
}

.detail-kpi-chip .chip-label {
  font-size: 11px;
}

.detail-kpi-chip .chip-delta {
  font-size: 10px;
}

.detail-alert-strip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.detail-alert-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  background: #fff7ed;
  color: #ea580c;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.detail-alert-pill i {
  font-size: 14px;
}

.detail-alert-pill.neutral {
  border-color: #d7e0ea;
  background: #f8fafc;
  color: #334155;
}

.detail-alert-pill.success {
  border-color: var(--success-line);
  background: var(--success-soft);
  color: var(--success);
}

.detail-alert-pill.danger {
  border-color: #fecaca;
  background: #fff1f2;
  color: #dc2626;
}

.topbar-toolset {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  min-width: 0;
}

.topbar-icon-btn {
  position: relative;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #111827;
  font-size: 23px;
  line-height: 1;
  transition:
    color 160ms var(--ease),
    background 160ms var(--ease);
}

.topbar-icon-btn:hover {
  background: var(--theme-primary-light-9);
  color: var(--theme-primary-active);
}

.notification-wrap {
  position: relative;
  display: inline-flex;
}

.notification-wrap.is-open .notification-btn {
  border: 1px solid var(--theme-primary-light-5);
  background: var(--theme-primary-light-9);
  color: var(--theme-primary-active);
}

.notification-btn {
  position: relative;
  overflow: visible;
  border: 1px solid transparent;
  border-radius: 4px;
  transition:
    border-color 180ms var(--ease),
    background 180ms var(--ease),
    color 180ms var(--ease);
}

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #fff;
  border-radius: 4px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.notification-panel-enter-active,
.notification-panel-leave-active {
  transition:
    opacity 220ms var(--ease),
    transform 220ms var(--ease);
}

.notification-panel-enter-from,
.notification-panel-leave-to {
  opacity: 0;
  transform: translateY(-6px);
}

@media (prefers-reduced-motion: reduce) {
  .notification-panel-enter-active,
  .notification-panel-leave-active {
    transition-duration: 1ms;
  }

  .notification-panel-enter-from,
  .notification-panel-leave-to {
    transform: none;
  }
}

.notification-popover {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 60;
  width: 428px;
  max-width: calc(100vw - 24px);
  max-height: min(560px, calc(100vh - 68px));
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  border: 1px solid #dbe4ef;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 
    0 18px 42px rgba(15, 23, 42, 0.13),
    0 4px 12px rgba(15, 23, 42, 0.06);
  overscroll-behavior-y: contain;
}

.notification-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid #e6edf6;
  background: #ffffff;
}

.notification-head-brand {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.notification-head-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid #dbeafe;
  border-radius: 4px;
  background: #f8fbff;
  color: var(--theme-primary-active);
  font-size: 17px;
}

.notification-head-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.notification-head strong {
  color: #0f172a;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.notification-head small {
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

.notification-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.notification-clear-btn {
  height: 30px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #475569;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  transition:
    background 160ms var(--ease),
    border-color 160ms var(--ease),
    color 160ms var(--ease);
}

.notification-clear-btn:hover:not(:disabled) {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: var(--theme-primary-active);
}

.notification-clear-btn:disabled {
  color: #cbd5e1;
  cursor: not-allowed;
}

.notification-close-btn {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #64748b;
  font-size: 18px;
  transition:
    background 160ms var(--ease),
    color 160ms var(--ease);
}

.notification-close-btn:hover {
  background: #eef2f7;
  color: #0f172a;
}

.notification-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0 16px;
  border-bottom: 1px solid #e6edf6;
  background: #f8fafc;
}

.notification-tabs button {
  position: relative;
  flex: 1 1 0;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: #64748b;
  font-size: 13px;
  font-weight: 750;
  transition:
    color 180ms var(--ease),
    border-color 180ms var(--ease);
}

.notification-tabs button em {
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  transition:
    background 180ms var(--ease),
    color 180ms var(--ease);
}

.notification-tabs button.active {
  color: var(--theme-primary-active);
  border-bottom-color: var(--theme-primary-active);
}

.notification-tabs button.active em {
  background: var(--theme-primary-light-9);
  color: var(--theme-primary-active);
}

.notification-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: min(420px, calc(100vh - 166px));
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 0 14px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f8fafc;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
}

.notification-list::-webkit-scrollbar {
  width: 6px;
}

.notification-list::-webkit-scrollbar-track {
  background: #f8fafc;
}

.notification-list::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background: #cbd5e1;
}

.notification-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  min-height: 104px;
  padding: 20px 22px;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  flex-shrink: 0;
  cursor: pointer;
  text-align: left;
  transition:
    background 180ms var(--ease),
    transform 180ms var(--ease);
}

.notification-row + .notification-row {
  border-top: 1px solid #f4f6fb;
}

.notification-row.unread {
  background: #ffffff;
}

.notification-row:hover {
  background: #f8fafc;
}

.notification-row.unread:hover {
  background: #f8fafc;
}

.notification-avatar {
  position: relative;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.notification-avatar.danger {
  border-color: #fecaca;
  background: #fff1f2;
  color: #be123c;
}

.notification-avatar.warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: #b45309;
}

.notification-avatar.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.notification-avatar.info {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #2563eb;
}

.notification-avatar-label {
  line-height: 1;
}

.notification-avatar-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.notification-row-content {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.notification-row-top {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.notification-row-title {
  min-width: 0;
  color: #111827;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-row.unread .notification-row-title {
  color: #0f172a;
}

.notification-preview {
  max-width: 100%;
  color: #8a94a6;
  font-size: 13.5px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-time {
  flex: 0 0 auto;
  color: #b4bcc8;
  font-size: 13px;
  font-style: normal;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  white-space: nowrap;
}

.notification-empty {
  min-height: 148px;
  display: grid;
  place-items: center;
  justify-items: center;
  gap: 6px;
  padding: 24px 20px;
  text-align: center;
}

.notification-empty-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #f8fafc;
  color: #94a3b8;
  font-size: 22px;
}

.notification-empty strong {
  color: #334155;
  font-size: 14px;
  font-weight: 800;
}

.notification-empty > span:last-child {
  max-width: 220px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.5;
}

.help-wrap {
  position: relative;
  display: inline-flex;
}

.help-wrap.is-open .help-btn {
  border: 1px solid var(--theme-primary-light-5);
  background: var(--theme-primary-light-9);
  color: var(--theme-primary-active);
}

.help-btn {
  border: 1px solid transparent;
  border-radius: 4px;
  transition:
    border-color 180ms var(--ease),
    background 180ms var(--ease),
    color 180ms var(--ease);
}

.help-panel-enter-active,
.help-panel-leave-active {
  transition:
    opacity 220ms var(--ease),
    transform 220ms var(--ease);
}

.help-panel-enter-from,
.help-panel-leave-to {
  opacity: 0;
  transform: translateY(-6px);
}

@media (prefers-reduced-motion: reduce) {
  .help-panel-enter-active,
  .help-panel-leave-active {
    transition-duration: 1ms;
  }

  .help-panel-enter-from,
  .help-panel-leave-to {
    transform: none;
  }
}

.help-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: min(300px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid #d7e0ea;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
}

.help-popover::before {
  content: "";
  display: block;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--theme-primary-active) 0%,
    var(--theme-primary-light-3, #7eb3d4) 100%
  );
}

.help-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #edf2f7;
  background: #fafbfd;
}

.help-head-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--theme-primary-light-6);
  border-radius: 4px;
  background: #fff;
  color: var(--theme-primary-active);
  font-size: 17px;
}

.help-head-copy {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  gap: 2px;
}

.help-head-copy strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
}

.help-head-copy small {
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

.help-close-btn {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #64748b;
  font-size: 18px;
  transition:
    background 160ms var(--ease),
    color 160ms var(--ease);
}

.help-close-btn:hover {
  background: #eef2f7;
  color: #0f172a;
}

.help-meta {
  margin: 0;
  padding: 10px 14px 12px;
  display: grid;
  gap: 8px;
}

.help-meta-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.help-meta-row--block {
  grid-template-columns: 1fr;
  gap: 4px;
}

.help-meta-row dt {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.help-meta-row dd {
  margin: 0;
  color: #0f172a;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
}

.help-meta-row--block dd {
  color: #475569;
  font-size: 12px;
  font-weight: 600;
}

.company-switcher {
  max-width: min(220px, 28vw);
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px 0 16px;
  border: 1px solid #edf1f5;
  border-radius: 999px;
  background: #fff;
  color: #111827;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, .04),
    inset 0 1px 0 rgba(255, 255, 255, .92);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition:
    border-color 160ms var(--ease),
    box-shadow 160ms var(--ease),
    color 160ms var(--ease);
}

.company-switcher:hover {
  border-color: rgba(var(--theme-primary-rgb, 58, 124, 165), .26);
  color: var(--theme-primary-active);
  box-shadow: 0 6px 16px rgba(var(--theme-primary-rgb, 58, 124, 165), .08);
}

.company-switcher span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.company-switcher .mdi {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 16px;
}

.topbar-ai-mode-toggle {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    conic-gradient(from 210deg, #15b8c8, #4f6fef, #b65cff, #ec4899, #f59e0b, #15b8c8) border-box;
  box-shadow:
    0 8px 18px rgba(79, 111, 239, 0.16),
    0 0 0 1px rgba(255, 255, 255, 0.78) inset;
  transition:
    transform 180ms var(--ease),
    box-shadow 180ms var(--ease),
    filter 180ms var(--ease);
}

.topbar-ai-mode-toggle__glyph {
  display: inline-block;
  background: linear-gradient(135deg, #0ea5b7 4%, #4f6fef 34%, #a855f7 58%, #ec4899 76%, #f59e0b 96%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  font-size: 15px;
  font-weight: 950;
  line-height: 1;
  letter-spacing: 0;
}

.topbar-ai-mode-toggle:hover,
.topbar-ai-mode-toggle:focus-visible {
  transform: translateY(-1px);
  box-shadow:
    0 12px 24px rgba(79, 111, 239, 0.2),
    0 0 0 4px rgba(236, 72, 153, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.86) inset;
}

.topbar-ai-mode-toggle:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--theme-primary-active) 72%, #ffffff);
  outline-offset: 3px;
}

.topbar-ai-mode-toggle.active {
  filter: saturate(1.1);
  box-shadow:
    0 12px 24px rgba(79, 111, 239, 0.22),
    0 0 0 4px rgba(14, 165, 183, 0.09),
    0 0 0 1px rgba(255, 255, 255, 0.88) inset;
}

.topbar-ai-mode-toggle:not(.active) {
  filter: saturate(0.82);
  box-shadow:
    0 6px 14px rgba(15, 23, 42, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.82) inset;
}

.kpi-chip {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  gap: 2px 10px;
  padding: 8px 16px;
  border-radius: 4px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--chip-color) 8%, #fff), color-mix(in srgb, var(--chip-color) 3%, #f8fafc));
  border: 1px solid color-mix(in srgb, var(--chip-color) 18%, #e2e8f0);
}

.chip-value {
  grid-row: 1 / 3;
  align-self: center;
  color: #0f172a;
  font-size: 22px;
  font-weight: 850;
  line-height: 1;
}

.chip-value small {
  font-size: 13px;
  font-weight: 700;
  margin-left: 2px;
}

.chip-label {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.chip-delta {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
}

.chip-delta.up { color: var(--success); }
.chip-delta.down { color: #f59e0b; }

.topbar-spacer {
  flex: 1;
  min-width: 0;
}

.create-top-btn {
  height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: var(--theme-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 750;
  box-shadow: 0 8px 18px rgba(var(--theme-primary-rgb, 58, 124, 165), 0.18);
  white-space: nowrap;
}

.create-top-btn:hover {
  background: var(--theme-primary-active);
}

@media (min-width: 961px) and (max-width: 1440px),
       (min-width: 961px) and (max-height: 820px) {
  .topbar {
    gap: 16px;
    padding: 12px 20px 14px;
  }

  .topbar.chat-mode {
    padding-bottom: 12px;
  }

  .eyebrow {
    margin-bottom: 5px;
    padding: 2px 8px;
    font-size: 10px;
    letter-spacing: 0.8px;
  }

  .topbar h1 {
    font-size: 22px;
    line-height: 1.16;
  }

  .topbar p {
    display: -webkit-box;
    max-width: 640px;
    margin-top: 3px;
    overflow: hidden;
    color: #64748b;
    font-size: 12.5px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
  }

  .top-actions {
    gap: 10px;
  }

  .range-shell {
    height: 36px;
    padding: 2px;
  }

  .range-meta {
    height: 30px;
    gap: 6px;
    padding: 0 10px;
    font-size: 12px;
  }

  .range-tabs button {
    height: 30px;
    min-width: 48px;
    padding: 0 10px;
    font-size: 12px;
  }

  .custom-range-btn {
    height: 36px;
    gap: 6px;
    padding: 0 11px;
    font-size: 12px;
  }

  .dashboard-switch-wrap {
    width: 176px;
    flex-basis: 176px;
    height: 38px;
  }

  .dashboard-switch-select :deep(.el-select__wrapper) {
    height: 38px;
    min-height: 38px;
  }

  .topbar-toolset {
    gap: 12px;
  }

  .topbar-icon-btn {
    width: 30px;
    height: 30px;
    font-size: 20px;
  }

  .company-switcher {
    height: 34px;
    padding: 0 12px;
    font-size: 12px;
  }

  .topbar-ai-mode-toggle {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
  }

  .topbar-ai-mode-toggle__glyph {
    font-size: 14px;
  }

  .kpi-chips {
    gap: 8px;
  }

  .kpi-chip {
    gap: 1px 8px;
    padding: 6px 12px;
  }

  .chip-value {
    font-size: 18px;
  }

  .chip-value small {
    font-size: 11px;
  }

  .chip-label {
    font-size: 11px;
  }

  .chip-delta {
    font-size: 10px;
  }

  .detail-alert-pill {
    min-height: 28px;
    padding: 0 10px;
    font-size: 11.5px;
  }

  .create-top-btn {
    height: 36px;
    padding: 0 14px;
    font-size: 13px;
  }
}

@media (max-width: 1120px) {
  .range-combo {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 960px) {
  .topbar {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .top-actions,
  .search-wrap,
  .search-wrap.wide,
  .topbar-toolset,
  .detail-alert-strip,
  .month-chip,
  .qa-filter,
  .new-question-btn {
    width: 100%;
  }

  .range-combo {
    justify-content: stretch;
  }

  .topbar-toolset {
    justify-content: flex-end;
  }

  .topbar-ai-mode-toggle {
    width: 34px;
    height: 34px;
  }

  .range-shell {
    flex: 1;
  }

  .range-meta {
    flex: 1;
  }

  .custom-range-btn {
    width: 100%;
    justify-content: center;
  }

  .dashboard-switch-wrap {
    width: 100%;
    flex: 1 1 100%;
  }

  .calendar-popover {
    right: auto;
    left: 0;
  }
}

@media (max-width: 760px) {
  .title-group {
    padding-right: 56px;
  }

  .topbar.detail-mode {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 10px 14px;
  }

  .topbar.detail-mode .title-group {
    min-width: 0;
    padding-right: 50px;
  }

  .topbar.detail-mode .eyebrow {
    display: none;
  }

  .topbar.detail-mode h1 {
    font-size: 22px;
    line-height: 1.12;
  }

  .topbar.detail-mode p {
    max-width: 100%;
    margin-top: 3px;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    font-size: 12px;
    line-height: 1.35;
  }

  .topbar.detail-mode .top-actions,
  .topbar.detail-mode .detail-topbar-actions {
    width: 100%;
    min-width: 0;
    justify-content: flex-end;
  }

  .topbar.detail-mode .detail-alert-strip {
    width: auto;
    max-width: 100%;
    min-width: 0;
    justify-content: flex-end;
    gap: 6px;
  }

  .topbar.detail-mode .detail-alert-pill {
    min-height: 26px;
    max-width: 100%;
    padding: 0 9px;
    border-radius: 4px;
    font-size: 11px;
  }
}

@media (max-width: 640px) {
  .topbar {
    gap: 14px;
    padding: 16px 16px 14px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .kpi-chips {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
    gap: 8px;
    overflow: visible;
    padding-bottom: 0;
  }

  .kpi-chip {
    min-width: 0;
    padding: 8px 12px;
  }

  .chip-value,
  .chip-label,
  .chip-delta {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-toolset {
    gap: 10px;
  }

  .notification-popover {
    position: fixed;
    top: 72px;
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    max-height: calc(100vh - 92px);
  }

  .notification-head {
    align-items: flex-start;
    padding: 11px 12px 9px;
  }

  .notification-head-actions {
    gap: 2px;
  }

  .notification-clear-btn {
    padding: 0 8px;
  }

  .notification-list {
    max-height: calc(100vh - 218px);
  }

  .notification-row {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    min-height: 90px;
    padding: 16px 14px;
  }

  .notification-avatar {
    width: 44px;
    height: 44px;
    font-size: 16px;
  }

  .notification-row-top {
    gap: 8px;
  }

  .notification-time {
    font-size: 12px;
  }

  .company-switcher {
    flex: 1 1 auto;
    max-width: none;
    justify-content: space-between;
  }

  .topbar-ai-mode-toggle {
    flex: 0 0 34px;
  }

  .range-combo {
    display: grid;
    gap: 8px;
  }

  .range-shell {
    height: auto;
    display: grid;
    gap: 4px;
  }

  .range-meta {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid #e2e8f0;
    justify-content: center;
  }

  .range-tabs {
    width: 100%;
    padding-left: 0;
  }

  .range-tabs button {
    flex: 1;
    padding: 0 8px;
  }

  .calendar-popover {
    width: min(336px, calc(100vw - 32px));
  }

  .date-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .notification-popover {
    top: 64px;
    right: 8px;
    left: 8px;
    max-height: calc(100vh - 78px);
  }

  .notification-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .notification-head-brand {
    gap: 8px;
  }

  .notification-head-icon,
  .notification-avatar {
    width: 30px;
    height: 30px;
  }

  .notification-tabs {
    padding: 0 10px;
  }

  .notification-row {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
    min-height: 82px;
    padding: 13px 10px;
  }

  .notification-avatar {
    font-size: 13px;
  }

  .notification-avatar-badge {
    min-width: 16px;
    height: 16px;
    font-size: 9px;
  }

  .notification-row-title {
    font-size: 13.5px;
  }

  .notification-preview {
    font-size: 12.5px;
  }

  .topbar.detail-mode {
    gap: 6px;
    padding: 8px 12px;
  }

  .topbar.detail-mode h1 {
    font-size: 20px;
  }

  .topbar.detail-mode p {
    font-size: 11.5px;
  }

  .topbar.detail-mode .detail-alert-pill {
    min-height: 24px;
  }
}
