/* The system-brand update button contains the version label on both app headers. */
#root button[class*="/system-brand:"]:has(> span.font-mono[class*="/system-brand:"]) {
  display: none !important;
}

/* Shared sage palette for the native console and custom panels. */
:root:not(.dark):not([data-trust-static]), :root:not(.dark):not([data-trust-static]) body {
  color-scheme: light;
  --background: #f8f9f5;
  --foreground: #26322c;
  --card: #fdfefa;
  --card-foreground: #26322c;
  --popover: #fdfefa;
  --popover-foreground: #26322c;
  --primary: #426b50;
  --primary-foreground: #fff;
  --secondary: #e8eee5;
  --secondary-foreground: #355740;
  --muted: #eef2eb;
  --muted-foreground: #66736a;
  --accent: #e8eee5;
  --accent-foreground: #355740;
  --success: #426b50;
  --success-foreground: #fff;
  --table-header: #eef2eb;
  --table-header-bg: #eef2eb;
  --border: #dce4d8;
  --input: #cbd6c5;
  --ring: #7d9c84;
  --sidebar: #f1f5ee;
  --sidebar-foreground: #33483a;
  --sidebar-primary: #426b50;
  --sidebar-primary-foreground: #fff;
  --sidebar-accent: #e2ebdd;
  --sidebar-accent-foreground: #355740;
  --sidebar-border: #dce4d8;
  --sidebar-ring: #7d9c84;
}

:root:not(.dark):not([data-trust-static]) body { background-color: var(--background); color: var(--foreground); }

:root.dark {
  color-scheme: dark;
  --trust-night-bg: #121816;
  --trust-night-panel: #1c2621;
  --trust-night-raised: #24312a;
  --trust-night-field: #161e1a;
  --trust-night-border: #3b4b41;
  --trust-night-input: #516459;
  --trust-night-text: #e8efe9;
  --trust-night-muted: #aebdb4;
  --trust-night-accent: #a9c9b0;
  --trust-night-accent-ink: #15241b;
  --trust-night-active: #31483a;
  --trust-night-focus: #8fbc9d;
}

/* New API uses its native theme for control state and these tokens for color. */
:root.dark:not([data-trust-static]), :root.dark:not([data-trust-static]) body {
  --background: var(--trust-night-bg);
  --foreground: var(--trust-night-text);
  --card: var(--trust-night-panel);
  --card-foreground: var(--trust-night-text);
  --popover: var(--trust-night-raised);
  --popover-foreground: var(--trust-night-text);
  --primary: var(--trust-night-accent);
  --primary-foreground: var(--trust-night-accent-ink);
  --secondary: var(--trust-night-raised);
  --secondary-foreground: var(--trust-night-text);
  --muted: var(--trust-night-raised);
  --muted-foreground: var(--trust-night-muted);
  --accent: var(--trust-night-active);
  --accent-foreground: var(--trust-night-accent);
  --success: var(--trust-night-accent);
  --success-foreground: var(--trust-night-accent-ink);
  --table-header: var(--trust-night-raised);
  --table-header-bg: var(--trust-night-raised);
  --border: var(--trust-night-border);
  --input: var(--trust-night-input);
  --ring: var(--trust-night-focus);
  --sidebar: #17201b;
  --sidebar-foreground: var(--trust-night-text);
  --sidebar-primary: var(--trust-night-accent);
  --sidebar-primary-foreground: var(--trust-night-accent-ink);
  --sidebar-accent: var(--trust-night-active);
  --sidebar-accent-foreground: var(--trust-night-text);
  --sidebar-border: var(--trust-night-border);
  --sidebar-ring: var(--trust-night-focus);
}

:root.dark:not([data-trust-static]) body { background-color: var(--background); color: var(--foreground); }

@media (min-width: 768px) {
  [data-slot="sidebar"] {
    --sidebar-width: 17rem;
  }

  [data-slot="sidebar"][data-state="expanded"] [data-slot="sidebar-menu-button"] {
    height: 2.75rem;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5rem;
  }

  [data-slot="sidebar"][data-state="expanded"] [data-slot="sidebar-menu-button"] > svg {
    width: 1.25rem;
    height: 1.25rem;
  }

  [data-slot="sidebar"][data-state="expanded"] [data-slot="sidebar-group-label"] {
    height: 2.5rem;
    padding-inline: 0.75rem;
    font-size: 0.75rem;
    line-height: 1rem;
  }

  [data-slot="sidebar"][data-state="expanded"] [data-slot="sidebar-group"] {
    padding-inline: 0.75rem;
    padding-block: 0.25rem;
  }

  [data-slot="sidebar"][data-state="expanded"] [data-slot="sidebar-menu"] {
    gap: 0.25rem;
  }
}

:root.dark .tm-page {
  --tm-bg: var(--trust-night-bg);
  --tm-panel: var(--trust-night-panel);
  --tm-line: var(--trust-night-border);
  --tm-text: var(--trust-night-text);
  --tm-muted: var(--trust-night-muted);
  --tm-accent: var(--trust-night-accent);
  --tm-selected: var(--trust-night-active);
  --tm-paid: var(--trust-night-raised);
}
:root.dark .tm-page .tm-hero { background: var(--trust-night-panel); border-color: var(--trust-night-border); }
:root.dark .tm-page .tm-choice:is(:hover, [aria-pressed="true"]) { border-color: var(--trust-night-focus); }
:root.dark [data-trust-filter-panel] {
  --tf-line: var(--trust-night-border);
  --tf-selected: var(--trust-night-active);
  --tf-accent: var(--trust-night-accent);
  --tf-note: var(--trust-night-panel);
}

:root.dark .tc-shop-frame { background: var(--trust-night-panel); }
:root.dark .tc-available-table th { background: var(--trust-night-raised); }

/* Keep the account balance prominent in the console's top navigation. */
#root header:has([data-sidebar="trigger"]) .tc-header-balance {
  background-color: #e2eae3;
  border-color: #bdcdc0;
  color: #182e21;
}

#root header:has([data-sidebar="trigger"]) .tc-header-balance:hover {
  background-color: #d6e2d8;
  border-color: #aabdaf;
}

#root header:has([data-sidebar="trigger"]) .tc-header-balance-label {
  color: #394f40;
}

#root header:has([data-sidebar="trigger"]) .tc-header-amount {
  font-weight: 700;
}

:root.dark #root header:has([data-sidebar="trigger"]) .tc-header-amount {
  color: #182e21;
}

@media (min-width: 768px) {
  #root header:has([data-sidebar="trigger"]) nav > a,
  #root header:has([data-sidebar="trigger"]) .tc-header-community-button,
  #root header:has([data-sidebar="trigger"]) .tc-header-balance {
    font-size: 1rem;
    line-height: 1.5rem;
    font-weight: 400;
  }

  #root header:has([data-sidebar="trigger"]) .tc-header-balance {
    box-sizing: border-box;
    min-height: 2.75rem;
    padding: 8px 12px;
  }

  #root header:has([data-sidebar="trigger"]) > div > .ms-auto > button:has(> svg) {
    width: 2.75rem;
    height: 2.75rem;
  }

  #root header:has([data-sidebar="trigger"]) > div > .ms-auto > button > svg {
    width: 1.25rem;
    height: 1.25rem;
  }

  #root header:has([data-sidebar="trigger"]) button:has(> [data-slot="avatar"]),
  #root header:has([data-sidebar="trigger"]) button > [data-slot="avatar"] {
    width: 1.75rem;
    height: 1.75rem;
  }

  #root header:has([data-sidebar="trigger"]) button > [data-slot="avatar"] > [data-slot="avatar-fallback"] {
    font-size: 0.8125rem;
  }
}

/* Match the public header to the model marketplace's platform names. */
:root {
  --app-header-height: 3.3rem;
}

#root header > div > nav:has(> [class*="/system-brand"]) {
  height: 4.4rem;
  zoom: 1;
  --trust-header-font-size: 1.25rem;
}

#root header > div > nav:has(> [class*="/system-brand"]) [class*="/system-brand"] > a > span,
#root header > div > nav:has(> [class*="/system-brand"]) > div > a {
  font-size: var(--trust-header-font-size);
  line-height: 1.4;
}

#root header > div > nav:has(> [class*="/system-brand"]) [class*="/system-brand"] > a > div {
  width: 2.5rem;
  height: 2.5rem;
}

#root header > div > nav:has(> [class*="/system-brand"]) > div > button,
#root header > div > nav:has(> [class*="/system-brand"]) > div > a[role="button"] {
  min-height: 2.75rem;
}

#root header > div > nav:has(> [class*="/system-brand"]) > div > button:has(> svg) {
  width: 2.75rem;
  height: 2.75rem;
}

#root header > div > nav:has(> [class*="/system-brand"]) > div > button > svg {
  width: 1.5625rem;
  height: 1.5625rem;
}

#root header > div > nav:has(> [class*="/system-brand"]) > div > button > [data-slot="avatar"] {
  width: 2rem;
  height: 2rem;
}

@media (max-width: 640px) {
  #root header > div > nav:has(> [class*="/system-brand"]) {
    height: 4rem;
    --trust-header-font-size: 1.0625rem;
  }

  #root header > div > nav:has(> [class*="/system-brand"]) [class*="/system-brand"] > a > div {
    width: 2.125rem;
    height: 2.125rem;
  }
}

#root header:has([data-sidebar="trigger"]) > div {
  height: 3rem;
  zoom: 1.1;
}

.home-tools {
  zoom: 1.1;
}
