:root {
    --opc-bg: #101417;
    --opc-surface: #181e22;
    --opc-surface-raised: #20272c;
    --opc-border: #343d43;
    --opc-border-strong: #4a565e;
    --opc-text: #e7ecef;
    --opc-muted: #93a0a8;
    --opc-accent: #3aa58f;
    --opc-selected: #173c3a;
    --opc-danger: #e26565;
    --opc-sidebar-width: 58px;
    --opc-header-height: 42px;
}

html,
body {
    min-height: 100%;
    background: var(--opc-bg);
    color: var(--opc-text);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: 19px;
    line-height: 1.4;
}

body { margin: 0; }
a, .btn-link { color: #63bdb0; }

/* Created dynamically by scada-designer.js, so this rule must not be CSS-scoped. */
.scada-selection-marquee {
    position: absolute;
    z-index: 50;
    box-sizing: border-box;
    pointer-events: none;
    border: 2px solid #087fc4;
    background: rgb(8 127 196 / 16%);
    box-shadow: 0 0 0 1px rgb(255 255 255 / 90%), inset 0 0 0 1px rgb(255 255 255 / 70%);
}

.btn {
    --bs-btn-border-radius: 4px;
    --bs-btn-padding-y: 0.34rem;
    --bs-btn-padding-x: 0.7rem;
    --bs-btn-font-size: 0.82rem;
    font-weight: 600;
}

.btn-sm {
    --bs-btn-padding-y: 0.25rem;
    --bs-btn-padding-x: 0.55rem;
    --bs-btn-font-size: 0.78rem;
}

.btn-primary {
    --bs-btn-bg: #2f8f7c;
    --bs-btn-border-color: #2f8f7c;
    --bs-btn-hover-bg: #3aa58f;
    --bs-btn-hover-border-color: #3aa58f;
    --bs-btn-active-bg: #287a6b;
    --bs-btn-active-border-color: #287a6b;
}

.btn-outline-primary {
    --bs-btn-color: #62c5b1;
    --bs-btn-border-color: #3d8e80;
    --bs-btn-hover-bg: #2f8f7c;
    --bs-btn-hover-border-color: #2f8f7c;
}

.content {
    box-sizing: border-box;
    height: 100%;
    min-width: 0;
    overflow: auto;
    padding: 8px;
}

.ui-page { display: grid; gap: 10px; }
.message-stack { display: grid; gap: 6px; }

.dashboard-heading,
.section-heading {
    display: flex;
    min-height: 50px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.page-title {
    margin: 0;
    font-size: 1.42rem;
    font-weight: 650;
    line-height: 1.2;
}

.page-subtitle,
.section-subtitle,
.text-muted-ui {
    color: var(--opc-muted);
    font-size: 0.8rem;
}

.section-title {
    margin: 0;
    font-size: 0.96rem;
    font-weight: 650;
}

.status-badge,
.badge {
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 650;
    line-height: 1;
    padding: 0.36rem 0.52rem;
    white-space: nowrap;
}

.alert {
    margin: 0;
    border-radius: 4px;
    padding: 0.55rem 0.72rem;
    font-size: 0.82rem;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.metric-grid.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.metric-panel,
.endpoint-panel,
.editor-panel,
.live-table {
    border: 1px solid var(--opc-border);
    border-radius: 6px;
    background: var(--opc-surface);
}

.metric-panel { min-height: 82px; padding: 10px 12px; }
.metric-label { color: var(--opc-muted); font-size: 0.76rem; }
.metric-value { margin-top: 2px; font-size: 1.2rem; font-weight: 650; }
.endpoint-panel, .editor-panel { padding: 11px 12px; }

.endpoint-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.panel-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.endpoint-address,
.code-value {
    overflow-wrap: anywhere;
    color: #b8e1da;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.8rem;
}

.stack-compact { display: grid; align-content: start; gap: 8px; }
.inline-list { display: flex; flex-wrap: wrap; gap: 6px; }
.table-responsive { border-radius: 5px; }

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--opc-text);
    --bs-table-border-color: var(--opc-border);
    --bs-table-hover-bg: #222b30;
    --bs-table-hover-color: var(--opc-text);
    margin: 0;
    font-size: 0.79rem;
}

.table > :not(caption) > * > * { padding: 0.42rem 0.55rem; vertical-align: middle; }

.table thead th {
    color: #b6c0c6;
    background: var(--opc-surface-raised);
    font-size: 0.74rem;
    font-weight: 650;
    white-space: nowrap;
}

.form-grid {
    display: grid;
    grid-template-columns: minmax(100px, 142px) minmax(0, 1fr);
    gap: 7px 10px;
    align-items: center;
}

.form-grid label,
.form-label-compact { margin: 0; color: #b3bdc3; font-size: 0.79rem; }

.config-input,
.config-textarea,
.form-control,
.form-select {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--opc-border-strong);
    border-radius: 4px;
    background-color: #11171a;
    color: var(--opc-text);
    font: inherit;
}

.config-input,
.form-control,
.form-select { min-height: 39px; padding: 5px 8px; font-size: 0.82rem; }

.config-input:focus,
.config-textarea:focus,
.form-control:focus,
.form-select:focus {
    border-color: var(--opc-accent);
    background-color: #11171a;
    color: var(--opc-text);
    box-shadow: none;
    outline: 0;
}

.config-textarea {
    min-height: 150px;
    padding: 8px;
    font-family: Consolas, "Courier New", monospace;
    resize: vertical;
}

.form-check-input { width: 1.05rem; height: 1.05rem; margin: 0; border-color: var(--opc-border-strong); }
.form-check-input:checked { background-color: var(--opc-accent); border-color: var(--opc-accent); }
.field-help { color: var(--opc-muted); font-size: 0.74rem; line-height: 1.25; }
.action-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }

.icon-button {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    flex: 0 0 34px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: #aeb9bf;
    font-size: 1rem;
    line-height: 1;
}

.icon-button:hover:not(:disabled) {
    border-color: var(--opc-border-strong);
    background: var(--opc-surface-raised);
    color: #fff;
}

.icon-button.primary { color: #5ec2ad; }
.icon-button.danger { color: #ee7777; }
.icon-button.warning { color: #e5ad4d; }
.icon-button:disabled { opacity: 0.4; }

.field-order-controls {
    display: inline-flex;
    gap: 0.2rem;
    white-space: nowrap;
}

.dashboard-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

.dialog-scrim {
    position: fixed;
    z-index: 1200;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgb(4 7 9 / 72%);
}

.compact-dialog {
    display: grid;
    width: min(590px, calc(100vw - 48px));
    max-height: calc(100vh - 48px);
    overflow: auto;
    border: 1px solid var(--opc-border-strong);
    border-radius: 6px;
    background: var(--opc-surface);
    box-shadow: 0 18px 50px rgb(0 0 0 / 48%);
}

.compact-dialog-header,
.compact-dialog-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 13px;
}

.compact-dialog-header {
    border-bottom: 1px solid var(--opc-border);
    background: var(--opc-surface-raised);
}

.compact-dialog-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 650;
}

.compact-dialog-body { padding: 13px; }
.compact-dialog > .alert { margin: 0 13px; }

.compact-dialog-footer {
    justify-content: flex-end;
    border-top: 1px solid var(--opc-border);
}

.project-page {
    display: grid;
    grid-template-columns: 350px minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) minmax(180px, 26vh);
    gap: 8px;
    width: 100%;
    min-width: 1080px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.project-page > .dashboard-heading {
    grid-column: 2;
    grid-row: 1;
    min-height: 40px;
}

.project-page > .message-stack {
    grid-column: 2;
    grid-row: 2;
}

.project-page > .alert {
    grid-column: 2;
    grid-row: 2;
    margin: 0;
}

.project-workspace {
    display: contents;
}

.project-workspace > .project-tree-panel {
    grid-column: 1;
    grid-row: 1 / 5;
}

.project-workspace > .properties-fieldset {
    grid-column: 2;
    grid-row: 3;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.data-types-workspace > .properties-fieldset {
    grid-row: 3 / 5;
}

.project-page > .device-tags-panel {
    grid-column: 2;
    grid-row: 4;
}

.project-tree-panel {
    display: flex;
    min-height: 0;
    height: 100%;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.project-property-panel {
    min-height: 0;
    height: 100%;
    overflow: auto;
}

.project-property-panel .form-grid { gap: 4px 10px; }
.project-property-panel .form-grid .config-input { min-height: 34px; padding: 3px 7px; }

.project-tree-header,
.project-property-header,
.device-tags-header,
.tag-publication-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.project-tree-header {
    min-height: 54px;
    flex: 0 0 auto;
    margin: 0;
    padding: 8px 9px;
    border-bottom: 1px solid var(--opc-border);
    background: #1b2226;
}

.project-tree-header > div { min-width: 0; }

.project-tree-header .btn {
    min-height: 32px;
    flex: 0 0 auto;
    padding: 4px 8px;
    font-size: 0.7rem;
    white-space: nowrap;
}

.project-property-header { margin-bottom: 8px; }

.project-tree {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 5px 4px 8px;
}

.tree-branch {
    position: relative;
    min-width: 0;
}

.tree-children {
    position: relative;
    margin: 0 0 0 14px;
    padding-left: 13px;
    border-left: 1px dotted #526169;
}

.tree-children > .tree-branch::before,
.tree-children > .tree-node::before {
    content: "";
    position: absolute;
    top: 16px;
    left: -14px;
    width: 12px;
    border-top: 1px dotted #526169;
}

.tree-node {
    position: relative;
    display: grid;
    grid-template-columns: 25px minmax(0, 1fr) 27px 27px;
    gap: 1px;
    align-items: center;
    min-height: 37px;
    border: 1px solid transparent;
    border-radius: 2px;
    padding: 1px 2px;
    background: transparent;
    transition: border-color 100ms ease, background-color 100ms ease;
}

.tree-node.connection-node {
    min-height: 36px;
}

.tree-node.tag-node {
    grid-template-columns: 25px minmax(0, 1fr) 27px;
    min-height: 34px;
}

.tree-node:hover {
    border-color: #3e4d54;
    background: #202a2f;
}

.tree-node.selected {
    border-color: #4eb19e;
    background: #1d4a45;
    box-shadow: inset 3px 0 0 #5bc2ae;
}

.tree-toggle {
    display: inline-grid;
    width: 22px;
    height: 22px;
    place-items: center;
    padding: 0;
    border: 1px solid #526169;
    border-radius: 2px;
    background: #202a2f;
    color: #d8e0e4;
    cursor: pointer;
}

.tree-toggle:hover {
    border-color: #6ec9b7;
    background: #304047;
    color: #fff;
}

.tree-toggle:focus-visible,
.tree-label:focus-visible,
.icon-button:focus-visible {
    outline: 2px solid #6ec9b7;
    outline-offset: 2px;
}

.tree-toggle[aria-expanded="true"] {
    border-color: #438f82;
    background: #1e4a43;
    color: #b9f0e4;
}

.tree-chevron {
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateX(-2px) rotate(-45deg);
    transition: transform 120ms ease;
}

.tree-chevron.expanded {
    transform: translateY(-2px) rotate(45deg);
}

.tree-label {
    display: grid;
    gap: 0;
    min-width: 0;
    min-height: 29px;
    align-content: center;
    border: 0;
    background: transparent;
    color: var(--opc-text);
    text-align: left;
    cursor: pointer;
}

.tree-label span,
.tree-label small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-label span { font-size: 0.82rem; font-weight: 650; }
.connection-node .tree-label span { font-size: 0.79rem; font-weight: 620; }
.tag-node .tree-label span { font-size: 0.76rem; font-weight: 580; }
.tree-label small { color: #9fadb4; font-size: 0.62rem; }

.device-title-row { display: flex; align-items: center; gap: 6px; min-width: 0; }

.device-status-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 2px rgb(255 255 255 / 5%);
}

.tree-leaf-marker {
    display: grid;
    width: 22px;
    height: 22px;
    place-items: center;
}

.tree-leaf-marker::before {
    content: "#";
    width: auto;
    height: auto;
    border: 0;
    background: transparent;
    color: #7e9992;
    font: 700 0.7rem/1 Consolas, monospace;
}

.tree-node > .icon-button {
    width: 25px;
    height: 25px;
    flex-basis: 25px;
    border-color: transparent;
    background: transparent;
    font-size: 0.86rem;
}

.tree-node > .icon-button:hover:not(:disabled) {
    border-color: #65747c;
    background: #2a353a;
}

.tree-placeholder, .empty-tree { color: var(--opc-muted); font-size: 0.78rem; padding: 6px 9px; }
.tree-placeholder { margin-left: 8px; }
.tree-placeholder.tag-placeholder { margin-left: 8px; }

.project-tree-search {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    align-items: center;
    min-height: 38px;
    flex: 0 0 auto;
    margin: 0;
    padding: 4px 6px;
    border-top: 1px solid var(--opc-border);
    background: #11171a;
}

.project-tree-search input {
    width: 100%;
    min-width: 0;
    height: 28px;
    border: 0;
    background: transparent;
    color: var(--opc-text);
    font-size: 0.74rem;
    outline: 0;
}

.project-tree-search input::placeholder { color: #74828a; }
.project-tree-search input::-webkit-search-cancel-button { display: none; }

.project-tree-search button {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #a7b4bb;
    font-size: 0.9rem;
}

.project-tree-search button:hover { color: #fff; }

.tree-search-glyph {
    position: relative;
    width: 11px;
    height: 11px;
    margin-left: 2px;
    border: 1.5px solid #839199;
    border-radius: 50%;
}

.tree-search-glyph::after {
    content: "";
    position: absolute;
    right: -4px;
    bottom: -3px;
    width: 5px;
    border-top: 1.5px solid #839199;
    transform: rotate(45deg);
}

.properties-grid { max-width: 720px; }

.properties-fieldset { min-width: 0; height: 100%; margin: 0; padding: 0; overflow: hidden; border: 0; }
.properties-fieldset:disabled { opacity: 0.75; }
.device-tags-panel { min-height: 0; overflow: hidden; }
.device-tags-header { margin-bottom: 7px; }
.device-tags-table-wrap { height: calc(100% - 40px); overflow: auto; }

.device-tags-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 0.77rem;
}

.device-tags-table th,
.device-tags-table td {
    border-bottom: 1px solid var(--opc-border);
    padding: 5px 7px;
    text-align: left;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.device-tags-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--opc-surface-raised);
    color: #b6c0c6;
    font-size: 0.72rem;
    font-weight: 650;
}

.device-tags-table tbody tr { cursor: pointer; }
.device-tags-table tbody tr:hover { background: #222b30; }
.device-tags-table tbody tr.selected { background: var(--opc-selected); }
.device-tags-table code { color: #b8e1da; font: 0.75rem Consolas, "Courier New", monospace; }

.data-types-workspace { grid-template-columns: minmax(300px, 34%) minmax(720px, 1fr); }
.type-editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.data-type-table { min-width: 980px; margin: 0; color: var(--opc-text); font-size: 0.75rem; }
.data-type-table th { color: var(--opc-muted); font-size: 0.7rem; font-weight: 650; white-space: nowrap; }
.data-type-table td { min-width: 92px; padding: 4px; vertical-align: middle; }
.data-type-table td:first-child { min-width: 145px; }
.data-type-table .config-input { min-height: 30px; padding: 3px 6px; font-size: 0.75rem; }

.tag-publication-panel {
    display: grid;
    gap: 8px;
    max-width: 720px;
    border-top: 1px solid var(--opc-border);
    padding-top: 9px;
}

.tag-publication-grid {
    display: grid;
    grid-template-columns: minmax(112px, 150px) minmax(0, 1fr);
    gap: 5px 10px;
    align-items: center;
}

.tag-publication-grid > span:nth-child(odd) { color: var(--opc-muted); font-size: 0.76rem; }
.tag-publication-grid code {
    min-width: 0;
    overflow-wrap: anywhere;
    border: 1px solid var(--opc-border);
    border-radius: 4px;
    background: #11171a;
    padding: 4px 6px;
    color: #b8e1da;
    font: 0.75rem Consolas, "Courier New", monospace;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background: var(--opc-bg);
}

.auth-panel {
    width: min(390px, 100%);
    padding: 22px;
    border: 1px solid var(--opc-border);
    border-radius: 6px;
    background: var(--opc-surface);
    box-shadow: 0 14px 34px rgb(0 0 0 / 28%);
}

.auth-brand { margin-bottom: 20px; color: #61c1ae; font-size: 1rem; font-weight: 700; }
.runtime-login-mark {
    width: 64px;
    height: 42px;
    display: grid;
    place-items: center;
    margin-bottom: 16px;
    border: 2px solid #42aa94;
    color: #72d0bd;
    font-size: .72rem;
    font-weight: 750;
}
.auth-panel h1 { margin: 0 0 4px; font-size: 1.42rem; }
.auth-subtitle, .auth-hint { color: var(--opc-muted); font-size: 0.8rem; }
.auth-runtime-users-warning {
    margin: 14px 0 0;
    color: #ff5b67;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.4;
    animation: auth-runtime-users-warning-blink 1s steps(2, end) infinite;
}

@keyframes auth-runtime-users-warning-blink {
    0%, 49.999% { opacity: 1; }
    50%, 100% { opacity: 0.28; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-runtime-users-warning { animation: none; }
}

.auth-form { display: grid; gap: 8px; margin-top: 16px; }

.auth-form input {
    width: 100%;
    min-height: 34px;
    padding: 5px 8px;
    border: 1px solid var(--opc-border-strong);
    border-radius: 4px;
    background: #11171a;
    color: var(--opc-text);
}

.auth-submit,
.auth-secondary { min-height: 34px; padding: 6px 12px; border-radius: 4px; font-size: 0.82rem; font-weight: 650; }
.auth-submit { margin-top: 5px; border: 1px solid #2f8f7c; color: #fff; background: #2f8f7c; }
.auth-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.auth-actions { display: grid; gap: 8px; margin-top: 16px; }
.auth-actions form { margin: 0; }
.auth-secondary { width: 100%; border: 1px solid var(--opc-border-strong); color: var(--opc-text); background: transparent; }

.auth-reset-link {
    display: block;
    margin: 14px auto 0;
    padding: 3px 5px;
    border: 0;
    background: transparent;
    color: #7f8d94;
    font-size: 0.72rem;
    text-decoration: underline;
    text-decoration-color: #59666d;
    text-underline-offset: 3px;
}

.auth-reset-link:hover { color: #b7c1c6; }
.auth-reset-success { display: grid; gap: 3px; }
.auth-reset-success code { color: #d6fff5; }

.auth-dialog-backdrop {
    position: fixed;
    z-index: 1500;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgb(4 7 9 / 78%);
}

.auth-reset-dialog {
    width: min(470px, calc(100vw - 40px));
    overflow: hidden;
    border: 1px solid var(--opc-border-strong);
    border-radius: 6px;
    background: var(--opc-surface);
    box-shadow: 0 20px 52px rgb(0 0 0 / 52%);
}

.auth-reset-dialog > header,
.auth-reset-dialog > footer {
    display: flex;
    min-height: 46px;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--opc-border);
    background: var(--opc-surface-raised);
}

.auth-reset-dialog > header { justify-content: space-between; }
.auth-reset-dialog > header h2 { margin: 0; font-size: 1rem; }
.auth-reset-dialog > footer { justify-content: flex-end; border-top: 1px solid var(--opc-border); border-bottom: 0; }
.auth-dialog-close { width: 30px; height: 30px; border: 0; background: transparent; color: var(--opc-muted); font-size: 1.2rem; }
.auth-dialog-close:hover { color: #fff; }
.auth-reset-dialog-body { display: grid; gap: 10px; padding: 16px; }
.auth-reset-dialog-body p { margin: 0; }
.auth-reset-dialog-body label { color: #b8c1c6; font-size: 0.78rem; }
.auth-reset-dialog-body small { color: var(--opc-muted); font-size: 0.72rem; }
.auth-reset-danger { border-left: 3px solid #d66b6b; padding: 7px 9px; background: #321f21; color: #f1c2c2; font-size: 0.78rem; }
.auth-reset-code { padding: 8px 10px; border: 1px solid #63737b; background: #0e1316; color: #f0f4f5; font: 700 1.45rem/1.2 Consolas, monospace; letter-spacing: 0; text-align: center; }
.auth-reset-error { margin: 0 16px 12px; border-left: 3px solid var(--opc-danger); padding: 7px 9px; background: #321f21; color: #f4c6c6; font-size: 0.78rem; }
.auth-dialog-button { min-height: 32px; padding: 5px 12px; border: 1px solid var(--opc-border-strong); border-radius: 4px; background: transparent; color: var(--opc-text); font-size: 0.78rem; }
.auth-dialog-button:hover:not(:disabled) { background: #2c353a; }
.auth-dialog-button.danger { border-color: #a44f57; background: #7c333a; color: #fff; }
.auth-dialog-button.danger:hover:not(:disabled) { background: #93404a; }
.auth-dialog-button:disabled { opacity: 0.45; }

.user-create-grid {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) minmax(180px, 1fr) 190px auto;
    align-items: end;
    gap: 8px;
    margin-top: 9px;
}

.field-block { display: grid; gap: 4px; }
.user-table-input { min-width: 145px; }
.valid.modified:not([type=checkbox]) { outline: 1px solid #42b883; }
.invalid { outline: 1px solid var(--opc-danger); }
.scada-udt-table td:focus { outline: none; }
.scada-udt-table td:focus,
.scada-udt-table td:has(input:focus, textarea:focus, select:focus) {
    box-shadow: inset 0 0 0 2px #2d8b7c;
}
.validation-message { color: var(--opc-danger); }
h1:focus { outline: none; }

.scada-resizable-table > thead > tr > th { position: relative; }
.scada-column-resizer {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 7px;
    cursor: col-resize;
    touch-action: none;
    z-index: 3;
}
.scada-column-resizer:hover, .scada-column-resizer:focus-visible { background: #16847366; }
.scada-resizing-column, .scada-resizing-column * { cursor: col-resize !important; user-select: none !important; }
.scada-resizable-table > tbody > tr > td { overflow: hidden; }
.scada-resizable-table :is(input, select, textarea) { min-width: 0; max-width: 100%; }

/* Use the field's existing border or the selected cell, never a second inset frame. */
input:not([type='checkbox']):not([type='radio']):not([aria-invalid='true']):not(.scada-invalid-field):focus,
textarea:not([aria-invalid='true']):focus, select:not([aria-invalid='true']):not(.scada-invalid-field):focus {
    box-shadow: none !important;
    outline: none !important;
}
.blazor-error-boundary { padding: 0.7rem 1rem; background: #7e2727; color: #fff; }
.blazor-error-boundary::after { content: "Произошла ошибка."; }
.scada-grid-scope { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.scada-grid-content { min-width: 0; min-height: 0; overflow: auto; flex: 1; }
.scada-data-table > .scada-grid-scope > .scada-grid-content { display: flex; flex-direction: column; }
.scada-grid-commands { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 4px 8px; background: #edf4f5; color: #263f49; font: 12px 'Segoe UI', sans-serif; }
.scada-grid-commands button { border: 1px solid #aebfc5; border-radius: 2px; background: white; color: #263f49; padding: 4px 8px; }
.scada-grid-commands small { color: #536971; margin-left: 6px; }
.scada-grid-commands [data-grid-status] { margin-left: auto; max-width: 100%; overflow-wrap: anywhere; }
.scada-grid-scope table td.scada-grid-selected, .scada-grid-scope table th.scada-grid-selected { box-shadow: inset 0 0 0 2px #2d8b7c; background-image: linear-gradient(#2d8b7c22,#2d8b7c22); }
.scada-grid-scope table .scada-grid-active:focus { outline: 2px solid #176b5f; outline-offset: -2px; }
.scada-grid-scope table td { padding: 4px 5px !important; }
.scada-data-table > .scada-grid-scope { flex: 1; height: 100%; }
