/*
  ----------------------------------------
  Admin and organization layouts
  ----------------------------------------
*/

@layer styles {
    .admin {
        &.admin-shell {
            height: 100vh;
            overflow: hidden;
        }

        .admin-desktop-shell {
            height: 100%;
            min-height: 0;
            overflow: hidden;
        }

        .admin-workspace {
            min-height: 0;
            overflow: hidden;
        }

        .admin-header {
            flex: none;
        }

        .admin-body {
            min-height: 0;
            overflow: hidden;
        }

        .admin-sidebar {
            flex: none;
            min-height: 0;
            overflow-y: auto;
        }

        .admin-membership-site-table {
            --admin-membership-row-height: calc(var(--ui-field-height) + (var(--space-2xs) * 2));
            table-layout: fixed;
        }

        .admin-membership-site-table tr:not(.admin-membership-site-drawer-row) > td,
        .admin-membership-building-table td {
            height: var(--admin-membership-row-height);
            vertical-align: middle;
        }

        .admin-membership-site-col {
            width: 20%;
        }

        .admin-membership-building-col {
            width: 17%;
        }

        .admin-membership-access-col {
            width: 23%;
        }

        .admin-membership-meter-col {
            width: 13%;
        }

        .admin-membership-edge-col {
            width: 27%;
        }

        .admin-membership-site-row,
        .admin-membership-building-row {
            transition: background-color 120ms ease, color 120ms ease;
        }

        .admin-membership-site-toggle {
            min-height: var(--ui-field-height);
            border: 0;
            background: transparent;
            color: inherit;
            font: inherit;
        }

        .admin-membership-site-toggle svg {
            flex: none;
            transition: transform 120ms ease-in-out;
        }

        .admin-membership-site-toggle[aria-expanded="true"] svg {
            transform: rotate(90deg);
        }

        .admin-membership-site-drawer-row td {
            padding: 0;
            background: transparent;
        }

        .admin-membership-site-drawer {
            display: grid;
            grid-template-rows: 0fr;
            opacity: 0;
            transition:
                grid-template-rows 180ms ease-in-out,
                opacity 140ms ease-in-out;
        }

        .admin-membership-site-drawer-row.is-open .admin-membership-site-drawer {
            grid-template-rows: 1fr;
            opacity: 1;
        }

        .admin-membership-building-table {
            table-layout: fixed;
        }

        @media (prefers-reduced-motion: reduce) {
            .admin-membership-site-drawer,
            .admin-membership-site-toggle svg {
                transition: none;
            }
        }

        .operator-sidebar {
            --operator-slate: #325459;
            --operator-slate-700: #284347;
            --operator-slate-300: #6c8b8f;
            --operator-slate-100: #d8e2e3;
            --operator-slate-50: #ecf1f1;
            --operator-straw: #d1cb4f;
            --operator-ink: #1c2821;
            --operator-ink-2: #3a4641;
            --operator-ink-3: #6a7570;
            --operator-ink-4: #9aa39e;
            --operator-line: #e6e7e2;
            --operator-line-2: #d6d8d2;

            flex: none;
            width: 17.5rem;
            min-height: 0;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            border-right: var(--border) solid var(--operator-line);
            background: var(--white);
            color: var(--operator-ink);
        }

        .operator-sidebar-brand {
            display: flex;
            align-items: center;
            gap: var(--space-xs);
            padding: var(--space-sm) var(--space-sm) var(--space-xs);
            border-bottom: var(--border) solid var(--operator-line);
            min-width: 0;
        }

        .operator-sidebar-brand-mark {
            display: grid;
            width: var(--space-lg);
            height: var(--space-lg);
            flex: none;
            place-items: center;
            border-radius: var(--rounded);
            background: var(--brand-1);
            color: var(--highlight);
            font-family: var(--font-heading);
            font-size: var(--text-base);
            font-weight: var(--font-bold);
            letter-spacing: 0.04em;
            text-decoration: none;
        }

        .operator-sidebar-brand-text {
            min-width: 0;
            flex: 1;
        }

        .operator-sidebar-brand-name {
            overflow: hidden;
            color: var(--dark);
            font-family: var(--font-heading);
            font-size: var(--text-base);
            font-weight: var(--font-bold);
            letter-spacing: 0.08em;
            line-height: 1.3;
            text-overflow: ellipsis;
            text-transform: uppercase;
            white-space: nowrap;
        }

        .operator-sidebar-brand-sub {
            margin-top: var(--space-3xs);
            color: var(--midtone);
            font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
            font-size: var(--text-base);
            letter-spacing: 0.08em;
            text-transform: uppercase;
        }

        .operator-sidebar-company {
            padding: var(--space-sm) var(--space-sm) var(--space-xs);
            border-bottom: var(--border) solid var(--operator-line);
        }

        .operator-sidebar-company-label {
            margin-bottom: var(--space-3xs);
            color: var(--operator-ink-3);
            font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
            font-size: var(--text-sm);
            letter-spacing: 0.1em;
            text-transform: uppercase;
        }

        .operator-sidebar-company-name {
            color: var(--operator-ink);
            font-family: var(--font-heading);
            font-size: var(--text-base);
            font-weight: var(--font-bold);
            line-height: 1.25;
            text-decoration: none;

            &:hover,
            &.is-active {
                color: var(--operator-slate);
            }
        }

        .operator-sidebar-company-meta {
            display: flex;
            flex-wrap: wrap;
            gap: var(--space-2xs);
            margin-top: var(--space-3xs);
            color: var(--operator-ink-3);
            font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
            font-size: var(--text-sm);
        }

        .operator-sidebar-quick-links {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: var(--space-3xs) var(--space-2xs);
        }

        .operator-sidebar-quick-links a {
            display: flex;
            align-items: center;
            gap: var(--space-2xs);
            min-width: 0;
            padding: var(--space-3xs) var(--space-2xs);
            border-radius: var(--rounded);
            color: var(--operator-ink-3);
            font-size: var(--text-sm);
            text-decoration: none;

            &:hover,
            &.is-active {
                background: var(--operator-slate-50);
                color: var(--operator-slate);
            }

            span {
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }
        }

        .operator-sidebar-search {
            position: relative;
            display: block;
            padding: var(--space-xs) var(--space-sm) var(--space-2xs);
            color: var(--operator-ink-3);

            span {
                position: absolute;
                left: calc(var(--space-sm) + var(--space-3xs));
                top: 50%;
                transform: translateY(-34%);
                pointer-events: none;
            }

            input {
                width: 100%;
                min-width: 0;
                padding: var(--space-2xs) var(--space-xs) var(--space-2xs) calc(var(--space-sm) + var(--space-xs));
                border: var(--border) solid var(--operator-line);
                border-radius: var(--rounded-lg);
                outline: 0;
                background: #fafaf7;
                color: var(--operator-ink);
                font: inherit;
                font-size: var(--text-sm);

                &:focus {
                    border-color: var(--operator-slate);
                    background: var(--white);
                }
            }
        }

        .operator-sidebar-filters {
            display: flex;
            flex-wrap: wrap;
            gap: var(--space-2xs);
            padding: var(--space-3xs) var(--space-sm) var(--space-2xs);
        }

        .operator-sidebar-chip {
            padding: var(--space-3xs) var(--space-xs);
            border: var(--border) solid var(--operator-line-2);
            border-radius: 999px;
            background: var(--white);
            color: var(--operator-ink-2);
            cursor: default;
            font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
            font-size: var(--text-sm);
            letter-spacing: 0.06em;
            text-transform: uppercase;
        }

        .operator-sidebar-chip--active {
            border-color: var(--operator-slate);
            background: var(--operator-slate);
            color: var(--white);
        }

        .operator-sidebar-section-label {
            padding: 0 var(--space-sm);
            color: var(--operator-ink-3);
            font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
            font-size: var(--text-sm);
            letter-spacing: 0.1em;
            text-transform: uppercase;
        }

        .operator-sidebar-empty {
            margin: 0;
            padding: var(--space-sm);
            color: var(--operator-ink-3);
            font-size: var(--text-sm);
        }

        .operator-tree {
            display: flex;
            flex: 1;
            flex-direction: column;
            gap: 0;
            margin: 0;
            max-width: none;
            padding: var(--space-3xs) var(--space-xs) var(--space-sm);
            overflow: auto;
            list-style: none;
        }

        .operator-tree-item {
            max-width: none;
            padding-left: 0;
            font-size: inherit;
            user-select: none;
        }

        .operator-tree-item::before {
            content: none;
        }

        .operator-tree-children {
            display: flex;
            flex-direction: column;
            gap: 0;
            margin: 0 0 0 var(--space-xs);
            max-width: none;
            padding: 0 0 0 var(--space-3xs);
            border-left: var(--border) dashed var(--operator-line-2);
            list-style: none;

            &.is-collapsed {
                display: none;
            }
        }

        .operator-sidebar.is-searching .operator-tree-children {
            display: block;
        }

        .operator-tree-row {
            display: flex;
            align-items: center;
            gap: var(--space-3xs);
            min-width: 0;
            margin: 0;
        }

        .operator-tree-row--leaf {
            padding-left: var(--space-xs);
        }

        .operator-tree-row--load {
            padding-left: var(--space-xs);
        }

        .operator-tree-row.is-search-match .operator-tree-link {
            outline: var(--border) solid var(--operator-straw);
        }

        .operator-tree-toggle {
            display: inline-flex;
            width: var(--space-sm);
            flex: none;
            justify-content: center;
            border: 0;
            background: transparent;
            color: var(--operator-ink-3);
            cursor: pointer;
            padding: 0;

            &[aria-expanded="true"] svg {
                transform: rotate(90deg);
            }

            svg {
                transition: transform 150ms ease;
            }
        }

        .operator-tree-spacer {
            width: 0;
        }

        .operator-tree-link {
            position: relative;
            display: flex;
            align-items: center;
            gap: var(--space-2xs);
            width: 100%;
            min-width: 0;
            padding: var(--space-3xs) var(--space-xs);
            border-radius: var(--rounded);
            color: var(--operator-ink);
            font-size: var(--text-sm);
            line-height: 1.45;
            text-decoration: none;

            &:hover {
                background: var(--operator-slate-50);
            }

            &.is-active {
                background: var(--operator-slate-100);
                color: var(--operator-slate-700);
                font-weight: var(--font-semibold);
            }

            &.is-active::before {
                content: "";
                position: absolute;
                left: 0;
                top: var(--space-3xs);
                bottom: var(--space-3xs);
                width: var(--border-lg);
                border-radius: var(--rounded-sm);
                background: var(--operator-slate);
            }

        }

        /* Custom CSS: applied VEM filter feedback, distinct from the route
    .is-active state, with a soft accent plus a badge as a non-color cue. */
        .operator-tree-row.is-vem-filtered {
            border-radius: var(--rounded);
            background: var(--operator-slate-50);
            box-shadow: inset 0 0 0 var(--border) var(--operator-slate-100);
        }

        .operator-tree-row.is-vem-filtered .operator-tree-link {
            color: var(--operator-slate-700);
            font-weight: var(--font-semibold);
        }

        .operator-tree-filter-badge {
            background: var(--operator-slate);
            color: var(--white);
            line-height: 1.5;
        }

        .operator-load-channel-row.is-selected,
        .operator-load-channel-row:target {
            background: var(--highlight);
            outline: var(--border-lg) solid var(--warning);
            outline-offset: calc(-1 * var(--border-lg));
        }

        .operator-tree-icon {
            display: grid;
            width: var(--text-sm);
            height: var(--text-sm);
            flex: none;
            place-items: center;
            color: var(--operator-ink-3);
        }

        .operator-sidebar-quick-links svg,
        .operator-tree-toggle svg,
        .operator-tree-icon svg {
            width: var(--text-base);
            height: var(--text-base);
        }

        .operator-tree-label {
            flex: 1;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .operator-tree-meta {
            color: var(--operator-ink-3);
            font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
            font-size: var(--text-sm);
            white-space: nowrap;
        }

        .operator-tree-status-dot {
            width: var(--space-2xs);
            height: var(--space-2xs);
            flex: none;
            border-radius: 999px;
            background: var(--operator-ink-4);
        }

        .operator-tree-status-dot--online {
            background: var(--success);
        }

        .operator-tree-status-dot--stale {
            background: var(--warning);
        }

        .production-calendar {
            --production-calendar-active: var(--brand-1);
            --production-calendar-idle: var(--lighter);
            --production-calendar-border: var(--light);
            --production-calendar-source-color: var(--light);
            --production-calendar-source-bg: var(--white);
            --production-calendar-force-on: var(--brand-2);
            --production-calendar-force-on-bg: var(--brand-2-light);
            --production-calendar-force-off: var(--error);
            --production-calendar-force-off-bg: var(--error-light);
        }

        .production-calendar-hierarchy-row {
            position: relative;
            overflow: hidden;
            --production-calendar-source-color: var(--light);
            --production-calendar-source-bg: var(--white);
        }

        .production-calendar-hierarchy-row::before {
            content: "";
            position: absolute;
            top: var(--space-3xs);
            bottom: var(--space-3xs);
            left: 0;
            width: var(--border-lg);
            border-radius: 999px;
            background: var(--production-calendar-source-color);
        }

        .production-calendar-hierarchy-row--own {
            border-color: var(--production-calendar-source-color);
        }

        .production-calendar-hierarchy-row--inherited {
            border-color: var(--production-calendar-source-color);
            background: var(--production-calendar-source-bg);
        }

        .production-calendar-hierarchy-row--source-organization {
            --production-calendar-source-color: var(--brand-1);
            --production-calendar-source-bg: var(--brand-1-light);
        }

        .production-calendar-hierarchy-row--source-site {
            --production-calendar-source-color: var(--info);
            --production-calendar-source-bg: var(--info-light);
        }

        .production-calendar-hierarchy-row--source-plant {
            --production-calendar-source-color: var(--brand-2);
            --production-calendar-source-bg: var(--brand-2-light);
        }

        .production-calendar-hierarchy-row--source-asset {
            --production-calendar-source-color: var(--warning);
            --production-calendar-source-bg: var(--warning-light);
        }

        .production-calendar-hierarchy-row--selected {
            border-color: var(--brand-1);
            background: var(--brand-1-light);
            box-shadow: inset 0 0 0 var(--border) var(--brand-1);
        }

        .production-calendar-mono {
            font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
        }

        .production-calendar-legend-mark {
            width: 0.65rem;
            height: var(--border-lg);
            border-radius: 999px;
            background: var(--production-calendar-border);
        }

        .production-calendar-legend-mark--on {
            background: var(--production-calendar-active);
        }

        .production-calendar-legend-mark--force-on {
            background: var(--production-calendar-force-on);
        }

        .production-calendar-legend-mark--force-off {
            background: var(--production-calendar-force-off);
        }

        .production-calendar-weekly-grid {
            display: grid;
            grid-template-columns: 3rem repeat(24, minmax(2rem, 1fr));
            gap: var(--border-lg);
            min-width: 70rem;
            overflow-x: auto;
        }

        .production-calendar-hour-cell {
            height: 1.45rem;
            border: var(--border) solid var(--production-calendar-border);
            border-radius: var(--rounded-sm);
            appearance: none;
            background: var(--production-calendar-idle);
            touch-action: none;
        }

        .production-calendar-hour-cell.is-active {
            border-color: var(--production-calendar-active);
            background: var(--production-calendar-active);
        }

        .production-calendar-month-grid {
            display: grid;
            grid-template-columns: repeat(7, minmax(6.25rem, 1fr));
            max-width: 45rem;
        }

        .production-calendar-month-empty,
        .production-calendar-date-cell {
            min-height: 4.5rem;
            border: var(--border) solid var(--production-calendar-border);
            border-radius: var(--rounded);
            background: var(--white);
        }

        .production-calendar-date-cell.is-force-on {
            border-color: var(--production-calendar-force-on);
            background: var(--production-calendar-force-on-bg);
        }

        .production-calendar-date-cell.is-force-off {
            border-color: var(--production-calendar-force-off);
            background: var(--production-calendar-force-off-bg);
        }

        .production-calendar-date-status {
            min-height: 1rem;
        }

        .vem-demand-card {
            overflow: hidden;
            color: #1c2821;
        }

        .vem-demand-card__controls {
            display: flex;
            flex-wrap: wrap;
            align-items: flex-start;
            justify-content: flex-end;
            gap: var(--space-xs);
            padding: var(--space-xs) var(--space-sm) 0;
        }

        .vem-demand-card__range {
            display: flex;
            font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
            font-size: 0.6875rem;
            letter-spacing: 0.08em;
            text-transform: uppercase;
        }

        .vem-demand-card__custom-range {
            flex-basis: 100%;
            color: var(--midtone);
            font-size: var(--text-sm);
            text-align: right;
        }

        .vem-demand-card__custom-range-label {
            display: inline-block;
            font-weight: var(--font-semibold);
        }

        .vem-demand-card__custom-range .ui-filter-form {
            justify-content: flex-end;
            margin-top: var(--space-xs);
        }

        .vem-demand-card__custom-range .ui-filter-field {
            flex: 0 1 14rem;
            text-align: left;
        }

        .vem-demand-card__range-link {
            border: var(--border) solid #e6e7e2;
            border-right: 0;
            padding: var(--space-3xs) var(--space-xs);
            color: #4f5a55;
            text-decoration: none;
            line-height: 1;
        }

        .vem-demand-card__range-link:first-child {
            border-radius: 999px 0 0 999px;
        }

        .vem-demand-card__range-link:last-child {
            border-right: var(--border) solid #e6e7e2;
            border-radius: 0 999px 999px 0;
        }

        .vem-demand-card__range-link--active {
            border-color: #325459;
            background: #325459;
            color: #fff;
        }

        .vem-demand-card__header {
            display: flex;
            flex-wrap: wrap;
            align-items: flex-start;
            justify-content: space-between;
            gap: var(--space-sm);
            padding: var(--space-sm);
            border-bottom: var(--border) solid #e6e7e2;
        }

        .vem-demand-card__subtitle,
        .vem-demand-card__toggles {
            font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
            letter-spacing: 0.08em;
            text-transform: uppercase;
        }

        .vem-demand-card__toggles {
            display: flex;
            flex-wrap: wrap;
            justify-content: flex-end;
            gap: var(--space-2xs);
            font-size: 0.6875rem;
        }

        .vem-demand-card__toggle {
            display: inline-flex;
            align-items: center;
            border: var(--border) solid #e6e7e2;
            border-radius: 999px;
            padding: var(--space-3xs) var(--space-xs);
            color: #6a7570;
            line-height: 1;
        }

        .vem-demand-card__toggle::before {
            content: "";
            width: 0.45rem;
            height: 0.45rem;
            margin-right: var(--space-3xs);
            border-radius: 0.125rem;
            background: #aeb9b4;
        }

        .vem-demand-card__toggle--active {
            border-color: #6c8b8f;
            color: #284347;
        }

        .vem-demand-card__toggle--active::before {
            background: #325459;
        }

        .vem-demand-card__toggle--limit::before {
            background: #c8c34d;
        }

        /* Custom CSS: PQ controls take their own row and match the chart's unit colors. */
        .vem-demand-card__toggles--pq {
            flex-basis: 100%;
        }

        .vem-demand-card__toggle--pq:disabled {
            cursor: not-allowed;
            opacity: 0.55;
        }

        .vem-demand-card__toggle--pq-voltage::before {
            background: var(--brand-2);
        }

        .vem-demand-card__toggle--pq-power_factor::before {
            background: var(--brand-1);
        }

        .vem-demand-card__toggle--pq-thd::before {
            background: var(--brand-4);
        }

        .vem-demand-card__toggle--pq-current_unbalance::before {
            background: var(--brand-3);
        }

        .vem-demand-card__body {
            padding: var(--space-sm);
        }

        .vem-demand-card__summary {
            position: absolute;
            top: var(--space-sm);
            right: var(--space-sm);
            z-index: 1;
        }

        .vem-demand-card__coverage {
            margin: 0 0 var(--space-xs);
            border: var(--border) solid #e6e7e2;
            border-radius: var(--radius-sm);
            background: #f7f7f3;
            color: #6a7570;
            font-size: 0.8125rem;
            padding: var(--space-2xs) var(--space-xs);
        }

        .vem-demand-card__range-help {
            margin: 0 0 var(--space-xs);
            color: var(--midtone);
            font-size: var(--text-sm);
        }

        .vem-demand-card__navigator {
            margin-top: var(--space-xs);
            border-top: var(--border) solid #e6e7e2;
            padding-top: var(--space-xs);
        }

        .vem-demand-card--loading [data-demand-stack-chart-target="chart"],
        .vem-demand-card--loading .vem-demand-card__navigator {
            opacity: 0.5;
            pointer-events: none;
        }

        .vem-demand-card__navigator-header {
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            gap: var(--space-2xs);
            color: var(--midtone);
            font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
            font-size: 0.6875rem;
            letter-spacing: 0.04em;
            text-transform: uppercase;
        }

        .vem-demand-zoom-brush .overlay {
            cursor: crosshair;
        }

        .vem-demand-zoom-brush .selection {
            fill: var(--brand-1);
            fill-opacity: 0.12;
            stroke: var(--brand-1);
            stroke-dasharray: 4 3;
        }

        .vem-demand-zoom-brush .handle {
            display: none;
        }

        .vem-demand-brush .selection {
            fill: var(--brand-1);
            fill-opacity: 0.22;
            stroke: var(--brand-1);
        }

        .vem-demand-brush .handle {
            fill: var(--white);
            stroke: var(--brand-1);
            stroke-width: 2;
        }

        .vem-metric-panel {
            color: #1c2821;
        }

        .vem-metric-panel__eyebrow {
            margin: 0 0 var(--space-xs);
            color: #79837d;
            font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
            font-size: 0.6875rem;
            letter-spacing: 0.14em;
            text-transform: uppercase;
        }

        .vem-metric-grid {
            display: grid;
            grid-template-columns: repeat(1, minmax(0, 1fr));
            gap: var(--space-xs);
        }

        .vem-metric-card {
            min-width: 0;
            padding: var(--space-sm);
            border: var(--border) solid #e6e7e2;
            border-radius: var(--radius-sm);
            background: var(--white);
        }

        .vem-metric-card__label {
            margin: 0 0 var(--space-2xs);
            color: #79837d;
            font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
            font-size: 0.6875rem;
            letter-spacing: 0.1em;
            text-transform: uppercase;
        }

        .vem-metric-card__value {
            margin: 0;
            color: #1c2821;
            font-family: var(--font-heading);
            font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem);
            font-weight: var(--font-bold);
            line-height: 1;
        }

        .vem-metric-card__value span {
            margin-left: var(--space-3xs);
            color: #6a7570;
            font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
            font-size: 0.75rem;
            font-weight: var(--font-normal);
        }

        .vem-metric-card__detail {
            margin: var(--space-2xs) 0 0;
            color: #6a7570;
            font-size: var(--text-sm);
        }

        .vem-metric-card__bar {
            height: 0.1875rem;
            margin-top: var(--space-xs);
            border-radius: 999px;
            background: linear-gradient(90deg, #c48a12 0 65%, #e6e7e2 65% 100%);
        }

        .vem-goal-comparison {
            overflow: hidden;
            border: var(--border) solid var(--light);
            border-radius: var(--rounded-sm);
            background: var(--white);
        }

        .vem-goal-comparison__header {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: var(--space-xs);
            padding: var(--space-sm);
            border-bottom: var(--border) solid var(--light);
        }

        .vem-goal-comparison__rows {
            display: flex;
            flex-direction: column;
        }

        .vem-goal-comparison__row {
            padding: var(--space-sm);
            border-bottom: var(--border) solid var(--light);
        }

        .vem-goal-comparison__row:last-child {
            border-bottom: 0;
        }

        .vem-goal-comparison__values,
        .vem-goal-comparison__detail {
            display: flex;
            align-items: flex-end;
            justify-content: space-between;
            gap: var(--space-sm);
        }

        .vem-goal-comparison__value,
        .vem-goal-comparison__target {
            margin: 0;
            color: var(--dark);
            font-family: var(--font-heading);
            font-size: var(--text-2xl);
            line-height: 1;
        }

        .vem-goal-comparison__value span {
            margin-left: var(--space-3xs);
            color: var(--midtone);
            font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
            font-size: var(--text-sm);
        }

        .vem-goal-comparison__label,
        .vem-goal-comparison__detail {
            margin: var(--space-3xs) 0 0;
            color: var(--midtone);
            font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
            font-size: var(--text-sm);
            letter-spacing: 0.04em;
            text-transform: uppercase;
        }

        .vem-goal-comparison__track {
            height: var(--space-3xs);
            margin-top: var(--space-xs);
            overflow: hidden;
            border-radius: var(--rounded-full);
            background: var(--light);
        }

        .vem-goal-comparison__track span {
            display: block;
            height: 100%;
            border-radius: inherit;
            background: var(--midtone);
        }

        .vem-goal-comparison__row.is-met .vem-goal-comparison__track span {
            background: var(--success);
        }

        .vem-goal-comparison__row.is-missed .vem-goal-comparison__track span {
            background: var(--error);
        }

        @media (min-width: 48rem) {
            .vem-metric-grid {
                grid-template-columns: repeat(3, minmax(0, 1fr));
            }

            .vem-metric-grid--wide {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
        }

        @media (min-width: 80rem) {
            .vem-metric-grid {
                grid-template-columns: repeat(6, minmax(0, 1fr));
            }

            .vem-metric-grid--wide {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
        }

        .admin-main {
            min-height: 0;
            overflow-x: hidden;
            overflow-y: auto;
            background: var(--lighter);
        }

        .admin-content {
            /* Fill short pages, but keep the painted background growing on long pages. */
            flex: 1 0 auto;
            min-height: 100%;
        }

        .admin-content-full-bleed {
            display: flex;
            flex-direction: column;
            overflow: hidden;
            padding: 0;
            box-shadow: none;
        }

        /* Admin nav links (left menu) */
        .nav-link-admin {
            display: flex;
            width: 100%;
            align-items: center;
            gap: var(--space-2xs);
            text-decoration: none;
            color: var(--midtone);
            padding: var(--space-xs);
            border-radius: var(--rounded-sm);
            transition: color 300ms ease;

            &.active,
            &:hover,
            &:active {
                background: var(--darker);
                color: var(--white);
            }

            svg {
                width: var(--text-lg);
                height: var(--text-lg);
            }
        }

        .admin-sidebar--superadmin {
            --superadmin-sidebar-link: color-mix(in oklch, var(--sidebar), var(--white) 50%);
            --superadmin-sidebar-link-hover: color-mix(in oklch, var(--sidebar), var(--white) 78%);
            --superadmin-sidebar-active: color-mix(in oklch, var(--sidebar), var(--white) 9%);

            width: 16rem;
            padding: var(--space-xs) var(--space-2xs);
            gap: var(--space-2xs);
            border-right: var(--border) solid color-mix(in oklch, var(--sidebar), var(--white) 10%);
            background: var(--sidebar);
        }

        .admin-sidebar--superadmin .nav-link-admin {
            min-height: 2.375rem;
            min-width: 0;
            gap: var(--space-xs);
            padding: var(--space-2xs) var(--space-xs);
            border-radius: var(--rounded-lg);
            background: transparent;
            color: var(--superadmin-sidebar-link);
            font-size: var(--text-sm);
            line-height: 1.2;
            white-space: nowrap;
            transition: background-color 160ms ease, color 160ms ease;

            &:hover,
            &:active {
                background: var(--superadmin-sidebar-active);
                color: var(--superadmin-sidebar-link-hover);
            }

            &.active {
                background: var(--superadmin-sidebar-active);
                color: var(--white);
                font-weight: var(--font-semibold);
            }

            svg {
                width: var(--text-base);
                height: var(--text-base);
                flex: none;
            }

            span {
                min-width: 0;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }
        }

        .semantic-graph {
            display: flex;
            flex-direction: column;
            gap: var(--space-sm);
        }

        .semantic-graph-toolbar {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: var(--space-2xs);
        }

        .semantic-graph-legend-item {
            display: inline-flex;
            align-items: center;
            gap: var(--space-3xs);
            color: var(--midtone);
            font-size: var(--text-sm);
        }

        .semantic-graph-legend-dot {
            width: var(--space-xs);
            height: var(--space-xs);
            flex: none;
            border-radius: 999px;
            background: var(--midtone);
        }

        .semantic-graph-layout {
            display: grid;
            grid-template-columns: minmax(0, 1fr);
            gap: var(--space-sm);
        }

        .semantic-graph-canvas {
            min-height: 30rem;
            overflow: hidden;
            border: var(--border) solid var(--light);
            border-radius: var(--rounded-sm);
            background: var(--white);
        }

        .semantic-graph-svg {
            display: block;
            width: 100%;
            height: 100%;
            min-height: 30rem;
        }

        .semantic-graph-link {
            stroke: var(--light);
            stroke-width: 1.4;
        }

        .semantic-graph-node {
            cursor: grab;
            stroke: var(--white);
            stroke-width: 2;
        }

        .semantic-graph-node:active {
            cursor: grabbing;
        }

        .semantic-graph-node.is-selected {
            stroke: var(--black);
            stroke-width: 3;
        }

        .semantic-graph-node--organization,
        .semantic-graph-legend-dot--organization {
            fill: var(--brand-1);
            background: var(--brand-1);
        }

        .semantic-graph-node--site,
        .semantic-graph-legend-dot--site {
            fill: var(--info);
            background: var(--info);
        }

        .semantic-graph-node--plant,
        .semantic-graph-legend-dot--plant {
            fill: var(--brand-3);
            background: var(--brand-3);
        }

        .semantic-graph-node--meter,
        .semantic-graph-legend-dot--meter {
            fill: var(--warning);
            background: var(--warning);
        }

        .semantic-graph-node--channel,
        .semantic-graph-legend-dot--channel {
            fill: var(--brand-4);
            background: var(--brand-4);
        }

        .semantic-graph-node--asset,
        .semantic-graph-legend-dot--asset {
            fill: var(--dark);
            background: var(--dark);
        }

        .semantic-graph-node--point,
        .semantic-graph-legend-dot--point {
            fill: var(--error);
            background: var(--error);
        }

        .semantic-graph-node--timeseries,
        .semantic-graph-legend-dot--timeseries {
            fill: var(--success);
            background: var(--success);
        }

        .semantic-graph-label {
            fill: var(--dark);
            font-size: var(--text-sm);
            paint-order: stroke;
            pointer-events: none;
            stroke: var(--white);
            stroke-linejoin: round;
            stroke-width: var(--border-lg);
            text-anchor: middle;
        }

        .semantic-graph-detail {
            min-width: 0;
            padding: var(--space-sm);
            border: var(--border) solid var(--light);
            border-radius: var(--rounded-sm);
            background: var(--lighter);
        }

        .semantic-graph-detail code {
            display: block;
            margin-top: var(--space-xs);
            white-space: normal;
            word-break: break-word;
        }

        .semantic-graph-empty {
            margin: 0;
            color: var(--midtone);
        }

        .admin-monitoring-standards-table {
            width: 100%;
            min-width: 64rem;
            table-layout: fixed;
            white-space: normal;

            th,
            td {
                vertical-align: top;
            }

            th:nth-child(1) {
                width: 30%;
            }

            th:nth-child(2),
            th:nth-child(3),
            th:nth-child(4) {
                width: 16%;
            }

            th:nth-child(5) {
                width: 10%;
            }

            th:nth-child(6) {
                width: 8%;
            }

            th:nth-child(7) {
                width: 4%;
            }
        }

        .admin-threshold-pill {
            display: inline-flex;
            align-items: center;
            padding: var(--space-3xs) var(--space-2xs);
            border-radius: var(--rounded-sm);
            font-weight: var(--font-semibold);
            line-height: 1.25;
            white-space: nowrap;
        }

        .admin-threshold-pill--warning {
            background: var(--highlight);
            color: var(--darker);
        }

        .admin-threshold-pill--alarm {
            background: var(--error-light);
            color: var(--error);
        }

        .admin-threshold-pill--emergency {
            background: color-mix(in srgb, var(--error) 78%, var(--black));
            color: var(--white);
            padding-inline: var(--space-xs);
        }

        @media (min-width: 64rem) {
            .semantic-graph-layout {
                grid-template-columns: minmax(0, 1fr) minmax(15rem, 20rem);
            }
        }

        .goals-workspace-form {
            width: 100%;
            max-width: none;
        }

        .goals-percentage-fields {
            display: grid;
            grid-template-columns: minmax(0, 1fr);
            gap: var(--space-xs);
        }

        .goals-percentage-cadence {
            min-height: var(--ui-field-height);
        }

        .goals-demand-card {
            overflow: visible;
            border: var(--border) solid var(--light);
            border-radius: var(--rounded-sm);
            background: var(--white);
        }

        .goals-demand-card__header {
            position: relative;
            display: flex;
            flex-wrap: wrap;
            align-items: flex-start;
            justify-content: space-between;
            gap: var(--space-xs);
            padding: var(--space-sm);
            border-bottom: var(--border) solid var(--light);
        }

        .goals-demand-card__body {
            padding: var(--space-sm);
        }

        .goals-demand-copy {
            position: relative;
        }

        .goals-demand-copy summary {
            list-style: none;
            cursor: pointer;
        }

        .goals-demand-copy summary::-webkit-details-marker {
            display: none;
        }

        .goals-demand-copy__popover {
            position: absolute;
            z-index: 20;
            top: calc(100% + var(--space-3xs));
            right: 0;
            display: flex;
            width: 17rem;
            flex-direction: column;
            gap: var(--space-xs);
            padding: var(--space-sm);
            border: var(--border) solid var(--light);
            border-radius: var(--rounded-sm);
            background: var(--white);
            box-shadow: var(--shadow-lg);
        }

        .goals-demand-copy__row {
            display: flex;
            align-items: center;
            gap: var(--space-2xs);
            min-height: var(--ui-field-height);
            border-bottom: var(--border) solid var(--light);
            cursor: pointer;
        }

        .goals-demand-copy__row input {
            accent-color: var(--brand-1);
        }

        .goals-demand-copy__row.hidden {
            display: none;
        }

        .goals-demand-tabs {
            display: flex;
            flex-wrap: wrap;
            gap: var(--space-3xs);
            margin-bottom: var(--space-xs);
        }

        .operator-analytics-eo-elements-body {
            display: grid;
            align-items: center;
            gap: var(--space-sm);
        }

        .operator-analytics-span-all {
            grid-column: 1 / -1;
        }

        .operator-analytics-eo-elements-visual {
            width: min(100%, 18rem);
            margin: 0 auto;
        }

        .operator-analytics-eo-elements-svg {
            display: block;
            width: 100%;
            height: auto;
        }

        .operator-analytics-eo-elements-list {
            min-width: 0;
        }

        .operator-analytics-eo-element-row {
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto auto;
            align-items: center;
            gap: var(--space-xs);
            padding: var(--space-xs) 0;
            border-bottom: var(--border) dashed var(--light);
        }

        .operator-analytics-eo-element-row:last-child {
            border-bottom: 0;
        }

        .operator-analytics-eo-element-name {
            display: flex;
            min-width: 0;
            align-items: center;
            gap: var(--space-xs);
        }

        .operator-analytics-eo-element-value,
        .operator-analytics-eo-element-percent {
            color: var(--dark);
            font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
            font-size: var(--text-sm);
            white-space: nowrap;
        }

        .operator-analytics-eo-element-percent {
            min-width: 3.5rem;
            color: var(--midtone);
            text-align: right;
        }

        @media (min-width: 48rem) {
            .operator-analytics-eo-elements-body {
                grid-template-columns: minmax(14rem, 0.8fr) minmax(0, 1.2fr);
            }
        }

        .operator-analytics-alarm-severity-body {
            display: grid;
            align-items: center;
            gap: var(--space-sm);
        }

        .operator-analytics-alarm-severity-visual {
            width: min(100%, 14rem);
            margin: 0 auto;
        }

        .operator-analytics-alarm-severity-svg {
            display: block;
            width: 100%;
            height: auto;
        }

        .operator-analytics-alarm-severity-list {
            min-width: 0;
        }

        .operator-analytics-alarm-severity-row {
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto auto;
            align-items: center;
            gap: var(--space-xs);
            padding: var(--space-xs) 0;
            border-bottom: var(--border) dashed var(--light);
        }

        .operator-analytics-alarm-severity-row:last-child {
            border-bottom: 0;
        }

        .operator-analytics-alarm-severity-name {
            display: flex;
            min-width: 0;
            align-items: center;
            gap: var(--space-xs);
        }

        .operator-analytics-alarm-severity-count,
        .operator-analytics-alarm-severity-percent {
            color: var(--dark);
            font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
            font-size: var(--text-sm);
            white-space: nowrap;
        }

        .operator-analytics-alarm-severity-percent {
            min-width: 3.5rem;
            color: var(--midtone);
            text-align: right;
        }

        @media (min-width: 48rem) {
            .operator-analytics-alarm-severity-body {
                grid-template-columns: minmax(10rem, 0.8fr) minmax(0, 1.2fr);
            }
        }

        .goals-demand-tab {
            display: inline-flex;
            min-height: var(--ui-field-height);
            align-items: center;
            gap: var(--space-3xs);
            padding: 0 var(--space-xs);
            border: var(--border) solid var(--light);
            border-radius: var(--rounded-sm);
            background: var(--white);
            color: var(--dark);
            font: inherit;
            cursor: pointer;
        }

        .goals-demand-tab.is-active {
            border-color: var(--brand-1);
            background: var(--brand-1);
            color: var(--white);
        }

        .goals-demand-tab__match {
            color: currentColor;
            font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
            opacity: 0.7;
        }

        .goals-demand-chart {
            width: 100%;
            min-height: 13.125rem;
        }

        .goals-demand-chart__svg {
            display: block;
            width: 100%;
            height: auto;
            min-height: 13.125rem;
        }

        .goals-demand-chart__grid .domain {
            display: none;
        }

        .goals-demand-chart__grid line {
            stroke: var(--light);
            stroke-dasharray: 2 4;
        }

        .goals-demand-chart__axis path,
        .goals-demand-chart__axis line {
            stroke: var(--light);
        }

        .goals-demand-chart__axis text {
            fill: var(--midtone);
            font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
            font-size: var(--text-sm);
        }

        .goals-demand-chart__area {
            fill: var(--brand-1);
            opacity: 0.08;
        }

        .goals-demand-chart__line {
            fill: none;
            stroke: var(--brand-1);
            stroke-linejoin: round;
            stroke-width: 2;
        }

        .goals-demand-chart__point {
            fill: var(--white);
            stroke: var(--brand-1);
            stroke-width: 1.5;
            pointer-events: none;
        }

        .goals-demand-chart__overlay {
            fill: transparent;
            cursor: ns-resize;
            touch-action: none;
        }

        .goals-demand-hours {
            display: grid;
            grid-template-columns: repeat(24, minmax(3.25rem, 1fr));
            gap: var(--space-3xs);
            overflow-x: auto;
            padding-bottom: var(--space-2xs);
        }

        .goals-demand-hours.hidden {
            display: none;
        }

        .goals-demand-hour {
            display: flex;
            min-width: 0;
            flex-direction: column;
            align-items: center;
            gap: var(--space-3xs);
            color: var(--midtone);
            font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
            font-size: var(--text-sm);
        }

        .goals-demand-hour input {
            width: 100%;
            min-width: 0;
            height: var(--ui-field-height);
            padding: 0 var(--space-3xs);
            border: var(--ui-field-border);
            border-radius: var(--ui-field-border-radius);
            background: var(--ui-field-bg);
            color: var(--ui-field-value-color);
            font: inherit;
            text-align: center;
        }

        .goals-demand-hour input:focus {
            border-color: var(--ui-field-focus-color);
            outline: var(--ui-field-focus-outline) var(--ui-field-focus-color);
            outline-offset: 0;
        }

        .goals-demand-hour input:disabled {
            color: var(--midtone);
            cursor: not-allowed;
        }

        @media (min-width: 48rem) {
            .goals-percentage-fields {
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
        }

        .system-monitor-page {
            display: flex;
            flex: 1;
            flex-direction: column;
            min-height: 0;
        }

        .system-monitor-panel {
            display: flex;
            flex: 1;
            flex-direction: column;
            min-height: 0;
            overflow: hidden;
            background: var(--white);
        }

        .system-monitor-toolbar {
            flex: none;
        }

        .system-monitor-frame {
            flex: 1;
            display: block;
            width: 100%;
            height: 100%;
            min-height: 0;
            border: 0;
            background: var(--white);
        }
    }

    /* Organization shell
  ---------------------------------- */
    /* Custom CSS: Prewind has no min-height utility for the two fixed header
       row heights. All other header layout uses Prewind utilities. */
    .organization-shell {
        .organization-header__primary {
            min-height: 3rem;
        }

        .organization-header__secondary {
            min-height: 3rem;
        }

        /* Custom CSS: the header reuses the sidebar brand partial; the sidebar's
           stacked padding and divider do not fit the primary row. */
        .organization-header__brand .operator-sidebar-brand {
            padding: 0;
            border-bottom: 0;
        }

        /* Custom CSS: match the existing sidebar width, which has no Prewind
           utility. Positioning, stacking and surfaces use utilities. */
        .admin-hierarchy-panel {
            width: 17.5rem;
        }

        /* Custom CSS: Prewind has no items-baseline alignment utility; the
           scope name and site summary share a text baseline. */
        .organization-header__scope-value {
            align-items: baseline;
        }

        /* Custom CSS: the requested light-grey header outline sits between
           Prewind's border-light and border-midtone tokens; no utility provides it. */
        .organization-header__outlined-button {
            border-color: color-mix(in srgb, var(--midtone) 35%, var(--light));
        }

        /* Custom CSS: preview badges overlap the button corner and need a
           circular count size, which Prewind offsets and sizing cannot express. */
        .organization-header__preview-badge {
            position: absolute;
            top: 0;
            right: 0;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: calc(var(--text-base) + var(--space-2xs));
            height: calc(var(--text-base) + var(--space-2xs));
            padding: 0;
            border: 0;
            background: var(--error);
            color: var(--white);
            font-size: var(--text-sm);
            font-weight: var(--font-semibold);
            line-height: 1;
            transform: translate(50%, -50%);
        }

        /* Custom CSS: Space Mono and its 0.08em tracking are not Prewind utilities. */
        .organization-meta {
            font-family: var(--font-mono);
            letter-spacing: 0.08em;
        }

        /* Custom CSS: the account menu needs a wider minimum than the dropdown
           default and stays inside the viewport on narrow desktop widths. */
        .organization-account__menu {
            min-width: 14rem;
            max-width: calc(100vw - var(--space-lg));
        }
    }

    /* Home briefing
  ---------------------------------- */
    /* Custom CSS: the briefing hero needs a pale tint mixed from the theme
       highlight; Prewind has no tinted background utility. The thin highlight
       border comes from the border-highlight utility at the call site. */
    .energy-briefing-home .energy-briefing-primary {
        background: color-mix(in srgb, var(--highlight) 10%, var(--lighter));
    }

    /* Custom CSS: Prewind has no proportional flex-basis utilities. Match its
       desktop breakpoint for the Home cards' 60/40 split. */
    @media (min-width: 1024px) {
        .energy-briefing-home {
            .energy-briefing-primary {
                flex: 3 1 0%;
            }

            .energy-briefing-actions {
                flex: 2 1 0%;
            }
        }
    }

    /* Organization settings
  ---------------------------------- */
    /* Custom CSS: Prewind has no fixed-width sidebar utility; 14rem fits the section labels. */
    @media (min-width: 1024px) {
        .organization-settings__navigation {
            flex: 0 0 14rem;
        }
    }

    /* Custom CSS: the horizontal settings variant must not inherit the desktop
       sidebar's fixed flex basis, which would force a tall row in a column layout. */
    .organization-settings__navigation--horizontal {
        flex: none;
    }

    /* Custom CSS: the seven monitoring columns need bounded reading widths;
       Prewind has no table column or min-width utility. */
    .organization-settings-monitoring-table {
        width: 100%;
        min-width: 68rem;
        table-layout: fixed;
        white-space: normal;

        th,
        td {
            vertical-align: top;
        }

        th:nth-child(1) {
            width: 16%;
        }

        th:nth-child(2) {
            width: 18%;
        }

        th:nth-child(3) {
            width: 15%;
        }

        th:nth-child(4) {
            width: 12%;
        }

        th:nth-child(5) {
            width: 16%;
        }

        th:nth-child(6) {
            width: 11%;
        }

        th:nth-child(7) {
            width: 12%;
        }
    }

    /* Custom CSS: the shared pagination helper fixes small text; this page uses standard UI text. */
    .organization-settings-monitoring-pagination nav {
        font-size: var(--text-base);
    }

    /* Custom CSS: Prewind cannot size icon tiles from the theme spacing scale. */
    .organization-settings__icon {
        width: calc(var(--space-sm) * 2);
        height: calc(var(--space-sm) * 2);
    }

    /* Custom CSS: explicit user request for policy-only 15px body text and compact header scale. */
    .policy-visual-shell {
        --text-base: 15px;
        --text-sm: 13px;
        --space-sm: 16px;
        --space-md: 27px;
        --ui-field-font-size: 15px;
    }

    .policy-visual-shell .organization-header {
        --text-base: 13px;
        --space-sm: 12px;
        --space-xs: 8px;
    }

    .policy-visual-shell .organization-header__primary,
    .policy-visual-shell .organization-header__secondary {
        min-height: 4rem;
    }

    .policy-visual-shell .operator-sidebar-brand-mark {
        width: 2rem;
        height: 2rem;
        font-size: 13px;
    }

    .policy-visual-shell .operator-sidebar-brand-name,
    .policy-visual-shell .operator-sidebar-brand-sub,
    .policy-visual-shell .organization-header {
        font-size: 13px;
    }

    .policy-visual-shell .organization-header .ui-button,
    .policy-visual-shell .organization-header__modules a {
        min-height: 2rem;
        font-size: 13px;
    }

    .policy-visual-shell .policy-stepper__step {
        font-size: 13px;
    }

    /* Monitoring policy wizard and list
  ---------------------------------- */
    /* Custom CSS: the generic settings form rule is form:has(.ui-field); this stronger scoped selector keeps the wizard full width. */
    form.policy-wizard-form:has(.ui-field) {
        max-width: none;
    }

    /* Custom CSS: the user requested the native 30px/500 policy title; no existing token matches this exact scale. */
    .policy-wizard-title {
        font-size: 30px;
        font-weight: 500;
        line-height: 38px;
    }

    /* Custom CSS: policy card titles follow the native 28px/500 reference scale. */
    .policy-card-title {
        font-size: 28px;
        font-weight: 500;
        line-height: 34px;
    }

    /* Custom CSS: the threshold subtitle follows the native 24px/500 reference scale. */
    .policy-threshold-title {
        font-size: 24px;
        font-weight: 500;
        line-height: 30px;
    }

    /* Custom CSS: example and preview titles follow the native 20px/500 reference scale. */
    .policy-example-title {
        font-size: 20px;
        font-weight: 500;
        line-height: 28px;
    }

    /* Custom CSS: the list heading follows the native 30px/500 reference scale. */
    .policy-list-title {
        font-size: 30px;
        font-weight: 500;
        line-height: 38px;
    }

    .policy-wizard-content {
        position: relative;
    }

    /* Custom CSS: the compact draft/preview meta sits at the heading right without adding a tall status bar. */
    .policy-wizard-meta {
        position: absolute;
        top: 0;
        right: 0;
        z-index: 1;
    }

    @media (max-width: 48rem) {
        .policy-wizard-meta {
            position: static;
            margin-top: var(--space-sm);
        }
    }

    /* Custom CSS: raw wizard inputs need the same 40px field chrome as the shared form helper. */
    .policy-wizard-input {
        height: 2.5rem;
        border: 1px solid #b8b7b7;
        border-radius: 6px;
        background: var(--white);
        padding: 0 var(--space-xs);
        font-size: var(--text-base);
    }

    /* Custom CSS: the shared form helper sets a 4px control radius; identity fields stay 6px. */
    .policy-identity-field {
        --ui-field-border-radius: 6px;
        --ui-field-border: 1px solid #b8b7b7;
    }

    /* Custom CSS: Figma cards use 24px/40px content insets, #b8b7b7 borders and 6px corners. */
    .policy-card {
        min-width: 0;
        border: 1px solid #b8b7b7;
        border-radius: 6px;
        background: var(--white);
        padding: 24px 40px;
    }

    /* Custom CSS: native reference steps occupy 208px slots inside the 51px strip. */
    .policy-stepper {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start;
        gap: 0;
        width: 100%;
        min-height: 51px;
        border: 1px solid #b8b7b7;
        border-radius: 6px;
        background: var(--white);
        padding: 10px 20px;
    }

    .policy-stepper__step {
        flex: 0 1 208px;
        min-width: 0;
    }

    .policy-stepper__number {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 1.5rem;
        height: 1.5rem;
        border: 1px solid var(--light);
        border-radius: 999px;
        background: var(--white);
        color: var(--midtone);
        font-family: var(--font-mono);
        font-size: var(--text-sm);
    }

    .policy-stepper__number.is-active {
        border-color: var(--brand-1);
        background: var(--brand-1);
        color: var(--white);
    }

    .policy-stepper__number.is-complete {
        border-color: var(--brand-1-light);
        background: var(--brand-1-light);
        color: var(--brand-1);
    }

    .policy-field-row {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: var(--space-sm) 104px;
    }

    /* Custom CSS: the reference places the second identity row 32px below the first. */
    .policy-identity-facts {
        margin-top: 32px;
    }

    /* Custom CSS: the reference uses paired 380px fields with a 104px column gap. */
    .policy-field-row > .policy-identity-field,
    .policy-field-row > .policy-readonly-fact {
        flex: 0 1 380px;
        min-width: 0;
        max-width: 100%;
    }

    /* Custom CSS: catalog facts are labels outside the 40px field chrome, matching the reference. */
    .policy-readonly-fact {
        min-width: 0;
    }

    .policy-readonly-value {
        display: flex;
        align-items: center;
        min-height: 40px;
        width: 380px;
        max-width: 100%;
        border: 1px solid #b8b7b7;
        border-radius: 6px;
        background: var(--white);
        padding: 0 var(--space-xs);
    }

    /* Custom CSS: scoped native channel controls share the same 40px field chrome. */
    .policy-channel__body :is(select, input[type="url"], input[type="time"], textarea) {
        display: block;
        width: 380px;
        max-width: 100%;
        min-height: 40px;
        border: 1px solid #b8b7b7;
        border-radius: 6px;
        background: var(--white);
        padding: var(--space-2xs) var(--space-xs);
        font-size: var(--text-base);
    }

    .policy-channel__body input[type="time"] {
        width: 150px;
    }

    /* Custom CSS: quiet-hours time fields sit outside policy-channel__body but keep the 150x40 chrome. */
    .policy-quiet-time {
        display: block;
        width: 150px;
        max-width: 100%;
        height: 40px;
        border: 1px solid #b8b7b7;
        border-radius: 6px;
        background: var(--white);
        padding: 0 var(--space-2xs);
        font-size: var(--text-base);
    }

    .policy-duration-band {
        min-height: 6.875rem;
        border: 1px solid var(--light);
        border-radius: 6px;
        background: var(--lighter);
        padding: 20px 54px 20px 40px;
    }


    .policy-separator {
        margin: var(--space-sm) 0 0;
        border: 0;
        border-top: 1px solid var(--light);
    }

    /* Custom CSS: the compact schedule summary behaves like a 380x40 field but expands the existing editor. */
    .policy-schedule__field {
        display: flex;
        align-items: center;
        width: 380px;
        max-width: 100%;
        height: 2.5rem;
        border: 1px solid #b8b7b7;
        border-radius: 6px;
        background: var(--white);
        padding: 0 var(--space-xs);
        cursor: pointer;
        list-style: none;
    }

    .policy-schedule__field::-webkit-details-marker {
        display: none;
    }

    /* Custom CSS: the timezone select shares the 380x40 field size without summary flex/list chrome. */
    .policy-schedule-select {
        display: block;
        width: 380px;
        max-width: 100%;
        height: 40px;
        border: 1px solid #b8b7b7;
        border-radius: 6px;
        background: var(--white);
        padding: 0 var(--space-xs);
        font-size: var(--text-base);
    }

    /* Custom CSS: the threshold table keeps horizontal scroll without triggering generic table borders. */
    .policy-threshold-scroll {
        overflow-x: auto;
        border: 0;
        min-width: 0;
    }

    /* Custom CSS: the threshold table needs a header surface, 6px card radius and compact paired fields. */
    .policy-threshold-table {
        width: 100%;
        min-width: 36rem;
        table-layout: fixed;
        border: 1px solid #b8b7b7;
        border-radius: 6px;
        border-collapse: separate;
        border-spacing: 0;
        overflow: hidden;
    }

    .policy-threshold-table th:nth-child(1) {
        width: 43%;
    }

    .policy-threshold-table th:nth-child(2) {
        width: 29%;
    }

    .policy-threshold-table th:nth-child(3) {
        width: 28%;
    }

    .policy-threshold-table th,
    .policy-threshold-table td {
        border-bottom: 1px solid var(--light);
        padding: var(--space-2xs) var(--space-xs);
        text-align: left;
        vertical-align: middle;
    }

    /* Custom CSS: threshold body cells inherit a small generic table size; keep standard UI text. */
    .policy-threshold-table td {
        font-size: var(--text-base);
    }

    .policy-threshold-table thead th {
        height: 51px;
        background: #f1f1f1;
        color: var(--midtone);
        font-family: var(--font-mono);
        font-size: var(--text-base);
        font-weight: var(--font-normal);
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    .policy-threshold-table tbody tr {
        height: 60px;
    }

    .policy-threshold-table tbody tr:last-child td {
        border-bottom: 0;
    }

    .policy-threshold-table .policy-threshold-input {
        width: 5rem;
        height: 2.5rem;
        border: 1px solid #b8b7b7;
        border-radius: 6px;
        background: var(--white);
        padding: 0 var(--space-2xs);
        font-size: var(--text-base);
    }

    .policy-severity-dot {
        display: inline-block;
        width: 0.75rem;
        height: 0.75rem;
        margin-right: var(--space-2xs);
        border-radius: 999px;
        background: var(--midtone);
    }

    .policy-severity-dot--warning {
        background: var(--organization-accent);
    }

    .policy-severity-dot--alarm {
        background: var(--organization-warning);
    }

    .policy-severity-dot--emergency {
        background: var(--organization-critical);
    }

    .policy-reset-link,
    .policy-reset-all {
        border: 0;
        background: transparent;
        color: var(--brand-1);
        font-size: var(--text-base);
        text-decoration: underline;
        cursor: pointer;
        padding: 0;
    }

    .policy-reset-all {
        display: inline-block;
    }

    /* Custom CSS: the inheritance and preservation callouts use a pale straw surface from the design tokens. */
    .policy-callout {
        border: 1px solid color-mix(in srgb, var(--organization-accent) 45%, var(--white));
        border-radius: 6px;
        background: color-mix(in srgb, var(--organization-accent) 14%, var(--white));
        padding: var(--space-sm);
    }

    /* Custom CSS: impact tiles need the Figma card chrome; utilities cannot express the 6px radius. */
    .policy-impact-tile {
        min-width: 0;
        border: 1px solid #b8b7b7;
        border-radius: 6px;
        background: #f5f5f5;
        padding: var(--space-sm);
    }

    /* Custom CSS: hierarchy rows use the taller reference rhythm and blue-gray selected surface. */
    .policy-scope-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-xs);
        min-width: 0;
        min-height: 6.5rem;
        border-radius: 4px;
        padding: var(--space-sm) var(--space-xs);
    }

    .policy-scope-row.is-selected {
        background: var(--brand-1-light);
    }

    /* Custom CSS: explicit flex rows must still honor the search filter's hidden state. */
    .policy-scope-option[hidden],
    .policy-scope-group[hidden] {
        display: none;
    }

    .policy-scope-search {
        height: 2.5rem;
        border: 1px solid #b8b7b7;
        border-radius: 6px;
        background: var(--white);
        padding: 0 var(--space-xs);
        font-size: var(--text-base);
    }

    .policy-scope-badge {
        display: inline-flex;
        align-items: center;
        flex: none;
        border: 1px solid var(--light);
        border-radius: 999px;
        background: var(--white);
        color: var(--midtone);
        font-size: var(--text-sm);
        font-family: var(--font-mono);
        text-transform: uppercase;
        font-weight: 500;
        line-height: 1.4;
        padding: var(--space-3xs) var(--space-xs);
        white-space: nowrap;
    }

    /* Custom CSS: concise shared-input note uses the blue-gray information surface, not a yellow banner. */
    .policy-info-note {
        border: 1px solid color-mix(in srgb, var(--brand-1) 24%, var(--white));
        border-radius: 6px;
        background: var(--brand-1-light);
        color: var(--dark);
        padding: var(--space-xs) var(--space-sm);
        font-size: var(--text-base);
    }

    .policy-scope-summary {
        cursor: pointer;
        list-style: none;
    }

    .policy-scope-summary::-webkit-details-marker {
        display: none;
    }

    .policy-scope-children {
        margin-left: var(--space-md);
        padding-top: var(--space-2xs);
    }

    .policy-scope-icon {
        display: inline-flex;
        flex: none;
        color: var(--midtone);
    }

    /* Custom CSS: no shared switch component exists; this is the policy channel toggle. */
    .policy-switch {
        position: relative;
        display: inline-flex;
        align-items: center;
        flex: none;
        cursor: pointer;
    }

    .policy-switch input {
        position: absolute;
        opacity: 0;
        width: 1px;
        height: 1px;
    }

    .policy-switch__track {
        position: relative;
        display: inline-block;
        width: 2.5rem;
        height: 1.25rem;
        border-radius: 999px;
        background: var(--light);
        transition: background 150ms ease;
    }

    .policy-switch__track::after {
        content: "";
        position: absolute;
        top: 0.125rem;
        left: 0.125rem;
        width: 1rem;
        height: 1rem;
        border-radius: 999px;
        background: var(--white);
        transition: transform 150ms ease;
    }

    .policy-switch input:focus-visible + .policy-switch__track {
        outline: 2px solid var(--brand-1);
        outline-offset: 2px;
    }

    .policy-switch input:checked + .policy-switch__track {
        background: var(--brand-1);
    }

    .policy-switch input:checked + .policy-switch__track::after {
        transform: translateX(1.25rem);
    }

    /* Custom CSS: channel headers use a pale-gray full row with an outlined expanded body. */
    .policy-channel {
        overflow: hidden;
        border: 1px solid var(--light);
        border-radius: 6px;
        background: var(--white);
    }

    .policy-channel__header {
        background: var(--lighter);
        padding: var(--space-sm);
    }

    .policy-channel__body {
        border-top: 1px solid var(--light);
        padding: var(--space-sm);
    }

    .policy-channel__summary {
        list-style: none;
    }

    .policy-channel__summary::-webkit-details-marker {
        display: none;
    }

    /* Custom CSS: critical held behavior uses the pale-red reference panel; no bypass control is added. */
    .policy-critical-note {
        border: 1px solid color-mix(in srgb, var(--error) 35%, var(--white));
        border-radius: 6px;
        background: var(--error-light);
        padding: var(--space-sm);
    }

    .policy-summary-row + .policy-summary-row {
        border-top: 1px solid var(--light);
        padding-top: var(--space-sm);
    }

    .policy-summary-row {
        padding-bottom: var(--space-sm);
    }

    /* Custom CSS: review major sections stack full width; each section owns a three-fact column grid. */
    .policy-review-sections {
        display: flex;
        flex-direction: column;
        gap: var(--space-md);
    }

    .policy-review-section {
        min-width: 0;
        border-top: 1px solid var(--light);
        padding-top: var(--space-sm);
    }

    .policy-fact-grid {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--space-md);
    }

    @media (max-width: 64rem) {
        .policy-fact-grid {
            grid-template-columns: 1fr;
        }
    }

    /* Custom CSS: the full-width tab strip keeps compact left-aligned links, matching the reference. */
    .policy-tabs {
        display: flex;
        justify-content: flex-start;
        width: 100%;
        overflow-x: auto;
        border: 1px solid var(--light);
        border-radius: 6px;
        background: var(--lighter);
    }

    .policy-tabs__link {
        flex: none;
        padding: var(--space-2xs) var(--space-sm);
        text-align: left;
        white-space: nowrap;
    }

    /* Custom CSS: list channel badges use the pale brand surface and normal text from the reference. */
    .policy-delivery-badge {
        display: inline-flex;
        align-items: center;
        border-radius: 6px;
        background: var(--brand-1-light);
        color: var(--brand-1);
        font-size: var(--text-sm);
        font-weight: var(--font-semibold);
        letter-spacing: 0.08em;
        line-height: 1.4;
        padding: var(--space-3xs) var(--space-2xs);
        text-transform: uppercase;
        white-space: nowrap;
    }

    /* Custom CSS: seven policy list columns need bounded reading widths; Prewind has no table column utilities. */
    .policy-list-table {
        width: 100%;
        min-width: 68rem;
        table-layout: fixed;
        border: 1px solid #b8b7b7;
        border-radius: 6px;
        border-collapse: separate;
        border-spacing: 0;
        overflow: hidden;
        background: var(--white);
    }

    .policy-list-table th,
    .policy-list-table td {
        border-bottom: 1px solid var(--light);
        padding: var(--space-sm) var(--space-xs);
        text-align: left;
        vertical-align: top;
    }

    .policy-list-table thead th {
        background: var(--lighter);
        color: var(--midtone);
        font-family: var(--font-mono);
        font-size: var(--text-sm);
        font-weight: var(--font-normal);
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    .policy-list-table tbody tr:last-child td {
        border-bottom: 0;
    }

    .policy-list-table th:nth-child(1) {
        width: 20%;
    }

    .policy-list-table th:nth-child(2) {
        width: 20%;
    }

    .policy-list-table th:nth-child(3) {
        width: 14%;
    }

    .policy-list-table th:nth-child(4) {
        width: 16%;
    }

    .policy-list-table th:nth-child(5) {
        width: 10%;
    }

    .policy-list-table th:nth-child(6) {
        width: 10%;
    }

    .policy-list-table th:nth-child(7) {
        width: 10%;
    }
}
