/* 21st component adapters. Every colour resolves to the existing Enerdex tokens. */
body.dashboard-page .edx-components {
  --background: var(--fx-surface); --foreground: var(--fx-ink); --card: var(--fx-surface); --card-foreground: var(--fx-ink);
  --border: var(--fx-rule); --muted: var(--fx-surface-2); --muted-foreground: var(--fx-muted);
  --chart-background: var(--fx-surface); --chart-foreground: var(--fx-ink); --chart-foreground-muted: var(--fx-muted);
  --chart-line-primary: var(--fx-green); --chart-line-secondary: var(--fx-ink-2); --chart-tooltip-background: var(--fx-surface); --chart-tooltip-foreground: var(--fx-ink);
  --chart-1: var(--fx-green); --chart-2: var(--fx-ink-2); --chart-3: var(--fx-accent); --chart-4: var(--fx-muted); --chart-5: var(--fx-amber);
  --radius: 6px; --radius-xl: 8px;
  color: var(--fx-ink-2); font-family: var(--fx-sans); font-size: 13px; line-height: 1.5; min-width: 0;
}
.edx-components *, .edx-components *::before, .edx-components *::after { box-sizing: border-box; border-width: 0; border-style: solid; border-color: var(--fx-rule); letter-spacing: 0; }
.edx-components button, .edx-components input, .edx-components select { font: inherit; color: inherit; }
.edx-components button, .edx-components summary { cursor: pointer; }
.edx-components button:disabled { cursor: not-allowed; opacity: .45; }
.edx-components button:focus-visible, .edx-components a:focus-visible, .edx-components input:focus-visible, .edx-components select:focus-visible, .edx-components summary:focus-visible, .edx-table-scroll:focus-visible { outline: 2px solid var(--fx-green); outline-offset: 3px; }
.edx-components svg { flex-shrink: 0; vertical-align: middle; }
.edx-components a { color: var(--fx-green-text); }
body.dashboard-page .edx-components h2 { font-size: 16px; line-height: 1.4; color: var(--fx-ink); font-weight: 600; margin: 0; }
body.dashboard-page .edx-components h3 { font-size: 14px; line-height: 1.4; margin: 0; }
.edx-overview { padding-top: 20px; }
.edx-overview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.edx-contract-total { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
body.dashboard-page .edx-contract-total > strong { font-size: 32px; line-height: 1.2; color: var(--fx-ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.edx-caption { font-size: 11px; color: var(--fx-muted); }
.edx-overview-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.edx-segmented { display: inline-flex; align-items: center; padding: 2px; border: 1px solid var(--fx-rule); border-radius: 6px; background: var(--fx-surface-2); flex: none; }
.edx-segmented button { min-height: 30px; padding: 3px 10px; border: 0; background: transparent; border-radius: 4px; white-space: nowrap; font-size: 12px; }
.edx-segmented button[aria-pressed=true], .edx-segmented button[aria-selected=true] { background: var(--fx-surface); color: var(--fx-green-text); box-shadow: var(--fx-s1); }
.edx-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; min-width: 36px; padding: 0; border: 1px solid var(--fx-rule); border-radius: 6px; background: var(--fx-surface); text-decoration: none; }
.edx-icon-button:hover:not(:disabled), .edx-button:hover { background: var(--fx-mint); }
.edx-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 28px; }
body.dashboard-page .edx-metric { display: block; text-decoration: none; background: var(--fx-surface); border: 1px solid var(--fx-rule); border-radius: 8px; padding: 16px; color: var(--fx-ink-2); min-width: 0; }
.edx-metric:hover { border-color: var(--fx-rule-2); box-shadow: var(--fx-s1); }
.edx-metric-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.edx-metric-body { display: flex; align-items: center; justify-content: space-between; height: 66px; gap: 12px; }
body.dashboard-page .edx-metric-body strong { font-size: 28px; line-height: 1.2; font-weight: 500; color: var(--fx-ink); font-variant-numeric: tabular-nums; }
.edx-metric-body svg { width: 45%; height: 45px; }
.edx-metric-change { display: inline-flex; align-items: center; gap: 4px; color: var(--fx-muted); font-size: 11px; }
.edx-metric-change.positive { color: var(--fx-green-text); }
.edx-metric-change.negative { color: var(--fx-amber); }
.edx-band { min-width: 0; border: 0; border-top: 1px solid var(--fx-rule); padding: 22px 0; background: transparent; }
.edx-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.edx-section-head p { margin: 4px 0 0; color: var(--fx-muted); font-size: 12px; }
.edx-chart-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 28px; }
.edx-chart-grid .edx-band { padding-bottom: 22px; }
.edx-area-chart { height: 310px; width: 100%; min-width: 0; }
.edx-area-chart .edx-area-inner { width: 100%; height: 100%; min-height: 0; aspect-ratio: auto; color: var(--fx-muted); }
.edx-area-chart :is(text, tspan), .edx-flow :is(text, tspan) { font-family: var(--fx-sans); }
.edx-area-chart .recharts-cartesian-grid line { stroke: var(--fx-rule); }
.edx-area-chart .recharts-cartesian-axis-tick-value { fill: var(--fx-muted); font-size: 11px; }
.edx-area-chart [data-slot=chart] { height: 100%; }
.edx-area-inner > .group { overflow-x: clip; }
.edx-chart-table { height: 310px; overflow: auto; }
.edx-chart-tooltip { display: grid; gap: 4px; padding: 10px 12px; background: var(--fx-surface); border: 1px solid var(--fx-rule); border-radius: 6px; box-shadow: var(--fx-s2); font-size: 12px; }
.edx-donut { height: 226px; width: 100%; }
.edx-donut-value { fill: var(--fx-ink); font-size: 24px; font-weight: 500; }
.edx-donut-unit { fill: var(--fx-muted); font-size: 11px; }
.edx-chart-legend { padding: 0; margin: 0; list-style: none; }
.edx-chart-legend li + li { border-top: 1px solid var(--fx-rule-row); }
.edx-chart-legend button { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 6px 0; border: 0; background: transparent; text-align: left; font-size: 12px; }
.edx-chart-legend button:hover { color: var(--fx-green-text); }
.edx-chart-legend strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.edx-swatch { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.edx-skyline { --color-background: var(--fx-surface); --color-foreground: var(--fx-ink-2); --color-muted-foreground: var(--fx-muted); --color-border: var(--fx-rule); background: var(--fx-surface); padding: 20px 16px; border-bottom: 1px solid var(--fx-rule); }
.edx-skyline [style] { letter-spacing: 0 !important; }
.edx-skyline > div { background: var(--fx-surface); color: var(--fx-ink-2); }
.edx-skyline canvas { touch-action: pan-y; }
.edx-flow { width: 100%; overflow: visible; }
.edx-flow-chart { height: 260px; aspect-ratio: auto !important; width: 100%; }
.edx-flow-chart svg { width: 100%; height: 100%; }
.edx-flow .fill-foreground { fill: var(--fx-ink-2); }
.edx-flow [role=tooltip] { color: var(--fx-ink); background: var(--fx-surface); }
.edx-chart-details { margin-top: 12px; font-size: 12px; overflow-x: auto; }
.edx-chart-details .edx-data-table { min-width: 0; }
.edx-chart-details summary { min-height: 32px; padding: 6px 0; color: var(--fx-muted); }
.edx-chart-details table { margin-top: 10px; }
.edx-filterbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.edx-search { min-width: 190px; flex: 1 1 220px; max-width: 340px; display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 36px; background: var(--fx-surface); border: 1px solid var(--fx-rule); border-radius: 6px; }
.edx-search input { width: 100%; min-width: 0; background: transparent; border: 0; height: 100%; padding: 0; outline: none; }
.edx-search:focus-within { outline: 2px solid var(--fx-green); outline-offset: 2px; }
.edx-search input:focus-visible { outline: none; }
.edx-field { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.edx-field > span { color: var(--fx-muted); }
.edx-field select { min-height: 36px; max-width: 220px; padding: 5px 28px 5px 9px; border: 1px solid var(--fx-rule); border-radius: 6px; background: var(--fx-surface); }
.edx-count { margin-left: auto; color: var(--fx-muted); font-size: 12px; white-space: nowrap; }
.edx-columns { position: relative; }
.edx-columns summary { list-style: none; width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--fx-rule); border-radius: 6px; background: var(--fx-surface); }
.edx-columns summary::-webkit-details-marker { display: none; }
.edx-column-menu { position: absolute; top: 42px; right: 0; z-index: 15; width: 190px; padding: 8px; background: var(--fx-surface); border: 1px solid var(--fx-rule); border-radius: 6px; box-shadow: var(--fx-s2); }
.edx-column-menu label { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 4px; }
.edx-column-menu input { accent-color: var(--fx-green); }
.edx-table-scroll { width: 100%; overflow-x: auto; }
.edx-data-table { border-collapse: collapse; width: 100%; text-align: left; font-size: 12px; }
.edx-data-table th { color: var(--fx-muted); font-weight: 500; background: var(--fx-surface-2); }
.edx-data-table th, .edx-data-table td { padding: 12px; border: 0; border-bottom: 1px solid var(--fx-rule-row); vertical-align: middle; }
.edx-data-table th button { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: transparent; font-size: 11px; white-space: nowrap; min-height: 24px; }
.edx-data-table td { color: var(--fx-ink-2); }
.edx-data-table td:first-child { min-width: 190px; }
.edx-data-table time { white-space: nowrap; font-size: 11px; }
.edx-data-table tbody tr:hover { background: var(--fx-surface-2); }
.edx-record-link { display: inline-flex; align-items: center; gap: 5px; border: 0; padding: 0; min-height: 28px; background: transparent; color: var(--fx-green-text) !important; text-align: left; font-size: 12px; text-decoration: none; }
.edx-record-link:hover { text-decoration: underline; }
.edx-numeric { white-space: nowrap; font-family: var(--fx-mono); font-variant-numeric: tabular-nums; font-size: 11px; }
.edx-status { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border: 1px solid var(--fx-rule); border-radius: 4px; background: var(--fx-surface); color: var(--fx-muted); font-size: 10px; white-space: nowrap; text-transform: capitalize; }
.edx-status.is-success { background: var(--fx-mint); color: var(--fx-green-text); border-color: var(--fx-mint-2); }
.edx-status.is-error { color: var(--fx-red); }
.edx-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; font-size: 11px; color: var(--fx-muted); }
.edx-pagination > div { display: flex; align-items: center; gap: 10px; }
.edx-empty { min-height: 150px; padding: 24px; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; text-align: center; color: var(--fx-muted); }
.edx-button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 6px 12px; border: 1px solid var(--fx-rule); border-radius: 6px; background: var(--fx-surface); font-size: 12px; }
.edx-log-list { list-style: none; padding: 0; margin: 0; }
.edx-log-row { padding: 0; border-bottom: 1px solid var(--fx-rule-row); }
.edx-log-trigger { width: 100%; display: grid; grid-template-columns: 15px 150px minmax(150px, 1fr) 150px 100px; align-items: center; gap: 12px; min-height: 52px; text-align: left; padding: 9px 10px; border: 0; background: transparent; }
.edx-log-trigger:hover { background: var(--fx-surface-2); }
.edx-log-trigger > svg { transition: transform .2s; }
.edx-log-trigger > svg.is-expanded { transform: rotate(180deg); }
.edx-log-trigger time { font-family: var(--fx-mono); font-size: 10px; color: var(--fx-muted); }
.edx-log-trigger strong { font-size: 12px; color: var(--fx-ink-2); }
.edx-log-hash { font-family: var(--fx-mono); color: var(--fx-muted); font-size: 10px; }
.edx-log-trigger .edx-status { justify-self: end; }
.edx-log-detail { overflow: hidden; background: var(--fx-surface-2); }
.edx-log-detail > dl { margin: 0; padding: 18px 20px 10px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.edx-log-detail dl > div:first-child, .edx-log-detail dl > div:last-child { grid-column: 1 / -1; }
.edx-log-detail dt { color: var(--fx-muted); font-size: 11px; }
.edx-log-detail dd { margin: 4px 0 0; font-family: var(--fx-mono); font-size: 11px; overflow-wrap: anywhere; }
.edx-log-detail dd a { display: inline-flex; gap: 6px; align-items: center; }
.edx-log-detail > button { margin: 0 20px 16px; }
.edx-date {
  --control-height-md: 36px; --control-height-sm: 34px; --font-body: var(--fx-sans); --text-sm: 12px; --text-xs: 11px; --tracking-body: 0; --leading-body: 1.5;
  --surface-raised: var(--fx-surface); --surface-muted: var(--fx-surface-2); --text-secondary: var(--fx-ink-2); --text-muted: var(--fx-muted);
  --border-subtle: var(--fx-rule-row); --border-strong: var(--fx-rule-2); --accent-subtle: var(--fx-mint-2); --accent: var(--fx-green); --accent-strong: var(--fx-green-text); --accent-foreground: var(--fx-surface);
  --shadow-resting: var(--fx-s1); --shadow-floating: var(--fx-s3); --duration-fast: 150ms; --duration-considered: 240ms; --duration-instant: 100ms; --ease-standard: ease; --radius-pill: 6px; --radius-control: 6px;
}
.edx-date-root { max-width: 100%; }
body.dashboard-page dialog.edx-command-dialog { padding: 0; width: min(620px, calc(100vw - 24px)); max-height: min(600px, calc(100dvh - 40px)); border: 1px solid var(--fx-rule); border-radius: 8px; background: var(--fx-surface); box-shadow: var(--fx-s3); }
.edx-command { min-width: 0; }
.edx-command-input { display: flex; align-items: center; border-bottom: 1px solid var(--fx-rule); padding-right: 8px; }
.edx-command-input > [cmdk-input-wrapper] { flex: 1; min-width: 0; border: 0; }
.edx-command [cmdk-input] { min-width: 0; height: 52px; border: 0; padding: 10px 4px; box-shadow: none; outline: none; }
.edx-command [cmdk-list] { max-height: min(440px, calc(100dvh - 130px)); overflow: auto; padding: 6px; }
.edx-command [cmdk-group-heading] { padding: 9px 10px 5px; color: var(--fx-muted); font-size: 11px; }
.edx-command [cmdk-item] { padding: 10px; min-height: 44px; cursor: pointer; border-radius: 5px; }
.edx-command [cmdk-item][data-selected=true] { background: var(--fx-mint); color: var(--fx-green-text); }
.edx-command-result { display: grid; gap: 2px; min-width: 0; }
.edx-command-result strong { font-size: 13px; overflow-wrap: anywhere; }
.edx-command-result small { font-size: 11px; color: var(--fx-muted); overflow-wrap: anywhere; }
.edx-notifications .edx-filterbar { justify-content: space-between; }
.edx-notification-list { list-style: none; margin: 0; padding: 0; }
.edx-notification-list li { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--fx-rule-row); }
.edx-notification-icon { width: 36px; height: 36px; display: grid; place-items: center; flex: none; border: 1px solid var(--fx-mint-2); border-radius: 6px; background: var(--fx-mint); color: var(--fx-green-text); }
.edx-notification-body { flex: 1; min-width: 0; display: grid; gap: 6px; }
.edx-notification-title { display: flex; align-items: center; gap: 8px; }
.edx-notification-title button { flex: 1; display: inline-flex; align-items: center; gap: 6px; text-align: left; font-size: 13px; border: 0; background: transparent; padding: 0; color: var(--fx-ink); }
.edx-notification-body time { color: var(--fx-muted); font-size: 11px; }
.edx-notification-body .edx-status { justify-self: start; }
.edx-unread-dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--fx-green); }
.edx-notification-list .is-read .edx-notification-icon { background: var(--fx-surface-2); color: var(--fx-muted); border-color: var(--fx-rule); }
.edx-notification-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 18px; font-size: 12px; text-decoration: none; }
.edx-more { display: flex; width: 100%; margin-top: 12px; }
.edx-notification-next { padding-top: 22px; }
.edx-notification-next > div { display: flex; align-items: start; gap: 8px; padding: 10px 0; font-size: 12px; }
@media (max-width: 1279px) { .edx-chart-grid { grid-template-columns: minmax(0, 1.7fr) minmax(240px, 1fr); gap: 20px; } .edx-log-trigger { grid-template-columns: 15px 130px minmax(130px, 1fr) 100px; } .edx-log-hash { display: none; } .edx-metrics { gap: 12px; } .edx-metric { padding: 14px; } }
@media (max-width: 1100px) { .edx-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) {
  .edx-overview { padding-top: 16px; } .edx-overview-toolbar { gap: 14px; } .edx-overview-controls { width: 100%; gap: 6px; } .edx-contract-total > .edx-caption { font-size: 10px; }
  .edx-chart-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .edx-metrics { gap: 10px; margin-bottom: 20px; } body.dashboard-page .edx-metric { padding: 12px; } .edx-metric-head { font-size: 11px; } .edx-metric-body { height: 62px; gap: 6px; } body.dashboard-page .edx-metric-body strong { font-size: 25px; } .edx-metric-change { font-size: 10px; min-height: 30px; }
  .edx-section-head { align-items: flex-start; } .edx-section-head p { font-size: 11px; } .edx-area-chart, .edx-chart-table { height: 280px; }
  .edx-skyline { padding: 18px 8px; } .edx-flow-chart { height: 240px; }
  .edx-filterbar { gap: 8px; } .edx-search { flex-basis: 100%; max-width: none; } .edx-field select { max-width: 180px; } .edx-field > span { display: none; }
  .edx-log-trigger { grid-template-columns: 15px minmax(0, 1fr) auto; gap: 5px 9px; min-height: 70px; padding: 9px 0; } .edx-log-trigger > svg { grid-row: span 2; } .edx-log-trigger time { grid-column: 2; grid-row: 2; } .edx-log-trigger strong { grid-column: 2; grid-row: 1; font-size: 11px; } .edx-log-trigger .edx-status { grid-column: 3; grid-row: span 2; }
  .edx-data-table th, .edx-data-table td { padding: 10px; } .edx-data-table td:first-child { min-width: 180px; }
  .edx-log-detail > dl { padding: 14px 12px 8px; gap: 10px; } .edx-log-detail > button { margin-left: 12px; }
  .edx-icon-button, .edx-columns summary { width: 40px; height: 40px; min-width: 40px; } .edx-segmented button { min-height: 34px; padding: 3px 8px; }
  .edx-overview-controls > .edx-icon-button { width: 32px; min-width: 32px; }
}
@media (max-width: 380px) { .edx-overview-controls { align-items: start; } .edx-date { order: 3; } .edx-contract-total { gap: 6px; } .edx-metric-body svg { width: 36%; } }
@media (max-width: 1023px) {
  body.dashboard-page .edx-components :is(input,select), body.dashboard-page .edx-command [cmdk-input] { font-size: 16px !important; }
  .edx-icon-button, .edx-columns summary, .edx-overview-controls > .edx-icon-button { width: 44px; height: 44px; min-width: 44px; }
  .edx-segmented button, .edx-chart-legend button, .edx-button { min-height: 44px; }
  .edx-search, .edx-field select { min-height: 44px; }
  .edx-date { --control-height-md: 44px; --control-height-sm: 44px; }
}
@media (prefers-reduced-motion: reduce) { .edx-components *, .edx-components *::before, .edx-components *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
