/* Maps Blazor Blueprint (shadcn/ui) variables onto the WebEon tokens in theme.css. Unlayered, so it wins over the
   library's layered defaults; the tokens themselves switch with html.dark, so one block covers both themes. */
:root, .dark {
  --font-sans: var(--weo-font);
  --background: var(--weo-bg);
  --foreground: var(--weo-text);
  --card: var(--weo-card);
  --card-foreground: var(--weo-text);
  --popover: var(--weo-card);
  --popover-foreground: var(--weo-text);
  --primary: var(--weo-primary);
  --primary-foreground: var(--weo-on-primary);
  --secondary: var(--weo-subtle);
  --secondary-foreground: var(--weo-text);
  --muted: var(--weo-subtle);
  --muted-foreground: var(--weo-muted);
  --accent: var(--weo-subtle);
  --accent-foreground: var(--weo-text);
  --destructive: var(--weo-danger-solid);
  --destructive-foreground: #FFFFFF;
  --border: var(--weo-line);
  --input: var(--weo-line-strong);
  --ring: var(--weo-primary);
  /* Generous corners throughout (layout direction): controls 10–12px, cards 22px. */
  --radius: .75rem;
  --sidebar: var(--weo-side);
  --sidebar-foreground: var(--weo-text);
  --sidebar-primary: var(--weo-primary);
  --sidebar-primary-foreground: var(--weo-on-primary);
  --sidebar-accent: var(--weo-subtle);
  --sidebar-accent-foreground: var(--weo-text);
  --sidebar-border: transparent;
  --sidebar-ring: var(--weo-primary);
  --sidebar-width: 17rem;
  --sidebar-width-icon: 4.25rem;
  --alert-success: var(--weo-success);
  --alert-warning: var(--weo-warning);
  --alert-info: var(--weo-tint-text);
  --alert-danger: var(--weo-danger);
  /* Charts read these as plain colours (ECharts cannot use var()/color-mix), so they point at the brand settings. */
  --chart-1: var(--weo-brand);
  --chart-2: var(--weo-accent);
  --chart-3: #94A3B8;
  --chart-4: #16A34A;
  --chart-5: #E11D48;
}

/* Combobox triggers have a fixed width; inside a form field they should fill it. */
.weo-fill, .weo-fill > button { width: 100%; }
/* The date picker sets its own 280px; inside a form field it takes the field's width instead. */
.weo-field > button[class*="bb:w-[280px]"] { width: 100%; max-width: 100%; }

/* Sidebar: airy items, a soft pill for the current page with a brand bar beside it. */
[data-sidebar="header"] { padding: 22px 18px 10px; gap: 14px; }
[data-sidebar="content"] { padding: 0 10px; }
[data-sidebar="group-label"] { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--weo-muted); padding-left: 14px; }
[data-sidebar="menu-button"] { height: 40px; padding: 0 14px; border-radius: 12px; font-size: 14px; gap: 12px; color: var(--weo-text); position: relative; }
[data-sidebar="menu-button"] svg { width: 19px; height: 19px; color: var(--weo-muted); }
[data-sidebar="menu-button"][data-active="true"] { background: var(--weo-subtle); font-weight: 600; }
[data-sidebar="menu-button"][data-active="true"] svg { color: var(--weo-primary-text); }
[data-sidebar="menu-button"][data-active="true"] { box-shadow: inset 3px 0 0 var(--weo-primary); }
[data-sidebar="footer"] { padding: 12px 18px 18px; }

/* Controls sit on the grey canvas as well as on white cards: give them the card colour, never the canvas. */
main :is(input, textarea, select, button, a)[class~="bb:bg-background"] { background-color: var(--weo-card); }

/* Sidebar: always the height of the screen; its menu scrolls on its own, the page scrolls separately. */
aside[data-side] { height: 100vh; height: 100dvh; align-self: flex-start; }
[data-sidebar="content"] { overscroll-behavior: contain; padding-bottom: 8px; }

/* Slim scrollbars that appear when the pointer is over the area (sidebar, palette, lists). */
[data-sidebar="content"], .weo-palette [role="listbox"] [role="listbox"], .weo-scroll {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color .2s;
}
[data-sidebar="content"]:hover, .weo-palette [role="listbox"] [role="listbox"]:hover, .weo-scroll:hover {
  scrollbar-color: color-mix(in srgb, var(--weo-muted) 45%, transparent) transparent;
}

/* Dialog backdrop: a soft blurred veil instead of near-black. */
[class~="bb:bg-black/80"] { background-color: color-mix(in srgb, #0B0D12 38%, transparent) !important; backdrop-filter: blur(6px); }

/* Command palette (Ctrl+K): a large rounded card, big search row, items with icon tiles. */
.weo-palette { max-width: min(640px, calc(100vw - 32px)) !important; top: 16vh !important; translate: 0 0; transform: translateX(-50%) !important; padding: 0 !important; gap: 0 !important; border: 1px solid var(--weo-card-border) !important; border-radius: 22px !important; background: var(--weo-card) !important; box-shadow: var(--weo-overlay-shadow) !important; overflow: hidden; }
.weo-palette > [role="listbox"] { border-radius: 22px; background: var(--weo-card); }
.weo-palette > [role="listbox"] > div:first-child { height: 64px; padding: 0 56px 0 22px; gap: 12px; border-bottom: 1px solid var(--weo-line); box-shadow: none !important; }
.weo-palette > [role="listbox"] > div:first-child svg { width: 20px; height: 20px; color: var(--weo-muted); opacity: 1; }
.weo-palette input[role="combobox"] { height: 64px; font-size: 16px; color: var(--weo-text); }
.weo-palette [role="listbox"] [role="listbox"] { max-height: min(440px, 55vh); padding: 6px 10px 10px; }
.weo-palette [role="group"] { padding: 0; }
.weo-palette [role="group"] > div:first-child { padding: 12px 12px 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--weo-muted); }
.weo-palette [role="option"] { height: 46px; padding: 0 10px; gap: 12px; border-radius: 12px; font-size: 14px; color: var(--weo-text); }
.weo-palette [role="option"] > span:first-child { width: 32px; height: 32px; margin: 0; display: grid; place-items: center; border-radius: 10px; background: var(--weo-subtle); color: var(--weo-muted); flex: none; }
.weo-palette [role="option"] > span:first-child svg { width: 17px; height: 17px; }
.weo-palette [role="option"]:hover, .weo-palette [role="option"][data-focused="true"], .weo-palette [role="option"][aria-selected="true"] { background: var(--weo-tint) !important; color: var(--weo-tint-text) !important; }
.weo-palette [role="option"]:hover > span:first-child, .weo-palette [role="option"][data-focused="true"] > span:first-child, .weo-palette [role="option"][aria-selected="true"] > span:first-child { background: var(--weo-card); color: var(--weo-primary-text); }
.weo-palette > button { top: 20px !important; right: 18px !important; inset-inline-end: 18px !important; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; }
.weo-palette > button:hover { background: var(--weo-subtle); }
.weo-palette-foot { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 12px 22px; border-top: 1px solid var(--weo-line); background: var(--weo-subtle); font-size: 12px; color: var(--weo-muted); }
.weo-palette-foot .weo-kbd { margin-right: 4px; }

/* Navigation tree: sections set apart by a hairline, groups that fold open with a turning chevron, their pages on a
   guide line indented under the group. */
.weo-nav-section + .weo-nav-section { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--weo-line); }
.weo-nav-section:first-child [data-sidebar="group-content"] { padding-top: 2px; }
.weo-nav-chevron { margin-left: auto; transition: transform 150ms ease-out; }
[data-sidebar="menu-button"] > span, [data-sidebar="menu-sub-button"] > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
[data-sidebar="menu-button"][data-state="open"] > .weo-nav-chevron { transform: rotate(90deg); }
[data-sidebar="menu-button"] svg.weo-nav-chevron { width: 14px; height: 14px; }
[data-sidebar="menu-sub"] { margin: 2px 0 6px 22px; padding: 0 0 0 8px; border-left: 1px solid var(--weo-line); gap: 2px; }
[data-sidebar="menu-sub-button"] { height: 34px; padding: 0 10px; border-radius: 10px; font-size: 13.5px; color: var(--weo-muted); }
[data-sidebar="menu-sub-button"]:hover { color: var(--weo-text); background: var(--weo-subtle); }
[data-sidebar="menu-sub-button"][data-active="true"] { color: var(--weo-text); font-weight: 600; background: var(--weo-subtle); box-shadow: inset 2px 0 0 var(--weo-primary); }
@media (prefers-reduced-motion: reduce) { .weo-nav-chevron { transition: none; } }

/* The icon rail (sidebar collapsed): icons only, centred; the branch card and texts give way; a group's icon expands
   the sidebar with that group open (theme.js). */
[data-collapsible="icon"] [data-sidebar="header"] { padding: 18px 0 8px; align-items: center; }
[data-collapsible="icon"] [data-sidebar="header"] .weo-brand span,
[data-collapsible="icon"] [data-sidebar="header"] .weo-context-card { display: none; }
[data-collapsible="icon"] [data-sidebar="content"] { padding: 0 10px; }
[data-collapsible="icon"] [data-sidebar="group-label"] { display: none; }
[data-collapsible="icon"] .weo-nav-section + .weo-nav-section { margin-top: 4px; padding-top: 6px; }
[data-collapsible="icon"] [data-sidebar="menu-button"] { width: 44px !important; height: 40px !important; padding: 0 !important; justify-content: center; margin: 0 auto; }
[data-collapsible="icon"] [data-sidebar="menu-button"] > span,
[data-collapsible="icon"] [data-sidebar="menu-button"] > .weo-nav-chevron,
[data-collapsible="icon"] [data-sidebar="menu-sub"] { display: none; }
[data-collapsible="icon"] [data-sidebar="footer"] { padding: 10px 0 16px; align-items: center; }
[data-collapsible="icon"] [data-sidebar="footer"] .weo-context-card { width: 44px; height: 40px; padding: 0; justify-content: center; }
[data-collapsible="icon"] [data-sidebar="footer"] .weo-context-card span { display: none; }

