/* Home board (HER-10): Gridstack tile layout, widget panels, info tiles, quick actions.
   Minimalist refresh: the board chrome (panels, headers, quick-action cells, config) is intentionally
   MONOCHROME and derived from currentColor — color-mix(... currentColor ...) yields borders/tints that
   flip automatically with the active theme's text colour, so the board reads correctly in light AND dark
   WITHOUT depending on --dxbl-* tokens (the DevExpress Fluent theme does not expose --dxbl-primary /
   -border-color / -panel-bg, so the old fallbacks were in fact the only values ever applied). Colour is
   reserved for DATA: the info-tile status fills and the embedded dashboard's chart.
   Info-tile fills are the user-picked DefaultColor / threshold-rule colours applied inline by KpiWidget,
   with a per-tile contrast foreground (ColorCss.ForegroundFor) — deliberately NOT theme-derived so a
   chosen colour reads identically across themes; do not convert them to theme variables. */

:root {
    /* One spatial scale, used everywhere so every surface shares the same rhythm. */
    --board-radius: var(--vl-sheet-radius);       /* cards: panels, info tiles */
    --board-radius-sm: var(--vl-control-radius);  /* controls: quick-action cells, inputs, dashboard items */
    --board-gap: .5rem;
    --board-pad: 14px;          /* card body padding */
    --board-pad-sm: 10px;
    /* Neutrals derived from the element's own text colour → theme-adaptive by construction.
       (custom-property values are substituted at the use site, so currentColor resolves there.) */
    --board-border: color-mix(in srgb, currentColor 14%, transparent);
    --board-border-strong: color-mix(in srgb, currentColor 32%, transparent);
    --board-surface: color-mix(in srgb, currentColor 3.5%, transparent);
    --board-hover: color-mix(in srgb, currentColor 8%, transparent);
    --board-muted: color-mix(in srgb, currentColor 58%, transparent);
}

/* A shared micro-label — uppercase, tracked, quiet. Every header/caption on the board uses it so the
   whole surface speaks one typographic language. */
.board-panel-title,
.board-kpi-caption {
    text-transform: uppercase;
    letter-spacing: .045em;
    font-size: .72rem;
    font-weight: 600;
}

.board-canvas { display: flex; flex-direction: column; height: 100%; }
.board-toolbar { display: flex; align-items: center; gap: var(--board-gap); padding: .4rem .25rem .6rem; }

/* The surface scrolls: the grid grows taller than the viewport as rows are added. */
.board-surface { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }

/* Each Gridstack cell fills with one widget panel. */
.grid-stack-item-content { overflow: hidden; }
.grid-stack-item-content > .board-panel { height: 100%; }

/* The panel header is the Gridstack drag handle; show the move cursor only when the grid is editable
   (Gridstack adds .grid-stack-static to the container when static). */
.grid-stack:not(.grid-stack-static) .board-panel-header { cursor: move; }

.board-panel {
    display: flex; flex-direction: column; height: 100%;
    border: 1px solid var(--board-border); border-radius: var(--board-radius);
    background: var(--board-surface);
}
.board-panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: .4rem var(--board-pad);
    border-bottom: 1px solid var(--board-border);
}
.board-panel-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .65; }
/* Edit-mode title editor. Sits where the title span normally is and fills the header's free space so
   the action buttons stay right-aligned (header is display:flex / justify-content:space-between).
   Borderless until hover/focus; cursor:text overrides the header's cursor:move (the header is the
   Gridstack drag handle). Drag-start is suppressed in markup via @onpointerdown/@onmousedown
   :stopPropagation, so clicking the input focuses it instead of moving the panel. Note: the input keeps
   normal casing (font:inherit, no uppercase) so the user edits the real title, not the display label. */
.board-panel-title-input {
    flex: 1; min-width: 0; margin-right: 8px;
    font: inherit; color: inherit; cursor: text;
    background: transparent; border: 1px solid transparent; border-radius: var(--board-radius-sm); padding: 2px 6px;
}
.board-panel-title-input:hover { border-color: var(--board-border); }
.board-panel-title-input:focus {
    outline: none; border-color: var(--board-border-strong);
    background: var(--board-hover);
}
.board-panel-actions { display: flex; align-items: center; gap: 4px; }
.board-panel-close, .board-panel-config, .board-panel-action {
    border: none; background: transparent; cursor: pointer; color: inherit; opacity: .6;
    line-height: 1; font-size: 16px; padding: 3px 7px; border-radius: var(--board-radius-sm);
}
.board-panel-close:hover, .board-panel-config:hover, .board-panel-action:hover { opacity: 1; background: var(--board-hover); }
.board-config { display: flex; flex-direction: column; gap: 6px; padding: 4px; }
.board-config-search {
    width: 100%; box-sizing: border-box;
    font: inherit; padding: 7px 10px;
    border: 1px solid var(--board-border); border-radius: var(--board-radius-sm);
    background: transparent; color: inherit;
}
.board-config-search:focus { outline: none; border-color: var(--board-border-strong); background: var(--board-hover); }
/* The selectable-entity list is the only scrolling region; the search box above and the Save button
   below stay pinned. Capped to half the viewport so the popup never grows past it (DxPopup sizes to
   content — see BoardCanvas.razor:52). */
.board-config-list { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; overflow-x: hidden; }
.board-config-item { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 5px 6px; border-radius: var(--board-radius-sm); }
.board-config-item:hover { background: var(--board-hover); }
.board-config-actions { margin-top: 8px; display: flex; justify-content: flex-end; }
.board-empty { padding: 10px; color: var(--board-muted); font-size: .85rem; }
.board-panel-body { flex: 1; overflow: auto; padding: 12px; position: relative; }
/* The info-tile widget hosts a fixed-pixel-height nested Gridstack; give that panel a tighter body so
   the grid never exceeds the panel and forces a scrollbar (the grid height is set by Gridstack, not by
   content, so the only lever here is the surrounding padding). */
.board-panel-body:has(.board-kpi-stack) { padding: 4px; }
/* Fill the body so widgets that size to their container (the embedded dashboard's DxDashboard uses
   height:100%) get a definite height to resolve against. Content-sized widgets (KPI, list) top-align
   inside it and overflow scrolls via .board-panel-body, so this is safe for every widget. */
.board-widget-host { height: 100%; }

/* Widget palette (AddWidgetDialog). */
.board-palette { display: flex; flex-direction: column; gap: 6px; }
.board-palette-item {
    text-align: left; padding: 8px 12px; font: inherit; color: inherit; cursor: pointer;
    border: 1px solid var(--board-border); border-radius: var(--board-radius-sm); background: transparent;
    transition: background .12s ease, border-color .12s ease;
}
.board-palette-item:hover { background: var(--board-hover); border-color: var(--board-border-strong); }

/* Nested Gridstack host inside the KPI panel. Tiles are draggable/resizable only in board edit mode
   (Gridstack adds .grid-stack-static to the container when static); the WHOLE tile is the drag handle
   (Gridstack ignores drag-start on the action <button>s, so the pencil/trash stay clickable). */
.board-kpi-stack { min-height: 64px; }
/* Per-tile authoring overlay (drag grip + edit pencil + remove trash), top-right, edit-mode only.
   Absolutely positioned so it floats over the tile without shifting its layout. */
.board-kpi-actions { display: none; position: absolute; top: 2px; right: 6px; gap: 2px; z-index: 1; }
.board-kpi-stack:not(.grid-stack-static) .board-kpi-actions { display: flex; align-items: center; }
/* Fixed-size centered hit box so the whole glyph stays inside the clickable/hover area. */
.board-kpi-action { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: none; background: transparent; cursor: pointer; color: inherit; opacity: .7; font-size: 15px; line-height: 1; padding: 0; border-radius: 4px; }
.board-kpi-action:hover { opacity: 1; background: color-mix(in srgb, currentColor 16%, transparent); }
/* Drag grip — a small icon in the same overlay (NOT a full-width bar; no layout shift). The grip alone
   is the Gridstack drag handle, so the rest of the tile body stays clickable. Inherits the tile color. */
.board-kpi-grip { display: none; }
.board-kpi-stack:not(.grid-stack-static) .board-kpi-grip { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 24px; cursor: move; color: inherit; opacity: .7; border-radius: 4px; }
.board-kpi-grip:hover { opacity: 1; background: color-mix(in srgb, currentColor 16%, transparent); }
.board-kpi-grip svg { pointer-events: none; display: block; }
/* Reveal Gridstack's bottom-right resize handle in edit mode and recolor it: drop its fixed-color SVG
   and draw a corner glyph in the inherited tile color so it matches the grip/pencil/trash. The color is
   set on .grid-stack-item (the handle lives outside .board-kpi-tile). !important overrides Gridstack's
   own stylesheet, which loads after this file. */
.board-kpi-stack .grid-stack-item > .ui-resizable-se { background-image: none !important; }
.board-kpi-stack:not(.grid-stack-static) .grid-stack-item > .ui-resizable-se {
    display: block !important; color: inherit;
}
/* Resize affordance: a 45° diagonal double-arrow drawn as a mask-image (not a font glyph — those get
   substituted to a near-horizontal arrow on some systems) and filled with currentColor so it matches the
   tile's other icons. Inset ~10px from the item edge — the handle is anchored on .grid-stack-item, which
   sits 4px (grid margin) outside the tile, so this lands it on the tile corner with the same ~6px gap as
   the top-right icons. */
.board-kpi-stack:not(.grid-stack-static) .grid-stack-item > .ui-resizable-se::after {
    content: ""; position: absolute; right: 10px; bottom: 9px; width: 12px; height: 12px;
    background-color: currentColor; opacity: .75;
    -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2010%2010'%20fill='none'%20stroke='black'%20stroke-width='1.4'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M2%202L8%208'/%3E%3Cpath%20d='M2%205L2%202L5%202'/%3E%3Cpath%20d='M5%208L8%208L8%205'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2010%2010'%20fill='none'%20stroke='black'%20stroke-width='1.4'%20stroke-linecap='round'%20stroke-linejoin='round'%3E%3Cpath%20d='M2%202L8%208'/%3E%3Cpath%20d='M2%205L2%202L5%202'/%3E%3Cpath%20d='M5%208L8%208L8%205'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* background + color set inline per tile by KpiWidget (user-picked color + computed contrast).
   Caption typography comes from the shared .board-kpi-caption micro-label rule above; the value is a
   tabular-figure number so digits stay aligned across tiles. */
.board-kpi-tile {
    position: relative; height: 100%; box-sizing: border-box;
    border-radius: var(--board-radius); padding: 8px 14px;
    display: flex; flex-direction: column; justify-content: center; gap: 2px; overflow: hidden;
}
.board-kpi-caption { opacity: .85; }
.board-kpi-value { font-size: 1.2rem; font-weight: 700; line-height: 1.05; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.board-link { color: var(--vl-accent); cursor: pointer; }

/* Quick actions (QuickActionsWidget). Each tile launches a "create new" Detail View, so it reads as a
   flat, equal cell in the board's monochrome language and carries a leading "+" to mark the create
   intent. This replaces the previous unstyled native <button>s — the board's biggest inconsistency. */
.board-quick-actions {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: .4rem; align-content: start;
}
.board-qa-tile {
    display: flex; align-items: center; gap: .45rem; min-width: 0;
    text-align: left; font: inherit; font-size: .85rem; font-weight: 500; color: inherit;
    padding: .45rem .65rem; cursor: pointer;
    background: transparent; border: 1px solid var(--board-border); border-radius: var(--board-radius-sm);
    transition: background .12s ease, border-color .12s ease, transform .05s ease;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.board-qa-tile::before {
    content: "+"; flex: none;
    font-size: 1rem; font-weight: 400; line-height: 1; width: 1.1em; text-align: center;
    color: var(--board-muted); transition: color .12s ease;
}
.board-qa-tile:hover { background: var(--board-hover); border-color: var(--board-border-strong); }
.board-qa-tile:hover::before { color: inherit; }
.board-qa-tile:active { transform: translateY(1px); }
.board-qa-tile:focus-visible { outline: 2px solid var(--board-border-strong); outline-offset: 1px; }

/* Embedded DevExpress dashboard (DashboardWidget) — flatten the viewer chrome so it matches the board's
   minimalist cards. The dx-dashboard CSS bundle loads AFTER this file (see each host's _Host.cshtml) and
   the viewer paints through .dx-designer-viewport-scoped rules, so these overrides need !important to win
   on the cascade. Class names verified against the v25.2 viewer DOM (2026-06): widget-container /
   surface = the gray surround; item-container = the white panel + drop shadow; caption-toolbar = each
   item's title bar. Only the light dashboard bundle is linked (dx-dashboard.light.css), so dashboard
   text is always dark — we therefore keep the item panels light and only strip the surrounding gray
   frame + heavy shadow, then quiet the captions into the same micro-labels the rest of the board uses. */
.board-panel-body .dx-dashboard-widget-container,
.board-panel-body .dx-dashboard-surface,
.board-panel-body .dx-dashboard-container { background: transparent !important; }
.board-panel-body .dx-dashboard-item-container {
    box-shadow: none !important;
    border: 1px solid var(--board-border) !important;
    border-radius: var(--board-radius-sm) !important;
}
.board-panel-body .dx-dashboard-caption-toolbar,
.board-panel-body .dx-dashboard-caption-toolbar-border {
    background: transparent !important;
    border-bottom-color: var(--board-border) !important;
}
.board-panel-body .dx-dashboard-caption-toolbar .dx-dashboard-ellipsis,
.board-panel-body .dx-dashboard-title-toolbar .dx-dashboard-ellipsis {
    text-transform: uppercase; letter-spacing: .045em; font-weight: 600; opacity: .55;
}

/* DevExpress Blazor Filter/Criteria editor fix. The framework gives .filter-editor a fixed
   height:300px (position:relative) with an absolutely-positioned inner tree (height:calc(100% - 30px)).
   Inside an auto-height / flex ancestor — the BoardInfoTile "Edit Criteria" popup, and any inline
   criteria editor (e.g. AppearanceRule) — that fixed host collapses to ~0px, leaving a thin line with no
   builder UI. A min-height floor (not a fixed height) keeps it usable while still allowing growth. This
   file loads after the framework styles.css in both hosts' _Host.cshtml, so these single-class selectors
   win on source order without !important. */
.filter-editor { min-height: 300px; }
.filter-wrapper { min-height: 0; }
.popup-filter-wrapper.filter-wrapper { min-height: 300px; }
