/* YUTO visual themes and layout polish.
   The four themes share one geometry so switching never shifts the workflow. */

:root[data-theme="pro"] {
  color-scheme: light;
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --surface-raised: #ffffff;
  --surface-translucent: rgba(255, 255, 255, 0.9);
  --surface-strong: #172033;
  --line: #dce3ec;
  --line-strong: #bdc9d7;
  --text: #17202d;
  --muted: #5a687a;
  --faint: #7a8797;
  --blue: #2563eb;
  --blue-soft: #e8efff;
  --green: #087f6f;
  --green-soft: #dcf6ef;
  --amber: #9a6400;
  --amber-soft: #fff2cc;
  --red: #b42318;
  --red-soft: #fee9e7;
  --violet: #6d5bd0;
  --ring: rgba(37, 99, 235, 0.22);
  --radius: 10px;
  --radius-small: 8px;
  --radius-large: 16px;
  --shadow: 0 12px 28px rgba(30, 42, 60, 0.075);
  --shadow-soft: 0 5px 16px rgba(30, 42, 60, 0.055);
  --control-bg: linear-gradient(180deg, #ffffff, #f9fbfd);
  --app-background:
    radial-gradient(circle at 7% 2%, rgba(37, 99, 235, 0.1), transparent 28rem),
    radial-gradient(circle at 91% 16%, rgba(8, 127, 111, 0.07), transparent 31rem),
    #f3f6fa;
  --module-home: #f1f7f7;
  --module-dashboard: #eff5ff;
  --module-finance: #f7f4ff;
  --chart-grid: #dce3ec;
  --chart-label: #637286;
  --chart-line: #2563eb;
  --chart-point: #087f6f;
  --chart-fill-start: rgba(37, 99, 235, 0.24);
  --chart-fill-end: rgba(8, 127, 111, 0.02);
}

:root[data-theme="aurora"] {
  color-scheme: light;
  --bg: #eef3ff;
  --surface: #ffffff;
  --surface-soft: #f3f4ff;
  --surface-raised: #ffffff;
  --surface-translucent: rgba(255, 255, 255, 0.76);
  --surface-strong: #211c40;
  --line: rgba(111, 108, 164, 0.2);
  --line-strong: rgba(94, 88, 150, 0.36);
  --text: #23203a;
  --muted: #615f79;
  --faint: #79778f;
  --blue: #6558e8;
  --blue-soft: #ece9ff;
  --green: #008f87;
  --green-soft: #daf8f3;
  --amber: #956000;
  --amber-soft: #fff1c7;
  --red: #b42346;
  --red-soft: #ffe8ef;
  --violet: #9457d9;
  --ring: rgba(101, 88, 232, 0.24);
  --radius: 14px;
  --radius-small: 10px;
  --radius-large: 22px;
  --shadow: 0 18px 42px rgba(79, 70, 138, 0.12);
  --shadow-soft: 0 9px 24px rgba(79, 70, 138, 0.09);
  --control-bg: rgba(255, 255, 255, 0.82);
  --app-background:
    radial-gradient(circle at 12% 8%, rgba(70, 196, 255, 0.23), transparent 28rem),
    radial-gradient(circle at 82% 4%, rgba(201, 115, 255, 0.21), transparent 30rem),
    radial-gradient(circle at 72% 82%, rgba(81, 220, 190, 0.14), transparent 34rem),
    #eef3ff;
  --module-home: rgba(239, 248, 251, 0.78);
  --module-dashboard: rgba(239, 243, 255, 0.82);
  --module-finance: rgba(248, 241, 255, 0.82);
  --chart-grid: #d9d9ed;
  --chart-label: #66627d;
  --chart-line: #6558e8;
  --chart-point: #008f87;
  --chart-fill-start: rgba(101, 88, 232, 0.26);
  --chart-fill-end: rgba(0, 143, 135, 0.025);
}

:root[data-theme="expressive"] {
  color-scheme: light;
  --bg: #fff7fb;
  --surface: #fffdfd;
  --surface-soft: #f7f1ff;
  --surface-raised: #ffffff;
  --surface-translucent: rgba(255, 253, 253, 0.94);
  --surface-strong: #2c1f33;
  --line: #e7dce8;
  --line-strong: #cdbbce;
  --text: #2c2230;
  --muted: #685a6b;
  --faint: #837487;
  --blue: #6650a4;
  --blue-soft: #eee7ff;
  --green: #006b5f;
  --green-soft: #d9f5ef;
  --amber: #845400;
  --amber-soft: #ffedbd;
  --red: #a8354d;
  --red-soft: #ffe7ec;
  --violet: #7b49b6;
  --ring: rgba(102, 80, 164, 0.24);
  --radius: 18px;
  --radius-small: 13px;
  --radius-large: 28px;
  --shadow: 0 15px 0 rgba(102, 80, 164, 0.055), 0 18px 40px rgba(68, 45, 83, 0.08);
  --shadow-soft: 0 8px 22px rgba(68, 45, 83, 0.075);
  --control-bg: #fffdfd;
  --app-background:
    radial-gradient(circle at 6% 4%, rgba(255, 196, 93, 0.2), transparent 25rem),
    radial-gradient(circle at 90% 8%, rgba(171, 132, 255, 0.2), transparent 30rem),
    #fff7fb;
  --module-home: #f4f7e9;
  --module-dashboard: #f1edff;
  --module-finance: #fff0f4;
  --chart-grid: #e3d9e5;
  --chart-label: #705f73;
  --chart-line: #6650a4;
  --chart-point: #006b5f;
  --chart-fill-start: rgba(102, 80, 164, 0.25);
  --chart-fill-end: rgba(0, 107, 95, 0.025);
}

:root[data-theme="carbon"] {
  color-scheme: dark;
  --bg: #111827;
  --surface: #182231;
  --surface-soft: #202c3c;
  --surface-raised: #263344;
  --surface-translucent: rgba(24, 34, 49, 0.94);
  --surface-strong: #f4f7fb;
  --line: #344257;
  --line-strong: #536178;
  --text: #f4f7fb;
  --muted: #c1cad6;
  --faint: #94a2b3;
  --blue: #78a9ff;
  --blue-soft: rgba(120, 169, 255, 0.16);
  --green: #42be91;
  --green-soft: rgba(66, 190, 145, 0.15);
  --amber: #f1c21b;
  --amber-soft: rgba(241, 194, 27, 0.14);
  --red: #ff8389;
  --red-soft: rgba(255, 131, 137, 0.14);
  --violet: #be95ff;
  --ring: rgba(120, 169, 255, 0.28);
  --radius: 4px;
  --radius-small: 3px;
  --radius-large: 6px;
  --shadow: none;
  --shadow-soft: none;
  --control-bg: #202c3c;
  --app-background:
    linear-gradient(rgba(120, 169, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 169, 255, 0.025) 1px, transparent 1px),
    #111827;
  --module-home: #151f2d;
  --module-dashboard: #141e2c;
  --module-finance: #171e2c;
  --chart-grid: #344257;
  --chart-label: #b7c2d0;
  --chart-line: #78a9ff;
  --chart-point: #42be91;
  --chart-fill-start: rgba(120, 169, 255, 0.24);
  --chart-fill-end: rgba(66, 190, 145, 0.02);
  --sidebar-width: 264px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  border: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

body {
  min-height: 100vh;
  background: var(--app-background);
}

body::before {
  opacity: 0.6;
}

svg {
  display: block;
}

input,
select {
  height: 44px;
  min-height: 44px;
  border-color: var(--line);
  background: var(--control-bg);
  color: var(--text);
}

select {
  background-color: var(--surface);
}

.button > span,
.file-button > span {
  margin: 0;
  color: inherit;
}

.button svg,
.icon-button svg {
  width: 17px;
  height: 17px;
}

.button > span svg {
  width: 15px;
  height: 15px;
}

.nav-icon svg {
  width: 17px;
  height: 17px;
  stroke-width: 2.15;
}

.nav-chevron svg {
  width: 15px;
  height: 15px;
}

.platform-gateway {
  background: var(--app-background);
  padding: clamp(20px, 4vw, 56px);
}

.platform-gateway-panel {
  position: relative;
  width: min(1180px, 100%);
  border-color: var(--line);
  border-radius: var(--radius-large);
  background: var(--surface-translucent);
  box-shadow: var(--shadow);
  padding: clamp(22px, 3vw, 36px);
  overflow: hidden;
}

.platform-gateway-panel::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--blue), var(--green), var(--violet));
  content: "";
}

.platform-gateway-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: clamp(24px, 4vw, 44px);
}

.platform-gateway-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.platform-gateway-kicker svg {
  width: 18px;
  height: 18px;
  color: var(--blue);
}

.theme-menu {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
}

.theme-trigger {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface-soft);
  color: var(--text);
  padding: 0 12px;
  font: inherit;
  font-size: 16px;
  font-weight: 780;
  line-height: normal;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
  transition:
    background 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
}

.theme-trigger:focus-visible {
  border-color: var(--blue);
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

.theme-trigger:active {
  transform: scale(0.98);
}

.theme-trigger > svg:first-child {
  width: 17px;
  height: 17px;
  color: var(--blue);
}

.theme-trigger-prefix {
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.theme-trigger-chevron {
  width: 15px;
  height: 15px;
  margin-left: 2px;
  color: var(--muted);
  transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}

.theme-menu.is-open .theme-trigger-chevron {
  transform: rotate(180deg);
}

.theme-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  display: grid;
  width: 292px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  background: var(--surface-raised);
  padding: 6px;
  box-shadow: 0 20px 52px rgba(24, 35, 52, 0.18), 0 2px 8px rgba(24, 35, 52, 0.08);
  transform-origin: top right;
}

.theme-popover[hidden] {
  display: none;
}

.theme-menu-compact .theme-popover {
  right: auto;
  left: 0;
  transform-origin: top left;
}

.theme-option {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  width: 100%;
  min-height: 58px;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--text);
  padding: 7px 9px;
  font: inherit;
  text-align: left;
  transition:
    background 120ms ease,
    color 120ms ease;
}

.theme-option:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.theme-option.is-selected {
  background: var(--blue-soft);
}

.theme-option-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface-soft);
  color: var(--muted);
}

.theme-option.is-selected .theme-option-icon {
  border-color: color-mix(in srgb, var(--blue) 34%, var(--line));
  background: var(--surface);
  color: var(--blue);
}

.theme-option-icon svg {
  width: 17px;
  height: 17px;
}

.theme-option > span:nth-child(2),
.theme-option strong,
.theme-option small {
  display: block;
  min-width: 0;
}

.theme-option strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 780;
  line-height: 1.25;
}

.theme-option small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 560;
  line-height: 1.35;
}

.theme-option-check {
  width: 16px;
  height: 16px;
  color: var(--blue);
  opacity: 0;
}

.theme-option.is-selected .theme-option-check {
  opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
  .theme-trigger:hover {
    border-color: color-mix(in srgb, var(--blue) 28%, var(--line));
    background: var(--surface);
    box-shadow: 0 8px 20px rgba(30, 42, 60, 0.08);
  }

  .theme-option:hover {
    background: var(--surface-soft);
  }
}

.platform-gateway-header {
  align-items: start;
  gap: clamp(18px, 3vw, 26px);
  margin-bottom: clamp(24px, 3vw, 34px);
}

.brand-mark.platform-brand-mark {
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
}

.platform-gateway-header h1 {
  max-width: 760px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.08;
  text-wrap: balance;
}

.platform-gateway-subtitle {
  max-width: 660px;
  font-size: 16px;
}

.platform-options {
  gap: 16px;
}

.platform-option {
  position: relative;
  min-height: 132px;
  border-color: var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  box-shadow: var(--shadow-soft);
  padding: 20px;
}

.platform-option:not(:disabled):hover,
.platform-option.is-selected {
  border-color: var(--green);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.platform-option.is-selected::after {
  position: absolute;
  top: 12px;
  right: 12px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  padding: 4px 8px;
  content: "当前";
  font-size: 11px;
  font-weight: 820;
}

.platform-option:disabled {
  opacity: 0.7;
}

.platform-logo {
  border-radius: var(--radius-small);
  box-shadow: 0 6px 16px rgba(21, 31, 47, 0.14);
}

.platform-gateway-footer {
  border-color: var(--line);
}

.app-shell {
  align-items: start;
}

.sidebar {
  gap: 18px;
  border-color: var(--line);
  background: var(--surface-translucent);
  box-shadow: 8px 0 28px rgba(27, 38, 55, 0.055);
  padding: 22px 18px;
}

.brand {
  padding: 0 4px 4px;
}

.mobile-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface-soft);
  color: var(--text);
  padding: 0 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 780;
}

.mobile-nav-toggle svg {
  width: 18px;
  height: 18px;
}

.mobile-nav-chevron {
  transition: transform 160ms ease;
}

.sidebar.is-mobile-nav-open .mobile-nav-chevron {
  transform: rotate(180deg);
}

.side-nav {
  gap: 10px;
}

.nav-group-toggle,
.side-nav .nav-home-link {
  border-color: var(--line);
  border-radius: var(--radius-small);
  background: var(--surface-soft);
  box-shadow: none;
}

.nav-group-toggle::before {
  inset-block: 8px;
  background: var(--blue);
}

.nav-chevron,
.nav-icon {
  border-color: var(--line);
  background: var(--surface);
  color: var(--muted);
}

.side-nav a:hover,
.side-nav a.is-active {
  background: var(--blue-soft);
  color: var(--blue);
}

.side-nav a:hover .nav-icon,
.side-nav a.is-active .nav-icon {
  border-color: color-mix(in srgb, var(--blue) 38%, var(--line));
  background: var(--surface);
  color: var(--blue);
}

.side-card,
.panel,
.metric-card {
  border-color: var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.side-card {
  background: var(--surface-soft);
}

.workspace {
  padding: clamp(18px, 2.3vw, 30px);
}

.module-view {
  border: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
  border-radius: var(--radius-large);
  background: var(--module-bg);
  padding: clamp(16px, 1.7vw, 24px);
}

#home {
  --module-bg: var(--module-home);
}

#dashboard {
  --module-bg: var(--module-dashboard);
}

#financeLedger,
#profitAnalysis {
  --module-bg: var(--module-finance);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  border-color: var(--line);
  border-radius: var(--radius-large);
  background: var(--surface-translucent);
  box-shadow: var(--shadow-soft);
  padding: 17px 20px;
}

.topbar h1 {
  font-size: 30px;
  text-wrap: balance;
}

.topbar-actions {
  justify-content: flex-start;
}

.workspace-feedback {
  padding: 8px 0 0;
  border-top: 1px solid var(--line);
  color: var(--green);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.workspace-feedback.is-error {
  color: var(--red);
}

.theme-menu-compact .theme-trigger {
  min-width: 160px;
}

.button,
.icon-button {
  min-height: 44px;
  border-radius: var(--radius-small);
}

.icon-button {
  width: 44px;
  height: 44px;
}

.button.ghost,
.icon-button {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--text);
}

.button.primary {
  border-color: var(--blue);
  background: var(--blue);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--blue) 24%, transparent);
}

.button:disabled {
  box-shadow: none;
  filter: saturate(0.4);
}

.finance-entry-card.is-disabled .button:disabled {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--faint);
}

.button.secondary {
  border-color: var(--green);
  background: var(--green);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--green) 22%, transparent);
}

.panel-heading {
  align-items: center;
}

.panel-heading h2,
.subheading h2 {
  text-wrap: balance;
}

.home-layout,
.home-bottom-grid,
.workspace-grid,
.analytics-grid {
  align-items: stretch;
}

.home-profile-card {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--green) 12%, transparent), color-mix(in srgb, var(--blue) 6%, transparent)),
    var(--surface);
}

.home-avatar {
  display: grid;
  place-items: center;
  text-align: center;
}

.home-profile-list div,
.home-suggestion-list li,
.home-shortcut,
.home-recommend-grid article {
  border-color: var(--line);
  border-radius: var(--radius-small);
  background: var(--surface-soft);
}

.home-shortcut {
  min-height: 78px;
  align-content: center;
}

.home-shortcut > span {
  border-color: color-mix(in srgb, var(--blue) 24%, var(--line));
  border-radius: var(--radius-small);
  background: var(--blue-soft);
  color: var(--blue);
}

.home-shortcut > span svg {
  width: 18px;
  height: 18px;
}

.home-overview-grid {
  align-items: stretch;
}

.metric-card {
  min-height: 116px;
}

.metric-card::before {
  height: 3px;
  background: var(--blue);
}

.metric-card:nth-child(2)::before,
.metric-card:nth-child(5)::before {
  background: var(--green);
}

.metric-card:nth-child(3)::before,
.metric-card:nth-child(6)::before {
  background: var(--violet);
}

.table-wrap table:not(.finance-table) {
  min-width: 900px;
}

.table-wrap:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 3px;
}

.finance-table {
  min-width: 880px;
}

th.numeric {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.finance-entry-form textarea,
.finance-dialog textarea {
  border-color: var(--line);
  background: var(--control-bg);
}

.data-status-banner.is-loading {
  border-left-color: var(--blue);
  background: var(--blue-soft);
}

.module-view :where(
  [class$="-card"],
  [class*="-card "],
  [class$="-row"],
  [class*="-row "],
  [class$="-item"],
  [class*="-item "]
) {
  border-color: var(--line);
}

.toast {
  border-color: var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--bg);
}

/* Theme personalities intentionally change material, shape and density—not layout. */
:root[data-theme="aurora"] .platform-gateway-panel,
:root[data-theme="aurora"] .sidebar,
:root[data-theme="aurora"] .topbar,
:root[data-theme="aurora"] .theme-trigger,
:root[data-theme="aurora"] .theme-popover {
  backdrop-filter: blur(24px) saturate(145%);
}

:root[data-theme="aurora"] .panel,
:root[data-theme="aurora"] .metric-card {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(247, 246, 255, 0.9)),
    var(--surface);
}

:root[data-theme="aurora"] .module-view::before {
  position: absolute;
  pointer-events: none;
  content: "";
}

:root[data-theme="expressive"] .platform-option.is-selected,
:root[data-theme="expressive"] .side-nav a.is-active,
:root[data-theme="expressive"] .home-shortcut:hover {
  outline: 2px solid color-mix(in srgb, var(--blue) 20%, transparent);
  outline-offset: 2px;
}

:root[data-theme="expressive"] .metric-card:nth-child(2n) {
  background: color-mix(in srgb, var(--green-soft) 46%, var(--surface));
}

:root[data-theme="expressive"] .metric-card:nth-child(3n) {
  background: color-mix(in srgb, var(--amber-soft) 48%, var(--surface));
}

:root[data-theme="expressive"] .button.primary,
:root[data-theme="expressive"] .button.secondary {
  border-radius: 999px;
  padding-inline: 18px;
}

:root[data-theme="carbon"] body::before {
  display: none;
}

:root[data-theme="carbon"] .platform-gateway-panel,
:root[data-theme="carbon"] .sidebar,
:root[data-theme="carbon"] .topbar,
:root[data-theme="carbon"] .theme-trigger,
:root[data-theme="carbon"] .theme-popover,
:root[data-theme="carbon"] .panel,
:root[data-theme="carbon"] .metric-card,
:root[data-theme="carbon"] .side-card {
  background: var(--surface);
}

:root[data-theme="carbon"] .module-view :where(
  [class$="-card"],
  [class*="-card "],
  [class$="-row"],
  [class*="-row "],
  [class$="-item"],
  [class*="-item "]
) {
  background-color: var(--surface-soft);
  color: var(--text);
}

:root[data-theme="carbon"] .home-profile-card {
  background: var(--surface);
}

:root[data-theme="carbon"] .button.primary {
  border-color: #0f62fe;
  background: #0f62fe;
  color: #ffffff;
}

:root[data-theme="carbon"] .button.secondary {
  border-color: #0f766e;
  background: #0f766e;
  color: #ffffff;
}

:root[data-theme="carbon"] .nav-group-toggle,
:root[data-theme="carbon"] .side-nav .nav-home-link,
:root[data-theme="carbon"] .nav-chevron,
:root[data-theme="carbon"] .nav-icon,
:root[data-theme="carbon"] .button.ghost,
:root[data-theme="carbon"] .icon-button,
:root[data-theme="carbon"] .home-profile-list div,
:root[data-theme="carbon"] .home-suggestion-list li,
:root[data-theme="carbon"] .home-shortcut,
:root[data-theme="carbon"] .home-recommend-grid article {
  background: var(--surface-soft);
  color: var(--text);
}

:root[data-theme="carbon"] :where(pre, code, table, th, td) {
  border-color: var(--line);
}

:root[data-theme="carbon"] :where(pre, .table-wrap, .finance-table-wrap) {
  background: #101724;
  color: var(--text);
}

:root[data-theme="carbon"] :where(th, .table-head) {
  background: #202c3c;
  color: var(--muted);
}

:root[data-theme="carbon"] :where(td, .table-row) {
  background: var(--surface);
  color: var(--text);
}

:root[data-theme="carbon"] .eyebrow,
:root[data-theme="carbon"] a,
:root[data-theme="carbon"] h1,
:root[data-theme="carbon"] h2,
:root[data-theme="carbon"] strong {
  color: inherit;
}

:root[data-theme="carbon"] .eyebrow {
  color: var(--green);
}

@media (min-width: 921px) {
  .topbar {
    position: sticky;
    top: 16px;
    z-index: 12;
  }
}

@media (max-width: 1400px) {
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .connector-form,
  .access-user-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .connector-form label:first-child,
  .access-user-form .button {
    grid-column: 1 / -1;
  }
}

@media (min-width: 921px) and (max-width: 1400px) {
  .table-wrap table:not(.finance-table),
  .finance-table {
    min-width: 100%;
  }
}

@media (max-width: 920px) {
  .sidebar {
    grid-template-columns: minmax(0, 1fr) auto;
    border-color: var(--line);
    background: var(--surface-translucent);
  }

  .brand {
    grid-column: auto;
  }

  .mobile-nav-toggle {
    display: inline-flex;
  }

  .side-nav {
    display: none;
    grid-column: 1 / -1;
    max-height: min(64vh, 520px);
    gap: 8px;
    border-top: 1px solid var(--line);
    padding: 12px 2px 4px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .sidebar.is-mobile-nav-open .side-nav {
    display: grid;
  }

  .nav-group {
    display: grid;
    gap: 6px;
  }

  .nav-group-toggle {
    display: flex;
  }

  .nav-group-list,
  .nav-group.is-collapsed .nav-group-list {
    display: grid;
    gap: 4px;
    margin-left: 12px;
    border-left: 1px solid var(--line);
    padding-left: 10px;
    overflow: hidden;
  }

  .nav-group-list {
    max-height: 280px;
    opacity: 1;
    pointer-events: auto;
  }

  .nav-group.is-collapsed .nav-group-list {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
  }

  .side-nav a {
    width: 100%;
    min-height: 44px;
  }

  .nav-icon {
    flex-basis: 24px;
  }

  .topbar {
    position: static;
  }
}

@media (max-width: 640px) {
  .module-view {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .platform-gateway-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    margin-bottom: 28px;
  }

  .platform-gateway-toolbar .theme-menu,
  .platform-gateway-toolbar .theme-trigger {
    width: 100%;
  }

  .platform-gateway-toolbar .theme-popover {
    right: auto;
    left: 0;
    width: 100%;
    transform-origin: top left;
  }

  .platform-gateway-header h1 {
    font-size: clamp(28px, 9vw, 38px);
  }

  .platform-option {
    min-height: 104px;
  }

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

  .topbar-actions .button.secondary {
    grid-column: auto;
  }

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

  .theme-menu-compact {
    grid-column: 1 / -1;
    width: 100%;
  }

  .theme-menu-compact .theme-trigger,
  .theme-menu-compact .theme-popover {
    width: 100%;
  }

  .metric-card {
    min-height: 108px;
  }
}

@media (max-width: 720px) {
  .finance-table {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
