:root {
  --ui-font-family: "Inter", "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --ui-type-page-title: 22px;
  --ui-type-section-title: 16px;
  --ui-type-body: 14px;
  --ui-type-control: 13px;
  --ui-type-chart: 12px;
  --ui-type-caption: 12px;
  --ui-type-metric: 26px;
  --ui-control-height: 38px;
  --ui-bg: #f4f6f8;
  --ui-surface: #ffffff;
  --ui-surface-subtle: #f8fafc;
  --ui-border: #e2e7ee;
  --ui-border-strong: #cfd7e3;
  --ui-text: #111827;
  --ui-text-soft: #344054;
  --ui-muted: #667085;
  --ui-primary: #2563eb;
  --ui-primary-hover: #1d4ed8;
  --ui-primary-soft: #eff6ff;
  --ui-success: #039855;
  --ui-danger: #d92d20;
  --ui-warning: #dc6803;
  --dash-sidebar-width: 216px;
  --dash-page-pad: 22px;
  --dash-gap: 16px;
  --dash-chart-gap: 16px;
  --dash-filter-gap: 12px;
  --dash-filter-user-space: 0px;
  --dash-card-pad-x: 18px;
  --dash-card-pad-y: 16px;
  --dash-metric-min-height: 112px;
  --dash-metric-icon-size: 44px;
  --dash-panel-head-height: 52px;
  background: var(--ui-bg);
  color: var(--ui-text);
  letter-spacing: 0;
  font-family: var(--ui-font-family);
}

/* Keep the embedded WeChat dashboard chrome aligned with the 5173 shell. */
.appShell {
  transition: grid-template-columns 220ms ease;
  overflow-x: hidden;
  overflow-x: clip;
}

.sidebar {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  contain: paint;
  transform: none;
  transition: opacity 120ms ease;
}

.appShell.sidebarCollapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.appShell.sidebarCollapsed .sidebar {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: none;
  transition: none;
}

.wechatDashboardWorkspace .workspaceTopbar {
  flex: 0 0 clamp(64px, 3vw, 76px);
  width: 100%;
  height: clamp(64px, 3vw, 76px);
  margin: 0;
  padding: 0 var(--dash-page-pad);
  background: rgba(255, 255, 255, 0.98);
}

.wechatDashboardWorkspace .wechatTopbarControls,
.materialsWorkspace .wechatTopbarControls,
.mpRoiWorkspace .wechatTopbarControls {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
}

.wechatChromeButton {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--ui-border);
  border-radius: 7px;
  color: #687588;
  background: var(--ui-surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

.wechatChromeButton:hover,
.wechatChromeButton:focus-visible {
  color: var(--ui-primary);
  border-color: #bfd1ef;
  background: var(--ui-primary-soft);
}

.wechatChromeButton svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.themeIconSun {
  display: none;
}

:root[data-theme="dark"] .themeIconMoon {
  display: none;
}

:root[data-theme="dark"] .themeIconSun {
  display: block;
}

.wechatDashboardWorkspace .pageHeading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.mpRoiWorkspace .pageHeading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.mpRoiWorkspace .pageEyebrow {
  display: none;
}

.mpRoiWorkspace .pageHeading h1 {
  color: #101828;
  font-size: 24px;
  font-weight: 700;
}

.mpRoiWorkspace .workspaceTopbarActions {
  position: relative;
  z-index: 2;
}

.wechatDashboardWorkspace .pageEyebrow {
  display: none;
}

.wechatDashboardWorkspace .pageHeading h1 {
  color: #101828;
  font-size: 24px;
  font-weight: 700;
}

.wechatDashboardWorkspace .workspaceTopbarActions {
  position: relative;
  z-index: 2;
  gap: 12px;
}

.wechatDashboardWorkspace .workspaceTopbarActions .aiQueryLauncher,
.wechatDashboardWorkspace .userMenuTrigger {
  height: 40px;
  min-height: 40px;
}

.wechatDashboardWorkspace .userMenuAvatar {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
}

.wechatDashboardWorkspace .wechatDashboardView {
  height: auto;
  min-height: 0;
  flex: 1 1 auto;
}

:root.themeTransition *,
:root.themeTransition *::before,
:root.themeTransition *::after {
  transition-property: background-color, border-color, color, fill, stroke, box-shadow !important;
  transition-duration: 260ms !important;
  transition-timing-function: ease !important;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ui-bg: #0b1220;
  --ui-surface: #111827;
  --ui-surface-subtle: #172033;
  --ui-border: #273449;
  --ui-border-strong: #3b4a62;
  --ui-text: #e5edf7;
  --ui-text-soft: #c5d0df;
  --ui-muted: #93a4ba;
  --ui-primary-soft: #162b4d;
}

:root[data-theme="dark"] body,
:root[data-theme="dark"] .appShell,
:root[data-theme="dark"] .workspace,
:root[data-theme="dark"] .workspace.wechatDashboardWorkspace,
:root[data-theme="dark"] .wechatDashboardView,
:root[data-theme="dark"] .wechatDashboardView iframe {
  background: var(--ui-bg);
}

:root[data-theme="dark"] .wechatDashboardWorkspace .workspaceTopbar,
:root[data-theme="dark"] .mpRoiWorkspace .workspaceTopbar,
:root[data-theme="dark"] .sidebar {
  background: rgba(17, 24, 39, 0.98);
}

:root[data-theme="dark"] .sidebar {
  border-right-color: #334155;
  color: #cbd5e1;
}

:root[data-theme="dark"] .navSectionLabel {
  color: #aebdd0;
}

:root[data-theme="dark"] .navSectionDivider {
  border-top-color: #334155;
}

:root[data-theme="dark"] .navItem {
  color: #c5d0df;
}

:root[data-theme="dark"] .navItem:hover {
  background: #1c293c;
  color: #f8fafc;
}

:root[data-theme="dark"] .navItem:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: -2px;
  background: #1c293c;
  color: #f8fafc;
}

:root[data-theme="dark"] .navItem.active {
  background: #19355f;
  color: #8bb7ff;
}

:root[data-theme="dark"] .navItem.active:hover,
:root[data-theme="dark"] .navItem.active:focus-visible {
  background: #214677;
  color: #b6d2ff;
}

:root[data-theme="dark"] .wechatChromeButton {
  border-color: #3b4a62;
  background: #111827;
  color: #b9c7da;
}

:root[data-theme="dark"] .wechatChromeButton:hover,
:root[data-theme="dark"] .wechatChromeButton:focus-visible {
  border-color: #60a5fa;
  background: #162b4d;
  color: #dbeafe;
}

:root[data-theme="dark"] .materialsWorkspace .workspaceTopbar,
:root[data-theme="dark"] .materialsWorkspace > .filters {
  background: rgba(17, 24, 39, 0.98);
}

:root[data-theme="dark"] .wechatDashboardWorkspace .pageHeading h1,
:root[data-theme="dark"] .mpRoiWorkspace .pageHeading h1,
:root[data-theme="dark"] .materialsWorkspace .pageHeading h1 {
  color: var(--ui-text);
}

:root[data-theme="dark"] .materialsWorkspace .creativeTablePanel,
:root[data-theme="dark"] .materialsWorkspace .creativeTablePanel .tableWrap {
  background: var(--ui-surface);
}

:root[data-theme="dark"] .materialsWorkspace .creativeTable th,
:root[data-theme="dark"] .materialsWorkspace .creativeTable td {
  border-color: var(--ui-border);
  color: var(--ui-text-soft);
}

:root[data-theme="dark"] .materialsWorkspace .creativeTable th,
:root[data-theme="dark"] .materialsWorkspace .creativeTable th:first-child {
  background: var(--ui-surface-subtle);
  color: var(--ui-text);
}

:root[data-theme="dark"] .materialsWorkspace .creativeTable td:first-child {
  background: var(--ui-surface);
}

:root[data-theme="dark"] .materialsWorkspace .creativeTable tbody tr:not(.summaryRow):hover td {
  background: #182338;
}

:root[data-theme="dark"] .materialsWorkspace .creativeTable .summaryRow td,
:root[data-theme="dark"] .materialsWorkspace .creativeTable .summaryRow td:first-child {
  background: #162b4d;
  color: #8bb7ff;
}

:root[data-theme="dark"] .materialsWorkspace .materialPreviewLoading,
:root[data-theme="dark"] .materialsWorkspace .materialPreviewUnavailable {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-subtle);
  color: var(--ui-muted);
}

@media (prefers-reduced-motion: reduce) {
  .appShell,
  .sidebar {
    transition: none;
  }
}

body {
  min-width: 0;
  background: var(--ui-bg);
  color: var(--ui-text);
}

body.authPending {
  min-width: 0;
  overflow: hidden;
}

.authBootScreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: var(--ui-bg);
  color: var(--ui-muted);
}

.authBootScreen[hidden] {
  display: none;
}

.authBootScreen img {
  width: 156px;
  height: auto;
}

.authBootScreen p {
  margin: 0;
  font-size: 13px;
}

.authBootSpinner {
  width: 24px;
  height: 24px;
  border: 2px solid #d7dee8;
  border-top-color: var(--ui-primary);
  border-radius: 50%;
  animation: authBootSpin 0.8s linear infinite;
}

@keyframes authBootSpin {
  to {
    transform: rotate(360deg);
  }
}

.loginScreen::before {
  background: none;
  opacity: 0;
}

.loginPanel input {
  border-color: var(--ui-border-strong);
  border-radius: 6px;
  background: var(--ui-surface);
}

.loginPanel input:focus {
  border-color: var(--ui-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.loginScreen {
  width: 100%;
  height: 100svh;
  min-height: 100svh;
  padding: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  background: var(--ui-bg);
}

.loginPanel {
  position: relative;
  width: min(420px, calc(100vw - 32px));
  min-height: 0;
  margin: 32px 0;
  padding: 38px 40px 30px;
  display: grid;
  align-content: start;
  gap: 18px;
  border: 1px solid var(--ui-border);
  border-top: 3px solid var(--ui-primary);
  border-radius: 8px;
  background: var(--ui-surface);
  box-shadow: 0 18px 48px rgba(16, 24, 40, 0.1);
  transform: none;
}

.loginBrand {
  min-height: 50px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loginBrand img {
  width: 174px;
  transform: none;
}

.loginIntro {
  display: grid;
  gap: 5px;
  margin-bottom: 2px;
  text-align: center;
}

.loginIntro h1 {
  margin: 0;
  color: var(--ui-text);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}

.loginIntro p {
  margin: 0;
  color: var(--ui-muted);
  font-size: 13px;
  line-height: 1.4;
}

.loginPanel label {
  gap: 7px;
  color: var(--ui-text-soft);
  font-size: 13px;
  font-weight: 600;
}

.loginPanel label + label {
  margin-top: 0;
}

.loginPanel input {
  height: 44px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 500;
}

.loginPanel input::placeholder {
  font-size: 13px;
  font-weight: 400;
}

.passwordField input {
  padding-right: 48px;
}

.passwordToggle {
  right: 7px;
  width: 32px;
  height: 32px;
  border-radius: 5px;
}

.passwordToggle svg {
  width: 18px;
  height: 18px;
}

.loginPanel .loginSubmit {
  width: 100%;
  height: 44px;
  margin-top: 2px;
  font-size: 14px;
}

.loginFootnote {
  min-height: 20px;
  margin: 0;
  color: #98a2b3;
  font-size: 11px;
  transform: none;
}

.loginMessage {
  min-height: 0;
  margin: -7px 0 -3px;
  font-size: 12px;
  text-align: left;
}

button,
input,
select {
  letter-spacing: 0;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.appShell {
  background: var(--ui-bg);
}

.sidebar {
  z-index: 30;
  gap: 18px;
  padding: 18px 12px 16px;
  border-right: 1px solid var(--ui-border);
  background: var(--ui-surface);
  color: var(--ui-text-soft);
  box-shadow: 2px 0 12px rgba(16, 24, 40, 0.025);
}

.brand {
  min-height: 52px;
  justify-content: flex-start;
  padding: 0 10px 12px;
  border-bottom: 1px solid var(--ui-border);
}

.brandLogo {
  width: 146px;
  height: 40px;
  justify-content: flex-start;
}

.navList {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.navSectionLabel {
  display: block;
  padding: 8px 12px 5px;
  color: #98a2b3;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.navSectionDivider {
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--ui-border);
}

.navItem {
  position: relative;
  min-height: 42px;
  gap: 11px;
  padding: 0 12px;
  border-radius: 7px;
  color: #475467;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.navItem:hover {
  background: #f3f5f8;
  color: var(--ui-text);
}

.navItem.active {
  background: var(--ui-primary-soft);
  color: var(--ui-primary);
  box-shadow: none;
}

.navItem.active::before {
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--ui-primary);
  content: "";
}

.navIcon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.workspace {
  padding: 0 var(--dash-page-pad) 28px;
  background: var(--ui-bg);
}

.workspace.wechatDashboardWorkspace {
  background: #f4f7fb;
}

.workspaceTopbar {
  position: sticky;
  top: 0;
  z-index: 15;
  width: auto;
  height: 76px;
  margin: 0 calc(var(--dash-page-pad) * -1);
  padding: 0 var(--dash-page-pad);
  border-bottom: 1px solid var(--ui-border);
  background: rgba(255, 255, 255, 0.96);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  pointer-events: auto;
  backdrop-filter: blur(12px);
}

.pageHeading {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.workspaceTopbarActions {
  min-width: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.pageEyebrow {
  color: var(--ui-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.pageHeading h1 {
  margin: 0;
  color: var(--ui-text);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.userMenu {
  position: relative;
  top: auto;
  right: auto;
  z-index: 20;
}

.userMenuTrigger {
  min-width: 150px;
  height: 42px;
  padding: 0 11px 0 6px;
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  background: var(--ui-surface);
  color: var(--ui-text-soft);
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.06);
}

.userMenuTrigger:hover,
.userMenu.open .userMenuTrigger {
  border-color: var(--ui-border-strong);
  background: var(--ui-primary-soft);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.userMenuAvatar {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffb020 0%, #f79009 100%);
  box-shadow: 0 2px 5px rgba(247, 144, 9, 0.22);
}

.userMenuInfo {
  justify-items: start;
  text-align: left;
}

.userMenuDropdown {
  top: calc(100% + 6px);
  border-color: var(--ui-border);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.12);
}

.userMenuAction {
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: 5px;
}

.userMenuAction svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.filters {
  position: sticky;
  top: 76px;
  z-index: 12;
  min-height: 86px;
  margin: 0 calc(var(--dash-page-pad) * -1);
  padding: 13px var(--dash-page-pad) 14px;
  border-bottom: 1px solid var(--ui-border);
  background: rgba(255, 255, 255, 0.96);
  grid-template-columns: 218px repeat(3, minmax(128px, 1fr)) auto;
  gap: var(--dash-filter-gap);
  align-items: end;
  backdrop-filter: blur(12px);
}

.filterGroup,
.dateFilter {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  color: var(--ui-text-soft);
  font-size: 12px;
  font-weight: 600;
}

#materialFilterRoot[hidden] {
  display: none;
}

.filterGroup > span:first-child,
.filterLabel {
  min-height: 15px;
  color: var(--ui-muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 15px;
}

.dateRangeButton,
.multiSelectButton,
input,
select {
  height: 38px;
  border: 1px solid var(--ui-border-strong);
  border-radius: 6px;
  background-color: var(--ui-surface);
  color: var(--ui-text-soft);
  font-size: 13px;
  box-shadow: none;
}

input:hover,
select:hover,
.dateRangeButton:hover,
.multiSelectButton:hover {
  border-color: #aeb9c8;
}

input:focus,
select:focus,
.dateRangeButton[aria-expanded="true"],
.multiSelectButton[aria-expanded="true"] {
  border-color: var(--ui-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.dateRangeButton {
  width: 100%;
  padding: 0 12px;
  border-radius: 6px;
  justify-content: flex-start;
  font-size: 13px;
}

.dateRangeButton:hover,
.dateRangeButton[aria-expanded="true"] {
  color: var(--ui-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.multiSelectButton {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px 0 12px;
  text-align: left;
}

.multiSelectButton > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multiSelectButton svg,
.multiSelectSearch svg {
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.multiSelectButton svg {
  width: 16px;
  height: 16px;
  color: var(--ui-muted);
  transition: transform 160ms ease;
}

.multiSelectButton[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.multiSelectButton.hasSelection {
  color: var(--ui-text);
  font-weight: 600;
}

.multiSelectPanel {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  z-index: 40;
  width: max(100%, 360px);
  overflow: hidden;
  border: 1px solid #dbe2ea;
  border-radius: 8px;
  background: var(--ui-surface);
  box-shadow: 0 18px 46px rgba(16, 24, 40, 0.18), 0 2px 8px rgba(16, 24, 40, 0.06);
}

.singleSelectPanel {
  width: max(100%, 320px);
}

#optimizerFilterRoot .multiSelectOptions {
  max-height: 420px;
}

.selectPanelHeader {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 9px 14px;
  border-bottom: 1px solid #edf0f4;
}

.selectPanelHeader > div {
  display: grid;
  gap: 1px;
}

.selectPanelHeader strong {
  color: var(--ui-text);
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
}

.selectPanelHeader span {
  color: var(--ui-muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 16px;
}

.selectPanelClose {
  display: inline-flex;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ui-muted);
}

.selectPanelClose:hover {
  background: #f2f4f7;
  color: var(--ui-text);
}

.selectPanelClose svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.multiSelectSearch {
  position: relative;
  padding: 10px 12px 8px;
}

.multiSelectSearch svg {
  position: absolute;
  top: 50%;
  left: 24px;
  width: 16px;
  height: 16px;
  color: var(--ui-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.multiSelectSearch input {
  width: 100%;
  height: 38px;
  padding: 0 11px 0 34px;
  border-color: #dfe5ec;
  background: #f8fafc;
  font-size: 13px;
}

.multiSelectSearch input:hover {
  border-color: #c8d1dc;
}

.multiSelectSearch input:focus {
  border-color: #78a6f8;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.multiSelectToolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 13px 0 14px;
  border-bottom: 1px solid #edf0f4;
}

.selectPanelStats {
  color: var(--ui-muted);
  font-size: 11px;
  font-weight: 500;
}

.selectPanelCommands {
  display: flex;
  align-items: center;
  gap: 4px;
}

.multiSelectToolbar button {
  min-width: 44px;
  height: 28px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ui-primary);
  font-size: 12px;
  font-weight: 600;
}

.multiSelectToolbar button:hover {
  color: var(--ui-primary-hover);
  background: #eff5ff;
}

.multiSelectOptions {
  max-height: 310px;
  overflow-y: auto;
  padding: 7px 8px 9px;
  scrollbar-color: #c8d1dc transparent;
  scrollbar-width: thin;
}

.multiSelectOption {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ui-text-soft);
  cursor: pointer;
}

.multiSelectOption:hover {
  background: #f7f9fc;
}

.multiSelectOption[aria-selected="true"] {
  border-color: #cfe0ff;
  background: #f1f6ff;
  color: var(--ui-text);
}

.multiSelectOption input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.multiSelectCheck {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border: 1px solid #b8c3d1;
  border-radius: 4px;
  background: #fff;
  color: #fff;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.multiSelectCheck svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

.multiSelectOption[aria-selected="true"] .multiSelectCheck {
  border-color: var(--ui-primary);
  background: var(--ui-primary);
}

.multiSelectOption[aria-selected="true"] .multiSelectCheck svg {
  opacity: 1;
}

.multiSelectOptionText {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.multiSelectOptionText strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ui-text);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multiSelectOptionText small {
  flex: 0 0 auto;
  color: var(--ui-muted);
  font-size: 11px;
  font-weight: 500;
}

.singleSelectOption {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px 7px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ui-text-soft);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}

.singleSelectOption:hover {
  background: #f7f9fc;
  color: var(--ui-text);
}

.singleSelectOption[aria-selected="true"] {
  border-color: #cfe0ff;
  background: #f1f6ff;
  color: var(--ui-primary);
  font-weight: 600;
}

.singleSelectOptionLabel {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.singleSelectOptionContent {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.singleSelectOptionMeta {
  color: var(--ui-muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 14px;
}

.singleSelectOptionCheck {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

.singleSelectOption[aria-selected="true"] .singleSelectOptionCheck {
  opacity: 1;
}

.multiSelectEmpty {
  padding: 28px 12px;
  color: var(--ui-muted);
  font-size: 12px;
  text-align: center;
}

.dateRangePanel {
  top: calc(100% + 7px);
  border-color: var(--ui-border);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgba(16, 24, 40, 0.16);
}

.filterActions {
  min-width: 146px;
  gap: 8px;
  justify-content: flex-end;
}

.primaryBtn,
.ghostBtn {
  height: 38px;
  min-width: 68px;
  border-radius: 6px;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 600;
}

.primaryBtn {
  border-color: var(--ui-primary);
  background: var(--ui-primary);
  box-shadow: none;
}

.primaryBtn:hover {
  border-color: var(--ui-primary-hover);
  background: var(--ui-primary-hover);
}

.ghostBtn {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface);
  color: var(--ui-text-soft);
}

.ghostBtn:hover {
  border-color: #aeb9c8;
  background: var(--ui-surface-subtle);
}

.primaryBtn svg,
.ghostBtn svg,
.iconBtn svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.iconBtn::before {
  display: none;
}

.filters.materialsFilters {
  grid-template-columns: 218px minmax(260px, 420px) minmax(0, 1fr);
}

.filters.materialsFilters .filterActions {
  grid-column: 3;
  width: 100%;
  justify-self: stretch;
  justify-content: space-between;
}

.filters.materialsFilters .creativeNameFilter {
  grid-column: 2;
}

.statusBar {
  min-height: 34px;
  color: var(--ui-muted);
  font-size: 11px;
}

.statusBar #syncState.isLoading {
  color: var(--ui-primary);
}

.metricGrid {
  gap: var(--dash-gap);
}

.metricCard,
.panel {
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
}

.metricCard {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 17px 44px 17px;
  align-content: center;
  justify-items: center;
  gap: 0;
  min-height: var(--dash-metric-min-height);
  padding: 17px 18px;
}

.metricCard > .metricMain {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.metricCard:nth-child(1) {
  border-top: 2px solid #93c5fd;
}

.metricCard:nth-child(2) {
  border-top: 2px solid #6ee7b7;
}

.metricCard:nth-child(3) {
  border-top: 2px solid #fcd34d;
}

.metricCard:nth-child(4) {
  border-top: 2px solid #c4b5fd;
}

.metricIcon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  font-size: 20px;
  box-shadow: none !important;
}

.metricIcon svg {
  width: 21px;
  height: 21px;
  stroke-width: 1.9;
}

.metricIcon.blue {
  color: #2563eb;
  background: #eff6ff;
}

.metricIcon.green {
  color: #039855;
  background: #ecfdf3;
}

.metricIcon.amber {
  color: #dc6803;
  background: #fffaeb;
}

.metricIcon.violet {
  color: #7a5af8;
  background: #f4f3ff;
}

.metricLabel {
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 17px;
}

.metricCard strong {
  margin: 0;
  color: var(--ui-text);
  font-size: 26px;
  font-variant-numeric: tabular-nums;
}

.metricCard small {
  display: block;
  min-height: 17px;
  color: var(--ui-muted);
  font-size: 11px;
  line-height: 17px;
  text-align: center;
}

.chartGrid .spanBar .panelHead h2,
.chartGrid .optimizerPanel .panelHead h2,
.chartGrid .materialDesignerPanel .panelHead h2 {
  font-size: 16px;
  font-weight: 700;
}

#gameCostTotal,
#optimizerCostTotal,
#materialDesignerCostTotal {
  color: var(--ui-text-soft);
  font-size: 13px;
  font-weight: 600;
}

.gameLegend .legendItem,
.optimizerLegend .legendItem,
.materialDesignerLegend .legendItem {
  min-height: 58px;
  font-size: 13px;
  line-height: 1.4;
}

.gameLegend .legendName,
.optimizerLegend .legendName,
.materialDesignerLegend .legendName {
  color: var(--ui-text-soft);
  font-weight: 600;
}

.gameLegend .legendItem strong,
.optimizerLegend .legendItem strong,
.materialDesignerLegend .legendItem strong {
  color: var(--ui-text-soft);
  font-size: 13px;
  font-weight: 600;
}

.gameLegend .legendItem em,
.optimizerLegend .legendItem em,
.materialDesignerLegend .legendItem em {
  font-size: 12px;
  font-weight: 500;
}

.deltaUp {
  color: var(--ui-success) !important;
}

.deltaDown {
  color: var(--ui-danger) !important;
}

.deltaSlightDown {
  color: var(--ui-warning) !important;
}

.chartGrid {
  gap: var(--dash-chart-gap);
  margin-top: var(--dash-chart-gap);
}

.panelHead {
  min-height: var(--dash-panel-head-height);
  padding: 13px 16px 10px;
  border-bottom: 1px solid #edf0f4;
}

.panelHead h2 {
  color: var(--ui-text);
  font-size: 14px;
  font-weight: 700;
}

.panelHead span {
  color: var(--ui-muted);
  font-size: 11px;
}

.gameDonutLayout,
.optimizerDonutLayout,
.materialDesignerDonutLayout {
  padding-right: 14px;
  padding-left: 14px;
}

.optimizerDonutLayout {
  display: block;
  padding: 12px 16px 14px;
}

.optimizerRanking {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.optimizerEfficiencyPanel {
  min-height: 408px;
}

.optimizerEfficiencyLayout {
  height: 356px;
}

.optimizerEfficiencyChart {
  height: 346px;
}

.optimizerRankingHeader,
.optimizerRankingRow {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) 84px 64px minmax(118px, 1.25fr);
  align-items: center;
  gap: 10px;
}

.optimizerRankingHeader {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 10px;
  border-bottom: 1px solid var(--ui-border);
  color: var(--ui-muted);
  font-size: 11px;
  text-align: center;
}

.optimizerRankingHeader span {
  text-align: center;
}

.optimizerRankingHeader span:nth-child(2),
.optimizerRankingHeader span:nth-child(3) {
  justify-self: stretch;
  text-align: center;
}

.optimizerRankingRows {
  min-height: 0;
  overflow-y: auto;
  scrollbar-color: #c8d1dc transparent;
  scrollbar-width: thin;
}

.optimizerRankingRow {
  width: 100%;
  min-height: 52px;
  padding: 7px 10px;
  border: 0;
  border-bottom: 1px solid #edf0f4;
  background: transparent;
  color: var(--ui-text);
  text-align: left;
  cursor: pointer;
}

.optimizerRankingRow:hover,
.optimizerRankingRow.hovered {
  background: #f7fbff;
}

.optimizerRankingRow.selected {
  background: #eef5ff;
  box-shadow: inset 3px 0 0 var(--ui-primary);
}

.optimizerRankingName {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.optimizerRankingValue {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.optimizerRankingShare {
  justify-self: center;
  min-width: 54px;
  padding: 3px 5px;
  border-radius: 4px;
  background: #f2f4f7;
  color: var(--ui-text-soft);
  font-size: 11px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.optimizerTrendBars {
  display: flex;
  align-items: end;
  justify-content: stretch;
  gap: 2px;
  height: 34px;
  min-width: 0;
  overflow: visible;
  border-radius: 0;
  border-bottom: 1px solid #bdebf4;
}

.optimizerTrendBar {
  flex: 1 1 0;
  max-width: none;
  min-width: 3px;
  border-radius: 3px 3px 0 0;
  background: #12c2e4;
}

.optimizerTrendBar.isZero {
  min-height: 2px;
  background: #dff5f9;
  opacity: 1;
}

.optimizerTrendBars.singleDay {
  justify-content: center;
  overflow: visible;
  border-radius: 0;
}

.optimizerTrendBars.singleDay .optimizerTrendBar {
  width: 8px;
  height: 8px !important;
  min-width: 8px;
  min-height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  align-self: center;
}

.optimizerTrendBar.empty {
  background: #dff5f9;
}

.optimizerTrendEmpty {
  margin: auto;
  color: var(--ui-muted);
  font-size: 12px;
  font-style: normal;
}

.optimizerRankingEmpty {
  display: grid;
  min-height: 240px;
  place-items: center;
  color: var(--ui-muted);
  font-size: 13px;
}

@media (max-width: 1440px) {
  .optimizerRankingHeader,
  .optimizerRankingRow {
    grid-template-columns: minmax(68px, 1fr) 76px 58px minmax(96px, 1fr);
    gap: 7px;
  }
}

.donutTooltip {
  border-color: var(--ui-border);
  border-radius: 7px;
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.14);
}

.gameOtherTooltip {
  width: min(340px, calc(100vw - 48px));
  color: var(--ui-text);
  font-family: var(--ui-font-family);
  font-size: 13px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

.gameOtherTooltipTitle {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.gameOtherTooltipSummary,
.gameOtherTooltipHead,
.gameOtherTooltipRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px 56px;
  align-items: center;
  gap: 10px;
}

.gameOtherTooltipSummary {
  padding-bottom: 9px;
}

.gameOtherTooltipSummary strong,
.gameOtherTooltipRow strong,
.gameOtherTooltipSummary em,
.gameOtherTooltipRow em {
  text-align: right;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.gameOtherTooltipSummary em,
.gameOtherTooltipHead,
.gameOtherTooltipRow em {
  color: var(--ui-muted);
}

.gameOtherTooltipHead {
  padding: 7px 0;
  border-top: 1px solid var(--ui-border);
  border-bottom: 1px solid var(--ui-border);
}

.gameOtherTooltipHead span:nth-child(n + 2) {
  text-align: right;
}

.gameOtherTooltipRows {
  max-height: min(440px, calc(100vh - 230px));
  overflow-y: auto;
  scrollbar-color: #c8d1dc transparent;
  scrollbar-width: thin;
}

.gameOtherTooltipRow {
  min-height: 27px;
  border-bottom: 1px solid #f0f2f5;
}

.gameOtherTooltipRow > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.segmented {
  gap: 2px;
  padding: 3px;
  border: 0;
  border-radius: 6px;
  background: #f0f2f5;
  overflow: visible;
}

.segmented button {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 600;
}

.segmented button.active {
  background: var(--ui-surface);
  color: var(--ui-text);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

.chartMode button {
  height: 24px;
  font-size: 11px;
}

.tablePanel {
  margin-top: var(--dash-gap);
}

.tableHead {
  min-height: 60px;
  padding: 11px 16px;
  border-bottom-color: var(--ui-border);
}

.tableActions {
  flex-wrap: wrap;
}

.tablePanel[data-ai-chart="delivery_table"] > .tableHead {
  flex-wrap: wrap;
}

.tablePanel[data-ai-chart="delivery_table"] > .tableHead > .tableActions {
  margin-left: auto;
  justify-content: flex-end;
}

.tablePanel[data-ai-chart="delivery_table"] > .tableHead > .aiChartButton {
  margin-left: 0;
}

.columnSettings {
  position: relative;
}

.columnSettingsPanel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  width: 320px;
  max-width: min(320px, calc(100vw - 24px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--ui-border-strong);
  border-radius: 8px;
  background: var(--ui-surface);
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.16);
  transform-origin: top right;
  animation: columnSettingsOpen 120ms ease-out;
}

@keyframes columnSettingsOpen {
  from { opacity: 0; transform: translateY(-4px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.columnSettingsPanel[hidden] {
  display: none;
}

.columnSettingsHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--ui-border);
}

.columnSettingsTitle {
  display: grid;
  gap: 2px;
}

.columnSettingsHead strong {
  color: var(--ui-text);
  font-size: 13px;
}

.columnSettingsTitle span {
  color: var(--ui-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.textCommand {
  height: 28px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: var(--ui-primary);
  font-size: 12px;
  cursor: pointer;
}

.columnSettingsList {
  max-height: min(420px, calc(100vh - 250px));
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  list-style: none;
}

.columnSettingItem {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.columnSettingItem:hover {
  background: var(--ui-surface-subtle);
  border-color: var(--ui-border);
}

.columnSettingItem:focus-within {
  border-color: #93b4ed;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.columnSettingItem.isVisible .columnDragHandle {
  color: var(--ui-primary);
}

.columnSettingItem.dragging {
  border-color: #93b4ed;
  background: var(--ui-primary-soft);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.14);
  opacity: 0.82;
}

.columnDragHandle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ui-muted);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.columnDragHandle:active {
  cursor: grabbing;
}

.columnSettingsList.dragActive {
  user-select: none;
}

.columnDragHandle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.columnSettingItem label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 38px;
  padding-right: 8px;
  color: var(--ui-text-soft);
  font-size: 12px;
  cursor: pointer;
}

.columnSettingItem label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.columnSettingItem input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--ui-primary);
}

.columnSettingsFooter {
  display: flex;
  justify-content: flex-end;
  padding: 9px 12px;
  border-top: 1px solid var(--ui-border);
  background: var(--ui-surface-subtle);
}

.columnSettingsFooter .primaryBtn {
  min-width: 72px;
  height: 32px;
  padding: 0 16px;
}

#dashboardTable th.metricColumnHeader {
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
}

#dashboardTable th.metricColumnHeader:active,
body.columnReordering {
  cursor: grabbing;
}

#dashboardTable th.columnOrderDragging {
  border-color: #b8cae6;
  background: var(--ui-surface-subtle);
  color: var(--ui-muted);
  opacity: 0.42;
}

#dashboardTable th.columnDropBefore,
#dashboardTable th.columnDropAfter {
  background: var(--ui-primary-soft);
  color: var(--ui-primary);
}

#dashboardTable th.columnDropBefore,
#dashboardTable td.columnDropGuideBefore {
  box-shadow: inset 2px 0 0 var(--ui-primary);
}

#dashboardTable th.columnDropAfter,
#dashboardTable td.columnDropGuideAfter {
  box-shadow: inset -2px 0 0 var(--ui-primary);
}

.tableHeaderDragGhost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #78a5ec;
  border-radius: 7px;
  background: var(--ui-surface);
  color: var(--ui-text);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.2), 0 2px 6px rgba(16, 24, 40, 0.12);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  pointer-events: none;
  will-change: transform;
}

.tableHeaderDragGhostGrip {
  position: relative;
  width: 3px;
  height: 3px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--ui-primary);
  box-shadow: 0 5px 0 var(--ui-primary), 0 10px 0 var(--ui-primary), 5px 0 0 var(--ui-primary), 5px 5px 0 var(--ui-primary), 5px 10px 0 var(--ui-primary);
  transform: translateY(-5px);
}

.tableHeaderDragGhostLabel {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#dashboardTable th.columnOrderDropped {
  animation: columnOrderDropped 420ms ease-out;
}

@keyframes columnOrderDropped {
  0% { background: #dbeafe; box-shadow: inset 0 -3px 0 var(--ui-primary); }
  100% { background: var(--ui-surface-subtle); box-shadow: inset 0 0 0 transparent; }
}

body.columnReordering {
  user-select: none;
}

.tableWrap {
  min-width: 0;
  max-height: 620px;
  overflow: auto;
  scrollbar-color: #c5ceda transparent;
  scrollbar-width: thin;
}

table {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

#dashboardTable {
  font-size: 14px;
}

#dashboardTable th,
#dashboardTable td {
  height: 50px;
  padding: 9px 6px;
  font-size: 14px;
  line-height: 1.35;
}

#dashboardTable th {
  height: 52px;
  font-size: 13px;
  line-height: 1.3;
}

#dashboardTable .summaryRow td {
  top: 52px;
}

#dashboardTable .metricLink,
#dashboardTable .accountLink,
#dashboardTable .adgroupLink {
  font-size: 14px;
}

#dashboardTable .cellCompare {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.2;
}

.creativeTable th:nth-child(3),
.creativeTable td:nth-child(3) {
  width: 240px;
  text-align: left;
  line-height: 1.45;
}

.creativeTable th:nth-child(4),
.creativeTable td:nth-child(4) {
  width: 112px;
}

.creativeTable {
  font-size: 13px;
}

.creativeTable th {
  font-size: 12px;
}

.creativeTablePanel {
  --creative-row-height: 66px;
  --creative-preview-size: clamp(48px, calc(var(--creative-row-height) - 12px), 60px);
}

.creativeTable tbody tr.creativeDataRow > td {
  height: var(--creative-row-height);
}

.materialPreviewCell {
  padding: 5px 12px;
  text-align: center;
}

.materialPreviewButton,
.materialPreviewLoading,
.materialPreviewUnavailable {
  position: relative;
  width: var(--creative-preview-size);
  height: var(--creative-preview-size);
  margin: 0 auto;
  border-radius: 6px;
}

.materialPreviewButton {
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--ui-border);
  background: #f8fafc;
  color: var(--ui-primary);
  cursor: pointer;
}

.materialPreviewButton:hover,
.materialPreviewButton:focus-visible {
  border-color: var(--ui-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}

.materialPreviewButton > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f8fafc;
}

.materialPreviewFallback,
.materialPreviewUnavailable {
  display: grid;
  place-items: center;
  background: #f8fafc;
  color: var(--ui-muted);
  font-size: 12px;
}

.materialPreviewUnavailable {
  align-content: center;
  gap: 4px;
  border: 1px dashed var(--ui-border);
}

.materialPreviewUnavailable small {
  color: #94a3b8;
  font-size: 10px;
}

.materialPreviewLoading {
  display: grid;
  place-items: center;
  border: 1px solid var(--ui-border);
  background: #f8fafc;
}

.materialPreviewLoading > span {
  width: 20px;
  height: 20px;
  border: 2px solid #bfdbfe;
  border-right-color: var(--ui-primary);
  border-radius: 50%;
  animation: loadingSpin 0.72s linear infinite;
}

.materialPreviewPlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.12);
}

.materialPreviewPlay svg {
  width: 30px;
  height: 30px;
  fill: rgba(255, 255, 255, 0.94);
  stroke: rgba(15, 23, 42, 0.7);
  stroke-width: 1.5;
}

.materialPreviewCount {
  position: absolute;
  right: 4px;
  bottom: 4px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 10px;
  line-height: 1.2;
}

.materialPreviewModal {
  z-index: 100;
}

.materialPreviewPanel {
  width: min(960px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: var(--ui-surface);
}

.materialPreviewHead,
.materialPreviewFooter {
  padding: 16px 18px;
}

.materialPreviewHead {
  border-bottom: 1px solid var(--ui-border);
}

.materialPreviewHead > div {
  min-width: 0;
}

.materialPreviewHead p {
  overflow: hidden;
  margin: 4px 0 0;
  color: var(--ui-muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.materialPreviewContent {
  min-height: 420px;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 20px;
  background: #f8fafc;
}

.materialPreviewVideo,
.materialPreviewImage,
.materialPreviewMainImage img {
  display: block;
  max-width: 100%;
  max-height: min(66vh, 680px);
  object-fit: contain;
}

.materialPreviewVideo {
  width: auto;
  min-width: min(360px, 100%);
  background: #0f172a;
}

.materialPreviewGallery {
  width: 100%;
  display: grid;
  gap: 14px;
}

.materialPreviewMainImage {
  min-height: 320px;
  display: grid;
  place-items: center;
}

.materialPreviewThumbnails {
  display: flex;
  justify-content: center;
  gap: 8px;
  overflow-x: auto;
  padding: 3px;
}

.materialPreviewThumbnails button {
  flex: 0 0 58px;
  width: 58px;
  height: 58px;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--ui-border);
  border-radius: 5px;
  background: #fff;
}

.materialPreviewThumbnails button.active {
  border-color: var(--ui-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14);
}

.materialPreviewThumbnails img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.materialPreviewEmpty {
  color: var(--ui-muted);
}

.materialPreviewFooter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--ui-border);
}

.materialPreviewMeta {
  min-width: 0;
  display: flex;
  gap: 28px;
  margin: 0;
}

.materialPreviewMeta div {
  min-width: 0;
}

.materialPreviewMeta dt {
  color: var(--ui-muted);
  font-size: 11px;
}

.materialPreviewMeta dd {
  overflow-wrap: anywhere;
  margin: 3px 0 0;
  color: var(--ui-text);
  font-size: 13px;
  font-weight: 600;
}

.materialPreviewCopyGroup {
  display: flex;
  align-items: center;
  gap: 10px;
}

.materialPreviewCopyGroup > span {
  min-width: 48px;
  color: #15803d;
  font-size: 12px;
  text-align: right;
}

:root[data-theme="dark"] .materialPreviewPanel,
:root[data-theme="dark"] .materialPreviewHead,
:root[data-theme="dark"] .materialPreviewFooter {
  border-color: var(--ui-border);
  background: var(--ui-surface);
  color: var(--ui-text-soft);
}

:root[data-theme="dark"] .materialPreviewHead h3 {
  color: var(--ui-text);
}

:root[data-theme="dark"] .materialPreviewHead p {
  color: var(--ui-text-soft);
}

:root[data-theme="dark"] .materialPreviewContent {
  background: var(--ui-bg);
}

:root[data-theme="dark"] .materialPreviewThumbnails button {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-subtle);
}

:root[data-theme="dark"] .materialPreviewThumbnails button.active {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.24);
}

:root[data-theme="dark"] .materialPreviewMeta dt {
  color: var(--ui-muted);
}

:root[data-theme="dark"] .materialPreviewMeta dd {
  color: var(--ui-text);
}

:root[data-theme="dark"] .materialPreviewPanel .modalCloseButton {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-subtle);
  color: var(--ui-text-soft);
}

:root[data-theme="dark"] .materialPreviewPanel .modalCloseButton:hover,
:root[data-theme="dark"] .materialPreviewPanel .modalCloseButton:focus-visible {
  border-color: #60a5fa;
  background: var(--ui-primary-soft);
  color: #dbeafe;
}

.optimizerTableWrap,
.roleTableWrap {
  border-color: var(--ui-border);
  border-radius: 7px;
}

.optimizerTable .tableActionGroup {
  gap: 6px;
  flex-wrap: wrap;
}

.roleTable .tableActionGroup {
  justify-content: center;
}

.optimizerTable .tableActionGroup .ghostBtn {
  height: 34px;
  padding: 0 10px;
}

th,
td {
  height: 42px;
  padding: 8px 10px;
  border-right: 0;
  border-bottom: 1px solid #edf0f4;
  color: var(--ui-text-soft);
}

th {
  position: sticky;
  top: 0;
  z-index: 4;
  height: 44px;
  background: #f8fafc;
  color: #475467;
  font-size: 11px;
  font-weight: 700;
}

tbody tr:not(.summaryRow):hover td {
  background: #f8fafc;
}

.summaryRow td {
  position: sticky;
  top: 44px;
  z-index: 3;
  background: #f0f6ff;
  color: #1d4ed8;
  font-weight: 700;
}

th:first-child,
td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--ui-surface);
}

th:first-child {
  z-index: 6;
  background: #f8fafc;
}

.summaryRow td:first-child {
  z-index: 5;
  background: #f0f6ff;
}

.metricLink:hover {
  color: var(--ui-primary);
  text-decoration: none;
}

.accountLink,
.adgroupLink {
  color: var(--ui-primary);
}

.accountLink:hover,
.accountLink.selected,
.adgroupLink:hover,
.adgroupLink.selected {
  background: var(--ui-primary-soft);
  box-shadow: inset 0 0 0 1px #bfdbfe;
}

.pager {
  min-height: 58px;
  padding: 10px 16px;
  border-top: 1px solid var(--ui-border);
  color: var(--ui-muted);
}

.compactSelect {
  position: relative;
  min-width: 96px;
  color: var(--ui-text-soft);
  font-size: 13px;
}

.compactSelectWide {
  width: 100%;
}

.compactSelectButton {
  width: 100%;
  height: 32px;
  padding: 0 9px 0 11px;
  border: 1px solid var(--ui-border-strong);
  border-radius: 6px;
  background: var(--ui-surface);
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: inherit;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.compactSelectButton:hover,
.compactSelect.open .compactSelectButton {
  border-color: #8eb5f6;
  background: var(--ui-primary-soft);
}

.compactSelectButton:focus-visible {
  outline: none;
  border-color: var(--ui-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.compactSelectButton > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compactSelectButton > svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  fill: none;
  stroke: var(--ui-muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.16s ease;
}

.compactSelect.open .compactSelectButton > svg {
  transform: rotate(180deg);
}

.compactSelectMenu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 60;
  min-width: max-content;
  padding: 4px;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: var(--ui-surface);
  box-shadow: 0 10px 26px rgba(16, 24, 40, 0.14);
}

.compactSelect[data-placement="top"] .compactSelectMenu {
  top: auto;
  bottom: calc(100% + 6px);
}

.compactSelectOption {
  width: 100%;
  min-width: 96px;
  height: 32px;
  padding: 0 8px 0 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ui-text-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
}

.compactSelectOption:hover,
.compactSelectOption:focus-visible {
  outline: none;
  background: var(--ui-surface-subtle);
}

.compactSelectOption[aria-selected="true"] {
  color: var(--ui-primary);
  background: var(--ui-primary-soft);
  font-weight: 600;
}

.compactSelectOption svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

.compactSelectOption[aria-selected="true"] svg {
  opacity: 1;
}

.creativePager {
  flex: 0 0 auto;
}

.creativePagerInfo {
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}

.creativePagerControls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  white-space: nowrap;
}

.creativePagerControls button,
.creativePager input {
  height: 32px;
  border: 1px solid var(--ui-border-strong);
  border-radius: 5px;
  background: var(--ui-surface);
  color: var(--ui-text-soft);
  font: inherit;
}

.creativePagerControls button {
  min-width: 48px;
  padding: 0 10px;
}

.creativePagerControls button:hover:not(:disabled) {
  border-color: var(--ui-primary);
  color: var(--ui-primary);
}

.creativePagerControls button:disabled {
  background: var(--ui-surface-subtle);
  color: #b9c3d0;
  cursor: not-allowed;
}

.creativePageSummary {
  color: var(--ui-text-soft);
  font-variant-numeric: tabular-nums;
}

.creativePageSizeControl,
.creativeJumpPage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.creativePager input {
  width: 54px;
  padding: 0 6px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.creativePager input::-webkit-inner-spin-button,
.creativePager input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.pageButtons button {
  width: 32px;
  height: 32px;
  border-color: var(--ui-border);
  border-radius: 5px;
}

.pageButtons button.active {
  border-color: var(--ui-primary);
  background: var(--ui-primary);
}

.modalPanel,
.formModalPanel {
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  box-shadow: 0 24px 64px rgba(16, 24, 40, 0.18);
}

.permissionItem,
.statusPill,
.formMessage,
.roleCard {
  border-radius: 6px;
}

.materialsView,
.optimizersView,
.systemView,
.placeholderView {
  margin-top: var(--dash-gap);
}

@media (min-width: 981px) {
  .workspace.materialsWorkspace {
    height: 100dvh;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 76px auto 34px minmax(0, 1fr);
    overflow: hidden;
  }

  .workspace.materialsWorkspace .pageActionMessage:not(.toastMessage) {
    position: absolute;
  }

  .workspace.materialsWorkspace .pageActionMessage.toastMessage {
    position: fixed;
  }

  .workspace.materialsWorkspace .workspaceTopbar {
    grid-row: 1;
    position: relative;
    justify-content: center;
  }

  .workspace.materialsWorkspace .pageHeading {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
  }

  .workspace.materialsWorkspace .pageHeading h1 {
    font-size: 24px;
  }

  .workspace.materialsWorkspace .pageEyebrow {
    display: none;
  }

  .workspace.materialsWorkspace .workspaceTopbarActions {
    margin-left: auto;
  }

  .workspace.materialsWorkspace > .filters {
    grid-row: 2;
  }

  .workspace.materialsWorkspace > .statusBar {
    grid-row: 3;
  }

  .workspace.materialsWorkspace .materialsView {
    grid-row: 4;
    min-height: 0;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
  }

  .workspace.materialsWorkspace .creativeTablePanel {
    min-height: 0;
    height: auto;
    flex: 1 1 auto;
    margin-top: 0;
  }

  .workspace.materialsWorkspace .creativeTablePanel .tableWrap {
    max-height: none;
  }
}

@media (max-width: 1500px) {
  :root {
    --dash-sidebar-width: 196px;
    --dash-page-pad: 18px;
    --dash-gap: 13px;
    --dash-chart-gap: 13px;
    --dash-filter-gap: 9px;
  }

  .sidebar {
    padding-right: 10px;
    padding-left: 10px;
  }

  .brandLogo {
    width: 136px;
  }

  .filters {
    grid-template-columns: 206px repeat(3, minmax(118px, 1fr)) auto;
  }

  .filterActions {
    min-width: 134px;
  }

  .gameLegend,
  .optimizerLegend,
  .materialDesignerLegend {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .primaryBtn,
  .ghostBtn {
    min-width: 62px;
    padding-right: 10px;
    padding-left: 10px;
  }
}

@media (max-width: 1200px) {
  .creativePagerControls {
    flex-wrap: wrap;
  }
}

@media (max-width: 980px) {
  .creativePager {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .creativePagerControls {
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 1320px) {
  .filters {
    position: relative;
    top: auto;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }

  .filterActions {
    justify-content: flex-start;
  }

  .filters.materialsFilters {
    grid-template-columns: 218px minmax(240px, 360px) minmax(0, 1fr);
  }

  .filters.materialsFilters .filterActions {
    grid-column: 3;
  }
}

@media (max-width: 1100px) {
  :root {
    --dash-sidebar-width: 72px;
  }

  .sidebar {
    padding-right: 8px;
    padding-left: 8px;
  }

  .brand {
    justify-content: center;
    padding-right: 0;
    padding-left: 0;
  }

  .brandLogo {
    width: 48px;
    overflow: hidden;
  }

  .brandLogo img {
    width: 138px;
    max-width: none;
    object-position: left center;
  }

  .navSectionLabel,
  .navItem span:last-child {
    display: none;
  }

  .navSectionDivider {
    height: 1px;
    margin: 10px 4px;
    padding: 0;
  }

  .navItem {
    justify-content: center;
    padding: 0;
  }

  .navItem.active::before {
    display: none;
  }
}

@media (max-width: 980px) {
  .workspaceTopbar {
    height: 66px;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .pageHeading h1 {
    font-size: 19px;
  }

  .metricGrid,
  .chartGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  :root {
    --dash-sidebar-width: 64px;
    --dash-page-pad: 12px;
    --dash-gap: 12px;
    --dash-chart-gap: 12px;
  }

  body {
    min-width: 0 !important;
  }

  .sidebar {
    width: var(--dash-sidebar-width);
    padding-right: 6px;
    padding-left: 6px;
  }

  .brandLogo {
    width: 44px;
  }

  .navItem {
    min-height: 40px;
  }

  .workspaceTopbar {
    height: 62px;
    padding-right: var(--dash-page-pad);
    padding-left: var(--dash-page-pad);
  }

  .pageEyebrow {
    display: none;
  }

  .filters,
  .filters.materialsFilters {
    position: relative;
    top: auto;
    grid-template-columns: minmax(0, 1fr);
    margin: 0 calc(var(--dash-page-pad) * -1);
    padding: 12px var(--dash-page-pad);
  }

  .filters.materialsFilters .filterActions {
    grid-column: 1;
    justify-content: flex-start;
  }

  .filters.materialsFilters .creativeNameFilter {
    grid-column: 1;
  }

  .materialPreviewPanel {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .materialPreviewContent {
    min-height: 260px;
    padding: 12px;
  }

  .materialPreviewMainImage {
    min-height: 220px;
  }

  .materialPreviewFooter,
  .materialPreviewMeta {
    align-items: stretch;
    flex-direction: column;
  }

  .materialPreviewFooter,
  .materialPreviewMeta {
    gap: 12px;
  }

  .materialPreviewCopyGroup {
    justify-content: flex-end;
  }

  .filterActions {
    min-width: 0;
  }

  .dateRangePanel {
    width: calc(100vw - var(--dash-sidebar-width) - var(--dash-page-pad) * 2);
    max-width: 620px;
  }

  .multiSelectPanel {
    width: 100%;
  }

  #dashboardTable {
    font-size: 13px;
  }

  #dashboardTable th,
  #dashboardTable td,
  #dashboardTable .metricLink,
  #dashboardTable .accountLink,
  #dashboardTable .adgroupLink {
    font-size: 13px;
  }

  #dashboardTable th {
    font-size: 12px;
  }

  .datePickerMonths {
    grid-template-columns: minmax(0, 1fr);
  }

  .datePickerMonth:nth-child(2) {
    display: none;
  }

  .metricGrid,
  .chartGrid,
  .optimizerEfficiencyGrid,
  .deliveryMiniGrid {
    grid-template-columns: minmax(0, 1fr);
  }

  .trendPanel,
  .optimizerEfficiencyGrid,
  .deliveryMiniGrid {
    grid-column: auto;
  }

  .tableHead,
  .tableTitleGroup,
  .tableActions {
    align-items: flex-start;
  }

  .tableHead {
    gap: 10px;
  }

  .pager {
    align-items: flex-start;
  }
}

@media (max-width: 520px) {
  .loginPanel {
    width: calc(100vw - 24px);
    margin: 12px 0;
    padding: 30px 22px 24px;
  }

  .loginBrand img {
    width: 158px;
  }

  .userMenuTrigger {
    width: 42px;
    min-width: 42px;
    padding: 0 5px;
  }

  .userMenuInfo,
  .userMenuChevron {
    display: none;
  }

  .pageHeading h1 {
    font-size: 17px;
  }

  .metricCard {
    min-height: 100px;
  }

  .segmented {
    max-width: 100%;
    overflow-x: auto;
  }
}

.aiQueryLauncher {
  position: relative;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid #1677ff;
  border-radius: 7px;
  color: #fff;
  background: #1677ff;
  box-shadow: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.aiQueryLauncher[hidden],
.aiQueryDrawer[hidden] {
  display: none;
}

.aiQueryLauncher:hover {
  border-color: #0958d9;
  background: #0958d9;
}

.aiQueryLauncher svg,
.aiIconButton svg,
.aiSendButton svg,
.aiChartButton svg,
.aiAssistantMark svg,
.aiEmptyMark svg,
.aiMessageMark svg,
.aiSuggestionArrow svg,
.aiComposerContext svg,
.aiFeedbackButton svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.aiChartButton {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  margin-left: auto;
  padding: 0;
  border: 1px solid #d8dee8;
  border-radius: 6px;
  color: #64748b;
  background: #fff;
  cursor: pointer;
}

.aiChartButton[hidden] {
  display: none;
}

.aiChartButton:hover {
  color: #1677ff;
  border-color: #1677ff;
}

.aiQueryBackdrop {
  position: fixed;
  inset: 0;
  z-index: 78;
  background: rgb(15 23 42 / 26%);
  backdrop-filter: blur(2px);
  animation: aiBackdropEnter 180ms ease-out;
}

.aiQueryDrawer {
  --ai-primary: #1677ff;
  --ai-primary-hover: #0958d9;
  --ai-primary-soft: #eaf3ff;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  width: min(520px, 100vw);
  border-left: 1px solid #e2e8f0;
  color: #172033;
  background: #fff;
  box-shadow: -18px 0 44px rgb(15 23 42 / 14%);
  animation: aiDrawerEnter 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.aiQueryHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px 12px 10px 14px;
  border-bottom: 1px solid #edf0f4;
}

.aiQueryHeader h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: 0;
}

.aiQueryEyebrow {
  color: #8a95a5;
  font-size: 11px;
  line-height: 1.25;
}

.aiQueryBrand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.aiAssistantMark,
.aiEmptyMark,
.aiMessageMark {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--ai-primary);
  background: var(--ai-primary-soft);
}

.aiAssistantMark {
  width: 34px;
  height: 34px;
  border-radius: 7px;
}

.aiAssistantMark svg {
  width: 18px;
  height: 18px;
}

.aiQueryTitle {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.aiQueryHeaderActions,
.aiQueryComposerActions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.aiIconButton {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #667085;
  background: transparent;
  cursor: pointer;
}

.aiIconButton:hover {
  color: var(--ai-primary);
  border-color: #d9e8ff;
  background: var(--ai-primary-soft);
}

.aiBackIcon {
  display: none;
}

.aiQueryStatus {
  position: relative;
  padding: 8px 16px 8px 36px;
  border-bottom: 1px solid #e7effb;
  color: #526176;
  background: #f7faff;
  font-size: 12px;
  line-height: 1.5;
}

.aiQueryStatus.ready {
  display: none;
}

.aiQueryStatus.busy::before {
  position: absolute;
  top: 50%;
  left: 17px;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  border: 2px solid #bfdbfe;
  border-top-color: var(--ai-primary);
  border-radius: 50%;
  content: "";
  animation: aiSpin 700ms linear infinite;
}

.aiQueryStatus.error {
  padding-left: 16px;
  color: #b42318;
  border-color: #fee4e2;
  background: #fff6f5;
}

.aiQueryHistory {
  max-height: min(300px, 42vh);
  overflow: auto;
  border-bottom: 1px solid #e8edf3;
  background: #fbfcfe;
}

.aiQueryHistoryHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px 7px;
  font-size: 13px;
}

.aiQueryHistoryRows {
  display: grid;
  gap: 2px;
  padding: 0 7px 9px;
}

.aiQueryHistoryRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 8px 9px;
  border: 0;
  border-radius: 6px;
  color: #344054;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.aiQueryHistoryRow:hover,
.aiQueryHistoryRow.active {
  color: #175cd3;
  background: #eef5ff;
}

.aiQueryHistoryRow span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aiQueryHistoryRow time {
  color: #64748b;
  font-size: 11px;
}

.aiTextButton {
  padding: 0;
  border: 0;
  color: #1677ff;
  background: transparent;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.aiTextButton.danger {
  color: #b91c1c;
}

.aiFeedbackAdmin {
  display: grid;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e5e9f0;
}

.aiFeedbackAdminHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.aiFeedbackAdminHead h3 {
  margin: 0 0 3px;
  font-size: 15px;
  letter-spacing: 0;
}

.aiFeedbackAdminHead span {
  color: #64748b;
  font-size: 12px;
}

.aiQueryMessages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 16px 24px;
  background: #fff;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.aiQueryEmpty {
  display: flex;
  min-height: 100%;
  padding: clamp(34px, 9vh, 86px) 2px 28px;
  flex-direction: column;
  align-items: center;
  color: #7b8798;
  text-align: center;
}

.aiQueryEmpty strong {
  margin-top: 14px;
  color: #1d2939;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
}

.aiQueryEmpty > span:not(.aiEmptyMark) {
  margin-top: 4px;
  font-size: 12px;
}

.aiEmptyMark {
  width: 48px;
  height: 48px;
  border-radius: 8px;
}

.aiEmptyMark svg {
  width: 24px;
  height: 24px;
}

.aiQuerySuggestions {
  display: grid;
  gap: 8px;
  width: 100%;
  margin-top: 28px;
  text-align: left;
}

.aiQuerySuggestion {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 9px 10px 9px 13px;
  border: 1px solid #e5eaf0;
  border-radius: 6px;
  color: #344054;
  background: #fff;
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.aiQuerySuggestion:hover,
.aiQuerySuggestion:focus-visible {
  color: #175cd3;
  border-color: #b9d5ff;
  background: #f7faff;
  outline: none;
}

.aiQuerySuggestion:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.aiSuggestionArrow {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: #98a2b3;
}

.aiSuggestionArrow svg {
  width: 15px;
  height: 15px;
}

.aiMessage {
  display: grid;
  gap: 7px;
  margin-bottom: 22px;
}

.aiMessage.user {
  justify-items: end;
}

.aiMessageBody {
  max-width: 100%;
  color: #344054;
  font-size: 14px;
  line-height: 1.72;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.aiMessage.user .aiMessageBody {
  max-width: 86%;
  padding: 9px 12px;
  border: 1px solid #cfe2ff;
  border-radius: 7px 7px 2px 7px;
  color: #174ea6;
  background: #eaf3ff;
  line-height: 1.6;
}

.aiMessageIdentity {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #475467;
  font-size: 12px;
  font-weight: 600;
}

.aiMessageMark {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

.aiMessageMark svg {
  width: 14px;
  height: 14px;
}

.aiMessage.assistant .aiMessageBody {
  padding-left: 33px;
  font-size: 15px;
  line-height: 1.75;
}

.aiMessage.assistant .aiMessageBody.isFormatted {
  white-space: normal;
}

.aiAnswerParagraph {
  margin: 0;
}

.aiAnswerParagraph + .aiAnswerParagraph,
.aiAnswerList + .aiAnswerParagraph,
.aiAnswerParagraph + .aiAnswerList {
  margin-top: 10px;
}

.aiAnswerList {
  display: grid;
  gap: 7px;
  margin: 9px 0 0;
  padding-left: 19px;
}

.aiAnswerList li {
  padding-left: 2px;
}

.aiCitationChip {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  margin-left: 4px;
  padding: 0 5px;
  border: 1px solid #d5e6ff;
  border-radius: 4px;
  color: #175cd3;
  background: #f4f8ff;
  font-size: 10px;
  font-weight: 600;
  line-height: 17px;
  vertical-align: 1px;
  white-space: nowrap;
}

.aiMessage.assistant.isLoading .aiMessageBody {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  margin-left: 33px;
  padding: 9px 11px;
  border: 1px solid #e7edf5;
  border-radius: 6px;
  color: #667085;
  background: #f8fafc;
  font-size: 12px;
}

.aiThinkingDot {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border: 2px solid #cfe2ff;
  border-top-color: var(--ai-primary);
  border-radius: 50%;
  animation: aiSpin 700ms linear infinite;
}

.aiEvidence {
  width: calc(100% - 33px);
  margin-left: 33px;
  padding: 9px 10px;
  border: 1px solid #dbe9ff;
  border-radius: 6px;
  color: #5d6b7d;
  background: #f7faff;
  font-size: 12px;
  line-height: 1.5;
}

.aiEvidence strong {
  display: block;
  margin-bottom: 2px;
  color: #175cd3;
}

.aiFeedbackActions {
  display: flex;
  gap: 4px;
  margin-left: 29px;
}

.aiFeedbackButton {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #64748b;
  background: transparent;
  cursor: pointer;
}

.aiFeedbackButton svg {
  width: 15px;
  height: 15px;
}

.aiFeedbackButton:hover,
.aiFeedbackButton.active {
  color: var(--ai-primary);
  border-color: #dbe9ff;
  background: #f3f7ff;
}

.aiQueryComposer {
  display: grid;
  flex: 0 0 auto;
  gap: 7px;
  padding: 10px 14px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid #e5eaf0;
  background: #fff;
}

.aiComposerContext {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: #7b8798;
}

.aiComposerContext svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}

.aiComposerShell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 7px;
  min-height: 48px;
  padding: 6px 6px 6px 11px;
  border: 1px solid #cfd8e5;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 1px 2px rgb(16 24 40 / 4%);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.aiComposerShell:focus-within {
  border-color: #7eb5ff;
  box-shadow: 0 0 0 3px rgb(22 119 255 / 10%);
}

.aiQueryComposer textarea {
  width: 100%;
  min-height: 34px;
  max-height: 132px;
  resize: none;
  padding: 6px 0 5px;
  border: 0;
  color: #172033;
  background: transparent;
  font: inherit;
  font-size: 14px;
  line-height: 1.55;
  overflow-y: auto;
}

.aiQueryComposer textarea:focus {
  outline: none;
}

.aiQueryComposer textarea::placeholder {
  color: #98a2b3;
}

.aiQueryComposerActions {
  gap: 4px;
  justify-content: flex-end;
}

#aiQueryContextLabel {
  min-width: 0;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aiSendButton {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid var(--ai-primary);
  border-radius: 6px;
  color: #fff;
  background: var(--ai-primary);
  cursor: pointer;
}

.aiSendButton:hover:not(:disabled) {
  border-color: var(--ai-primary-hover);
  background: var(--ai-primary-hover);
}

.aiSendButton svg {
  width: 17px;
  height: 17px;
}

.aiQueryComposer .aiIconButton {
  width: 34px;
  height: 34px;
  color: #667085;
  border-color: #e4e9f0;
  background: #fff;
}

.aiSendButton:disabled,
.aiIconButton:disabled,
.aiQueryComposer textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

body.aiQueryOpen {
  overflow: hidden;
}

@keyframes aiSpin {
  to { transform: rotate(360deg); }
}

@keyframes aiBackdropEnter {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes aiDrawerEnter {
  from { transform: translateX(24px); opacity: 0.72; }
  to { transform: translateX(0); opacity: 1; }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .aiQueryDrawer {
    width: clamp(500px, 62vw, 680px);
  }
}

@media (max-width: 640px) {
  .aiQueryLauncher span {
    display: none;
  }

  .aiQueryLauncher {
    width: 40px;
    padding: 0;
    justify-content: center;
  }

  .workspaceTopbarActions {
    gap: 8px;
  }

  .aiQueryDrawer {
    width: 100vw;
    height: 100dvh;
    border-left: 0;
    box-shadow: none;
  }

  .aiQueryHeader {
    position: relative;
    min-height: 56px;
    padding-top: max(9px, env(safe-area-inset-top));
    padding-left: 52px;
  }

  .aiQueryHeaderActions {
    gap: 2px;
  }

  .aiQueryHeaderActions .aiIconButton {
    width: 34px;
    height: 34px;
  }

  .aiCloseIcon {
    display: none;
  }

  .aiBackIcon {
    display: block;
  }

  #aiQueryCloseButton {
    position: absolute;
    top: max(11px, env(safe-area-inset-top));
    left: 9px;
  }

  .aiQueryMessages {
    padding-right: 14px;
    padding-left: 14px;
  }

  .aiQueryEmpty {
    padding-top: clamp(28px, 8vh, 64px);
  }

  .aiQuerySuggestions {
    margin-top: 22px;
  }

  .aiQueryComposer {
    padding-right: 12px;
    padding-left: 12px;
  }
}

:root[data-theme="dark"] .aiQueryDrawer,
:root[data-theme="dark"] .aiQueryHeader,
:root[data-theme="dark"] .aiQueryMessages,
:root[data-theme="dark"] .aiQueryComposer,
:root[data-theme="dark"] .aiComposerShell {
  color: var(--ui-text);
  border-color: var(--ui-border);
  background: var(--ui-surface);
}

:root[data-theme="dark"] .aiQueryHeader h2,
:root[data-theme="dark"] .aiQueryEmpty strong,
:root[data-theme="dark"] .aiQueryComposer textarea {
  color: var(--ui-text);
}

:root[data-theme="dark"] .aiMessage.assistant .aiMessageBody {
  color: #f1f5f9;
}

:root[data-theme="dark"] .aiMessageIdentity {
  color: #cbd5e1;
}

:root[data-theme="dark"] .aiFeedbackButton {
  color: #94a3b8;
}

:root[data-theme="dark"] .aiQuerySuggestion,
:root[data-theme="dark"] .aiMessage.assistant.isLoading .aiMessageBody,
:root[data-theme="dark"] .aiEvidence,
:root[data-theme="dark"] .aiQueryHistory {
  color: var(--ui-text-soft);
  border-color: var(--ui-border);
  background: var(--ui-surface-subtle);
}

:root[data-theme="dark"] .aiCitationChip {
  color: #b8d7ff;
  border-color: #315b8d;
  background: #18365b;
}

:root[data-theme="dark"] .aiMessage.user .aiMessageBody {
  color: #b8d7ff;
  border-color: #254e83;
  background: #16365f;
}

:root[data-theme="dark"] .aiQueryStatus {
  color: var(--ui-text-soft);
  border-color: var(--ui-border);
  background: var(--ui-surface-subtle);
}

/* Login composition: quiet enterprise branding with one focused auth surface. */
.loginScreen {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100svh;
  min-height: 680px;
  padding: 48px;
  display: grid;
  place-items: center;
  overflow: auto;
  color: #172033;
  background: #f1f4f8;
}

.loginScreen::before {
  position: absolute;
  inset: 0 0 0 auto;
  width: 36%;
  border-left: 1px solid #dce2ea;
  background: #e8edf3;
  content: "";
  opacity: 1;
}

.loginScreen::after {
  position: absolute;
  top: 0;
  left: 0;
  width: 168px;
  height: 5px;
  background: #1687ef;
  content: "";
}

.loginLayout {
  position: relative;
  z-index: 1;
  width: min(1080px, calc(100vw - 96px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  gap: 96px;
  align-items: center;
}

.loginIdentity {
  min-width: 0;
  min-height: 500px;
  padding: 42px 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.loginIdentityLogo {
  width: 214px;
  height: auto;
  display: block;
}

.loginIdentityRule {
  width: 52px;
  height: 3px;
  margin: 42px 0 26px;
  background: #1687ef;
}

.loginIdentityEyebrow {
  margin: 0 0 12px;
  color: #667085;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

.loginIdentity h1 {
  max-width: 560px;
  margin: 0;
  color: #101828;
  font-size: 40px;
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: 0;
}

.loginIdentitySummary {
  margin: 16px 0 0;
  color: #475467;
  font-size: 16px;
  line-height: 1.6;
}

.loginIdentityMark {
  width: 76px;
  height: 76px;
  margin-top: 72px;
  display: grid;
  place-items: center;
  opacity: 0.1;
}

.loginIdentityMark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.loginPanel {
  position: relative;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 42px 40px 34px;
  display: grid;
  gap: 22px;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 72px rgba(26, 38, 57, 0.13);
  transform: none;
  backdrop-filter: none;
}

.loginPanel::before {
  display: none;
}

.loginBrand {
  display: none;
}

.loginIntro {
  display: grid;
  gap: 6px;
  margin: 0 0 4px;
  text-align: left;
}

.loginIntroEyebrow {
  color: #1769d2;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.loginIntro h2 {
  margin: 0;
  color: #101828;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0;
}

.loginIntro p {
  margin: 0;
  color: #667085;
  font-size: 14px;
  line-height: 1.5;
}

.loginPanel label {
  gap: 8px;
  color: #344054;
  font-size: 13px;
  font-weight: 600;
}

.loginPanel label + label {
  margin-top: -2px;
}

.loginPanel input {
  height: 48px;
  padding: 0 14px;
  border: 1px solid #cfd6e2;
  border-radius: 6px;
  color: #172033;
  background: #f9fafb;
  font-size: 14px;
  font-weight: 500;
}

.loginPanel input:hover {
  border-color: #aeb9c8;
}

.loginPanel input:focus {
  border-color: #1769d2;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(23, 105, 210, 0.12);
}

.loginPanel input::placeholder {
  color: #98a2b3;
  font-size: 13px;
  font-weight: 400;
}

.loginPanel .passwordToggle {
  width: 44px;
  height: 48px;
  color: #667085;
}

.loginPanel .loginMessage:empty {
  display: none;
}

.loginPanel .loginSubmit {
  width: 100%;
  height: 48px;
  margin-top: 2px;
  border: 1px solid #1769d2;
  border-radius: 6px;
  color: #fff;
  background: #1769d2;
  box-shadow: 0 10px 24px rgba(23, 105, 210, 0.2);
  font-size: 14px;
  font-weight: 700;
}

.loginPanel .loginSubmit:hover:not(:disabled) {
  border-color: #145bb7;
  background: #145bb7;
  transform: none;
}

.loginFootnote {
  min-height: 0;
  margin: 2px 0 0;
  padding-top: 18px;
  border-top: 1px solid #edf0f4;
  color: #98a2b3;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  transform: none;
}

@media (max-width: 900px) {
  .loginScreen {
    height: auto;
    min-height: 100svh;
    padding: 40px 20px;
  }

  .loginScreen::before {
    display: none;
  }

  .loginLayout {
    width: min(440px, calc(100vw - 40px));
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .loginIdentity {
    min-height: 0;
    padding: 0;
    align-items: center;
    text-align: center;
  }

  .loginIdentityLogo {
    width: 180px;
  }

  .loginIdentityRule,
  .loginIdentityEyebrow,
  .loginIdentitySummary,
  .loginIdentityMark {
    display: none;
  }

  .loginIdentity h1 {
    margin-top: 20px;
    font-size: 26px;
  }
}

@media (max-width: 520px) {
  .loginScreen {
    padding: 28px 12px;
  }

  .loginScreen::after {
    width: 96px;
    height: 4px;
  }

  .loginLayout {
    width: min(440px, calc(100vw - 24px));
    gap: 22px;
  }

  .loginIdentityLogo {
    width: 164px;
  }

  .loginIdentity h1 {
    margin-top: 16px;
    font-size: 23px;
  }

  .loginPanel {
    padding: 30px 22px 24px;
    gap: 18px;
    box-shadow: 0 18px 48px rgba(26, 38, 57, 0.11);
  }

  .loginIntro h2 {
    font-size: 23px;
  }
}

@media (max-height: 760px) and (min-width: 901px) {
  .loginScreen {
    min-height: 620px;
    padding: 24px 48px;
  }

  .loginIdentity {
    min-height: 420px;
    padding: 20px 0;
  }

  .loginIdentityRule {
    margin: 28px 0 20px;
  }

  .loginIdentityMark {
    margin-top: 40px;
  }

  .loginPanel {
    padding: 32px 36px 28px;
    gap: 17px;
  }
}

/* Shared management workspace: mirrors the sidebar's navy and blue hierarchy. */
.managementView {
  margin-top: var(--dash-gap);
  padding-bottom: var(--dash-page-pad);
}

.managementPanel {
  min-height: 0;
  overflow: hidden;
  border-color: var(--ui-border);
  border-radius: 8px;
  background: var(--ui-surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
}

.managementPanel .managementHead {
  min-height: 60px;
  padding: 10px 18px;
  flex-wrap: wrap;
  border: 0;
  border-bottom: 1px solid var(--ui-border);
  background: var(--ui-surface);
}

.managementPanel .managementHeadIdentity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.managementHeadIcon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 1px solid rgba(147, 197, 253, 0.28);
  border-radius: 7px;
  color: #dbeafe;
  background: rgba(37, 99, 235, 0.2);
}

.managementHeadIcon svg,
.managementSectionIcon svg,
.adminIconButton svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.managementHeadCopy {
  min-width: 0;
}

.managementPanel .managementHead .managementHeadCopy h2 {
  margin: 0;
  color: var(--ui-text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.managementPanel .managementHead .managementHeadCopy > span {
  display: block;
  margin-top: 3px;
  color: var(--ui-muted);
  font-size: 12px;
  line-height: 1.4;
}

.managementPanel .managementPrimaryAction {
  height: 38px;
  min-width: 0;
  padding: 0 14px;
  border-color: var(--ui-primary);
  border-radius: 6px;
  background: var(--ui-primary);
  box-shadow: none;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.managementPanel .managementPrimaryAction > span {
  color: #fff;
  font-size: 13px;
}

.managementPanel .managementPrimaryAction:hover {
  border-color: var(--ui-primary-hover);
  background: var(--ui-primary-hover);
}

.managementBody,
.optimizerAdminBody.managementBody {
  padding: 0 18px 20px;
  background: var(--ui-surface);
}

.managementTableWrap,
.optimizerTableWrap.managementTableWrap,
.roleTableWrap.managementTableWrap {
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: var(--ui-surface);
}

.managementTable {
  width: 100%;
  margin: 0;
  table-layout: fixed;
  font-size: 14px;
}

.managementPanel .managementTable th,
.managementPanel .managementTable td {
  height: 50px;
  padding: 9px 16px;
  border-right: 0;
  border-bottom: 1px solid var(--ui-border);
  color: var(--ui-text-soft);
  text-align: left;
  vertical-align: middle;
}

.managementPanel .managementTable th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 44px;
  padding-top: 0;
  padding-bottom: 0;
  background: var(--ui-surface-subtle);
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 700;
}

.managementPanel .managementTable tbody tr:last-child td {
  border-bottom: 0;
}

.managementPanel .managementTable tbody tr:hover td {
  background: #f7faff;
}

.managementPanel .managementTable th:last-child,
.managementPanel .managementTable td:last-child {
  text-align: right;
}

.managementIdentityCell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.managementIdentityCell strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ui-text);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.managementCellTitle {
  color: var(--ui-text);
  font-size: 14px;
  font-weight: 600;
}

.managementAvatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 6px;
  color: #1d4ed8;
  background: #eaf2ff;
  font-size: 13px;
  font-weight: 700;
}

.managementAvatar.role {
  color: #075985;
  background: #e6f6fb;
}

.managementPanel .statusPill {
  min-width: 0;
  height: 24px;
  padding: 0 9px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.managementPanel .tableActionGroup {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
}

.adminIconButton {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ui-muted);
  background: transparent;
  cursor: pointer;
}

.adminIconButton:hover,
.adminIconButton:focus-visible {
  border-color: #9bb9ea;
  color: var(--ui-primary);
  background: var(--ui-primary-soft);
  outline: none;
}

.adminIconButton.danger {
  color: var(--ui-muted);
}

.adminIconButton.danger:hover,
.adminIconButton.danger:focus-visible {
  border-color: #f0b8b2;
  color: #b42318;
  background: #fff1f0;
}

.adminIconButton:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.permissionSummary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.permissionSummary > span {
  min-width: 0;
  overflow: hidden;
  color: var(--ui-text-soft);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permissionSummary > small {
  flex: 0 0 auto;
  color: var(--ui-muted);
  font-size: 12px;
}

.managementEmptyValue {
  color: var(--ui-muted);
}

.managementSectionTitle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.managementSectionIcon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 6px;
  color: #1d4ed8;
  background: #eaf2ff;
}

.managementPanel .aiFeedbackAdmin {
  gap: 14px;
  margin-top: 0;
  padding-top: 16px;
  border-top: 0;
}

.managementPanel .aiFeedbackAdminHead {
  min-height: 42px;
}

.managementPanel .aiFeedbackAdminHead h3 {
  margin: 0 0 2px;
  color: var(--ui-text);
  font-size: 15px;
  font-weight: 700;
}

.managementPanel .aiFeedbackAdminHead span {
  color: var(--ui-muted);
  font-size: 12px;
}

.feedbackRating {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.feedbackRating::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.feedbackRating.positive {
  color: #07815d;
  background: #e6f8f0;
}

.feedbackRating.negative {
  color: #b54708;
  background: #fff4e5;
}

.adminIdentifier {
  overflow: hidden;
  color: var(--ui-muted) !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.managementTabs {
  display: inline-flex;
  align-items: center;
  gap: 22px;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.managementTabs button {
  position: relative;
  height: 40px;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  color: var(--ui-muted);
  background: transparent;
  font-size: 14px;
  font-weight: 600;
}

.managementTabs button:hover {
  color: var(--ui-text-soft);
}

.managementTabs button.active {
  color: var(--ui-primary);
  background: transparent;
  box-shadow: none;
}

.managementTabs button.active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -10px;
  left: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--ui-primary);
}

.managementTabs button:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.25);
  outline-offset: 1px;
}

.managementTable col.employeeNameColumn {
  width: 180px;
}

.managementTable col.employeeAccountColumn,
.managementTable col.employeePasswordColumn {
  width: 190px;
}

.managementTable col.employeeStatusColumn {
  width: 100px;
}

.managementTable col.employeeActionColumn {
  width: 170px;
}

.managementTable col.roleNameColumn {
  width: 220px;
}

.managementTable col.roleTypeColumn {
  width: 130px;
}

.managementTable col.roleActionColumn {
  width: 110px;
}

.managementTable col.feedbackTimeColumn {
  width: 180px;
}

.managementTable col.feedbackUserColumn {
  width: 160px;
}

.managementTable col.feedbackRatingColumn {
  width: 110px;
}

.managementTable col.feedbackSessionColumn {
  width: 280px;
}

.managementTable col.feedbackActionColumn {
  width: 76px;
}

.managementPanel .optimizerTable {
  min-width: 900px;
}

.managementPanel .optimizerTable th:nth-child(1),
.managementPanel .optimizerTable td:nth-child(1) {
  width: 180px;
}

.managementPanel .optimizerTable th:nth-child(2),
.managementPanel .optimizerTable td:nth-child(2) {
  width: 190px;
}

.managementPanel .optimizerTable th:nth-child(3),
.managementPanel .optimizerTable td:nth-child(3) {
  width: 180px;
}

.managementPanel .optimizerTable th:nth-child(4),
.managementPanel .optimizerTable td:nth-child(4) {
  width: 100px;
}

.managementPanel .optimizerTable th:nth-child(5),
.managementPanel .optimizerTable td:nth-child(5) {
  width: auto;
}

.managementPanel .optimizerTable th:nth-child(6),
.managementPanel .optimizerTable td:nth-child(6) {
  width: 190px;
}

.managementPanel .roleTable {
  min-width: 760px;
}

.managementPanel .roleTable th:nth-child(1),
.managementPanel .roleTable td:nth-child(1) {
  width: 210px;
}

.managementPanel .roleTable th:nth-child(2),
.managementPanel .roleTable td:nth-child(2) {
  width: 120px;
}

.managementPanel .roleTable th:nth-child(4),
.managementPanel .roleTable td:nth-child(4) {
  width: 120px;
}

.managementPanel .feedbackTable {
  min-width: 1040px;
}

.managementPanel .feedbackTable th:nth-child(1),
.managementPanel .feedbackTable td:nth-child(1) {
  width: 170px;
}

.managementPanel .feedbackTable th:nth-child(2),
.managementPanel .feedbackTable td:nth-child(2) {
  width: 150px;
}

.managementPanel .feedbackTable th:nth-child(3),
.managementPanel .feedbackTable td:nth-child(3) {
  width: 110px;
}

.managementPanel .feedbackTable th:nth-child(4),
.managementPanel .feedbackTable td:nth-child(4) {
  width: 260px;
}

.managementPanel .feedbackTable th:nth-child(6),
.managementPanel .feedbackTable td:nth-child(6) {
  width: 82px;
}

.managementView .formModalPanel,
.managementView .systemPasswordForm {
  border-color: var(--ui-border);
  border-top: 3px solid var(--ui-primary);
  border-radius: 8px;
  background: var(--ui-surface);
}

.managementView .optimizerFormActions {
  flex-direction: row-reverse;
  justify-content: flex-start;
}

:root[data-theme="dark"] .managementPanel {
  border-color: var(--ui-border);
  background: var(--ui-surface);
  color: var(--ui-text-soft);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

:root[data-theme="dark"] .managementPanel .managementHead {
  border-color: var(--ui-border);
  background: var(--ui-surface);
}

:root[data-theme="dark"] .managementPanel .managementHead .managementHeadCopy h2,
:root[data-theme="dark"] .managementPanel .managementTable td,
:root[data-theme="dark"] .managementCellTitle,
:root[data-theme="dark"] .managementPanel .aiFeedbackAdminHead h3 {
  color: var(--ui-text);
}

:root[data-theme="dark"] .managementPanel .managementTable td {
  color: var(--ui-text-soft);
}

:root[data-theme="dark"] .managementPanel .managementHead .managementHeadCopy > span,
:root[data-theme="dark"] .managementTabs button,
:root[data-theme="dark"] .managementPanel .managementTable th,
:root[data-theme="dark"] .managementPanel .aiFeedbackAdminHead span {
  color: var(--ui-muted);
}

:root[data-theme="dark"] .managementTabs button.active {
  color: #8bb7ff;
  background: transparent;
}

:root[data-theme="dark"] .managementBody,
:root[data-theme="dark"] .optimizerAdminBody.managementBody,
:root[data-theme="dark"] .managementTableWrap,
:root[data-theme="dark"] .optimizerTableWrap.managementTableWrap,
:root[data-theme="dark"] .roleTableWrap.managementTableWrap {
  background: var(--ui-surface);
}

:root[data-theme="dark"] .managementPanel .managementTable th {
  border-color: var(--ui-border);
  background: var(--ui-surface-subtle);
}

:root[data-theme="dark"] .managementPanel .managementTable td {
  border-color: var(--ui-border);
}

:root[data-theme="dark"] .managementPanel .managementTable tbody tr:hover td {
  background: #182338;
}

:root[data-theme="dark"] .managementAvatar,
:root[data-theme="dark"] .managementSectionIcon {
  color: #93c5fd;
  background: #162b4d;
}

:root[data-theme="dark"] .managementAvatar.role {
  color: #7dd3fc;
  background: #143146;
}

:root[data-theme="dark"] .adminIconButton.danger:hover,
:root[data-theme="dark"] .adminIconButton.danger:focus-visible {
  border-color: #7f3c3c;
  background: #351d24;
}

:root[data-theme="dark"] .workspaceTopbar {
  border-color: var(--ui-border);
  background: rgba(17, 24, 39, 0.98);
}

:root[data-theme="dark"] .workspace .pageHeading h1 {
  color: var(--ui-text);
}

:root[data-theme="dark"] .workspace .pageEyebrow {
  color: var(--ui-muted);
}

@media (max-width: 760px) {
  .managementPanel .managementHead {
    min-height: 60px;
    gap: 12px;
    padding: 12px;
  }

  .managementHeadIcon {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .managementPanel .managementPrimaryAction {
    margin-left: auto;
  }

  .managementBody,
  .optimizerAdminBody.managementBody {
    padding: 0 12px 16px;
  }

  .managementPanel .managementTable th,
  .managementPanel .managementTable td {
    padding-right: 12px;
    padding-left: 12px;
  }
}

/* Native delivery dashboard chrome follows the established WeChat board header. */
.workspace.dashboardWorkspace {
  background: #f4f7fb;
}

.dashboardWorkspace .workspaceTopbar {
  height: 64px;
  margin: 0 calc(var(--dash-page-pad) * -1);
  padding: 0 var(--dash-page-pad);
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.98);
}

.dashboardWorkspace .wechatTopbarControls {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dashboardWorkspace .wechatChromeButton {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  box-shadow: none;
}

.dashboardWorkspace .pageHeading {
  position: absolute;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

.dashboardWorkspace .pageEyebrow {
  display: none;
}

.dashboardWorkspace .pageHeading h1 {
  color: #101828;
  font-size: 22px;
  font-weight: 700;
}

.dashboardWorkspace .workspaceTopbarActions {
  position: relative;
  z-index: 2;
  gap: 8px;
}

.dashboardWorkspace .userMenuTrigger {
  min-width: 142px;
  height: 42px;
  border-radius: 12px;
}

.dashboardWorkspace > .filters {
  top: 64px;
  min-height: 62px;
  margin: 12px 0 0;
  padding: 10px;
  grid-template-columns: 320px repeat(3, minmax(142px, 1fr)) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--ui-border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

.dashboardWorkspace > .filters .filterGroup {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--ui-text-soft);
  font-size: 12px;
  font-weight: 600;
}

.dashboardWorkspace > .filters .dateFilter {
  display: block;
}

.dashboardWorkspace > .filters .dateFilter > .filterLabel {
  display: none;
}

.dashboardWorkspace > .filters .filterGroup > span:first-child,
.dashboardWorkspace > .filters .filterLabel {
  min-height: 0;
  color: var(--ui-muted);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.dashboardWorkspace > .filters .dateRangeButton,
.dashboardWorkspace > .filters .multiSelectButton {
  height: 38px;
  border-radius: 6px;
}

@media (min-width: 1321px) {
  .dashboardWorkspace > .filters .dateFilter,
  .dashboardWorkspace > .filters #dateRangeButton {
    width: 320px;
    min-width: 320px;
    max-width: 320px;
  }
}

.dashboardWorkspace > .filters .filterActions {
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.dashboardWorkspace > .filters .primaryBtn,
.dashboardWorkspace > .filters .ghostBtn {
  height: 38px;
  min-width: 66px;
  border-radius: 6px;
}

.dashboardWorkspace > .statusBar {
  min-height: 28px;
}

:root[data-theme="dark"] .workspace.dashboardWorkspace {
  background: var(--ui-bg);
}

:root[data-theme="dark"] .dashboardWorkspace .workspaceTopbar,
:root[data-theme="dark"] .dashboardWorkspace > .filters {
  border-color: var(--ui-border);
  background: rgba(17, 24, 39, 0.98);
}

:root[data-theme="dark"] .dashboardWorkspace .pageHeading h1 {
  color: var(--ui-text);
}

@media (max-width: 1320px) {
  .dashboardWorkspace > .filters {
    position: relative;
    top: auto;
    grid-template-columns: repeat(2, minmax(220px, 1fr)) auto;
  }
}

@media (max-width: 760px) {
  .dashboardWorkspace .workspaceTopbar {
    height: 62px;
  }

  .dashboardWorkspace .pageHeading h1 {
    font-size: 19px;
  }

  .dashboardWorkspace .userMenuTrigger {
    min-width: 0;
  }

  .dashboardWorkspace > .filters {
    position: relative;
    top: auto;
    margin: 10px 0 0;
    padding: 10px;
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboardWorkspace > .filters .filterGroup:not(.dateFilter) {
    grid-template-columns: 76px minmax(0, 1fr);
  }
}

/* Shared typography and control rhythm across every native workspace. */
body,
button,
input,
select,
textarea {
  font-family: var(--ui-font-family);
  letter-spacing: 0;
}

.workspace .pageHeading h1 {
  font-size: var(--ui-type-page-title);
  font-weight: 700;
  line-height: 1.3;
}

.workspace .panelHead h2,
.workspace .managementHeadCopy h2,
.workspace .aiFeedbackAdminHead h3 {
  font-size: var(--ui-type-section-title);
  font-weight: 700;
  line-height: 1.4;
}

#dashboardTable,
.dataTable,
.creativeTable,
.managementTable,
.mpRoiTable {
  font-size: var(--ui-type-body);
  line-height: 1.5;
}

#dashboardTable th,
.dataTable th,
.creativeTable th,
.managementTable th,
.mpRoiTable th {
  height: 44px;
  font-size: var(--ui-type-caption);
  font-weight: 600;
  line-height: 1.4;
}

#dashboardTable td,
.dataTable td,
.creativeTable td,
.managementTable td,
.mpRoiTable td {
  height: 50px;
  font-size: var(--ui-type-body);
  line-height: 1.5;
}

.metricCard strong {
  font-size: var(--ui-type-metric);
  font-weight: 700;
  line-height: 1.1;
}

.workspace > .filters .primaryBtn,
.workspace > .filters .ghostBtn,
.mpRoiFilterButton,
.managementPanel .managementPrimaryAction {
  height: var(--ui-control-height);
  font-size: var(--ui-type-control);
  font-weight: 600;
  line-height: 1.4;
}

.wechatChromeButton,
.adminIconButton {
  width: 32px;
  height: 32px;
}

.wechatChromeButton svg,
.adminIconButton svg {
  width: 16px;
  height: 16px;
}

@media (max-width: 760px) {
  .workspace .pageHeading h1 {
    font-size: 19px;
  }
}

/* Complete dark-mode coverage for native dashboard controls and data surfaces. */
:root[data-theme="dark"] .dashboardWorkspace .panelHead {
  border-color: var(--ui-border);
}

:root[data-theme="dark"] .dashboardWorkspace .legendItem {
  border-color: var(--ui-border);
  background: var(--ui-surface-subtle);
  color: var(--ui-text-soft);
}

:root[data-theme="dark"] .dashboardWorkspace .barRow:hover,
:root[data-theme="dark"] .dashboardWorkspace .legendItem:hover,
:root[data-theme="dark"] .dashboardWorkspace .optimizerRankingRow:hover,
:root[data-theme="dark"] .dashboardWorkspace .optimizerRankingRow.hovered {
  background: #1c293c;
}

:root[data-theme="dark"] .dashboardWorkspace .barRow.selected,
:root[data-theme="dark"] .dashboardWorkspace .legendItem.selected,
:root[data-theme="dark"] .dashboardWorkspace .optimizerRankingRow.active,
:root[data-theme="dark"] .dashboardWorkspace .optimizerRankingRow.selected {
  background: var(--ui-primary-soft);
  box-shadow: inset 0 0 0 1px #31578a;
}

:root[data-theme="dark"] .dashboardWorkspace .optimizerRankingRow {
  border-color: var(--ui-border);
  color: var(--ui-text);
}

:root[data-theme="dark"] .dashboardWorkspace .optimizerRankingShare {
  background: #223047;
  color: var(--ui-text-soft);
}

:root[data-theme="dark"] .dashboardWorkspace .optimizerTrendBars {
  border-color: #31566a;
}

:root[data-theme="dark"] .dashboardWorkspace .optimizerTrendBar.isZero,
:root[data-theme="dark"] .dashboardWorkspace .optimizerTrendBar.empty {
  background: #244052;
}

:root[data-theme="dark"] .dashboardWorkspace .segmented {
  background: #1a2538;
}

:root[data-theme="dark"] .dashboardWorkspace .segmented button.active {
  background: #26354b;
  color: var(--ui-text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

:root[data-theme="dark"] .dashboardWorkspace #dashboardTable th,
:root[data-theme="dark"] .dashboardWorkspace #dashboardTable th:first-child {
  border-color: var(--ui-border);
  background: var(--ui-surface-subtle);
  color: var(--ui-text);
}

:root[data-theme="dark"] .dashboardWorkspace #dashboardTable td,
:root[data-theme="dark"] .dashboardWorkspace #dashboardTable td:first-child {
  border-color: var(--ui-border);
  background: var(--ui-surface);
  color: var(--ui-text-soft);
}

:root[data-theme="dark"] .dashboardWorkspace #dashboardTable tbody tr:not(.summaryRow):hover td {
  background: #182338;
}

:root[data-theme="dark"] .dashboardWorkspace #dashboardTable .summaryRow td,
:root[data-theme="dark"] .dashboardWorkspace #dashboardTable .summaryRow td:first-child {
  background: #162b4d;
  color: #8bb7ff;
}

:root[data-theme="dark"] .dashboardWorkspace #dashboardTable .metricLink,
:root[data-theme="dark"] .dashboardWorkspace #dashboardTable .metricText {
  color: inherit;
}

:root[data-theme="dark"] .dashboardWorkspace .pageButtons button {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-subtle);
  color: var(--ui-text-soft);
}

:root[data-theme="dark"] .dashboardWorkspace .pageButtons button:hover:not(:disabled) {
  border-color: #60a5fa;
  background: var(--ui-primary-soft);
  color: #dbeafe;
}

:root[data-theme="dark"] .dashboardWorkspace .pageButtons button.active {
  border-color: var(--ui-primary);
  background: var(--ui-primary);
  color: #fff;
}

:root[data-theme="dark"] .dashboardWorkspace .pageButtons button:disabled {
  border-color: var(--ui-border);
  background: #151e2e;
  color: #64748b;
}

:root[data-theme="dark"] .dateRangePanel {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface);
  color: var(--ui-text-soft);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

:root[data-theme="dark"] .datePickerDraft,
:root[data-theme="dark"] .datePickerFooter {
  border-color: var(--ui-border);
  color: var(--ui-text);
}

:root[data-theme="dark"] .datePickerMonthTitle {
  color: var(--ui-text);
}

:root[data-theme="dark"] .datePickerWeekdays,
:root[data-theme="dark"] .datePickerNavButton,
:root[data-theme="dark"] .datePickerDay.outside {
  color: var(--ui-muted);
}

:root[data-theme="dark"] .datePickerDay {
  color: var(--ui-text-soft);
}

:root[data-theme="dark"] .datePickerDay:hover,
:root[data-theme="dark"] .datePickerNavButton:hover,
:root[data-theme="dark"] .datePickerShortcuts button:hover {
  background: var(--ui-primary-soft);
  color: #8bb7ff;
}

:root[data-theme="dark"] .datePickerDay.inRange {
  background: #203b63;
  color: #dbeafe;
}

:root[data-theme="dark"] .datePickerDay.selected {
  background: var(--ui-primary);
  color: #fff;
}

:root[data-theme="dark"] .datePickerDay.disabled,
:root[data-theme="dark"] .datePickerDay.disabled:hover {
  background: transparent;
  color: #526176;
}

:root[data-theme="dark"] .datePickerShortcuts button {
  color: var(--ui-text-soft);
}

:root[data-theme="dark"] .datePickerCancel {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-subtle);
  color: var(--ui-text-soft);
}

:root[data-theme="dark"] .multiSelectPanel {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
}

:root[data-theme="dark"] .selectPanelHeader,
:root[data-theme="dark"] .multiSelectToolbar {
  border-color: var(--ui-border);
}

:root[data-theme="dark"] .selectPanelClose:hover,
:root[data-theme="dark"] .multiSelectToolbar button:hover {
  background: var(--ui-primary-soft);
  color: #8bb7ff;
}

:root[data-theme="dark"] .multiSelectSearch input,
:root[data-theme="dark"] .multiSelectSearch input:focus {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-subtle);
  color: var(--ui-text);
}

:root[data-theme="dark"] .multiSelectSearch input::placeholder {
  color: var(--ui-muted);
}

:root[data-theme="dark"] .multiSelectOption:hover,
:root[data-theme="dark"] .singleSelectOption:hover {
  background: #1c293c;
}

:root[data-theme="dark"] .multiSelectOption[aria-selected="true"],
:root[data-theme="dark"] .singleSelectOption[aria-selected="true"] {
  border-color: #31578a;
  background: var(--ui-primary-soft);
  color: #8bb7ff;
}

:root[data-theme="dark"] .multiSelectCheck {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-subtle);
}

:root[data-theme="dark"] .aiChartButton {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-subtle);
  color: var(--ui-text-soft);
}

:root[data-theme="dark"] .aiChartButton:hover,
:root[data-theme="dark"] .aiChartButton:focus-visible {
  border-color: #60a5fa;
  background: var(--ui-primary-soft);
  color: #dbeafe;
}

:root[data-theme="dark"] .pageActionMessage.toastMessage {
  border-color: #256d4a;
  background: #123524;
  color: #bbf7d0;
}

/* Management dialogs must not inherit the light-only form controls. */
:root[data-theme="dark"] .managementView .modalHead h3,
:root[data-theme="dark"] .managementView .optimizerForm label,
:root[data-theme="dark"] .managementView .optimizerFormField,
:root[data-theme="dark"] .managementView .systemRoleForm label,
:root[data-theme="dark"] .managementView .systemPasswordForm label,
:root[data-theme="dark"] .managementView .permissionEditorHead {
  color: var(--ui-text);
}

:root[data-theme="dark"] .managementView .fieldHint,
:root[data-theme="dark"] .managementView .formMessage {
  color: var(--ui-muted);
}

:root[data-theme="dark"] .managementView .optimizerForm input,
:root[data-theme="dark"] .managementView .optimizerForm select,
:root[data-theme="dark"] .managementView .systemRoleForm > label input,
:root[data-theme="dark"] .managementView .systemPasswordForm input,
:root[data-theme="dark"] .managementView .optimizerFormField .compactSelectButton {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-subtle);
  color: var(--ui-text);
  color-scheme: dark;
}

:root[data-theme="dark"] .managementView .optimizerForm input::placeholder,
:root[data-theme="dark"] .managementView .systemRoleForm > label input::placeholder,
:root[data-theme="dark"] .managementView .systemPasswordForm input::placeholder {
  color: var(--ui-muted);
}

:root[data-theme="dark"] .managementView .permissionEditor {
  border-color: var(--ui-border);
}

:root[data-theme="dark"] .managementView .permissionItem {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-subtle);
  color: var(--ui-text-soft);
}

:root[data-theme="dark"] .managementView .permissionItem span::before {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface);
}

:root[data-theme="dark"] .managementView .systemRoleForm .permissionItem input[type="checkbox"]:disabled + span::before {
  border-color: var(--ui-border);
  background: #1c2637;
}

:root[data-theme="dark"] .managementView .modalCloseButton {
  border-color: var(--ui-border-strong);
  background: var(--ui-surface-subtle);
  color: var(--ui-text-soft);
}

:root[data-theme="dark"] .managementView .modalCloseButton:hover,
:root[data-theme="dark"] .managementView .modalCloseButton:focus-visible {
  border-color: #60a5fa;
  background: var(--ui-primary-soft);
  color: #dbeafe;
}

/* Mobile signed-in views use the established fixed-canvas overview behavior. */
@media (max-width: 960px), (max-device-width: 960px) {
  body.appActive {
    min-width: 1180px !important;
    overflow-x: visible;
  }

  body.appActive .appShell {
    --dash-sidebar-width: 176px;
    --dash-page-pad: 16px;
    --dash-gap: 12px;
    --dash-chart-gap: 12px;
    min-width: 1180px;
    grid-template-columns: var(--dash-sidebar-width) minmax(0, 1fr);
    overflow-x: visible;
  }

  body.appActive .appShell.sidebarCollapsed {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  body.appActive .sidebar {
    width: 100%;
    padding-right: 12px;
    padding-left: 12px;
  }

  body.appActive .brand {
    justify-content: flex-start;
    padding-right: 8px;
    padding-left: 8px;
  }

  body.appActive .brandLogo {
    width: auto;
    overflow: visible;
  }

  body.appActive .brandLogo img {
    width: 138px;
    max-width: 100%;
  }

  body.appActive .navSectionLabel,
  body.appActive .navItem span:last-child {
    display: block;
  }

  body.appActive .navItem {
    justify-content: flex-start;
    padding: 0 12px;
  }

  body.appActive .workspaceTopbar {
    height: 64px;
  }

  body.appActive .workspace .pageEyebrow {
    display: none;
  }

  body.appActive .workspace .pageHeading h1 {
    font-size: 22px;
  }

  body.appActive .dashboardWorkspace > .filters {
    position: relative;
    top: auto;
    display: grid;
    grid-template-columns: 230px repeat(3, minmax(0, 1fr)) auto;
    align-items: center;
    gap: 10px;
    margin: 10px 0 0;
    padding: 10px;
  }

  body.appActive .dashboardWorkspace > .filters .filterGroup {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
  }

  body.appActive .dashboardWorkspace > .filters .dateFilter {
    display: block;
  }

  body.appActive .dashboardWorkspace > .filters .filterActions {
    display: flex;
    width: auto;
    min-width: 134px;
    justify-content: flex-start;
    gap: 8px;
  }

  body.appActive .dashboardWorkspace > .filters .dateRangeButton,
  body.appActive .dashboardWorkspace > .filters .multiSelectButton,
  body.appActive .dashboardWorkspace > .filters .primaryBtn,
  body.appActive .dashboardWorkspace > .filters .ghostBtn {
    height: 40px;
    font-size: 13px;
  }

  body.appActive .dateRangePanel {
    width: 620px;
    max-width: none;
  }

  body.appActive .multiSelectPanel {
    width: 380px;
    max-width: none;
  }

  body.appActive .metricGrid,
  body.appActive .chartGrid,
  body.appActive .optimizerEfficiencyGrid,
  body.appActive .deliveryMiniGrid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  body.appActive .metricCard {
    min-height: 92px;
  }

  body.appActive .chartGrid > *,
  body.appActive .trendPanel,
  body.appActive .optimizerEfficiencyGrid,
  body.appActive .deliveryMiniGrid {
    grid-column: auto;
  }

  body.appActive .spanBar,
  body.appActive .optimizerPanel,
  body.appActive .materialDesignerPanel {
    min-height: 430px;
  }

  body.appActive .trendPanel {
    min-height: 330px;
  }

  body.appActive .tableWrap,
  body.appActive .creativeTableWrap,
  body.appActive .optimizerTableWrap,
  body.appActive .roleTableWrap {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  body.appActive .modalBackdrop,
  body.appActive .aiQueryBackdrop {
    inset: auto;
    top: var(--mobile-visual-top, 0px);
    left: var(--mobile-visual-left, 0px);
    width: var(--mobile-visual-width, 1180px);
    max-width: none;
    height: var(--mobile-visual-height, 100vh);
  }

  body.appActive .aiQueryDrawer {
    top: var(--mobile-visual-top, 0px);
    right: auto;
    left: var(--mobile-visual-left, 0px);
    width: var(--mobile-visual-width, 1180px);
    max-width: none;
    height: var(--mobile-visual-height, 100vh);
  }

  html.mobileViewportZoomed body.appActive .modalBackdrop,
  html.mobileViewportZoomed body.appActive .aiQueryBackdrop,
  html.mobileViewportZoomed body.appActive .aiQueryDrawer {
    top: var(--mobile-visual-top, 0px);
    left: var(--mobile-visual-left, 0px);
  }

  body.appActive input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
  body.appActive select,
  body.appActive textarea {
    font-size: 16px !important;
  }
}
