html {
    font-size: var(--ctp-font-size-min);
}

:root {
    --font-family: var(--ctp-font-sans, "Segoe UI Variable", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", sans-serif);
    --log-display-font-family: var(--font-family);
    --log-display-font-size: var(--scheme-font-control);
    --log-display-font-weight: var(--ctp-font-weight-body);
    --log-display-line-height: 1.45;
    --ctp-font-size-min: 10px;
    --font-size-base: 11px;
    --ctp-display-font-title: 14px;
    --ctp-display-font-section: 14px;
    --ctp-display-font-body: 11px;
    --ctp-display-font-control: 11px;
    --ctp-display-font-meta: 10px;
    --ctp-display-font-small: 10px;
    --scheme-font-title: var(--ctp-display-font-title);
    --scheme-font-section: max(var(--ctp-font-size-min), var(--ctp-display-font-section));
    --scheme-font-body: max(var(--ctp-font-size-min), var(--ctp-display-font-body));
    --scheme-font-control: max(var(--ctp-font-size-min), var(--ctp-display-font-control));
    --scheme-font-meta: max(var(--ctp-font-size-min), var(--ctp-display-font-meta));
    --scheme-font-small: max(var(--ctp-font-size-min), var(--ctp-display-font-small));
    --app-font-weight-label: var(--ctp-font-weight-control);
    --app-font-weight-table-header: var(--ctp-font-weight-control);
    --app-font-weight-section-title: var(--ctp-font-weight-title);
    --app-header-height: 4rem;
    --app-content-padding: 1rem;
    --app-content-padding-top: .5rem;
    --app-card-body-padding: 1rem;
    --app-control-height: 32px;
    --app-control-height-sm: 30px;
    --app-control-padding-x: 14px;
    --app-control-padding-x-sm: 7px;
    --app-field-padding-y: .42rem;
    --app-field-padding-x: .65rem;
    --app-table-cell-padding-y: .5rem;
    --app-table-cell-padding-x: .75rem;
    --app-nav-item-height: 2.85rem;
    --app-nav-item-padding-y: .45rem;
    --app-nav-item-padding-x: .85rem;
    --app-nav-gap: 10px;
    --app-density-gap: .65rem;
    --scheme-workbench-panel-height: calc(100vh - 110px);
    --app-scrollbar-size: 8px;
    --app-scrollbar-thumb: rgba(166, 190, 202, .54);
    --app-scrollbar-thumb-hover: rgba(132, 164, 180, .66);
    --app-scrollbar-track: transparent;
}

html[data-display-size="small"] {
    --ctp-font-size-min: 9px;
    --font-size-base: 10px;
    --ctp-display-font-title: 12px;
    --ctp-display-font-section: 12px;
    --ctp-display-font-body: 10px;
    --ctp-display-font-control: 10px;
    --ctp-display-font-meta: 9px;
    --ctp-display-font-small: 9px;
    --app-header-height: 3.25rem;
    --app-content-padding: .55rem;
    --app-content-padding-top: .25rem;
    --app-card-body-padding: .55rem;
    --app-control-height: 30px;
    --app-control-height-sm: 28px;
    --app-control-padding-x: 8px;
    --app-control-padding-x-sm: 5px;
    --app-field-padding-y: .26rem;
    --app-field-padding-x: .45rem;
    --app-table-cell-padding-y: .26rem;
    --app-table-cell-padding-x: .45rem;
    --app-nav-item-height: 2.2rem;
    --app-nav-item-padding-y: .24rem;
    --app-nav-item-padding-x: .55rem;
    --app-nav-gap: 7px;
    --app-density-gap: .35rem;
}

html[data-display-size="medium"] {
    --ctp-font-size-min: 10px;
    --font-size-base: 11px;
    --ctp-display-font-title: 14px;
    --ctp-display-font-section: 14px;
    --ctp-display-font-body: 11px;
    --ctp-display-font-control: 11px;
    --ctp-display-font-meta: 10px;
    --ctp-display-font-small: 10px;
    --app-header-height: 3.5rem;
    --app-content-padding: .75rem;
    --app-content-padding-top: .38rem;
    --app-card-body-padding: .75rem;
    --app-control-height: 32px;
    --app-control-height-sm: 30px;
    --app-control-padding-x: 10px;
    --app-control-padding-x-sm: 6px;
    --app-field-padding-y: .32rem;
    --app-field-padding-x: .5rem;
    --app-table-cell-padding-y: .34rem;
    --app-table-cell-padding-x: .55rem;
    --app-nav-item-height: 2.45rem;
    --app-nav-item-padding-y: .32rem;
    --app-nav-item-padding-x: .65rem;
    --app-nav-gap: 8px;
    --app-density-gap: .5rem;
}

html[data-display-size="large"] {
    --ctp-font-size-min: 11px;
    --font-size-base: 12px;
    --ctp-display-font-title: 16px;
    --ctp-display-font-section: 16px;
    --ctp-display-font-body: 12px;
    --ctp-display-font-control: 12px;
    --ctp-display-font-meta: 11px;
    --ctp-display-font-small: 11px;
    --app-header-height: 4rem;
    --app-content-padding: 1rem;
    --app-content-padding-top: .5rem;
    --app-card-body-padding: 1rem;
    --app-control-height: 36px;
    --app-control-height-sm: 32px;
    --app-control-padding-x: 14px;
    --app-control-padding-x-sm: 7px;
    --app-field-padding-y: .42rem;
    --app-field-padding-x: .65rem;
    --app-table-cell-padding-y: .5rem;
    --app-table-cell-padding-x: .75rem;
    --app-nav-item-height: 2.85rem;
    --app-nav-item-padding-y: .45rem;
    --app-nav-item-padding-x: .85rem;
    --app-nav-gap: 10px;
    --app-density-gap: .65rem;
}

html { font-size: max(var(--ctp-font-size-min), var(--font-size-base)); }

* {
    scrollbar-width: thin;
    scrollbar-color: transparent var(--app-scrollbar-track);
}

*:hover {
    scrollbar-color: var(--app-scrollbar-thumb) var(--app-scrollbar-track);
}

*::-webkit-scrollbar {
    width: var(--app-scrollbar-size);
    height: var(--app-scrollbar-size);
}

*::-webkit-scrollbar-track,
*::-webkit-scrollbar-corner {
    background: var(--app-scrollbar-track);
}

*::-webkit-scrollbar-thumb {
    background: transparent;
    border: 2px solid transparent;
    border-radius: 999px;
    background-clip: padding-box;
}

*:hover::-webkit-scrollbar-thumb {
    background: var(--app-scrollbar-thumb);
    background-clip: padding-box;
}

*:hover::-webkit-scrollbar-thumb:hover {
    background: var(--app-scrollbar-thumb-hover);
    background-clip: padding-box;
}

html, body {
    font-family: var(--font-family);
    background: var(--ctp-color-page);
    color: var(--ink);
    letter-spacing: 0;
}

button,
input,
select,
textarea,
table {
    font-family: var(--font-family);
    letter-spacing: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
}

a, .btn-link {
    color: var(--primary);
}

.btn-primary {
    color: var(--primary-contrast);
    background-color: var(--primary);
    border-color: var(--primary-dark);
}

.btn-light {
    color: rgba(0, 0, 0, 0.88);
    background: #fff;
    border: 1px solid #d9d9d9;
}

.btn-light:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: #fff;
}

.btn:not(.btn-close):not(.scheme-step-action-btn):not(.login-btn),
.ant-btn,
.modern-btn-primary,
.modern-btn-secondary,
.modern-btn-danger {
    width: auto !important;
    min-width: auto !important;
    max-width: 100%;
    flex: 0 0 auto;
    white-space: nowrap;
    border-radius: var(--control-radius);
    font-size: var(--scheme-font-body);
    font-weight: var(--ctp-font-weight-control);
    letter-spacing: 0;
}

.btn:not(.btn-close):not(.scheme-step-action-btn):not(.login-btn):not(.btn-sm),
.modern-btn-primary,
.modern-btn-secondary,
.modern-btn-danger {
    min-height: var(--app-control-height);
    padding: var(--app-field-padding-y) var(--app-control-padding-x);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    line-height: 1.2;
}

.btn-sm:not(.btn-close):not(.scheme-step-action-btn):not(.login-btn),
.btn.btn-sm:not(.btn-close):not(.scheme-step-action-btn):not(.login-btn) {
    min-height: var(--app-control-height-sm);
    padding: 0 var(--app-control-padding-x-sm);
    font-size: var(--scheme-font-control);
    line-height: 1.2;
    gap: .35rem;
}

.btn.w-100:not(.btn-close):not(.scheme-step-action-btn):not(.login-btn),
button.btn:not(.btn-close):not(.scheme-step-action-btn):not(.login-btn) {
    width: auto !important;
    min-width: auto !important;
}

.ant-btn {
    border-radius: 6px;
    border: 1px solid var(--app-line);
    background: var(--ctp-color-surface);
    color: #243b48;
    height: var(--app-control-height);
    padding: 4px var(--app-control-padding-x);
    font-size: var(--scheme-font-body);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1.5715;
    cursor: pointer;
    transition: background .14s ease, border-color .14s ease, color .14s ease;
    box-shadow: none;
}

.ant-tag {
    display: inline-flex;
    align-items: center;
    border-radius: 3px;
    padding: 0 var(--app-control-padding-x-sm);
    height: var(--app-control-height-sm);
    font-size: var(--scheme-font-control);
    border: 1px solid var(--border-color);
    background: #fafafa;
}

.ant-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.ant-btn-default {
    background: #fff;
}

.ant-btn-sm {
    height: var(--app-control-height-sm);
    padding: 0 var(--app-control-padding-x-sm);
    font-size: var(--scheme-font-control);
}

.ant-spin-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    color: rgba(0, 0, 0, 0.65);
}

.ant-spin-dot {
    width: 16px;
    height: 16px;
    border: 2px solid #a9cbd8;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: antSpin 1s linear infinite;
}

.auth-transition-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--ctp-color-page);
}

.password-change-shell {
    min-block-size: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    background: linear-gradient(
        115deg,
        color-mix(in srgb, var(--ctp-color-primary) 10%, var(--ctp-color-page)) 0%,
        var(--ctp-color-page-subtle) 46%,
        var(--ctp-color-page) 100%);
}

.auth-transition-status {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
    max-width: min(100%, 360px);
    padding: 14px 18px;
    border: 1px solid rgba(196, 212, 221, 0.95);
    border-radius: var(--control-radius);
    background: rgba(255, 255, 255, 0.84);
    color: #334155;
    font-size: var(--scheme-font-body);
    font-weight: var(--ctp-font-weight-control);
    box-shadow: var(--ctp-shadow-subtle);
}

@keyframes antSpin {
    to {
        transform: rotate(360deg);
    }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 2px rgba(31, 111, 139, .16);
}

.form-check-input:focus {
    border-color: var(--status-ok);
}

.form-check-input:checked {
    background-color: var(--status-ok);
    border-color: var(--status-ok);
}

.form-check-input:checked:focus {
    box-shadow: 0 0 0 2px rgba(31, 111, 139, .18);
}

.form-check-input:disabled:checked {
    background-color: rgba(31, 111, 139, .72);
    border-color: rgba(31, 111, 139, .72);
}

.content {
    padding-top: var(--app-content-padding-top);
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) { outline: 1px solid var(--success); }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDgNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #a94b45;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}
.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.modern-btn-primary {
    color: #ffffff;
    background: var(--primary);
    border: 1px solid var(--primary-dark);
    border-radius: 6px;
    padding: var(--app-field-padding-y) var(--app-control-padding-x);
    font-size: var(--scheme-font-body);
    font-weight: var(--ctp-font-weight-control);
    box-shadow: none;
    transition: background .14s ease, border-color .14s ease, box-shadow .14s ease;
    letter-spacing: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.modern-btn-primary:hover {
    color: #ffffff;
    background: var(--primary-hover);
    box-shadow: none;
}

.modern-btn-secondary {
    color: #243b48;
    background: var(--ctp-color-surface);
    border: 1px solid var(--app-line);
    border-radius: 6px;
    padding: var(--app-field-padding-y) var(--app-control-padding-x);
    font-size: var(--scheme-font-body);
    font-weight: var(--ctp-font-weight-control);
    transition: color .14s ease, border-color .14s ease, background .14s ease;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.modern-btn-secondary:hover {
    color: var(--primary);
    border-color: #a9cbd8;
    background: #ffffff;
    box-shadow: none;
}

.modern-btn-primary:disabled,
.modern-btn-secondary:disabled {
    opacity: 1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.modern-btn-primary:disabled {
    color: rgba(0, 0, 0, 0.25);
    background: var(--app-surface-subtle);
    border-color: var(--app-line);
}

.modern-btn-secondary:disabled {
    color: rgba(0, 0, 0, 0.25);
    background: var(--app-surface-subtle);
    border-color: var(--app-line);
}

.spinner-border {
    border-color: rgba(31, 111, 139, .2);
    border-right-color: var(--primary);
}

/* Typography tweaks */
.page-title {
    font-size: var(--scheme-font-title);
    font-weight: var(--ctp-font-weight-title);
    color: var(--ink);
    margin: 0;
    line-height: 1.2;
}

.table th, .table td {
    font-size: var(--scheme-font-control);
    vertical-align: middle;
    padding: var(--app-table-cell-padding-y) var(--app-table-cell-padding-x);
}

.form-label {
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
    margin-bottom: .25rem;
    color: #475569;
}

.modern-card {
    background: #ffffff;
    border-radius: var(--control-radius);
    border: 1px solid var(--app-line);
    box-shadow: var(--control-panel-shadow);
}

.modern-card .card-header {
    background: transparent;
    border-bottom: 1px solid #f1f5f9;
    padding: var(--app-table-cell-padding-y) var(--app-control-padding-x);
    font-weight: var(--ctp-font-weight-title);
    color: var(--ink);
    font-size: var(--scheme-font-section);
}

.modern-card .card-body {
    padding: var(--app-card-body-padding);
}

.table th {
    background-color: var(--app-surface-muted);
    color: #2f4454;
    font-weight: var(--ctp-font-weight-control);
    text-transform: none;
    font-size: var(--scheme-font-control);
    letter-spacing: normal;
    border-bottom: 1px solid var(--app-line);
}

.table td {
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: #fbfdfe;
}

.table-hover > tbody > tr:hover > * {
    background-color: #eef6f8;
}

.alert {
    border-radius: var(--control-radius);
    border: 1px solid var(--app-line);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.form-control, .form-select {
    min-height: var(--app-control-height);
    font-size: var(--scheme-font-body);
    padding: var(--app-field-padding-y) var(--app-field-padding-x);
    border-radius: var(--control-radius);
    border: 1px solid var(--app-line);
    background-color: #ffffff;
    transition: border-color .14s ease, box-shadow .14s ease, background-color .14s ease;
}

.form-control:focus, .form-select:focus {
    background-color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 111, 139, .15);
}

.home-channel-index-col {
    width: 18%;
}

.home-version-actions-col {
    width: 190px;
}

.home-recycle-actions-col {
    width: 120px;
}

.home-batch-select-col {
    width: 48px;
}

.home-ai-error-text {
    white-space: pre-wrap;
}

.value-assistant-inline-label {
    display: inline-flex;
    align-items: center;
    line-height: 1.5;
    margin-bottom: .25rem;
}

.value-assistant-title-inline {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 3px;
    width: fit-content;
    max-width: 100%;
    height: 18px;
    font-size: var(--scheme-font-control);
    line-height: 1.5;
    margin-bottom: .25rem;
    white-space: nowrap;
}

.value-assistant-title-inline .value-assistant-inline-label {
    flex: 0 1 auto;
    min-width: 0;
    line-height: inherit;
    margin-bottom: 0;
}

.value-assistant-title-inline .value-assistant-link,
.value-assistant-inline-label + .value-assistant-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 20px;
    min-width: 20px;
    height: auto;
    min-height: 0;
    margin-bottom: 0;
    padding: 0;
    color: var(--primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
    letter-spacing: 0;
    line-height: 1;
    position: relative;
    align-self: center;
    text-align: center;
    text-decoration: none;
}

.value-field-control {
    display: flex;
    align-items: stretch;
    gap: .5rem;
    width: 100%;
}

.value-field-control .form-control {
    flex: 1 1 auto;
    min-width: 0;
}

.value-field-control-textarea {
    align-items: flex-start;
}

.value-assistant-link {
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 20px;
    width: 20px;
    min-width: 20px;
    height: 18px;
    padding: 0;
    background: transparent;
    color: var(--primary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
    letter-spacing: 0;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease, box-shadow .12s ease;
}

.value-field-control-textarea .value-assistant-link {
    align-self: flex-start;
}

.value-assistant-link:hover:not(.is-disabled) {
    background: transparent;
    color: var(--primary-dark);
    text-decoration: underline;
}

.value-assistant-link:focus-visible {
    outline: 2px solid rgba(31, 111, 139, .34);
    outline-offset: 1px;
}

.value-assistant-link.is-disabled {
    cursor: not-allowed;
    opacity: .55;
    pointer-events: none;
}

.serial-port-group .form-select,
.serial-port-group .serial-refresh-btn {
    height: calc(2.25rem + 2px);
}

.serial-port-group .serial-refresh-btn {
    min-width: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.serial-tools-page > .page-header-bar,
.serial-tool-page > .page-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.serial-tools-page,
.serial-tool-page {
    max-width: 1520px;
}

.serial-tools-header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.serial-tools-bridge-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.serial-tools-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    border: 1px solid #c9d5de;
    border-radius: 6px;
    background: #e9f0f4;
}

.serial-tools-tab {
    min-height: var(--app-control-height);
    padding: 0 var(--app-control-padding-x);
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #425567;
    font-size: var(--scheme-font-body);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1;
    white-space: nowrap;
}

.serial-tools-tab:hover {
    color: #1f3345;
    background: rgba(255, 255, 255, 0.72);
}

.serial-tools-tab.active {
    color: #0f2638;
    background: #fff;
    box-shadow: 0 1px 3px rgba(36, 57, 74, 0.18);
}

.serial-tools-tab:disabled {
    color: #758493;
    cursor: not-allowed;
    opacity: .72;
}

.serial-tools-content.is-unavailable {
    opacity: .48;
    filter: grayscale(.75);
    pointer-events: none;
    user-select: none;
}

.serial-tools-update-notice {
    display: flex;
    align-items: center;
    min-height: var(--app-control-height);
    padding: .65rem .85rem;
    border: 1px solid #c9d5de;
    border-radius: 6px;
    background: #f6f9fb;
    color: #263b4b;
    font-size: var(--scheme-font-body);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1.35;
}

.serial-tools-update-notice.is-muted {
    border-color: #cbd6df;
    background: #f5f8fa;
    color: #526577;
}

.serial-tools-update-notice.is-warning {
    border-color: #ddd0aa;
    background: #faf5e6;
    color: #6e5621;
}

.serial-tools-update-notice.is-required {
    border-color: #e0c2bf;
    background: #fbf1f0;
    color: #8a3a35;
}

.serial-tool-control-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(420px, auto);
    gap: 14px;
    align-items: center;
}

.serial-tool-status-stack {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.serial-tool-status-label {
    color: var(--app-helper-text-strong);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
}

.serial-tool-status-value {
    color: #132738;
    font-size: var(--ctp-font-size-section-title);
    font-weight: var(--ctp-font-weight-title);
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.serial-tool-inline-status {
    color: var(--app-helper-text);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-helper);
    overflow-wrap: anywhere;
}

.serial-tool-action-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.serial-tool-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.serial-tool-panel-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.serial-tool-count {
    color: var(--app-helper-text);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-helper);
}

.serial-tool-empty {
    display: flex;
    align-items: center;
    min-height: 120px;
    color: var(--app-helper-text);
    font-weight: var(--ctp-font-weight-helper);
    line-height: 1.4;
}

.serial-tool-list {
    display: grid;
    align-content: start;
    gap: .55rem;
}

.serial-tool-list-entry {
    display: grid;
    gap: .45rem;
    min-width: 0;
    padding: .15rem .2rem .72rem;
    border-bottom: 1px solid #edf2f6;
}

.serial-tool-list-entry:last-child {
    border-bottom: 0;
}

.serial-tool-list-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-width: 0;
}

.serial-tool-list-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem .8rem;
    min-width: 0;
    color: var(--app-helper-text);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-helper);
    overflow-wrap: anywhere;
}

.local-serial-bridge-port-name {
    color: #132738;
    font-size: var(--ctp-font-size-section-title);
    font-weight: var(--ctp-font-weight-title);
    line-height: 1.2;
}

.serial-debug-control-grid {
    grid-template-columns: minmax(220px, .6fr) minmax(620px, 1.4fr);
}

.serial-debug-settings {
    display: grid;
    grid-template-columns: minmax(180px, 1.25fr) minmax(92px, .58fr) minmax(82px, .48fr) minmax(120px, .64fr) minmax(120px, .64fr) auto;
    gap: 8px;
    align-items: end;
    min-width: 0;
}

.serial-debug-settings.uses-web-serial {
    grid-template-columns: minmax(92px, .58fr) minmax(82px, .48fr) minmax(120px, .64fr) minmax(120px, .64fr) auto;
}

.serial-debug-selected-port-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.serial-debug-select-port-button {
    justify-self: start;
    min-width: 96px !important;
    width: auto !important;
}

.serial-debug-port-group {
    display: flex;
    gap: 8px;
    min-width: 0;
}

.serial-debug-port-group .form-select {
    flex: 1 1 auto;
    min-width: 0;
}

.serial-debug-field {
    display: grid;
    gap: 4px;
    min-width: 0;
    margin: 0;
}

.serial-debug-field span {
    color: #475569;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1.2;
}

.serial-debug-open-button {
    align-self: end;
    min-width: 86px !important;
}

.serial-debug-send-list {
    display: grid;
    gap: 8px;
}

.serial-debug-send-row {
    display: grid;
    grid-template-columns: 110px minmax(220px, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.serial-debug-send-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.serial-debug-send-mode,
.serial-debug-send-input {
    min-width: 0;
}

.serial-tool-compact-btn {
    min-height: var(--app-control-height);
}

.serial-tool-icon-btn {
    width: 34px !important;
    min-width: 34px !important;
    height: var(--app-control-height);
    padding-left: 0;
    padding-right: 0;
    font-size: 18px;
    line-height: 1;
}

.serial-debug-delete-row-button {
    min-width: 64px !important;
}

.network-tools-page {
    max-width: 1520px;
    container-name: network-tools;
    container-type: inline-size;
}

.network-debug-control-grid {
    grid-template-columns: minmax(220px, .55fr) minmax(680px, 1.45fr);
    align-items: start;
}

.network-debug-settings {
    display: grid;
    gap: 8px;
    align-items: end;
    min-width: 0;
}

.network-debug-settings.is-client {
    grid-template-columns: minmax(84px, .55fr) minmax(100px, .62fr) minmax(200px, 1.5fr) minmax(96px, .58fr) auto;
}

.network-debug-settings.is-server {
    grid-template-columns: minmax(84px, .55fr) minmax(100px, .62fr) minmax(160px, 1fr) minmax(96px, .58fr) auto;
}

.network-debug-settings .serial-debug-field label,
.network-debug-peer-toolbar .serial-debug-field label {
    color: var(--ctp-color-helper-strong);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1.25;
}

.network-debug-port-field {
    min-width: 96px;
}

.network-debug-host-field {
    min-width: 160px;
}

.network-debug-toggle-button {
    align-self: end;
    min-width: 112px !important;
}

@container network-tools (max-width: 900px) {
    .network-debug-control-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .network-debug-control-grid > * {
        min-width: 0;
    }

    .network-debug-settings.is-client,
    .network-debug-settings.is-server {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .network-debug-settings > .network-debug-toggle-button {
        grid-column: 1 / -1;
        justify-self: start;
    }
}

@container network-tools (max-width: 680px) {
    .network-debug-settings.is-client,
    .network-debug-settings.is-server {
        grid-template-columns: minmax(0, 1fr);
    }
}

.network-debug-client-address {
    color: var(--ctp-color-primary-deep);
    font-weight: var(--ctp-font-weight-control);
}

.network-debug-public-ip-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.network-debug-public-ip-row .btn {
    min-height: var(--app-control-height-sm);
}

.network-debug-peer-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 420px);
    gap: 8px;
}

.network-debug-send-row-wrap {
    display: grid;
    gap: 4px;
}

.ctp-field-error {
    color: var(--ctp-color-danger-text);
    font-size: var(--scheme-font-meta);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1.35;
}

.network-debug-send-error {
    margin-left: 118px;
}

.gprs-debug-control-grid {
    grid-template-columns: minmax(220px, .65fr) minmax(520px, 1.35fr);
    align-items: start;
}

.gprs-debug-settings {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto auto;
    gap: var(--ctp-space-2);
    align-items: end;
    min-width: 0;
}

.gprs-debug-settings .serial-debug-field label {
    color: var(--ctp-color-helper-strong);
    font-size: var(--ctp-font-size-control);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1.25;
}

.gprs-debug-meter-field {
    min-width: 0;
}

.gprs-debug-refresh-button {
    align-self: end;
}

.gprs-debug-empty-meters {
    margin-top: var(--ctp-space-2);
    color: var(--ctp-color-helper);
    font-size: var(--ctp-font-size-helper);
    font-weight: var(--ctp-font-weight-helper);
}

.gprs-debug-log-entry {
    grid-template-columns: minmax(76px, max-content) 38px minmax(108px, 150px) minmax(120px, 180px) minmax(72px, max-content) minmax(0, 1fr);
    align-items: baseline;
}

.gprs-debug-log-meter,
.gprs-debug-log-endpoint {
    min-width: 0;
    color: var(--ctp-color-info);
    font-size: var(--ctp-font-size-helper);
    font-weight: var(--ctp-font-weight-helper);
    line-height: 1.45;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.network-debug-log-entry {
    grid-template-columns: minmax(76px, max-content) 38px minmax(120px, 180px) minmax(72px, max-content) minmax(0, 1fr);
    align-items: baseline;
}

.network-debug-log-peer {
    min-width: 0;
    color: var(--ctp-color-info);
    font-size: var(--scheme-font-meta);
    font-weight: var(--ctp-font-weight-helper);
    line-height: 1.45;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.network-debug-log-length {
    color: var(--ctp-color-helper);
    font-size: var(--scheme-font-meta);
    font-weight: var(--ctp-font-weight-helper);
    line-height: 1.45;
    white-space: nowrap;
}

.serial-tool-log-list {
    display: grid;
    align-content: start;
    gap: .75rem;
    max-height: min(62vh, 680px);
    min-height: 180px;
    overflow: auto;
    padding: .15rem .2rem .25rem;
    scrollbar-gutter: stable;
}

.serial-tool-log-entry {
    display: grid;
    gap: .45rem;
    min-width: 0;
    padding: .15rem .2rem .78rem;
    border-bottom: 1px solid #edf2f6;
    background: transparent;
}

.serial-tool-log-entry:last-child {
    border-bottom: 0;
}

.serial-tool-log-line {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.serial-tool-log-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 20px;
    padding: 0 .42rem;
    border-radius: 4px;
    color: #fff;
    font-size: var(--scheme-font-meta);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1;
}

.serial-tool-log-badge.is-tx {
    background: var(--primary);
}

.serial-tool-log-badge.is-rx {
    background: var(--status-info);
}

.serial-tool-log-badge.is-error {
    background: #a94b45;
}

.serial-tool-log-badge.is-port {
    background: #6f6650;
}

.serial-tool-log-badge.is-info,
.serial-tool-log-badge.is-log {
    background: #526779;
}

.serial-tool-log-time {
    flex: 0 0 auto;
    color: var(--app-helper-text);
    font-size: var(--scheme-font-meta);
    font-weight: var(--ctp-font-weight-helper);
    font-variant-numeric: tabular-nums;
}

.serial-tool-log-data {
    min-width: 0;
    padding: .55rem .65rem;
    border: 1px solid #d7e0e8;
    border-radius: 4px;
    background: #f7fafc;
    color: #1f2a44;
    font-family: Consolas, "Cascadia Mono", monospace;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-body);
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.serial-debug-plain-log {
    color: #1f2a44;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.serial-bypass-page {
    max-width: 1520px;
}

.serial-bypass-control-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(560px, auto);
    gap: 14px;
    align-items: center;
}

.serial-bypass-actions {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(280px, 440px) auto;
    align-items: center;
    justify-content: end;
    gap: 8px;
    min-width: 0;
}

.serial-bypass-port-select-wrap,
.serial-bypass-process-select-wrap {
    min-width: 0;
}

.serial-bypass-port-select,
.serial-bypass-process-select {
    width: 100%;
}

.serial-bypass-main-button {
    min-width: 128px !important;
}

.serial-bypass-process-select .searchable-select-trigger {
    min-height: calc(2.25rem + 2px);
}

.serial-bypass-table-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.serial-bypass-table-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
}

.serial-bypass-view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-height: calc(2.25rem + 2px);
    padding: 3px;
    border: 1px solid #c9d5de;
    border-radius: 6px;
    background: #eef4f7;
}

.serial-bypass-view-toggle-label {
    padding: 0 7px 0 5px;
    color: #526779;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
    white-space: nowrap;
}

.serial-bypass-view-toggle-button {
    border: 0;
    border-radius: 4px;
    min-width: 64px;
    height: 32px;
    padding: 0 12px;
    color: #425567;
    background: transparent;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1;
}

.serial-bypass-view-toggle-button:hover {
    color: #1f3345;
    background: rgba(255, 255, 255, 0.72);
}

.serial-bypass-view-toggle-button.active {
    color: #0f2638;
    background: #fff;
    box-shadow: 0 1px 3px rgba(36, 57, 74, 0.18);
}

.serial-bypass-empty {
    display: flex;
    align-items: center;
    min-height: 140px;
    color: #627482;
    font-weight: var(--ctp-font-weight-helper);
}

.serial-bypass-log-list {
    display: grid;
    align-content: start;
    max-height: min(62vh, 680px);
    min-height: 180px;
    overflow: auto;
    padding: 0 .75rem;
    scrollbar-gutter: stable;
}

.serial-bypass-log-entry {
    display: grid;
    grid-template-columns: minmax(76px, max-content) 44px minmax(0, 1fr);
    align-items: baseline;
    column-gap: 1rem;
    min-width: 0;
    padding: .55rem 0;
    border-bottom: 1px solid var(--control-line, #d8e4eb);
    background: transparent;
}

.serial-bypass-log-entry:last-child {
    border-bottom: 0;
}

.direct-live-log-group {
    display: grid;
    align-content: start;
    gap: .25rem;
    padding: .55rem 0 .65rem;
    border-bottom: 1px solid var(--control-line, #d8e4eb);
}

.direct-live-log-group:last-child {
    border-bottom: 0;
}

.direct-live-log-object {
    min-width: 0;
    color: var(--control-ink, #1c2b36);
    font-size: var(--scheme-font-control, 12px);
    font-weight: var(--ctp-font-weight-title);
    line-height: 1.35;
    word-break: break-word;
}

.direct-live-log-operation {
    min-width: 0;
    margin-top: .15rem;
    color: var(--app-strong-helper-text, #405363);
    font-size: var(--scheme-font-meta, 11px);
    font-weight: var(--ctp-font-weight-helper);
    line-height: 1.3;
}

.direct-live-log-group .serial-bypass-log-entry {
    padding: .28rem 0;
    border-bottom: 0;
}

.serial-bypass-log-direction {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    color: var(--control-accent, var(--primary, #1f6f8b));
    font-size: var(--scheme-font-meta, 11px);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1.25;
    text-align: center;
}

.serial-bypass-log-direction.is-tx {
    color: var(--control-accent, var(--primary, #1f6f8b));
}

.serial-bypass-log-direction.is-rx {
    color: var(--status-info, #526779);
}

.serial-bypass-log-direction.is-error {
    color: var(--danger, #a94b45);
}

.serial-bypass-log-time {
    min-width: 0;
    color: var(--app-helper-text, #526676);
    font-size: var(--scheme-font-meta, 11px);
    font-weight: var(--ctp-font-weight-helper);
    line-height: 1.45;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.serial-bypass-hex,
.serial-bypass-ascii {
    font-family: Consolas, "Cascadia Mono", monospace;
    font-size: var(--scheme-font-control, 12px);
}

.serial-bypass-log-data {
    min-width: 0;
    color: #1f2a44;
    font-weight: var(--ctp-font-weight-helper);
    line-height: 1.45;
}

.serial-bypass-log-entry.is-error .serial-bypass-log-data {
    color: var(--danger, #a94b45);
}

.serial-bypass-log-data.serial-bypass-hex {
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: anywhere;
}

.serial-bypass-log-data.serial-bypass-ascii {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .serial-tool-control-grid,
    .serial-bypass-control-grid {
        grid-template-columns: 1fr;
    }

    .serial-tool-action-row,
    .serial-bypass-actions {
        justify-content: flex-start;
    }

    .serial-bypass-actions {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .serial-debug-settings {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .network-debug-settings.is-client,
    .network-debug-settings.is-server,
    .gprs-debug-settings {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .network-debug-settings > .network-debug-toggle-button {
        grid-column: 1 / -1;
        justify-self: start;
    }

    .gprs-debug-meter-field {
        grid-column: 1 / -1;
    }

    .serial-debug-settings > .btn,
    .serial-debug-port-group {
        grid-column: 1 / -1;
    }

    .serial-bypass-port-select,
    .serial-bypass-port-select-wrap,
    .serial-bypass-process-select,
    .serial-bypass-process-select-wrap,
    .serial-bypass-main-button {
        width: 100% !important;
    }

    .serial-bypass-table-header {
        flex-direction: column;
    }

    .serial-tool-panel-actions,
    .serial-bypass-table-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .serial-bypass-log-entry {
        grid-template-columns: minmax(76px, max-content) 38px minmax(0, 1fr);
        row-gap: .2rem;
    }

    .network-debug-log-entry {
        grid-template-columns: minmax(76px, max-content) 38px minmax(0, 1fr);
    }

    .gprs-debug-log-entry {
        grid-template-columns: minmax(76px, max-content) 38px minmax(0, 1fr);
    }

    .network-debug-log-peer {
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
    }

    .network-debug-log-length,
    .network-debug-log-entry .serial-bypass-log-data {
        grid-column: 1 / -1;
    }

    .gprs-debug-log-endpoint,
    .gprs-debug-log-entry .network-debug-log-length,
    .gprs-debug-log-entry .serial-bypass-log-data {
        grid-column: 1 / -1;
    }

    .gprs-debug-log-meter,
    .gprs-debug-log-endpoint {
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
    }

    .serial-bypass-log-data {
        grid-column: 1 / -1;
    }

    .serial-tool-log-line {
        align-items: flex-start;
        flex-wrap: wrap;
        white-space: normal;
    }
}

@media (max-width: 680px) {
    .serial-tools-tabs {
        display: grid;
        width: 100%;
    }

    .serial-tools-tab {
        width: 100%;
    }

    .serial-tools-header-actions,
    .serial-tools-bridge-actions,
    .serial-tools-header-actions .btn {
        width: 100%;
    }

    .serial-debug-settings,
    .network-debug-settings.is-client,
    .network-debug-settings.is-server,
    .gprs-debug-settings,
    .serial-debug-send-row {
        grid-template-columns: 1fr;
    }

    .gprs-debug-settings > * {
        grid-column: 1;
        width: 100%;
    }

    .network-debug-peer-toolbar {
        grid-template-columns: 1fr;
    }

    .network-debug-send-error {
        margin-left: 0;
    }

    .serial-debug-send-actions {
        justify-content: flex-start;
    }

    .serial-debug-send-actions .btn:not(.serial-tool-icon-btn) {
        flex: 1 1 auto;
    }
}

/* Drag-and-drop reorder styles */
.drag-handle-cell { vertical-align: middle; }
.drag-over { background-color: #eaf5f8; }
.dragging { opacity: 0.6; }

/* Row action buttons: hidden by default, show on row hover */
#dataItemsBody tr .row-actions { opacity: 0; transform: translateY(4px); transition: opacity .12s ease, transform .12s ease; pointer-events: none; }
#dataItemsBody tr:hover .row-actions,
#dataItemsBody tr:focus-within .row-actions { opacity: 1; transform: translateY(0); pointer-events: auto; }
#dataItemsBody tr .row-actions .btn { padding: .28rem .45rem; min-width: 34px; display:inline-flex; align-items:center; justify-content:center; }

@media (hover: none), (pointer: coarse) {
    #dataItemsBody tr .row-actions {
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }
}

.direct-communication-page {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.communication-page-shell.direct-communication-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.direct-communication-page.container-fluid {
    padding-top: .5rem !important;
    padding-bottom: .5rem !important;
}

.direct-communication-page .page-header-bar {
    flex: 0 0 auto;
    margin-bottom: var(--ctp-space-2) !important;
}

.direct-workbench-header {
    z-index: 40;
    overflow: visible;
}

.direct-statusline {
    display: flex;
    align-items: center;
    gap: var(--ctp-space-2);
    min-width: 0;
    overflow: hidden;
    color: var(--ctp-color-helper);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-helper);
    line-height: 1.25;
    white-space: nowrap;
}

.direct-statusline > span {
    flex: 0 0 auto;
}

.direct-status-dot {
    width: 9px;
    height: 9px;
    border-radius: var(--ctp-radius-pill);
    background: var(--ctp-color-info);
    box-shadow: 0 0 0 2px var(--ctp-color-info-bg);
}

.direct-status-dot.is-running {
    background: var(--ctp-color-success);
    box-shadow: 0 0 0 2px var(--ctp-color-success-bg);
}

.direct-status-dot.is-stopping {
    background: var(--ctp-color-warning);
    box-shadow: 0 0 0 2px var(--ctp-color-warning-bg);
}

.direct-page-fieldset {
    display: flex;
    min-width: 0;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    margin: 0;
    padding: 0;
    border: 0;
}

.direct-page-fieldset > .direct-setup-shell {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    margin-bottom: 0 !important;
    overflow: hidden;
}

.direct-page-fieldset > .communication-run-setup {
    display: none;
}

.direct-setup-shell {
    margin-top: 0;
}

.direct-setup-body {
    display: flex;
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    padding: 0;
}

.direct-workbench {
    display: grid;
    flex: 1 1 auto;
    grid-template-rows: minmax(0, 1fr) 240px;
    gap: var(--ctp-space-2);
    height: 100%;
    max-height: 100%;
    min-height: 0;
    width: 100%;
}

.direct-main-panels {
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: minmax(300px, .6fr) minmax(680px, 1.4fr);
    gap: var(--ctp-space-2);
    align-items: stretch;
    min-height: 0;
    width: 100%;
}

.direct-workbench-pane,
.direct-library-panel {
    min-width: 0;
}

.direct-workbench-pane {
    min-height: 0;
    overflow: hidden;
    border-color: var(--ctp-color-line);
    border-radius: var(--ctp-radius-card);
    background: var(--ctp-color-surface);
    box-shadow: var(--ctp-shadow-subtle);
}

.direct-library-panel {
    grid-column: 1;
    grid-row: 1;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
}

.direct-protocol-tabs.data-item-library-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin: 0;
    max-width: 100%;
    padding: 4px;
    border: 1px solid #c9d5de;
    border-radius: 6px;
    background: #e9f0f4;
    box-shadow: none;
    overflow-x: auto;
    overflow-y: hidden;
}

.direct-protocol-tabs.data-item-library-tabs .scheme-workspace-tab {
    appearance: none;
    flex: 0 0 auto;
    min-height: var(--app-control-height);
    min-width: 78px;
    padding: 0 var(--app-control-padding-x);
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 4px;
    background: transparent;
    box-shadow: none;
    color: #425567;
    font-size: var(--scheme-font-body);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1;
    cursor: pointer;
}

.direct-protocol-tabs.data-item-library-tabs .scheme-workspace-tab:hover,
.direct-protocol-tabs.data-item-library-tabs .scheme-workspace-tab:focus {
    border-bottom-color: transparent;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: none;
    color: #1f3345;
}

.direct-protocol-tabs.data-item-library-tabs .scheme-workspace-tab:focus-visible {
    outline: 2px solid rgba(31, 111, 139, .34);
    outline-offset: -2px;
}

.direct-protocol-tabs.data-item-library-tabs .scheme-workspace-tab.active {
    border-bottom-color: var(--primary);
    background: #fff;
    box-shadow: 0 1px 3px rgba(36, 57, 74, 0.18);
    color: #0f2638;
}

.direct-protocol-tabs.data-item-library-tabs .scheme-workspace-tab:disabled {
    cursor: not-allowed;
    opacity: .65;
}

.direct-selected-panel {
    grid-column: 2;
    grid-row: 1;
    display: block;
    overflow: hidden;
}

.direct-communication-controls,
.direct-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: .65rem;
    align-items: end;
}

.direct-communication-controls {
    grid-template-columns: 1fr;
    gap: .6rem;
}

.direct-basic-settings {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) minmax(82px, .55fr) minmax(92px, .6fr);
    gap: .65rem;
    align-items: end;
}

.direct-serial-settings {
    margin-top: .65rem;
}

.direct-filterbar {
    display: grid;
    grid-template-columns: minmax(136px, .7fr) minmax(112px, .45fr);
    gap: var(--ctp-space-2);
    min-width: 0;
    padding: var(--ctp-space-2);
    border-bottom: 1px solid var(--ctp-color-line);
    background: var(--ctp-color-page-subtle);
}

.direct-filter-search-field {
    grid-column: 1 / -1;
}

.direct-filter-field {
    display: grid;
    gap: var(--ctp-space-1);
    min-width: 0;
}

.direct-filter-field .form-label {
    margin: 0;
    color: var(--ctp-color-helper-strong);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1.25;
}

.direct-filter-field .form-select,
.direct-filter-field .form-control {
    width: 100%;
    max-width: none;
    min-width: 0;
    min-height: var(--app-control-height);
    overflow: hidden;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1.15;
}

.direct-filter-field .searchable-select,
.direct-filter-field .searchable-select-trigger {
    width: 100%;
    min-width: 0;
}

.direct-filter-object-file-select {
    min-height: var(--app-control-height);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
}

.direct-picker-tools {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: var(--ctp-space-2);
    min-width: 0;
    padding: var(--ctp-space-2);
    border-bottom: 1px solid var(--ctp-color-line);
    background: var(--ctp-color-surface);
}

.direct-filter-summary {
    justify-self: end;
    max-width: 100%;
    min-width: 0;
    padding: var(--ctp-space-1) var(--ctp-space-2);
    overflow: hidden;
    border: 1px solid var(--ctp-color-line);
    border-radius: var(--ctp-radius-pill);
    background: var(--ctp-color-surface-muted);
    color: var(--ctp-color-helper);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.direct-filter-search {
    width: 100%;
}

.direct-selection-actions {
    display: flex;
    align-items: center;
    gap: var(--ctp-space-1);
    min-width: 0;
}

.direct-mini-action-button {
    min-width: 48px !important;
    padding-right: .35rem !important;
    padding-left: .35rem !important;
}

.modal-dialog.direct-run-config-dialog {
    width: min(960px, calc(100vw - 32px));
    max-width: min(960px, calc(100vw - 32px));
    margin-right: auto;
    margin-left: auto;
}

.direct-run-config-modal-body {
    max-height: calc(100dvh - 180px);
    padding: .85rem;
    overflow-y: auto;
}

.direct-run-config-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.direct-run-config-button {
    display: inline-flex;
    align-items: center;
    width: auto !important;
    min-width: 0;
    gap: .25rem;
    min-height: 32px;
    padding: .32rem .55rem !important;
    text-align: left;
    white-space: nowrap;
}

.direct-dlms-config-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 86px;
    min-height: 32px;
    padding: .32rem .55rem !important;
    white-space: nowrap;
}

.direct-run-config-title {
    flex: 0 0 auto;
    color: #172b3a;
    font-size: var(--scheme-font-body);
    font-weight: var(--ctp-font-weight-title);
    line-height: 1.25;
}

.direct-config-modal-section {
    min-width: 0;
    padding: .75rem;
    border: 1px solid #e1e8f0;
    border-radius: 6px;
    background: #fbfdff;
}

.direct-config-modal-section + .direct-config-modal-section {
    margin-top: .75rem;
}

.direct-config-modal-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .65rem;
    color: #172b3a;
    font-size: var(--scheme-font-section);
    font-weight: var(--ctp-font-weight-title);
}

.direct-config-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .65rem;
    align-items: end;
}

.direct-config-communication-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.direct-config-grid .form-label {
    margin-bottom: .25rem;
    color: #425466;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
}

.direct-config-serial-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: .65rem;
}

.direct-transport-target-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-width: 0;
    margin-top: .65rem;
    padding: .6rem .65rem;
    border: 1px solid #dce7ef;
    border-radius: 6px;
    background: #fff;
}

.direct-transport-target-info {
    display: grid;
    min-width: 0;
    gap: .15rem;
}

.direct-transport-target-label,
.direct-transport-target-hint {
    color: var(--app-helper-text);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1.25;
}

.direct-transport-target-hint {
    font-weight: var(--ctp-font-weight-helper);
}

.direct-transport-target-info strong {
    min-width: 0;
    overflow: hidden;
    color: #172b3a;
    font-size: var(--scheme-font-section);
    font-weight: var(--ctp-font-weight-title);
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.direct-transport-target-actions {
    display: flex;
    align-items: center;
    gap: .45rem;
    flex: 0 0 auto;
}

.direct-gprs-target-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    margin-top: .65rem;
}

.direct-gprs-target-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-width: 0;
}

.direct-gprs-target-actions {
    display: flex;
    align-items: center;
    gap: .45rem;
    flex: 0 0 auto;
}

.direct-gprs-target-field {
    min-width: 0;
    width: 100%;
}

.direct-gprs-select-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: .5rem;
}

.direct-gprs-select-row .form-select {
    min-width: 0;
}

.direct-gprs-empty {
    margin-top: .55rem;
    padding: .55rem .6rem;
    border: 1px dashed #d8e3ec;
    border-radius: 6px;
    color: var(--app-helper-text);
    background: #f8fbfd;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-helper);
    line-height: 1.4;
    text-align: center;
}

.direct-meter-address-source {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
}

.dropdown-menu .dropdown-item {
    color: var(--app-menu-item-ink);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1.25;
    padding: 6px 12px;
}

.dropdown-menu .dropdown-item:disabled,
.dropdown-menu .dropdown-item.disabled {
    color: var(--app-menu-item-muted);
    font-weight: var(--ctp-font-weight-helper);
}

.direct-meter-address-option {
    display: flex;
    align-items: center;
    gap: .45rem;
    min-width: 0;
    min-height: 38px;
    margin: 0;
    padding: .45rem .6rem;
    border: 1px solid #d8e3ec;
    border-radius: 6px;
    background: #fff;
    color: #33495a;
    font-size: var(--scheme-font-body);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1.25;
    cursor: pointer;
}

.direct-meter-address-option.active {
    border-color: #a9cbd8;
    background: #eaf5f8;
    color: #1f6f8b;
}

.direct-meter-address-option span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.direct-manual-meter-address {
    margin-top: .65rem;
}

.direct-manual-meter-address .form-label {
    margin-bottom: .25rem;
    color: #425466;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
}

.direct-config-variable-list {
    gap: .45rem;
}

.direct-run-actions {
    display: flex;
    align-items: center;
    gap: var(--ctp-space-1);
    flex-wrap: nowrap;
}

.direct-run-actions .btn {
    width: 132px;
    min-width: 132px;
    min-height: var(--app-control-height);
    padding-top: .32rem;
    padding-bottom: .32rem;
    text-align: center;
}

.direct-run-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--ctp-space-1);
    min-width: 0;
}

.direct-run-toolbar .direct-run-config-button {
    flex: 0 0 auto;
    max-width: none;
}

.direct-run-toolbar .direct-dlms-config-button {
    flex: 0 0 auto;
}

.direct-run-toolbar .direct-run-actions {
    flex: 0 0 auto;
}

.direct-variable-list {
    display: grid;
    gap: .5rem;
}

.direct-variable-row {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1fr) auto;
    gap: .5rem;
    align-items: center;
}

.direct-picker-list {
    min-height: 0;
    max-height: none;
    border: 0;
    border-radius: 0;
    background: var(--ctp-color-surface);
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.direct-picker-item {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    column-gap: .5rem;
    align-items: center;
    min-height: 42px;
    margin: 0;
    padding: .28rem .55rem .28rem .85rem;
    border: 0;
    border-bottom: 1px solid var(--ctp-color-line);
    border-radius: 0;
    background: var(--ctp-color-surface);
    cursor: pointer;
    transition: background var(--ctp-motion-fast) ease, box-shadow var(--ctp-motion-fast) ease;
}

.direct-picker-item:last-child {
    border-bottom: 0;
}

.direct-picker-item::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: transparent;
    content: "";
}

.direct-picker-item:hover {
    background: var(--ctp-color-action-soft);
}

.direct-picker-item.direct-item-selected {
    background: var(--ctp-color-selected);
}

.direct-picker-item.direct-item-selected::before {
    background: var(--ctp-color-primary);
}

.direct-picker-item:focus-within {
    box-shadow: inset 0 0 0 2px rgba(31, 111, 139, .18);
}

.direct-picker-item .form-check-input {
    margin-top: 0;
}

.direct-picker-body {
    display: grid;
    grid-template-columns: minmax(88px, .72fr) minmax(0, 1fr);
    gap: .45rem;
    align-items: center;
    min-width: 0;
}

.direct-picker-key {
    min-width: 0;
    overflow: hidden;
    color: var(--ctp-color-text);
    font-family: var(--ctp-font-mono);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-title);
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.direct-picker-name {
    min-width: 0;
    overflow: hidden;
    color: var(--ctp-color-helper);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-title);
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.direct-picker-side {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 34px;
}

.direct-picker-frame {
    color: var(--app-helper-text);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-helper);
    line-height: 1;
    white-space: nowrap;
}

.direct-selected-list {
    height: 100%;
    min-height: 0;
    max-height: none;
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
    border: 0;
    border-radius: 0;
    background: var(--ctp-color-surface);
}

.direct-selected-empty {
    padding: .85rem;
    color: var(--ctp-color-helper);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-helper);
    line-height: 1.4;
    text-align: center;
}

.direct-selected-row {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 300px);
    gap: .55rem;
    align-items: center;
    min-height: 44px;
    padding: .35rem .65rem .35rem .9rem;
    border-bottom: 1px solid var(--ctp-color-line);
    background: var(--ctp-color-surface);
}

.direct-selected-row:last-child {
    border-bottom: 0;
}

.direct-selected-row::before {
    position: absolute;
    inset: .55rem auto .55rem 0;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: transparent;
    content: "";
}

.direct-selected-row.direct-current-row {
    background: var(--ctp-color-selected);
}

.direct-selected-row.direct-current-row::before {
    background: var(--primary);
}

.direct-selected-row.direct-current-row .comm-step-index {
    border-color: #a9cbd8;
    background: #dff0f7;
    color: #1f6f8b;
}

.direct-selected-row .comm-step-index {
    min-width: 32px;
    height: 28px;
    border-radius: 6px;
    font-size: var(--scheme-font-body);
}

.direct-selected-main {
    display: flex;
    align-items: center;
    gap: .45rem;
    min-width: 0;
    overflow: hidden;
}

.direct-selected-key {
    flex: 0 1 180px;
    min-width: 0;
    overflow: hidden;
    color: #0d2238;
    font-family: "Cascadia Mono", Consolas, monospace;
    font-size: var(--scheme-font-body);
    font-weight: var(--ctp-font-weight-title);
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.direct-selected-name {
    flex: 0 1 auto;
    min-width: 54px;
    overflow: hidden;
    color: var(--app-helper-text-strong);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.direct-selected-meta {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: .35rem;
    min-width: 0;
}

.direct-selected-frame {
    color: var(--app-helper-text);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-helper);
    line-height: 1.2;
    white-space: nowrap;
}

.direct-selected-meta .comm-step-chip {
    justify-content: center;
    min-width: 58px;
}

.direct-selected-result {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: .4rem;
    min-width: 0;
    overflow: hidden;
}

.direct-selected-result .direct-result-pill {
    flex: 0 0 auto;
}

.direct-selected-result .direct-result-detail {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 190px;
    margin-top: 0;
    text-align: left;
}

.direct-write-value-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .35rem;
    min-width: 0;
    margin-top: .25rem;
}

.direct-selected-write-value {
    flex: 1 1 220px;
    max-width: 360px;
    margin-top: 0;
}

.direct-write-value-label {
    color: #6b7b88;
    font-size: var(--scheme-font-meta);
    font-weight: var(--ctp-font-weight-helper);
    line-height: 1;
    white-space: nowrap;
}

.direct-write-value-row .macro-highlight-editor {
    min-width: 0;
}

.direct-write-value-row .direct-write-value-input {
    min-height: 28px;
    padding: .2rem .4rem;
    font-size: var(--scheme-font-control);
}

.direct-write-value-row .value-assistant-link {
    line-height: 1;
}

.direct-result-pill {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-height: 22px;
    padding: 0 .45rem;
    border-radius: 999px;
    border: 1px solid #cfdbe5;
    background: #f5f8fa;
    color: #516273;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1.4;
    white-space: nowrap;
}

.direct-result-pill.is-ok {
    border-color: var(--status-ok-border);
    background: var(--status-ok-bg);
    color: var(--status-ok-text);
}

.direct-result-pill.is-ng {
    border-color: #e0c2bf;
    background: #fbf1f0;
    color: #8a3a35;
}

.direct-result-pill.is-running {
    border-color: #a9cbd8;
    background: #eaf5f8;
    color: #1f6f8b;
}

.direct-result-detail {
    min-width: 0;
    margin-top: .2rem;
    color: #657484;
    font-size: var(--scheme-font-meta);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.direct-collapse {
    padding-top: .65rem;
    border-top: 1px solid #e4ebf3;
}

.direct-collapse > summary {
    cursor: pointer;
    list-style: none;
    font-weight: var(--ctp-font-weight-control);
    color: #2f4454;
    user-select: none;
}

.direct-collapse > summary::-webkit-details-marker {
    display: none;
}

.direct-collapse > summary::before {
    content: ">";
    display: inline-block;
    margin-right: .4rem;
    color: #1f6f8b;
    transition: transform .12s ease;
}

.direct-collapse[open] > summary::before {
    transform: rotate(90deg);
}

.direct-collapse[open] .direct-settings-grid {
    margin-top: .65rem;
}

.direct-log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ctp-space-3);
    min-height: 38px;
    padding: var(--ctp-space-2);
    border-bottom: 1px solid var(--ctp-color-line);
    background: var(--ctp-color-page-subtle);
}

.direct-log-header h2 {
    margin: 0;
    color: var(--ctp-color-text);
    font-size: var(--scheme-font-section);
    font-weight: var(--ctp-font-weight-title);
    line-height: 1.2;
}

.direct-log-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--ctp-space-2);
}

.direct-log-list {
    display: grid;
    align-content: start;
    gap: .9rem;
    min-height: 0;
    max-height: none;
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
    padding: .25rem .15rem;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.direct-log-entry {
    display: grid;
    gap: .22rem;
    min-width: 0;
    padding: .1rem .15rem .7rem;
    border-bottom: 1px solid #edf2f6;
    background: transparent;
}

.direct-log-entry.is-expandable {
    cursor: pointer;
}

.direct-log-entry.is-expandable:hover .direct-log-title,
.direct-log-entry.is-expandable:hover .direct-log-message {
    color: #1f6f8b;
}

.direct-log-entry:last-child {
    border-bottom: 0;
}

.direct-log-heading {
    display: flex;
    align-items: center;
    gap: .4rem;
    min-width: 0;
}

.direct-log-line {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: .55rem;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.direct-log-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    padding: .08rem .42rem;
    border-radius: 4px;
    background: #e7edf2;
    color: #46596b;
    font-size: var(--scheme-font-small);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1.4;
    flex: 0 0 auto;
}

.direct-log-entry.is-ok .direct-log-status {
    background: var(--status-ok);
    color: #fff;
}

.direct-log-entry.is-ng .direct-log-status {
    background: #a94b45;
    color: #fff;
}

.direct-log-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: #1c2b36;
    font-size: var(--scheme-font-body);
    font-weight: var(--ctp-font-weight-title);
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.direct-log-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--app-helper-text);
    font-size: var(--scheme-font-meta);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1;
    transition: background-color .12s ease, color .12s ease, transform .12s ease;
}

.direct-log-toggle:hover {
    background: #e8f2f7;
    color: #1f6f8b;
}

.direct-log-entry.is-expanded .direct-log-toggle {
    transform: rotate(90deg);
}

.direct-log-time,
.direct-log-detail {
    min-width: 0;
    color: var(--app-helper-text);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-helper);
}

.direct-log-time {
    font-weight: var(--ctp-font-weight-helper);
}

.direct-log-sequence {
    color: #1f2d38;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
    flex: 0 0 auto;
}

.direct-log-message,
.direct-log-detail {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.direct-log-message {
    flex: 1 1 auto;
    color: #22323d;
    font-size: var(--scheme-font-meta);
    font-weight: var(--ctp-font-weight-body);
}

.direct-log-entry.is-expanded .direct-log-title,
.direct-log-entry.is-expanded .direct-log-message {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.direct-log-expanded-details {
    display: grid;
    gap: .45rem;
    max-height: 180px;
    min-width: 0;
    overflow: auto;
    margin-top: .35rem;
    padding: .5rem .6rem;
    border: 1px solid #dce7ef;
    border-radius: 6px;
    background: #f7fafc;
}

.direct-log-detail-block {
    min-width: 0;
}

.direct-log-detail-label {
    margin-bottom: .15rem;
    color: var(--app-helper-text);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1.2;
}

.direct-log-detail-text {
    min-width: 0;
    color: #1f2d38;
    font-size: var(--scheme-font-meta);
    font-weight: var(--ctp-font-weight-body);
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.direct-item-selected {
    background: #f2f8ff;
}

.direct-log-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
}

.direct-log-panel .serial-bypass-log-list {
    min-height: 0;
    max-height: none;
    border: 0;
    border-radius: 0;
    background: var(--ctp-color-surface);
}

@media (max-width: 1320px) {
    .direct-basic-settings {
        grid-template-columns: minmax(120px, 1fr) minmax(76px, .5fr) minmax(86px, .55fr);
    }
}

@media (max-width: 1260px) {
    .modal-dialog.direct-run-config-dialog {
        width: min(960px, calc(100vw - 24px));
        max-width: min(960px, calc(100vw - 24px));
    }

    .direct-communication-page,
    .communication-page-shell.direct-communication-page {
        display: block;
        height: auto;
        overflow: visible;
    }

    .direct-page-fieldset,
    .direct-page-fieldset > .direct-setup-shell {
        display: block;
        overflow: visible;
    }

    .direct-setup-body {
        display: block;
    }

    .direct-workbench {
        grid-template-rows: auto 220px;
        height: auto;
        max-height: none;
    }

    .direct-main-panels {
        grid-template-columns: 1fr;
        grid-template-rows: 360px 520px;
    }

    .direct-workbench-pane {
        position: static;
        max-height: none;
    }

    .direct-library-panel,
    .direct-selected-panel,
    .direct-log-panel {
        grid-column: auto;
        grid-row: auto;
    }

    .direct-log-panel {
        min-height: 220px;
    }

    .direct-config-grid,
    .direct-config-serial-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .direct-main-panels {
        grid-template-rows: 360px 360px;
    }

    .direct-variable-row {
        grid-template-columns: 1fr;
        display: grid;
    }

    .direct-communication-controls,
    .direct-settings-grid,
    .direct-basic-settings {
        grid-template-columns: 1fr;
    }

    .direct-picker-list {
        max-height: 360px;
    }

    .direct-selected-list {
        max-height: 360px;
    }

    .direct-filterbar,
    .direct-picker-tools {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .direct-filter-summary {
        justify-self: start;
    }

    .direct-selection-actions {
        width: 100%;
    }

    .direct-selection-actions .btn {
        flex: 1 1 120px;
    }

    .direct-selected-row {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
    }

    .direct-selected-main {
        flex-wrap: wrap;
    }

    .direct-selected-meta,
    .direct-selected-result {
        grid-column: 2 / -1;
        justify-content: flex-start;
    }

    .direct-selected-write-value {
        flex-basis: 100%;
        max-width: none;
    }

    .direct-selected-result .direct-result-detail {
        max-width: 100%;
        text-align: left;
    }

    .direct-variable-row .btn {
        width: 100%;
    }

    .direct-run-toolbar {
        flex-wrap: wrap;
        width: 100%;
    }

    .direct-run-toolbar .direct-run-config-button {
        flex: 1 1 120px;
        max-width: none;
    }

    .direct-run-toolbar .direct-run-actions {
        flex: 2 1 220px;
    }

    .direct-run-toolbar .direct-run-actions .btn {
        width: auto;
        min-width: 96px;
        flex: 1 1 96px;
    }

    .direct-log-header {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .direct-log-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .direct-write-value-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .direct-write-value-label {
        grid-column: 1 / -1;
    }

    .direct-meter-address-source {
        grid-template-columns: 1fr;
    }

    .direct-transport-target-panel,
    .direct-gprs-target-header,
    .direct-gprs-target-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .direct-gprs-select-row {
        grid-template-columns: 1fr;
    }

    .direct-config-grid,
    .direct-config-serial-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .modal-dialog.direct-run-config-dialog {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
    }

    .direct-run-config-modal-body {
        max-height: calc(100dvh - 128px);
        padding: .65rem;
    }

    .direct-config-grid,
    .direct-config-serial-grid {
        grid-template-columns: 1fr;
    }
}

.template-library-page,
.shared-schemes-page {
    color: var(--ink);
}

.scheme-workspace-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 1rem;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    background: #f8fafc;
    box-shadow: var(--shadow-sm);
}

.scheme-workspace-tab {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #405466;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1.2;
    padding: 0 14px;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.scheme-workspace-tab:hover,
.scheme-workspace-tab:focus {
    color: #185a72;
    border-color: #bdd3df;
    background: #eef6fa;
    text-decoration: none;
}

.scheme-workspace-tab:focus-visible {
    outline: 2px solid rgba(31, 111, 139, .45);
    outline-offset: 2px;
}

.scheme-workspace-tab.active {
    color: #ffffff;
    border-color: #1f6f8b;
    background: #1f6f8b;
    box-shadow: 0 6px 14px rgba(31, 111, 139, .18);
}

.scheme-workspace-picker-dialog {
    width: clamp(820px, 72vw, 1080px);
    max-width: calc(100vw - 32px);
    height: clamp(520px, 72vh, 680px);
    max-height: calc(100vh - 32px);
    margin: max(16px, 5vh) auto;
}

.scheme-workspace-picker {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border-radius: 8px;
}

.scheme-workspace-picker .modal-header,
.scheme-workspace-picker .modal-footer {
    flex: 0 0 auto;
}

.scheme-workspace-picker-body {
    display: grid;
    grid-template-columns: 184px minmax(0, 1fr);
    flex: 1 1 auto;
    gap: 0;
    padding: 0;
    min-height: 0;
    max-height: none;
    overflow: hidden;
    background: #ffffff;
}

.scheme-workspace-plain-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.version-history-modal-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: #ffffff;
}

.version-history-compare-result {
    flex: 0 1 auto;
    min-height: 0;
    max-height: 38%;
    margin-bottom: 1rem;
    overflow: auto;
}

.version-history-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    background: #ffffff;
}

.version-history-table {
    min-width: 760px;
}

.version-history-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f4f8fa;
    box-shadow: inset 0 -1px 0 #d8e0e7;
}

.version-history-table td {
    vertical-align: top;
}

.version-history-table td:nth-child(4) {
    min-width: 220px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.version-history-table th:last-child,
.version-history-table td:last-child {
    width: 120px;
    text-align: right;
    white-space: nowrap;
}

.scheme-publish-diff-dialog-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: auto;
    background: #ffffff;
}

.scheme-publish-diff-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .65rem;
}

.scheme-publish-diff-meta-item {
    min-width: 0;
    padding: .55rem .65rem;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    background: #f6f9fb;
}

.scheme-publish-diff-meta-item span,
.scheme-publish-diff-meta-item strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scheme-publish-diff-meta-item span {
    color: var(--app-helper-text);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-helper);
}

.scheme-publish-diff-meta-item strong {
    margin-top: .2rem;
    color: #1c2b36;
    font-size: var(--scheme-font-body);
}

.scheme-publish-diff-baseline {
    max-width: 760px;
}

.scheme-publish-diff-base-item strong {
    white-space: normal;
    overflow-wrap: anywhere;
}

.scheme-publish-diff-result {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    padding: .75rem;
    background: #ffffff;
}

.scheme-compare-diff-dialog-body {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    flex: 1 1 auto;
    gap: 10px;
    min-height: 0;
    padding: 12px;
    overflow: hidden;
    background: #f6f8fa;
}

.scheme-source-tabs.scheme-compare-source-tabs {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    overflow: visible;
}

.scheme-compare-source-tabs .scheme-source-tab {
    width: auto;
    min-width: max-content;
    min-height: 34px;
    padding: 6px 12px;
    border-color: #d8e0e7;
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.scheme-compare-source-tabs .scheme-source-tab.active::before {
    top: auto;
    right: 12px;
    bottom: 4px;
    left: 12px;
    width: auto;
    height: 3px;
}

.scheme-compare-toolbar {
    display: grid;
    grid-template-columns: minmax(260px, .9fr) minmax(360px, 1.45fr);
    gap: 10px;
    min-width: 0;
    min-height: 0;
}

.scheme-compare-current-card,
.scheme-compare-target-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: .65rem .75rem;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.scheme-compare-current-card {
    background: #f7fafc;
}

.scheme-compare-card-eyebrow {
    color: var(--app-helper-text);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-helper);
}

.scheme-compare-current-title {
    min-width: 0;
    overflow: hidden;
    color: #1c2b36;
    font-size: var(--scheme-font-body);
    font-weight: var(--ctp-font-weight-title);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scheme-compare-unsaved-hint {
    padding: .42rem .55rem;
    font-size: var(--scheme-font-control);
}

.scheme-compare-target-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
    align-items: end;
    min-width: 0;
}

.scheme-compare-target-fields .form-label {
    margin-bottom: .25rem;
}

.scheme-compare-result-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    overflow: hidden;
    padding: .75rem;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.scheme-compare-result-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, .9fr);
    gap: .75rem;
    align-items: center;
    min-width: 0;
}

.scheme-compare-direction-hint {
    padding: .45rem .6rem;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    background: #f6f9fb;
    color: #536475;
    font-size: var(--scheme-font-control);
    line-height: 1.4;
}

.scheme-compare-result-body {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.scheme-compare-diff-result {
    flex: 1 1 auto;
    width: 100%;
}

.scheme-compare-diff-result .table-responsive {
    overflow: visible;
}

.scheme-compare-diff-result table {
    min-width: 1040px;
}

.scheme-compare-diff-result thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f4f8fa;
    box-shadow: inset 0 -1px 0 #d8e0e7;
}

.scheme-compare-diff-result th:nth-child(6),
.scheme-compare-diff-result td:nth-child(6),
.scheme-compare-diff-result th:nth-child(7),
.scheme-compare-diff-result td:nth-child(7) {
    min-width: 180px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.scheme-source-tabs {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 4px;
}

.scheme-workspace-source-rail {
    min-width: 0;
    padding: 10px 8px;
    border: 0;
    border-right: 1px solid #d8e0e7;
    border-radius: 0;
    background: #f7fafc;
    overflow: auto;
}

.scheme-source-tab {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 7px 10px 7px 15px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #35495b;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1.25;
    text-align: left;
    white-space: nowrap;
}

.scheme-source-tab-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scheme-source-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    border: 1px solid #d8e0e7;
    border-radius: 999px;
    background: #eef4f7;
    color: #496273;
    font-size: var(--scheme-font-meta);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1;
    padding: 0 7px;
}

.scheme-source-tab:hover,
.scheme-source-tab:focus {
    border-color: #c9d8e1;
    background: #edf4f7;
    color: #185a72;
    outline: 0;
}

.scheme-source-tab.active {
    border-color: #c8dce6;
    background: #ffffff;
    color: #185a72;
    box-shadow: 0 8px 18px rgba(27, 59, 78, .08);
}

.scheme-source-tab.active .scheme-source-tab-count {
    border-color: #b8d5e1;
    background: #e4f1f6;
    color: #185a72;
}

.scheme-source-tab.active::before {
    content: "";
    position: absolute;
    top: 9px;
    bottom: 9px;
    left: 6px;
    width: 3px;
    border-radius: 999px;
    background: #1f6f8b;
}

.scheme-workspace-content {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    padding: 0;
    background: #ffffff;
}

.scheme-workspace-content.scheme-workspace-three-pane {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
}

.scheme-workspace-select-pane {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    padding: 12px;
    border-right: 1px solid #d8e0e7;
    background: #ffffff;
}

.scheme-workspace-preview-pane {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    padding: 12px;
    background: #f6f8fa;
}

.scheme-source-panel {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    min-width: 0;
    min-height: 100%;
}

.scheme-picker-select-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .75rem;
    align-items: stretch;
    min-width: 0;
    padding: .85rem;
    border: 1px solid #d8e0e7;
    border-radius: var(--card-radius);
    background: #f9fbfc;
    box-shadow: var(--shadow-sm);
}

.scheme-library-picker-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .75rem;
    align-items: end;
    min-width: 0;
}

.scheme-picker-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .5rem;
    align-items: center;
    min-width: 0;
    padding: .65rem;
    border: 1px solid #d8e0e7;
    border-radius: var(--card-radius);
    background: #fbfcfd;
    box-shadow: var(--shadow-sm);
}

.scheme-picker-compact-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.scheme-picker-row {
    appearance: none;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .75rem;
    align-items: center;
    min-width: 0;
    min-height: 58px;
    padding: .7rem .75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface);
    color: #1c2b36;
    text-align: left;
    box-shadow: 0 1px 2px rgba(27, 59, 78, .04);
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.scheme-picker-row:hover {
    border-color: #b7cbd6;
    background: #f8fbfc;
    box-shadow: 0 8px 18px rgba(27, 59, 78, .08);
}

.scheme-picker-row.is-selected {
    border-color: #78a9bd;
    background: #eef7fa;
    box-shadow: inset 3px 0 0 #1f6f8b, 0 8px 18px rgba(31, 111, 139, .1);
}

.scheme-picker-row-composite {
    cursor: default;
}

.scheme-picker-row-select {
    appearance: none;
    display: block;
    min-width: 0;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.scheme-picker-row-select:focus-visible {
    border-radius: 4px;
    outline: 2px solid rgba(31, 111, 139, .38);
    outline-offset: 3px;
}

.scheme-picker-row-main {
    display: grid;
    gap: .22rem;
    min-width: 0;
}

.scheme-picker-row-title-line {
    display: flex;
    align-items: center;
    gap: .45rem;
    min-width: 0;
    flex-wrap: wrap;
}

.scheme-picker-row-main strong {
    min-width: 0;
    color: #1c2b36;
    font-size: var(--scheme-font-body);
    font-weight: var(--ctp-font-weight-title);
    line-height: 1.25;
    word-break: break-word;
}

.scheme-picker-row-main > span {
    color: var(--muted);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-helper);
    line-height: 1.35;
    word-break: break-word;
}

.scheme-picker-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
    color: var(--muted);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
}

.scheme-picker-row-meta span {
    border: 1px solid #d8e0e7;
    border-radius: 3px;
    background: #f7fafc;
    padding: 2px 7px;
    word-break: normal;
}

.scheme-picker-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .4rem;
    min-width: max-content;
}

.scheme-picker-row-actions .btn {
    min-height: 32px;
    white-space: nowrap;
}

.scheme-picker-side-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: .4rem;
}

.scheme-preview-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: .75rem;
    min-width: 0;
    min-height: 100%;
}

.scheme-preview-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    min-width: 0;
    padding: .75rem;
    border: 1px solid #d8e0e7;
    border-radius: var(--card-radius);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.scheme-preview-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.scheme-preview-title {
    color: #1c2b36;
    font-size: var(--scheme-font-section);
    font-weight: var(--ctp-font-weight-title);
    line-height: 1.2;
}

.scheme-preview-subtitle {
    min-width: 0;
    margin-top: .2rem;
    color: var(--muted);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-helper);
    line-height: 1.35;
    word-break: break-word;
}

.scheme-preview-body {
    display: grid;
    align-content: start;
    min-width: 0;
    min-height: 0;
    overflow: auto;
    padding: .75rem;
    border: 1px solid #d8e0e7;
    border-radius: var(--card-radius);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.scheme-preview-step-list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.scheme-preview-step-list li {
    position: relative;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: .65rem;
    align-items: start;
    min-width: 0;
    padding: .55rem .65rem .55rem .45rem;
    border: 1px solid #edf2f5;
    border-radius: 6px;
    background: #fbfcfd;
}

.scheme-preview-step-list li::before {
    content: "";
    position: absolute;
    top: 35px;
    bottom: -7px;
    left: calc(.45rem + 15px);
    width: 2px;
    border-radius: 999px;
    background: #dbe7ee;
}

.scheme-preview-step-list li:last-child::before {
    display: none;
}

.scheme-preview-step-index {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    min-width: 32px;
    height: 32px;
    border: 1px solid #d1e1e8;
    border-radius: 999px;
    background: #eef6f9;
    color: #185a72;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-title);
    line-height: 1;
}

.scheme-preview-step-name {
    min-width: 0;
    color: #1c2b36;
    font-size: var(--scheme-font-body);
    font-weight: var(--ctp-font-weight-title);
    line-height: 1.35;
    word-break: break-word;
}

.scheme-preview-actions {
    display: grid;
    gap: .65rem;
    min-width: 0;
    padding: .75rem;
    border: 1px solid #d8e0e7;
    border-radius: var(--card-radius);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.scheme-preview-actions:empty {
    display: none;
}

.scheme-preview-inline-error {
    padding: 0 .25rem;
}

.scheme-preview-action-title {
    color: #1c2b36;
    font-size: var(--scheme-font-title);
    font-weight: var(--ctp-font-weight-title);
    line-height: 1.25;
}

.template-library-toolbar {
    padding: var(--app-card-body-padding);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    display: grid;
    gap: var(--app-density-gap);
}

.template-library-search-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: var(--app-density-gap);
    align-items: center;
}

.template-library-grid,
.shared-schemes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--app-density-gap);
}

.template-library-grid {
    align-items: start;
}

.template-card,
.shared-scheme-card {
    min-height: 210px;
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    padding: var(--app-card-body-padding);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--app-density-gap);
}

.template-card {
    min-height: 0;
    justify-content: flex-start;
    gap: .6rem;
    padding: .95rem 1rem;
}

.shared-scheme-card {
    min-height: 150px;
}

.template-card-header,
.template-card-footer,
.shared-scheme-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--app-density-gap);
}

.shared-scheme-action-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: var(--app-density-gap);
}

.template-card-footer {
    align-items: center;
    justify-content: flex-end;
    border-top: 1px solid #edf2f5;
    margin-top: .2rem;
    padding-top: .55rem;
    color: var(--muted);
    font-size: var(--scheme-font-control);
}

.shared-scheme-owner {
    color: var(--accent);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-title);
    text-transform: uppercase;
}

.scheme-picker-row-title-line .shared-scheme-owner {
    flex: 0 0 auto;
    padding: 2px 7px;
    border: 1px solid #d3e2ea;
    border-radius: 999px;
    background: #f3f8fa;
    color: #557083;
    font-size: var(--scheme-font-meta);
    line-height: 1.2;
}

.template-card-title,
.shared-scheme-title {
    font-size: var(--scheme-font-title);
    line-height: 1.25;
    margin: 4px 0 0;
    font-weight: var(--ctp-font-weight-title);
    color: #1c2b36;
    word-break: break-word;
}

.template-card-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.template-card .template-card-title {
    margin: 0;
}

.shared-scheme-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--muted);
    font-size: var(--scheme-font-control);
}

.shared-scheme-meta span {
    border: 1px solid #d8e0e7;
    border-radius: 3px;
    background: #f7fafc;
    padding: 2px 7px;
}

.template-card-description {
    color: #405466;
    font-size: var(--scheme-font-body);
    line-height: 1.45;
    margin: 0;
}

.template-management-toolbar-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(160px, 220px);
    gap: var(--app-density-gap);
    align-items: center;
}

.template-management-table-wrap {
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.template-management-table {
    margin: 0;
    font-size: var(--scheme-font-control);
}

.template-management-table th {
    color: #2f4454;
    font-weight: var(--ctp-font-weight-control);
    white-space: nowrap;
    background: #f7fafc;
    border-bottom-color: #d8e0e7;
}

.template-management-table td {
    vertical-align: middle;
}

.template-management-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.template-management-name {
    color: #1c2b36;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-title);
    line-height: 1.25;
    word-break: break-word;
}

.template-step-count-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border: 1px solid #d8e0e7;
    border-radius: 3px;
    background: #f7fafc;
    color: var(--muted);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1.2;
    padding: 2px 7px;
    white-space: nowrap;
}

.template-management-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

.template-status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 3px;
    padding: 2px 8px;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
    white-space: nowrap;
}

.template-status-badge.enabled,
.template-status-badge.scenario {
    border: 1px solid var(--status-ok-border);
    background: var(--status-ok-bg);
    color: var(--status-ok-text);
}

.template-status-badge.disabled {
    border: 1px solid #d8e0e7;
    background: #f7fafc;
    color: #647482;
}

.template-status-badge.legacy {
    border: 1px solid #ddd0aa;
    background: #faf5e6;
    color: #6e5621;
}

.template-management-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--app-density-gap);
}

.template-management-enabled-field {
    display: flex;
    align-items: end;
    min-height: var(--app-control-height);
}

.shared-preview-list {
    display: grid;
    gap: 6px;
    font-size: var(--scheme-font-body);
}

.shared-preview-list > div {
    border: 1px solid var(--border-color);
    border-radius: 3px;
    background: #f7fafc;
    padding: 7px 9px;
}

@media (max-width: 720px) {
    .template-library-search-row,
    .template-management-toolbar-grid,
    .template-management-form-grid,
    .scheme-library-picker-fields,
    .scheme-picker-toolbar,
    .scheme-picker-select-card,
    .template-card-header,
    .template-card-footer,
    .shared-scheme-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .template-library-search-row .btn,
    .scheme-workspace-tab,
    .scheme-picker-toolbar .btn,
    .template-card-footer .btn,
    .shared-scheme-actions .btn,
    .shared-scheme-action-group .btn,
    .scheme-picker-side-actions .btn {
        width: 100% !important;
    }

    .scheme-workspace-picker-dialog {
        width: 100vw;
        height: 100vh;
        margin: 0;
    }

    .scheme-workspace-picker {
        border-radius: 0;
    }

    .scheme-publish-diff-meta {
        grid-template-columns: 1fr;
    }

    .scheme-compare-diff-dialog-body {
        grid-template-rows: auto auto minmax(0, 1fr);
        gap: 8px;
        padding: 10px;
    }

    .scheme-source-tabs.scheme-compare-source-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .scheme-compare-toolbar,
    .scheme-compare-target-fields,
    .scheme-compare-result-header {
        grid-template-columns: 1fr;
    }

    .scheme-compare-result-panel {
        padding: 10px;
    }

    .scheme-compare-diff-result table {
        min-width: 980px;
    }

    .scheme-workspace-picker-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
        max-height: none;
        overflow: hidden;
    }

    .scheme-workspace-source-rail {
        flex-direction: row;
        gap: 6px;
        padding: 8px;
        border-right: 0;
        border-bottom: 1px solid #d8e0e7;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .scheme-source-tab {
        width: auto;
        min-width: max-content;
        min-height: 38px;
        justify-content: center;
        padding: 7px 12px;
    }

    .scheme-source-tab.active::before {
        top: auto;
        right: 12px;
        bottom: 4px;
        left: 12px;
        width: auto;
        height: 3px;
    }

    .scheme-workspace-content {
        padding: 0;
    }

    .scheme-workspace-content.scheme-workspace-three-pane {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) minmax(260px, 44vh);
    }

    .scheme-workspace-select-pane {
        padding: 10px;
        border-right: 0;
        border-bottom: 1px solid #d8e0e7;
    }

    .scheme-workspace-preview-pane {
        padding: 10px;
    }

    .scheme-picker-row {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .scheme-picker-row-actions {
        justify-content: flex-start;
        min-width: 0;
        width: 100%;
    }

    .scheme-picker-row-actions .btn {
        width: 100% !important;
    }

    .scheme-preview-panel {
        min-height: 0;
    }

    .scheme-picker-side-actions {
        justify-content: flex-start;
    }

    .scheme-preview-header {
        flex-direction: column;
    }

    .scheme-preview-step-list li {
        grid-template-columns: 1fr;
    }

    .scheme-preview-step-list li::before {
        display: none;
    }

    .shared-scheme-action-group {
        display: grid;
        grid-template-columns: 1fr;
    }
}

.review-message-entry {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.review-message-trigger {
    position: relative;
    width: var(--app-control-height);
    min-width: var(--app-control-height) !important;
    justify-content: center;
    padding: 0;
    border-color: #cbd8e1;
    background: #ffffff;
    color: #1d3444;
}

.review-message-trigger:hover,
.review-message-trigger:focus {
    color: #1f6f8b;
    border-color: #91b8c9;
    background: #f8fbfc;
    box-shadow: 0 0 0 3px rgba(31, 111, 139, .09);
}

.review-message-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 2px solid #ffffff;
    border-radius: 999px;
    background: #a94b45;
    color: #ffffff;
    font-size: var(--scheme-font-meta);
    font-weight: var(--ctp-font-weight-control);
    line-height: 1;
}

.review-message-list-dialog {
    width: min(860px, calc(100vw - 32px));
    max-width: none;
    height: min(640px, calc(100vh - 64px));
    margin: max(18px, 4vh) auto;
}

.review-message-detail-dialog {
    width: min(860px, calc(100vw - 32px));
    max-width: none;
    height: min(640px, calc(100vh - 64px));
    margin: max(18px, 4vh) auto;
}

.review-message-fixed-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    overflow: auto;
    padding: 32px 16px;
    background-color: rgba(20, 47, 60, 0.52);
    backdrop-filter: blur(2px);
}

.modal-overlay.review-message-detail-overlay {
    z-index: 5010;
}

.review-message-modal {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    max-height: calc(100vh - 32px);
    overflow: hidden;
    border-radius: 8px;
    border-color: #c5d5df;
}

.review-message-detail-modal {
    display: flex;
    flex-direction: column;
    height: min(640px, calc(100vh - 64px));
    min-height: 0;
}

.review-message-modal .modal-header,
.review-message-modal .modal-footer {
    flex: 0 0 auto;
}

.review-message-header {
    align-items: flex-start;
    gap: 12px;
}

.review-message-subtitle,
.review-message-detail-title {
    margin-top: 4px;
    color: var(--app-helper-text);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-helper);
    line-height: 1.35;
}

.review-message-detail-title {
    max-width: min(56vw, 560px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.review-message-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.review-message-list-body,
.review-message-detail-body {
    min-height: 0;
    overflow: auto;
    background: #f6fafc;
}

.review-message-list-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    padding: 12px;
    overflow: hidden;
}

.review-message-tabs {
    display: inline-flex;
    align-self: flex-start;
    gap: 6px;
    padding: 4px;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    background: #eef4f7;
}

.review-message-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: var(--app-control-height);
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: #405466;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-control);
}

.review-message-tab.active {
    border-color: #a9cbd8;
    background: #ffffff;
    color: #185a72;
    box-shadow: var(--shadow-sm);
}

.review-message-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #eaf5f8;
    color: #185a72;
    font-size: var(--scheme-font-small);
    font-weight: var(--ctp-font-weight-control);
}

.review-message-loading {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 160px;
    color: #627482;
    font-weight: var(--ctp-font-weight-helper);
}

.review-message-loading.inline {
    justify-content: flex-start;
    min-height: 42px;
}

.review-message-list-body > .empty-state-container {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.review-message-list {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    overflow: auto;
    padding-right: 2px;
}

.review-message-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    background: #ffffff;
    color: inherit;
    text-align: left;
    transition: border-color .14s ease, box-shadow .14s ease, background-color .14s ease;
}

.review-message-row:hover,
.review-message-row:focus {
    border-color: #a9cbd8;
    background: #fbfdfe;
    box-shadow: 0 0 0 3px rgba(31, 111, 139, .08);
    outline: none;
}

.review-message-row-main {
    min-width: 0;
}

.review-message-row-title {
    display: block;
    overflow: hidden;
    color: var(--ink);
    font-size: var(--scheme-font-body);
    font-weight: var(--ctp-font-weight-title);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.review-message-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: 5px;
    color: #627482;
    font-size: var(--scheme-font-meta);
    font-weight: var(--ctp-font-weight-helper);
}

.review-message-row-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.review-message-row-time {
    color: #627482;
    font-size: var(--scheme-font-meta);
    font-weight: var(--ctp-font-weight-helper);
}

.review-message-detail-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    overflow: auto;
}

.review-message-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.review-message-field {
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    background: #ffffff;
}

.review-message-field span,
.review-message-field strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.review-message-field span {
    color: #627482;
    font-size: var(--scheme-font-meta);
    font-weight: var(--ctp-font-weight-helper);
}

.review-message-field strong {
    margin-top: 4px;
    color: var(--ink);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-title);
}

.review-message-note,
.review-message-diff-panel,
.review-message-decision {
    margin-top: 0;
    padding: 10px 12px;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    background: #ffffff;
}

.review-message-section-title {
    margin-bottom: 6px;
    color: #263947;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-title);
}

.review-message-decision .form-label {
    margin-bottom: 6px;
    font-weight: var(--ctp-font-weight-control);
}

.review-message-decision textarea {
    min-height: 74px;
}

.review-message-diff-panel .table-responsive {
    max-height: 320px;
    overflow: auto;
}

@media (max-width: 760px) {
    .review-message-list-dialog,
    .review-message-detail-dialog {
        width: 100vw;
        height: 100vh;
        margin: 0;
    }

    .review-message-modal,
    .review-message-detail-modal {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .review-message-detail-grid {
        grid-template-columns: 1fr;
    }

    .review-message-tabs {
        width: 100%;
        align-self: stretch;
    }

    .review-message-tab {
        flex: 1 1 0;
        justify-content: center;
    }

    .review-message-row {
        grid-template-columns: 1fr;
    }

    .review-message-row-side {
        align-items: flex-start;
    }
}

.read-only-scheme-viewer-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000 !important;
    isolation: isolate;
    overflow: auto;
    padding: 0;
    background-color: rgba(20, 47, 60, 0.58);
    backdrop-filter: blur(2px);
}

.read-only-scheme-viewer-dialog {
    position: relative;
    z-index: 9001;
    width: 100vw;
    max-width: none;
    height: 100vh;
    margin: 0;
}

.read-only-scheme-viewer {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: #f4f7f9;
    box-shadow: 0 24px 70px rgba(11, 31, 45, .26);
}

.read-only-scheme-viewer-header {
    flex: 0 0 auto;
    border-bottom: 1px solid #d8e0e7;
    background: #ffffff;
}

.read-only-scheme-title-block {
    min-width: 0;
}

.read-only-scheme-title-block .modal-title {
    overflow: hidden;
    color: var(--ink);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.read-only-scheme-subtitle {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-top: 4px;
    color: var(--app-helper-text);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-helper);
    line-height: 1.35;
}

.read-only-scheme-subtitle span {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
}

.read-only-scheme-viewer-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    padding: 14px;
    overflow: hidden;
}

.read-only-scheme-editor {
    flex: 1 1 auto;
    align-items: stretch;
    min-height: 0;
}

.read-only-scheme-left-stack {
    position: static;
    top: auto;
    height: 100%;
    min-height: 0;
}

.read-only-scheme-left-stack .scheme-timeline-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.scheme-step-card.read-only {
    cursor: pointer;
}

.scheme-step-card.read-only .scheme-step-title-row {
    align-items: flex-start;
}

.read-only-scheme-detail-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.read-only-scheme-detail-editor {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.read-only-scheme-enabled-strip .form-check-input,
.scheme-config-readonly-fieldset[disabled] .form-check-input,
.scheme-config-readonly-fieldset[disabled] .form-control,
.scheme-config-readonly-fieldset[disabled] .form-select,
.scheme-config-readonly-fieldset[disabled] .searchable-select-trigger {
    cursor: default;
    opacity: 1;
}

.scheme-config-readonly-fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.scheme-config-readonly-fieldset[disabled] {
    opacity: 1;
}

.scheme-config-readonly-fieldset[disabled] .form-control,
.scheme-config-readonly-fieldset[disabled] .form-select,
.scheme-config-readonly-fieldset[disabled] .searchable-select-trigger {
    border-color: #d7e1e8;
    background-color: #eef4f7;
    color: #243746;
}

.scheme-config-readonly-fieldset[disabled] .scheme-item-type-button,
.scheme-config-readonly-fieldset[disabled] .scheme-command-button,
.scheme-config-readonly-fieldset[disabled] .scheme-config-tab {
    opacity: 1;
}

.scheme-config-readonly-fieldset[disabled] .value-assistant-button,
.scheme-config-readonly-fieldset[disabled] .btn {
    pointer-events: none;
}

.read-only-scheme-flow-rules {
    display: grid;
    gap: 12px;
}

.read-only-scheme-flow-rule-items {
    display: grid;
    gap: 10px;
}

.read-only-scheme-flow-rule-item {
    align-items: start;
}

.read-only-scheme-flow-fields {
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    min-width: 0;
}

.read-only-scheme-flow-fields > div {
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    background: #fff;
}

.read-only-scheme-flow-fields span {
    display: block;
    overflow: hidden;
    color: var(--app-helper-text);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-helper);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.read-only-scheme-flow-fields strong {
    display: block;
    overflow: hidden;
    margin-top: 3px;
    color: #263947;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-title);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.read-only-scheme-meta {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.read-only-scheme-meta > div,
.read-only-scheme-detail-grid > div {
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    background: #ffffff;
}

.read-only-scheme-meta span,
.read-only-scheme-detail-grid span {
    display: block;
    overflow: hidden;
    color: var(--app-helper-text);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-helper);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.read-only-scheme-meta strong,
.read-only-scheme-detail-grid strong {
    display: block;
    overflow: hidden;
    margin-top: 4px;
    color: #263947;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-title);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.read-only-scheme-workspace {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: 12px;
    min-height: 0;
}

.read-only-scheme-step-list,
.read-only-scheme-step-detail {
    min-height: 0;
    border: 1px solid #d8e0e7;
    border-radius: 8px;
    background: #ffffff;
}

.read-only-scheme-step-list {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.read-only-scheme-step-detail {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    overflow: auto;
}

.read-only-scheme-pane-title {
    flex: 0 0 auto;
    color: #405466;
    font-size: var(--scheme-font-meta);
    font-weight: var(--ctp-font-weight-title);
}

.read-only-scheme-step-list > .read-only-scheme-pane-title {
    padding: 12px 12px 8px;
}

.read-only-scheme-step-scroll {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    overflow: auto;
    padding: 0 10px 12px;
}

.read-only-scheme-step-row {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 9px;
    width: 100%;
    padding: 8px;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    background: #fbfdfe;
    color: inherit;
    text-align: left;
    transition: border-color .14s ease, box-shadow .14s ease, background-color .14s ease;
}

.read-only-scheme-step-row:hover,
.read-only-scheme-step-row:focus {
    border-color: #a9cbd8;
    box-shadow: 0 0 0 3px rgba(31, 111, 139, .08);
    outline: none;
}

.read-only-scheme-step-row.active {
    border-color: #1f6f8b;
    background: #eef7fa;
}

.read-only-scheme-step-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #e7eef2;
    color: #405466;
    font-size: var(--scheme-font-small);
    font-weight: var(--ctp-font-weight-title);
}

.read-only-scheme-step-row.active .read-only-scheme-step-index {
    background: #1f6f8b;
    color: #ffffff;
}

.read-only-scheme-step-text {
    min-width: 0;
}

.read-only-scheme-step-text strong,
.read-only-scheme-step-text span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.read-only-scheme-step-text strong {
    color: #263947;
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-title);
}

.read-only-scheme-step-text span {
    margin-top: 3px;
    color: var(--app-helper-text);
    font-size: var(--scheme-font-control);
    font-weight: var(--ctp-font-weight-helper);
    line-height: 1.3;
}

.read-only-scheme-detail-heading {
    display: flex;
    flex: 0 0 auto;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e3e9ee;
}

.read-only-scheme-detail-heading h6 {
    margin: 4px 0 0;
    color: var(--ink);
    font-size: var(--ctp-font-size-section-title);
    font-weight: var(--ctp-font-weight-title);
}

.read-only-scheme-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.read-only-scheme-json-section {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.read-only-scheme-json-section.grow {
    flex: 1 1 auto;
}

.read-only-scheme-json-section pre {
    min-height: 88px;
    max-height: 240px;
    margin: 0;
    padding: 10px 12px;
    overflow: auto;
    border: 1px solid #d8e0e7;
    border-radius: 6px;
    background: #f6f9fb;
    color: #263947;
    font-size: var(--scheme-font-meta);
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.read-only-scheme-json-section.grow pre {
    max-height: none;
}

@media (max-width: 900px) {
    .read-only-scheme-viewer-overlay {
        padding: 0;
    }

    .read-only-scheme-viewer-dialog {
        width: 100vw;
        height: 100vh;
        margin: 0;
    }

    .read-only-scheme-viewer {
        border-radius: 0;
    }

    .read-only-scheme-meta {
        grid-template-columns: 1fr 1fr;
    }

    .read-only-scheme-workspace {
        grid-template-columns: 1fr;
    }

    .read-only-scheme-editor {
        grid-template-columns: 1fr;
        overflow: auto;
    }

    .read-only-scheme-step-list {
        max-height: 34vh;
    }

    .read-only-scheme-left-stack {
        height: auto;
    }

    .read-only-scheme-detail-grid {
        grid-template-columns: 1fr 1fr;
    }

    .read-only-scheme-flow-fields {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .read-only-scheme-meta,
    .read-only-scheme-detail-grid {
        grid-template-columns: 1fr;
    }
}
