:root {
    --vd-topbar-height: 54px;
    --vd-panel-border: #cbd3dc;
    --vd-detected: #36404c;
    --vd-fault: #d03f3f;
    --vd-selected: #4489e4;
    --vd-unavailable: #aab8c5;
}

html,
body {
    height: 100%;
}

.vd-body {
    min-width: 980px;
    overflow: auto;
}

.vd-topbar {
    min-height: var(--vd-topbar-height);
}

.vd-topbar .topbar {
    min-height: var(--vd-topbar-height);
}

.vd-brand {
    align-items: center;
    color: #fff;
    display: inline-flex;
    gap: .65rem;
    line-height: 1.05;
}

.vd-brand:hover {
    color: #fff;
}

.vd-brand-mark {
    align-items: center;
    background: var(--tz-primary);
    border: 1px solid rgba(255, 255, 255, .34);
    border-radius: 3px;
    display: inline-flex;
    font-size: .72rem;
    font-weight: 900;
    height: 30px;
    justify-content: center;
    letter-spacing: .05em;
    width: 34px;
}

.vd-brand strong,
.vd-brand small {
    display: block;
}

.vd-brand small {
    color: rgba(255, 255, 255, .62);
    font-size: .65rem;
    font-weight: 400;
    margin-top: .15rem;
}

.vd-status-badge {
    align-items: center;
    display: inline-flex;
    font-size: .72rem;
    gap: .4rem;
    padding: .42rem .58rem;
}

.vd-status-dot {
    background: currentColor;
    border-radius: 50%;
    display: inline-block;
    height: 7px;
    width: 7px;
}

.vd-content-page {
    margin-left: 0 !important;
    min-height: calc(100vh - var(--vd-topbar-height));
    padding: 0 !important;
}

.vd-shell {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--vd-topbar-height));
    padding: .5rem;
}

.vd-vehicle-strip {
    border: 1px solid var(--vd-panel-border);
    border-radius: 2px;
    flex: 0 0 auto;
    margin-bottom: .5rem;
}

.vd-field-label,
.vd-field-value {
    display: block;
}

.vd-field-label {
    color: var(--tz-secondary-color);
    font-size: .65rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.vd-field-value {
    font-size: .78rem;
    margin-top: .1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vd-progress {
    height: 2px;
}

.vd-main-tabs {
    flex: 0 0 auto;
}

.vd-main-tabs .nav-link,
.vd-detail-card .nav-link {
    border-radius: 0;
    font-size: .75rem;
    padding: .45rem .75rem;
}

.vd-main-content {
    flex: 1 1 auto;
    min-height: 0;
}

.vd-main-content > .tab-pane {
    height: 100%;
    padding-top: .5rem;
}

.vd-work-card,
.vd-detail-card,
.vd-full-card {
    border: 1px solid var(--vd-panel-border);
    border-radius: 2px;
    box-shadow: none;
}

.vd-work-card {
    min-height: 310px;
}

.vd-detail-card {
    min-height: 235px;
}

.vd-full-card {
    height: 100%;
}

.vd-work-card .card-header,
.vd-detail-card .card-header,
.vd-full-card .card-header {
    background: var(--tz-secondary-bg);
    border-bottom: 1px solid var(--vd-panel-border);
}

.vd-legend {
    color: var(--tz-secondary-color);
    display: flex;
    font-size: .65rem;
    gap: .75rem;
}

.vd-legend span {
    align-items: center;
    display: inline-flex;
    gap: .25rem;
}

.vd-legend-box {
    background: #fff;
    border: 2px solid var(--vd-unavailable);
    display: inline-block;
    height: 10px;
    width: 14px;
}

.vd-legend-box.is-detected {
    border-color: var(--vd-detected);
}

.vd-legend-box.is-fault {
    border-color: var(--vd-fault);
}

.vd-topology {
    min-height: 264px;
    overflow: auto;
    position: relative;
}

.vd-topology-nodes {
    display: grid;
    gap: .65rem;
    grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
}

.vd-topology-node {
    background: var(--tz-body-bg);
    border: 2px solid var(--vd-unavailable);
    border-radius: 1px;
    color: var(--tz-secondary-color);
    cursor: pointer;
    min-height: 50px;
    padding: .35rem .45rem;
    text-align: left;
}

.vd-topology-node strong,
.vd-topology-node span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vd-topology-node strong {
    color: var(--tz-body-color);
    font-size: .72rem;
}

.vd-topology-node span {
    font-size: .63rem;
    margin-top: .2rem;
}

.vd-topology-node.is-detected {
    border-color: var(--vd-detected);
}

.vd-topology-node.is-fault {
    border-color: var(--vd-fault);
}

.vd-topology-node.is-selected {
    border-color: var(--vd-selected);
    box-shadow: 0 0 0 1px var(--vd-selected);
}

.vd-empty-state {
    align-items: center;
    color: var(--tz-secondary-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: center;
    min-height: 190px;
    text-align: center;
}

.vd-empty-state i {
    font-size: 1.75rem;
    margin-bottom: .4rem;
}

.vd-empty-state strong {
    color: var(--tz-body-color);
    margin-bottom: .25rem;
}

.vd-empty-state.compact {
    min-height: 150px;
}

.vd-module-table-wrap {
    height: 264px;
}

.vd-module-table tbody tr:not(.vd-placeholder-row) {
    cursor: pointer;
}

.vd-module-table tbody tr.is-selected > * {
    background: rgba(68, 137, 228, .13);
}

.vd-catalog-row {
    cursor: pointer;
}

.vd-catalog-row.is-selected > * {
    background: rgba(68, 137, 228, .13);
}

.vd-basket-column {
    width: 3.5rem;
    text-align: center;
}

.vd-placeholder-row td {
    color: var(--tz-secondary-color);
    padding: 2rem 1rem;
    text-align: center;
}

.vd-module-status {
    font-size: .65rem;
}

.vd-module-detail {
    min-height: 180px;
    overflow: auto;
}

.vd-operation-grid {
    display: grid;
    gap: .5rem;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.vd-operation-grid .btn {
    align-items: center;
    display: flex;
    gap: .75rem;
}

.vd-operation-grid strong {
    color: var(--tz-primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

@media (max-height: 760px) {
    .vd-work-card {
        min-height: 250px;
    }

    .vd-topology,
    .vd-module-table-wrap {
        height: 204px;
        min-height: 204px;
    }

    .vd-detail-card {
        min-height: 205px;
    }
}

/* Shared diagnostic workstation: module selection stays visible while working. */
.vd-body {
    min-width: 0;
    font-size: .875rem;
}

.vd-shell {
    min-height: 600px;
}

.vd-field-value,
.vd-main-tabs .nav-link,
.vd-detail-card .nav-link,
.vd-module-status {
    font-size: .8125rem;
}

.vd-diagnostic-workspace {
    display: grid;
    gap: .65rem;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    height: 100%;
    min-height: 0;
}

.vd-module-sidebar,
.vd-function-workspace,
.vd-diagnostic-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.vd-module-sidebar > .card {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.vd-module-sidebar .vd-module-table-wrap {
    flex: 1 1 auto;
    height: auto;
    min-height: 150px;
    overflow: auto;
}

.vd-module-sidebar .vd-module-table {
    font-size: .8125rem;
}

.vd-module-sidebar .vd-module-table td {
    padding: .55rem .5rem;
    vertical-align: middle;
}

.vd-module-sidebar .vd-topology {
    max-height: 200px;
    min-height: 0;
}

.vd-module-sidebar .vd-topology-nodes {
    gap: .4rem;
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
}

.vd-function-workspace > .vd-detail-card,
.vd-diagnostic-main > .vd-detail-card {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.vd-function-workspace .vd-module-detail,
.vd-diagnostic-main .vd-module-detail {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 1rem;
}

.vd-feature-tabs {
    flex-wrap: wrap;
    gap: .15rem;
    margin: 0;
    max-width: 100%;
}

.vd-feature-tabs .nav-link {
    padding: .65rem .7rem;
    white-space: nowrap;
}

.vd-detail-card .header-title,
.vd-work-card .header-title {
    font-size: .9375rem;
}

.vd-catalog-toolbar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .5rem;
}

.vd-catalog-toolbar input[type="search"] {
    flex: 1 1 220px;
    width: auto;
}

.vd-catalog-table-wrap,
.vd-catalog-scroll {
    max-height: 35vh;
    min-height: 100px;
    overflow: auto;
    overscroll-behavior: contain;
}

.vd-catalog-table-wrap thead,
.vd-catalog-scroll thead,
.vd-module-table-wrap thead {
    background: var(--tz-body-bg, #fff);
    position: sticky;
    top: 0;
    z-index: 1;
}

.vd-module-detail .table {
    font-size: .875rem;
}

.vd-module-detail .table td,
.vd-module-detail .table th {
    padding: .5rem .6rem;
    overflow-wrap: anywhere;
    vertical-align: top;
}

.vd-module-detail .form-control,
.vd-module-detail .form-select {
    font-size: .875rem;
    min-height: 36px;
}

.vd-module-detail .form-label {
    font-size: .8125rem;
    line-height: 1.4;
    margin-bottom: .3rem;
}

.vd-coding-helper {
    background: var(--tz-secondary-bg, #f4f5f7);
    border: 1px solid var(--vd-panel-border);
    border-radius: 3px;
    margin-bottom: .75rem;
    padding: .75rem;
}

.vd-coding-helper code,
.vd-coding-helper input[type="text"] {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.vd-coding-bits {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    max-height: 220px;
    overflow: auto;
}

.vd-coding-bits > * {
    border: 1px solid var(--vd-panel-border);
    border-radius: 3px;
    padding: .5rem;
}

.vd-input-dirty {
    border-left: 3px solid #cc9228;
    padding-left: .65rem;
}

.vd-module-detail pre {
    max-height: 220px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.vd-module-detail details > summary {
    cursor: pointer;
    padding: .25rem 0;
}

.vd-active-task {
    align-items: center;
    background: var(--tz-secondary-bg, #f4f5f7);
    border: 1px solid var(--vd-panel-border);
    border-radius: 2px;
    display: flex;
    flex: 0 0 auto;
    gap: .75rem;
    margin-bottom: .5rem;
    padding: .55rem .75rem;
}

.vd-active-task-copy {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    overflow-wrap: anywhere;
}

.vd-active-task > .spinner-border,
.vd-active-task > .btn,
#activeTaskElapsed {
    flex: 0 0 auto;
}

.vd-fault-scope {
    max-width: 155px;
}

.vd-fault-workspace {
    align-items: start;
    display: grid;
    gap: .75rem;
    grid-template-columns: minmax(0, 1.4fr) minmax(270px, .85fr);
    min-width: 0;
}

.vd-fault-list,
.vd-fault-detail {
    max-height: 45vh;
    min-width: 0;
    overflow: auto;
    overscroll-behavior: contain;
}

.vd-fault-list thead {
    background: var(--tz-body-bg, #fff);
    position: sticky;
    top: 0;
    z-index: 1;
}

.vd-fault-list th,
.vd-fault-list .vd-fault-code,
.vd-fault-list .vd-fault-state,
.vd-fault-list .vd-fault-module > strong {
    white-space: nowrap;
}

.vd-fault-list td {
    overflow-wrap: normal;
    word-break: normal;
}

.vd-fault-list .vd-fault-module {
    min-width: 105px;
}

.vd-fault-list .vd-fault-description {
    min-width: 140px;
}

.vd-fault-list .vd-fault-time {
    min-width: 85px;
}

.vd-fault-row {
    cursor: pointer;
}

.vd-fault-row.is-selected > * {
    background: rgba(68, 137, 228, .13);
}

.vd-fault-row:focus {
    outline: 2px solid var(--vd-selected);
    outline-offset: -2px;
}

.vd-fault-detail {
    background: var(--tz-secondary-bg, #f4f5f7);
    border: 1px solid var(--vd-panel-border);
    border-radius: 2px;
    overflow-wrap: anywhere;
    padding: .75rem;
}

.vd-measurement-basket {
    background: var(--tz-secondary-bg, #f4f5f7);
    border: 1px solid var(--vd-panel-border);
    border-radius: 2px;
    padding: .75rem;
}

.vd-basket-items {
    display: grid;
    gap: .5rem;
    max-height: 270px;
    overflow: auto;
    overscroll-behavior: contain;
}

.vd-measurement-basket.has-measurements .vd-basket-items {
    min-height: 200px;
}

.vd-measurement-monitor {
    background: var(--tz-body-bg, #fff);
    border: 1px solid var(--vd-panel-border);
    border-radius: 2px;
    min-width: 0;
    padding: .5rem .65rem;
}

.vd-measurement-monitor-heading {
    align-items: center;
    display: flex;
    gap: .4rem;
    justify-content: space-between;
    overflow-wrap: anywhere;
}

.vd-measurement-monitor-heading .btn {
    color: var(--tz-secondary-color);
    flex: 0 0 auto;
    font-size: 1rem;
    padding: 0 .2rem;
    text-decoration: none;
}

.vd-measurement-field {
    align-items: center;
    border-top: 1px solid #e3e7eb;
    display: grid;
    gap: .65rem;
    grid-template-columns: minmax(160px, .85fr) minmax(180px, 1.15fr);
    padding-top: .4rem;
    margin-top: .35rem;
    min-width: 0;
}

.vd-measurement-field-copy {
    min-width: 0;
    overflow-wrap: anywhere;
}

.vd-measurement-value {
    color: var(--tz-body-color);
    font-size: 1.3rem;
    font-variant-numeric: tabular-nums;
}

.vd-measurement-field.is-retained .vd-measurement-value {
    color: #856334;
}

.vd-measurement-chart {
    min-width: 0;
}

.vd-measurement-chart svg {
    display: block;
    height: 82px;
    width: 100%;
}

.vd-vehicle-overview {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.vd-overview-toolbar {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: .75rem;
    padding: 12px 16px;
}

#vehicleOverviewStatus {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem .75rem;
}

.vd-overview-toolbar input {
    flex: 1 1 250px;
    width: auto;
}

.vd-overview-toolbar select {
    flex: 0 1 210px;
    width: auto;
}

.vd-vehicle-module-tree {
    flex: 1 1 auto;
    min-height: 180px;
    min-width: 0;
    overflow: auto;
    overscroll-behavior: contain;
}

.vd-vehicle-module {
    border-bottom: 1px solid var(--vd-panel-border);
    min-width: 0;
}

.vd-vehicle-module > summary,
.vd-overview-fault > summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    gap: .75rem;
    list-style: none;
    min-width: 0;
    padding: 14px 16px;
}

.vd-vehicle-module > summary::-webkit-details-marker,
.vd-overview-fault > summary::-webkit-details-marker {
    display: none;
}

.vd-vehicle-module > summary::before,
.vd-overview-fault > summary::before {
    color: var(--tz-secondary-color);
    content: "\203A";
    flex: 0 0 12px;
    font-size: 1.35rem;
    line-height: 1;
    text-align: center;
}

.vd-vehicle-module[open] > summary::before,
.vd-overview-fault[open] > summary::before {
    transform: rotate(90deg);
}

.vd-vehicle-module > summary:hover,
.vd-overview-fault > summary:hover {
    background: var(--tz-secondary-bg, #f4f7fa);
}

.vd-vehicle-module > summary:focus-visible,
.vd-overview-fault > summary:focus-visible {
    outline: 2px solid var(--vd-selected);
    outline-offset: -2px;
}

.vd-overview-module-copy,
.vd-overview-fault-copy {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.vd-overview-module-copy strong,
.vd-overview-fault-copy strong {
    color: var(--tz-body-color);
}

.vd-overview-module-copy small,
.vd-overview-fault-copy small {
    display: block;
    margin-top: 3px;
}

.vd-overview-module-status {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: flex-end;
}

.vd-overview-faults {
    margin: 0 16px 14px 40px;
    min-width: 0;
}

.vd-overview-fault {
    background: #fff;
    border: 1px solid var(--vd-panel-border);
    border-radius: 4px;
    margin-top: .5rem;
    min-width: 0;
    overflow: hidden;
}

.vd-overview-fault > summary {
    padding: 10px 12px;
}

.vd-overview-fault > div {
    border-top: 1px solid var(--vd-panel-border);
    min-width: 0;
    padding: 12px;
}

.vd-overview-fault table {
    margin-bottom: 0;
}

.vd-overview-fault td {
    overflow-wrap: anywhere;
}

.vd-operation-empty {
    display: none;
}

.vd-module-detail:has(.vd-operation-layout) {
    overflow: hidden;
}

#moduleDetailContent:has(> .vd-operation-layout) {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.vd-operation-layout {
    border: 1px solid var(--vd-panel-border);
    border-radius: 4px;
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: minmax(240px, .9fr) minmax(0, 1.1fr);
    min-height: 230px;
    min-width: 0;
    overflow: hidden;
}

.vd-operation-layout > #functionCatalogPane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    padding: 12px;
}

.vd-operation-layout .vd-catalog-toolbar {
    flex: 0 0 auto;
}

.vd-operation-layout .vd-catalog-scroll {
    flex: 1 1 auto;
    max-height: none;
    min-height: 100px;
}

.vd-operation-layout .vd-catalog-scroll table {
    table-layout: fixed;
    width: 100%;
}

.vd-operation-layout > #functionParametersPane {
    border-left: 1px solid var(--vd-panel-border);
    min-height: 0;
    min-width: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 16px;
}

.vd-operation-layout #selectedOperationPanel {
    border-top: 0 !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.vd-operation-layout #functionParametersPane:has(> #selectedOperationPanel.d-none) .vd-operation-empty {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: .65rem;
    justify-content: center;
    min-height: 200px;
    text-align: center;
}

.vd-operation-empty i {
    color: var(--vd-selected);
    font-size: 1.5rem;
}

.vd-plot-label {
    fill: var(--tz-secondary-color, #6c757d);
    font-family: inherit;
    font-size: 10px;
}

@media (max-width: 575px) {
    .vd-measurement-field {
        grid-template-columns: minmax(0, 1fr);
        gap: .25rem;
    }

    .vd-basket-items {
        max-height: 330px;
    }
}

@media (max-width: 1199px) {
    .vd-fault-workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .vd-fault-list,
    .vd-fault-detail {
        max-height: 320px;
    }
}

@media (max-width: 575px) {
    .vd-active-task {
        gap: .4rem;
        padding: .5rem;
    }

    .vd-active-task-copy {
        font-size: .8125rem;
    }

    .vd-active-task > .spinner-border {
        display: none;
    }
}

@media (max-width: 991px) {
    .vd-vehicle-overview {
        height: auto;
        min-height: 350px;
    }

    .vd-vehicle-module-tree {
        max-height: none;
        overflow: visible;
    }

    .vd-module-detail:has(.vd-operation-layout) {
        overflow: visible;
    }

    #moduleDetailContent:has(> .vd-operation-layout) {
        height: auto;
    }

    .vd-operation-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .vd-operation-layout .vd-catalog-scroll {
        max-height: 320px;
    }

    .vd-operation-layout > #functionParametersPane {
        border-left: 0;
        border-top: 1px solid var(--vd-panel-border);
        overflow: visible;
    }

    .vd-shell {
        height: auto;
        min-height: calc(100vh - var(--vd-topbar-height));
    }

    .vd-main-content > .tab-pane {
        height: auto;
    }

    .vd-diagnostic-workspace {
        grid-template-columns: minmax(0, 1fr);
        height: auto;
    }

    .vd-module-sidebar .vd-module-table-wrap {
        flex: 0 0 auto;
        max-height: 250px;
    }

    .vd-function-workspace .vd-module-detail,
    .vd-diagnostic-main .vd-module-detail {
        overflow: visible;
    }

    .vd-catalog-table-wrap,
    .vd-catalog-scroll {
        max-height: 320px;
    }
}

@media (max-width: 575px) {
    .vd-overview-toolbar {
        gap: .5rem;
        padding: 12px;
    }

    .vd-overview-toolbar input,
    .vd-overview-toolbar select {
        flex-basis: 100%;
        width: 100%;
    }

    .vd-vehicle-module > summary {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: .5rem;
        padding: 12px;
    }

    .vd-overview-module-copy {
        flex-basis: calc(100% - 24px);
    }

    .vd-overview-module-status {
        margin-left: 24px;
    }

    .vd-overview-faults {
        margin: 0 12px 12px;
    }

    .vd-topbar .topbar {
        gap: .5rem;
        padding-left: .65rem;
        padding-right: .65rem;
    }

    .vd-brand small,
    #refreshStatusButton,
    .vd-status-badge .vd-status-dot {
        display: none;
    }

    .vd-brand {
        gap: .35rem;
    }

    .vd-status-badge {
        display: inline-block;
        max-width: 115px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .vd-topbar .btn {
        font-size: .75rem;
        padding: .3rem .4rem;
    }

    .vd-module-detail > .d-flex {
        flex-wrap: wrap;
    }

    .vd-module-detail .vd-feature-tabs .nav-link {
        padding: .5rem;
    }
}
