:root {
                --bg: #0d1117;
                --surface: #161b22;
                --surface-2: #21262d;
                --border: #30363d;
                --text: #e6edf3;
                --muted: #848d97;
                --primary: #388bfd;
                --primary-text: #79c0ff;
                --primary-soft: rgba(56, 139, 253, 0.14);
                --danger: #f85149;
                --danger-bg: rgba(248, 81, 73, 0.12);
                --success: #3fb950;
                --success-bg: rgba(63, 185, 80, 0.12);
                --warning: #d29922;
                --warning-bg: rgba(210, 153, 34, 0.12);
                --radius: 6px;
                --radius-lg: 10px;
                font-family:
                    -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica,
                    Arial, sans-serif;
                font-size: 14px;
                color-scheme: dark;
            }
            * {
                box-sizing: border-box;
            }
            body {
                margin: 0;
                min-height: 100vh;
                background: var(--bg);
                color: var(--text);
                overflow-x: hidden;
            }
            a {
                color: var(--primary-text);
                text-decoration: none;
            }
            a:hover {
                text-decoration: underline;
            }
            a:focus-visible,
            button:focus-visible,
            input:focus-visible,
            select:focus-visible,
            textarea:focus-visible {
                outline: 2px solid var(--primary-text);
                outline-offset: 2px;
            }
            h1,
            h2,
            h3 {
                margin: 0 0 0.5rem;
                color: var(--text);
            }
            h1 {
                font-size: 20px;
                font-weight: 600;
            }
            h2 {
                font-size: 16px;
                font-weight: 600;
            }
            p {
                margin: 0.4rem 0;
                line-height: 1.6;
            }
            code {
                background: var(--surface-2);
                border: 1px solid var(--border);
                border-radius: 4px;
                padding: 1px 5px;
                font-size: 12px;
            }
            .muted {
                color: var(--muted);
                font-size: 13px;
            }

            /* ── Layout ── */
            .app-shell {
                min-height: 100vh;
                display: flex;
                flex-direction: column;
            }
            .topbar {
                position: sticky;
                top: 0;
                z-index: 20;
                background: var(--surface);
                border-bottom: 1px solid var(--border);
            }
            .topbar-inner {
                max-width: 1400px;
                margin: 0 auto;
                padding: 0 20px;
                height: 48px;
                display: flex;
                align-items: center;
                gap: 4px;
            }
            .brand {
                display: flex;
                align-items: center;
                gap: 8px;
                font-weight: 600;
                font-size: 15px;
                color: var(--text);
                white-space: nowrap;
                margin-right: 8px;
            }
            .brand:hover {
                text-decoration: none;
            }
            .brand-mark {
                width: 28px;
                height: 28px;
                border-radius: 8px;
                background: var(--primary);
                display: grid;
                place-items: center;
                font-size: 12px;
                font-weight: 700;
                color: #fff;
                flex-shrink: 0;
            }
            .brand-short {
                display: none;
            }
            .nav-toggle {
                display: none;
            }
            nav.nav-links {
                display: flex;
                align-items: center;
                gap: 2px;
                flex: 1;
            }
            .nav-link {
                padding: 5px 10px;
                border-radius: var(--radius);
                color: var(--muted);
                font-size: 13px;
                white-space: nowrap;
            }
            .nav-link:hover {
                background: var(--surface-2);
                color: var(--text);
                text-decoration: none;
            }
            .spacer {
                flex: 1;
            }
            .topbar-right {
                display: flex;
                align-items: center;
                gap: 8px;
                flex-shrink: 0;
            }
            main {
                flex: 1;
                max-width: 1400px;
                width: 100%;
                margin: 0 auto;
                padding: 20px 20px 40px;
            }

            /* ── Cards & Surfaces ── */
            .card {
                background: var(--surface);
                border: 1px solid var(--border);
                border-radius: var(--radius-lg);
                padding: 14px 16px;
                margin: 12px 0;
            }
            .card.compact {
                padding: 10px 12px;
            }
            .surface {
                background: var(--surface);
                border: 1px solid var(--border);
                border-radius: var(--radius-lg);
                overflow: hidden;
                margin: 12px 0;
            }
            .surface-heading {
                margin: 0;
                border-radius: 0;
                border-top: 0;
                border-right: 0;
                border-left: 0;
            }

            /* ── Buttons ── */
            button,
            .button {
                display: inline-flex;
                align-items: center;
                justify-content: center;
                gap: 6px;
                padding: 5px 12px;
                border-radius: var(--radius);
                border: 1px solid transparent;
                font: inherit;
                font-size: 13px;
                font-weight: 500;
                cursor: pointer;
                white-space: nowrap;
                text-decoration: none;
                min-height: 30px;
                background: var(--primary);
                color: #fff;
                border-color: var(--primary);
                transition:
                    opacity 0.12s,
                    filter 0.12s;
            }
            button:hover,
            .button:hover {
                filter: brightness(1.12);
                text-decoration: none;
            }
            button:disabled {
                opacity: 0.45;
                cursor: not-allowed;
                filter: none;
            }
            button.secondary,
            .button.secondary {
                background: var(--surface-2);
                color: var(--text);
                border-color: var(--border);
            }
            button.danger,
            .button.danger {
                background: var(--danger);
                border-color: var(--danger);
                color: #fff;
            }
            button.ghost,
            .button.ghost {
                background: transparent;
                color: var(--primary-text);
                border-color: transparent;
            }
            button.ghost:hover {
                background: var(--primary-soft);
            }
            .link-button {
                background: none;
                border: none;
                color: var(--primary-text);
                cursor: pointer;
                padding: 0;
                font: inherit;
                font-size: 13px;
                min-height: 0;
            }

            /* ── Inputs ── */
            input[type="text"],
            input:not([type]),
            input[type="email"],
            input[type="password"],
            input[type="search"],
            input[type="number"],
            input[type="url"],
            select,
            textarea {
                background: var(--surface-2);
                border: 1px solid var(--border);
                border-radius: var(--radius);
                color: var(--text);
                font: inherit;
                font-size: 13px;
                padding: 5px 10px;
                outline: none;
                min-height: 30px;
                transition: border-color 0.12s;
            }
            input:focus,
            textarea:focus,
            select:focus {
                border-color: var(--primary);
                box-shadow: 0 0 0 3px var(--primary-soft);
            }
            label {
                font-size: 13px;
                color: var(--muted);
            }
            label input,
            label select {
                margin-top: 4px;
            }
            .form-row {
                display: flex;
                align-items: flex-end;
                gap: 8px;
                flex-wrap: wrap;
            }
            .search-form {
                display: block;
                min-width: 0;
            }
            /* Scope the flexible width to the query input only — a blanket
               `.search-form input` rule used to blow facet checkboxes up to
               200px wide and stretch the search area full-screen. */
            .search-row input[type="search"] {
                flex: 1;
                min-width: 200px;
                width: 100%;
            }
            .search-row {
                display: flex;
                gap: 8px;
                align-items: center;
            }
            .search-row .button {
                flex: none;
                white-space: nowrap;
            }
            .facet-groups {
                display: flex;
                flex-wrap: wrap;
                gap: 8px;
                margin-top: 8px;
            }
            .facet-group {
                border: 1px solid var(--border);
                border-radius: var(--radius);
                padding: 2px 8px 6px;
                margin: 0;
                min-width: 0;
            }
            .facet-group legend {
                font-size: 11px;
                padding: 0 4px;
                color: var(--muted);
            }
            .facet-option {
                display: inline-flex;
                align-items: center;
                gap: 4px;
                font-size: 13px;
                margin-right: 10px;
                white-space: nowrap;
            }
            .facet-option:last-child {
                margin-right: 0;
            }
            .facet-option input[type="checkbox"] {
                margin: 0;
                flex: none;
            }
            .search-toolbar {
                display: flex;
                gap: 8px;
                align-items: flex-start;
            }
            .search-toolbar .search-form {
                flex: 1;
            }
            .search-toolbar > .danger {
                flex: none;
            }
            .search-count {
                margin: 8px 0 0;
            }
            .search-count.error {
                color: var(--danger);
            }
            .checkbox-row {
                display: flex;
                gap: 8px;
                align-items: center;
                min-height: 30px;
            }
            .checkbox-row input {
                min-height: auto;
            }
            form.inline {
                display: inline;
            }

            /* ── Status chips ── */
            .chip {
                display: inline-flex;
                align-items: center;
                gap: 4px;
                padding: 4px 12px;
                border-radius: 999px;
                border: 1px solid var(--border);
                background: var(--surface-2);
                color: var(--muted);
                font-size: 12px;
                font-weight: 500;
                white-space: nowrap;
            }
            .chip.ok {
                color: var(--success);
                background: var(--success-bg);
                border-color: rgba(63, 185, 80, 0.3);
                width: 52px;
                justify-content: center;
                text-align: center;
                padding: 4px 12px;
            }
            .chip.admin {
                color: var(--primary-text);
                background: var(--primary-soft);
                border-color: rgba(56, 139, 253, 0.3);
            }
            .chip.customer {
                color: var(--muted);
            }
            .chip.warn {
                color: var(--warning);
                background: var(--warning-bg);
                border-color: rgba(210, 153, 34, 0.3);
            }
            .chip.danger {
                color: var(--danger);
                background: var(--danger-bg);
                border-color: rgba(248, 81, 73, 0.3);
            }
            .chip.device-presence.online {
                color: var(--success);
                background: var(--success-bg);
                border-color: rgba(63, 185, 80, 0.5);
                font-weight: 400;
            }
            .chip.device-presence.offline {
                color: var(--danger);
                background: var(--danger-bg);
                border-color: rgba(248, 81, 73, 0.5);
                font-weight: 400;
            }
            .chip.device-presence.stale {
                color: var(--warning);
                background: var(--warning-bg);
                border-color: rgba(210, 153, 34, 0.5);
                font-weight: 400;
            }
            .chip.result-chip {
                width: auto;
                min-width: 52px;
                justify-content: center;
                text-align: center;
                border-radius: 6px;
            }
            .chip.selected {
                background: var(--primary);
                color: #fff;
                border-color: var(--primary);
            }
            .chip.h60 {
                width: 52px;
                justify-content: center;
                text-align: center;
                padding: 4px 12px;
                color: #7ee33b;
                background: rgba(126, 227, 59, 0.14);
                border-color: rgba(126, 227, 59, 0.35);
                border-radius: var(--radius);
            }
            .chip.h40 {
                width: 52px;
                justify-content: center;
                text-align: center;
                padding: 4px 12px;
                color: #e2c541;
                background: rgba(226, 197, 65, 0.14);
                border-color: rgba(226, 197, 65, 0.35);
                border-radius: var(--radius);
            }
            .chip.h20 {
                width: 52px;
                justify-content: center;
                text-align: center;
                padding: 4px 12px;
                color: #f77860;
                background: rgba(247, 120, 96, 0.14);
                border-color: rgba(247, 120, 96, 0.35);
                border-radius: var(--radius);
            }
            .chip.h0 {
                width: 52px;
                justify-content: center;
                text-align: center;
                padding: 4px 12px;
                color: #6e7681;
                background: rgba(110, 118, 129, 0.14);
                border-color: rgba(110, 118, 129, 0.3);
                border-radius: var(--radius);
            }
            .chip-group {
                display: flex;
                flex-wrap: wrap;
                gap: 6px;
                align-items: center;
            }
            .chip-group form {
                display: inline;
            }
            .chip-group button {
                min-height: 0;
                box-shadow: none;
                font-size: 12px;
            }

            /* ── Table ── */
            .table-scroll {
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
            }
            table {
                width: 100%;
                border-collapse: collapse;
                min-width: 800px;
            }
            th,
            td {
                border-bottom: 1px solid var(--border);
                padding: 8px 10px;
                text-align: left;
                vertical-align: middle;
                white-space: nowrap;
            }
            th {
                color: var(--muted);
                font-size: 11px;
                text-transform: uppercase;
                letter-spacing: 0.06em;
                background: var(--surface-2);
                font-weight: 600;
                position: sticky;
                top: 0;
            }
            tr:hover td {
                background: rgba(56, 139, 253, 0.05);
            }
            tr.row-warning td {
                background: var(--warning-bg);
            }
            tr.row-danger td {
                background: var(--danger-bg);
            }
            tr.row-warning:hover td {
                background: rgba(210, 153, 34, 0.18);
            }
            tr.row-danger:hover td {
                background: rgba(248, 81, 73, 0.18);
            }
            td .subtle {
                display: block;
                color: var(--muted);
                font-size: 11px;
                margin-top: 2px;
            }
            td.col-serial {
                min-width: 200px;
                white-space: nowrap;
            }
            td.col-time {
                min-width: 160px;
                white-space: nowrap;
            }
            input[type="checkbox"] {
                accent-color: var(--primary);
                width: 14px;
                height: 14px;
                cursor: pointer;
                vertical-align: middle;
            }
            th.col-cb,
            td.col-cb {
                width: 32px;
                padding: 6px 8px;
            }

            th.col-cb,
            td.col-cb {
                width: 32px;
                padding: 6px 8px;
            }
            .table-dense {
                min-width: 800px;
            }
            .table-dense th,
            .table-dense td {
                padding: 3px 8px;
                font-size: 12px;
            }
            .table-dense th {
                font-size: 10px;
                letter-spacing: 0.04em;
            }
            table.ram-inventory-table {
                min-width: 680px;
                table-layout: fixed;
            }
            .ram-inventory-table th:nth-child(1) { width: 32%; }
            .ram-inventory-table th:nth-child(2) { width: 27%; }
            .ram-inventory-table th:nth-child(3) { width: 15%; }
            .ram-inventory-table th:nth-child(4) { width: 16%; }
            .ram-inventory-table th:nth-child(5) { width: 10%; }
            .ram-inventory-table td {
                white-space: normal;
                overflow-wrap: anywhere;
            }
            .ram-module-cell strong,
            .ram-module-meta,
            .ram-type-name,
            .ram-result-meta {
                display: block;
            }
            .ram-module-meta,
            .ram-result-meta {
                margin-top: 3px;
                color: var(--muted);
                font-size: 11px;
                line-height: 1.35;
            }
            .ram-type-name {
                margin-bottom: 5px;
                line-height: 1.35;
            }
            .ram-time {
                display: inline-block;
                max-width: 10ch;
                line-height: 1.4;
                white-space: normal;
            }

            .table-dense th {
                font-size: 10px;
                letter-spacing: 0.04em;
            }
            .health-pre pre {
                padding: 8px 12px;
                line-height: 1.5;
            }
            .health-pre span {
                display: block;
                padding: 1px 4px;
                margin: 0 -4px;
                border-radius: 2px;
            }
            .hl-warning {
                background: var(--warning-bg);
            }
            .hl-danger {
                background: var(--danger-bg);
            }

            /* ── Kv grid ── */
            .grid,
            .kv-grid {
                display: grid;
                grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
                gap: 10px;
            }
            .kv {
                background: var(--surface-2);
                border: 1px solid var(--border);
                border-radius: var(--radius);
                padding: 10px 12px;
            }
            .kv b {
                display: block;
                font-size: 11px;
                text-transform: uppercase;
                letter-spacing: 0.05em;
                color: var(--muted);
                margin-bottom: 4px;
            }
            .kv > span:first-child {
                display: block;
                font-size: 11px;
                text-transform: uppercase;
                letter-spacing: 0.05em;
                color: var(--muted);
                margin-bottom: 4px;
            }
            .kv > strong {
                display: block;
                color: var(--text);
                overflow-wrap: anywhere;
            }
            .profile-columns {
                display: grid;
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 16px;
                margin-top: 10px;
            }
            .profile-columns h3 {
                font-size: 12px;
                color: var(--muted);
                text-transform: uppercase;
                letter-spacing: 0.05em;
                margin-bottom: 8px;
            }
            .profile-list {
                display: grid;
                gap: 6px;
            }
            .profile-row {
                display: grid;
                grid-template-columns: minmax(110px, auto) minmax(0, 1fr);
                align-items: baseline;
                gap: 12px;
                padding: 8px 10px;
                background: var(--surface-2);
                border: 1px solid var(--border);
                border-radius: var(--radius);
            }
            .profile-row span {
                color: var(--muted);
                font-size: 12px;
            }
            .profile-row strong {
                overflow-wrap: anywhere;
            }
            .metric-value {
                font-size: 14px;
                font-weight: 500;
                color: var(--text);
                word-break: break-word;
            }

            /* ── Page hero ── */
            .page-hero {
                display: flex;
                align-items: flex-start;
                justify-content: space-between;
                gap: 12px;
                margin-bottom: 16px;
                flex-wrap: wrap;
            }
            .page-hero h1 {
                font-size: 18px;
            }
            .eyebrow {
                font-size: 11px;
                text-transform: uppercase;
                letter-spacing: 0.08em;
                color: var(--muted);
                margin-bottom: 4px;
            }

            /* ── Alerts ── */
            .error {
                background: var(--danger-bg);
                border: 1px solid rgba(248, 81, 73, 0.3);
                color: var(--danger);
                padding: 10px 14px;
                border-radius: var(--radius);
                margin: 8px 0;
                font-size: 13px;
            }
            .ok {
                background: var(--success-bg);
                border: 1px solid rgba(63, 185, 80, 0.3);
                color: var(--success);
                padding: 10px 14px;
                border-radius: var(--radius);
                margin: 8px 0;
                font-size: 13px;
            }

            /* ── Pre / code ── */
            pre {
                background: var(--surface-2);
                border: 1px solid var(--border);
                border-radius: var(--radius);
                padding: 12px;
                color: var(--muted);
                font-size: 12px;
                white-space: pre-wrap;
                word-break: break-word;
                overflow-x: auto;
            }

            /* ── Batch defaults listbox ── */
            .defaults-grid {
                display: grid;
                grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
                gap: 8px;
            }
            .defaults-box {
                background: var(--surface-2);
                border: 1px solid var(--border);
                border-radius: var(--radius);
                overflow: hidden;
            }
            .defaults-box-hdr {
                padding: 5px 10px;
                font-size: 11px;
                font-weight: 600;
                text-transform: uppercase;
                letter-spacing: 0.06em;
                color: var(--primary-text);
                border-bottom: 1px solid var(--border);
                background: var(--surface);
            }
            .defaults-list {
                max-height: 180px;
                overflow-y: auto;
            }
            .defaults-row {
                display: block;
                width: 100%;
                padding: 5px 10px;
                background: transparent;
                border: none;
                border-bottom: 1px solid rgba(48, 54, 61, 0.6);
                border-radius: 0;
                text-align: left;
                color: var(--text);
                cursor: pointer;
                font-size: 12px;
                box-shadow: none;
                min-height: 0;
            }
            .defaults-row:last-child {
                border-bottom: none;
            }
            .defaults-row:hover {
                background: var(--primary-soft);
            }
            .defaults-row.row-selected {
                background: rgba(56, 139, 253, 0.28);
                color: #fff;
                font-weight: 600;
            }
            .default-picker {
                padding: 10px 12px;
            }
            .default-title {
                font-size: 11px;
                text-transform: uppercase;
                letter-spacing: 0.06em;
                color: var(--muted);
                margin: 0 0 7px;
                font-weight: 600;
            }
            .default-title span {
                font-weight: 400;
                text-transform: none;
                letter-spacing: 0;
            }
            .default-line {
                display: flex;
                align-items: center;
                gap: 6px;
                flex-wrap: wrap;
                padding: 4px 0;
                border-top: 1px solid rgba(48, 54, 61, 0.55);
            }
            .default-line:first-of-type {
                border-top: none;
            }
            .default-label {
                min-width: 92px;
                color: var(--muted);
                font-size: 12px;
                font-weight: 600;
                text-transform: uppercase;
                letter-spacing: 0.05em;
            }
            .default-pill {
                min-height: 0;
                padding: 2px 7px;
                border-radius: 5px;
                border: 1px solid var(--border);
                background: transparent;
                color: var(--text);
                font-size: 12px;
                font-weight: 500;
                box-shadow: none;
            }
            .default-pill:hover {
                background: var(--primary-soft);
                filter: none;
            }
            .default-pill.selected {
                background: rgba(63, 185, 80, 0.24);
                color: #fff;
                border-color: rgba(63, 185, 80, 0.65);
            }
            .default-empty {
                margin: 4px 0 0 98px;
                color: var(--muted);
                font-size: 12px;
            }

            /* ── Admin forms ── */
            .form-grid {
                display: grid;
                grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
                gap: 10px;
                align-items: end;
            }
            .toolbar {
                display: flex;
                gap: 8px;
                align-items: flex-end;
                flex-wrap: wrap;
            }
            .card-header {
                display: flex;
                justify-content: space-between;
                align-items: center;
                gap: 10px;
            }
            .pagination {
                display: flex;
                justify-content: center;
                align-items: center;
                gap: 6px;
                margin-top: 12px;
                flex-wrap: wrap;
            }
            .device-actions,
            .action-row {
                display: flex;
                gap: 8px;
                flex-wrap: wrap;
            }
            .task-status {
                overflow-wrap: anywhere;
            }
            .task-cancel {
                display: inline;
                margin-left: 12px;
            }
            .device-action-note {
                margin: 0 0 10px;
            }
            .search-panel {
                padding: 10px 12px;
            }
            .scroll-hint {
                display: none;
            }
            .mobile-detail-link {
                display: none;
            }

            /* ── Responsive ── */
            @media (max-width: 820px) {
                .profile-columns {
                    grid-template-columns: 1fr;
                }
                .topbar-inner {
                    min-height: 52px;
                    height: auto;
                    padding: 6px max(12px, env(safe-area-inset-right)) 6px
                        max(12px, env(safe-area-inset-left));
                    flex-wrap: wrap;
                    row-gap: 6px;
                }
                .brand {
                    flex: 1;
                    min-width: 0;
                }
                .spacer {
                    display: none;
                }
                .brand-full {
                    display: none;
                }
                .brand-short {
                    display: inline;
                }
                .nav-toggle {
                    display: inline-flex;
                    min-width: 44px;
                    min-height: 44px;
                    padding: 8px;
                    background: var(--surface-2);
                    border-color: var(--border);
                }
                nav.nav-links {
                    display: none;
                    order: 10;
                    flex: 0 0 100%;
                    align-items: stretch;
                    padding: 6px 0 4px;
                    border-top: 1px solid var(--border);
                }
                nav.nav-links.is-open {
                    display: grid;
                    grid-template-columns: repeat(2, minmax(0, 1fr));
                    gap: 6px;
                }
                .nav-link {
                    min-height: 44px;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    padding: 8px 10px;
                    background: var(--surface-2);
                }
                .topbar-right {
                    gap: 6px;
                }
                .topbar-right .chip {
                    max-width: 110px;
                    overflow: hidden;
                    text-overflow: ellipsis;
                }
                main {
                    padding: 14px max(12px, env(safe-area-inset-right))
                        max(32px, env(safe-area-inset-bottom))
                        max(12px, env(safe-area-inset-left));
                }
                .page-hero {
                    flex-direction: column;
                    margin-bottom: 12px;
                }
                .page-hero > *,
                .page-hero .toolbar {
                    width: 100%;
                }
                .search-row {
                    flex-wrap: wrap;
                }
                .search-row input[type="search"] {
                    min-width: 0;
                    flex-basis: 100%;
                }
                .search-toolbar {
                    flex-direction: column;
                }
                .search-toolbar > .danger {
                    width: 100%;
                }
                input[type="text"],
                input:not([type]),
                input[type="email"],
                input[type="password"],
                input[type="search"],
                input[type="number"],
                input[type="url"],
                select,
                textarea {
                    font-size: 16px;
                    min-height: 44px;
                    width: 100%;
                }
                button,
                .button {
                    min-height: 44px;
                    padding: 9px 14px;
                }
                .link-button {
                    min-height: 44px;
                    padding: 8px;
                }
                input[type="checkbox"] {
                    width: 20px;
                    height: 20px;
                }
                .form-row,
                .toolbar,
                .device-actions,
                .action-row {
                    align-items: stretch;
                }
                .mobile-stack,
                .mobile-stack > *,
                .form-row > .search-form,
                .form-row > button {
                    width: 100%;
                }
                .task-cancel {
                    display: block;
                    margin: 10px 0 0;
                }
                .task-cancel button,
                .specs-actions > *,
                .pagination .button {
                    min-height: 44px;
                }
                .attribute-values [data-value-wrap] {
                    min-height: 44px;
                }
                .form-grid,
                .grid {
                    grid-template-columns: minmax(0, 1fr);
                }
                .card {
                    padding: 12px;
                }
                .card-header {
                    align-items: stretch;
                    flex-direction: column;
                }
                .health-pre pre {
                    white-space: pre-wrap;
                    font-size: 11px;
                    line-height: 1.55;
                }
                .default-label {
                    min-width: 100%;
                }
                .default-empty {
                    margin-left: 0;
                }
                .default-pill,
                .chip-group button {
                    min-height: 40px;
                    padding: 7px 11px;
                }
                .device-actions > button {
                    flex: 1 1 calc(50% - 8px);
                    white-space: normal;
                }
                .device-actions > .danger {
                    flex-basis: 100%;
                    margin-bottom: 6px;
                }
                .scroll-hint {
                    display: block;
                    padding: 8px 12px 0;
                    color: var(--muted);
                    font-size: 11px;
                }
                .mobile-detail-link {
                    display: inline-flex;
                    align-items: center;
                    min-height: 40px;
                    padding: 6px 8px;
                }
                table.responsive-cards {
                    min-width: 0;
                }
                table.responsive-cards thead {
                    display: none;
                }
                table.responsive-cards,
                table.responsive-cards tbody,
                table.responsive-cards tr,
                table.responsive-cards td {
                    display: block;
                    width: 100%;
                }
                table.responsive-cards tbody {
                    padding: 8px;
                }
                table.responsive-cards tr {
                    margin-bottom: 10px;
                    overflow: hidden;
                    border: 1px solid var(--border);
                    border-radius: var(--radius-lg);
                    background: var(--surface-2);
                }
                table.responsive-cards tr:last-child {
                    margin-bottom: 0;
                }
                table.responsive-cards td {
                    display: grid;
                    grid-template-columns: minmax(96px, 36%) minmax(0, 1fr);
                    gap: 10px;
                    align-items: center;
                    min-width: 0;
                    padding: 9px 10px;
                    white-space: normal;
                    overflow-wrap: anywhere;
                    border-bottom: 1px solid var(--border);
                }
                table.responsive-cards td:last-child {
                    border-bottom: 0;
                }
                table.responsive-cards td::before {
                    content: attr(data-label);
                    color: var(--muted);
                    font-size: 10px;
                    font-weight: 600;
                    text-transform: uppercase;
                    letter-spacing: 0.05em;
                }
                table.responsive-cards td.mobile-primary {
                    grid-template-columns: minmax(0, 1fr) auto;
                    font-size: 15px;
                }
                table.responsive-cards td.mobile-primary::before {
                    display: none;
                }
                table.responsive-cards td.col-cb {
                    display: flex;
                    width: 100%;
                    min-height: 44px;
                }
                table.responsive-cards td.col-cb::before {
                    content: "Select";
                    flex: 1;
                }
                table.responsive-cards tr.empty-row {
                    border: 0;
                }
                table.responsive-cards tr.empty-row td {
                    display: block;
                    text-align: center;
                }
                table.responsive-cards tr.empty-row td::before {
                    display: none;
                }
                .metric-value,
                .page-hero h1,
                code {
                    overflow-wrap: anywhere;
                }
            }

            @media (max-width: 420px) {
                .topbar-right .mode-chip {
                    display: none;
                }
                nav.nav-links.is-open {
                    grid-template-columns: minmax(0, 1fr);
                }
                .device-actions > button {
                    flex-basis: 100%;
                }
            }

/* ── Controller page shell ──────────────────────────────────────────────
   The Python base stylesheet above is the layout authority; these rules are
   the equivalent classes for the few inline styles in the Python templates.
   Inline style attributes are not used because the Controller CSP does not
   allow them. */
.hero-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hero-actions form, .inline-form { display: inline; }
.workbench-nav { gap: 8px; margin: 8px 0 16px; }
.section-nav { gap: 6px; margin: 10px 0 14px; }
.row-baseline { align-items: baseline; }
.grow-1 { flex: 1; }
.grow-2 { flex: 2; }
.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-0 { margin-bottom: 0; }
.surface-title { padding: 14px 16px 0; margin: 0; }
.hidden { display: none; }
.pagination span { margin: 0 6px; color: var(--muted); font-size: 13px; }
#wb-status:empty, #wb-action-status:empty, #session-action-status:empty { display: none; }
#wb-action-status, #session-action-status { padding: 10px 14px; }
#wb-action-status.error, #session-action-status.error { color: var(--danger); border-color: var(--danger); }
.risk-label { display: inline-flex; align-items: center; gap: 6px; max-width: 340px; }
.risk-label.sector { max-width: 320px; }
.risk-label.fio { max-width: 360px; }
.log-toolbar { gap: 8px; align-items: center; }
.log-toolbar .spacer { flex: 1; }
.log-output { background: var(--bg); color: var(--text); padding: 10px; font: 12px/1.45 monospace; white-space: pre-wrap; overflow: auto; overflow-wrap: anywhere; }
#log-modal-list { max-height: 62vh; }
#wb-log-list { max-height: 65vh; }
.log-modal { width: min(920px, 94vw); max-height: 88vh; }
@media (max-width: 700px) { #wb-log-list, #log-modal-list { max-height: 58vh; } }
[hidden] { display: none !important; }
/* heat-0..5 = <3, 3-10, 10-50, 50-150, 150-500, >=500 ms */
.surface-disclaimer { border-left: 3px solid var(--warning); background: var(--warning-bg); color: var(--text); padding: 8px 10px; margin: 8px 0; border-radius: var(--radius); }
.surface-progress p { margin: 4px 0; }
.surface-heatmap { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.weak-disk-map { display: grid; grid-template-columns: repeat(32, minmax(0, 1fr)); gap: 3px; margin-top: 8px; }
.weak-disk-map .heat-cell { width: 100%; }
.weak-disk-map .weak-history { outline: 2px solid #5ba7ff; outline-offset: -2px; }
.heat-row { display: flex; align-items: center; gap: 3px; }
.heat-row-label { flex: 0 0 92px; font: 11px/1 monospace; color: var(--muted); }
.heat-cell { flex: 1 1 0; min-width: 6px; height: 16px; padding: 0; border: 1px solid var(--border); border-radius: 2px; cursor: pointer; }
.heat-cell:hover, .heat-cell:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; z-index: 1; }
.heat-0 { background: #1f6f3f; }
.heat-1 { background: #3fb950; }
.heat-2 { background: #d29922; }
.heat-3 { background: #e3801a; }
.heat-4 { background: #f85149; }
.heat-5 { background: #8b1a1a; }
.heat-idle { background: var(--surface-2); }
.heat-unplanned { background: transparent; border-style: dashed; cursor: default; }
.heat-partial { background: repeating-linear-gradient(45deg, #d29922 0 4px, #5a4413 4px 8px); }
.heat-failed { background: repeating-linear-gradient(45deg, #f85149 0 4px, #4a1512 4px 8px); }
.heat-cancelled { background: repeating-linear-gradient(45deg, #848d97 0 4px, #2b3038 4px 8px); }
.surface-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.surface-bins { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.surface-bin { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; }
.surface-bin.heat-0, .surface-bin.heat-1, .surface-bin.heat-2, .surface-bin.heat-3, .surface-bin.heat-4, .surface-bin.heat-5 { color: #0d1117; font-weight: 600; }
.surface-window-detail { font: 12px/1.5 monospace; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
@media (max-width: 700px) { .heat-row-label { flex-basis: 64px; font-size: 10px; } .heat-cell { height: 12px; } }

/* Workbench page rules. The Python base stylesheet (served first in
   /static/go-workbench.css) provides the layout and tokens; only the WIP
   primitives from the Python workbench.css live here. */
.wip-refresh { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 14px; padding: 10px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font-size: .9rem; }
.wip-refresh-toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.wip-row > td { vertical-align: top; }
.wip-status, .wip-time { display: grid; grid-template-rows: 24px; grid-auto-rows: auto; row-gap: 4px; align-items: center; justify-items: start; }
.wip-time { font-size: .92em; }
.wip-time-line { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.wip-progress { display: grid; gap: 5px; width: 210px; min-width: 150px; }
.wip-progress-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; width: 100%; }
.wip-progress-label { color: var(--text); font-size: .82rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wip-progress-eta { color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wip-progress-track { display: block; width: 100%; height: 7px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
.wip-progress-fill { display: block; height: 100%; min-width: 2px; border-radius: 999px; background: var(--primary); background-image: linear-gradient(90deg, color-mix(in srgb, var(--primary) 70%, #000000), var(--primary)); box-shadow: 0 0 6px color-mix(in srgb, var(--primary) 45%, transparent); transition: width .45s ease; }
.wip-progress progress { display: block; appearance: none; width: 100%; height: 6px; border: 0; border-radius: 999px; overflow: hidden; background: var(--surface-2); color: var(--primary); }
.wip-progress progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
.wip-progress progress::-webkit-progress-value { background: var(--primary); border-radius: 999px; }
.wip-progress progress::-moz-progress-bar { background: var(--primary); border-radius: 999px; }
.worker-card .form-row { margin-top: 6px; }
