:root {
  --bg: #0b141a;
  --surface: #111f27;
  --surface-2: #152832;
  --line: #233943;
  --text: #e9f2f0;
  --muted: #8fa5a8;
  --teal: #55d5bf;
  --teal-dim: #1f6e69;
  --blue: #6bb9ff;
  --violet: #a997ff;
  --amber: #e5b968;
  --red: #ed7f87;
  --shadow: 0 18px 50px rgba(0, 0, 0, .18);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 84% -10%, #1d3b41 0, transparent 34rem), var(--bg); }
button, input { font: inherit; }
button { cursor: pointer; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
.shell { max-width: 1440px; margin: 0 auto; padding: 0 34px 30px; }
.topbar { height: 84px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(143, 165, 168, .16); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; letter-spacing: .01em; }
.brand-mark { display: grid; place-items: center; width: 31px; height: 31px; color: #09221f; background: var(--teal); border-radius: 9px; font-weight: 850; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 13px; line-height: 1.15; letter-spacing: .08em; text-transform: uppercase; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 9px; letter-spacing: .13em; }
.topbar-actions { display: flex; align-items: center; gap: 15px; }
.badge, .status-pill, .panel-note, .count-badge { border-radius: 999px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; }
.badge-amber { color: #e6c784; border: 1px solid rgba(229, 185, 104, .28); background: rgba(229, 185, 104, .09); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(229, 185, 104, .1); }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); font-size: 19px; transition: .2s ease; }
.icon-button:hover { color: var(--teal); border-color: var(--teal-dim); transform: rotate(30deg); }
.hero { display: flex; justify-content: space-between; align-items: end; gap: 30px; padding: 64px 0 40px; }
.eyebrow { margin: 0 0 12px; color: var(--teal); font-size: 10px; font-weight: 750; letter-spacing: .16em; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 650px; margin-bottom: 13px; font-size: clamp(33px, 5vw, 58px); line-height: .98; letter-spacing: -.055em; font-weight: 720; }
.hero-copy { max-width: 570px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.hero-stamp { min-width: 170px; padding: 15px 17px; border-left: 1px solid var(--teal-dim); }
.stamp-label, .hero-stamp strong, .hero-stamp .muted { display: block; }
.stamp-label { color: var(--muted); font-size: 9px; letter-spacing: .15em; }
.hero-stamp strong { margin: 8px 0 4px; color: var(--teal); font-size: 14px; text-transform: uppercase; }
.muted { color: var(--muted); font-size: 11px; }
.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; margin-bottom: 30px; }
.status-card { display: flex; align-items: center; gap: 12px; min-height: 90px; padding: 18px; background: rgba(17, 31, 39, .76); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); }
.status-icon { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 10px; font-size: 19px; }
.status-icon.green { color: var(--teal); background: rgba(85, 213, 191, .1); }
.status-icon.blue { color: var(--blue); background: rgba(107, 185, 255, .1); }
.status-icon.violet { color: var(--violet); background: rgba(169, 151, 255, .1); }
.status-card > div:nth-child(2) { min-width: 0; flex: 1; }
.card-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; letter-spacing: .13em; }
.status-card strong, .status-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-card strong { font-size: 14px; font-weight: 620; }
.status-card small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.status-pill { display: inline-block; padding: 6px 8px; color: var(--teal); background: rgba(85, 213, 191, .1); white-space: nowrap; }
.status-pill.pending { color: var(--muted); background: rgba(143, 165, 168, .1); }
.status-pill.amber { color: var(--amber); background: rgba(229, 185, 104, .1); }
.status-pill.error { color: var(--red); background: rgba(237, 127, 135, .1); }
.workspace-grid, .lower-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, .75fr); gap: 13px; margin-bottom: 13px; }
.lower-grid { grid-template-columns: minmax(0, 1.35fr) minmax(360px, .8fr); }
.variable-form-wrap { margin-bottom: 13px; }
.runtime-summary-panel { margin-bottom: 13px; padding: 18px 22px; background: linear-gradient(120deg, rgba(20, 46, 49, .92), rgba(17, 31, 39, .88)); }
.runtime-summary-topline { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.runtime-summary-topline .eyebrow { margin-bottom: 5px; }
.runtime-summary-topline h2 { font-size: 17px; }
.runtime-dashboard { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; align-items: stretch; }
.dashboard-metric { min-width: 0; padding: 11px 13px; border: 1px solid rgba(85, 213, 191, .16); border-radius: 8px; background: rgba(10, 22, 29, .4); }
.dashboard-metric span, .dashboard-metric strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-metric span { color: var(--muted); font-size: 9px; letter-spacing: .05em; }
.dashboard-metric strong { margin-top: 5px; color: var(--teal); font-size: 19px; font-weight: 620; letter-spacing: -.03em; }
.dashboard-metric-label { display: flex !important; align-items: center; gap: 7px; }
.dashboard-indicator { display: inline-block; flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; }
.dashboard-metric-success { border-color: rgba(85, 213, 191, .27); background: linear-gradient(135deg, rgba(85, 213, 191, .07), rgba(10, 22, 29, .4)); }
.dashboard-metric-success .dashboard-indicator { background: var(--teal); box-shadow: 0 0 0 3px rgba(85, 213, 191, .12); }
.dashboard-metric-success strong { color: var(--teal); }
.dashboard-metric-error { border-color: rgba(237, 127, 135, .25); background: linear-gradient(135deg, rgba(237, 127, 135, .065), rgba(10, 22, 29, .4)); }
.dashboard-metric-error .dashboard-indicator { background: var(--red); box-shadow: 0 0 0 3px rgba(237, 127, 135, .12); }
.dashboard-metric-error strong { color: var(--red); }
.runtime-summary-topline .button { min-height: 34px; }
.connection-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.connection-kicker { display: block; margin-bottom: 6px; color: var(--teal); font-size: 9px; font-weight: 750; letter-spacing: .14em; }
h3 { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: -.02em; }
.two-compact { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.compact-actions { align-items: center; gap: 8px; }
.compact-actions .switch-label { font-size: 9px; }
.compact-actions .button { min-height: 33px; padding: 0 10px; font-size: 9px; }
select { padding: 11px 12px; }
select:focus { border-color: var(--teal-dim); box-shadow: 0 0 0 3px rgba(85, 213, 191, .08); }
.panel { min-width: 0; padding: 25px; background: rgba(17, 31, 39, .84); border: 1px solid var(--line); border-radius: 13px; box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 15px; margin-bottom: 23px; }
.panel-heading .eyebrow { margin-bottom: 7px; }
h2 { margin-bottom: 0; font-size: 19px; font-weight: 650; letter-spacing: -.025em; }
.panel-note { padding: 6px 8px; color: var(--muted); background: rgba(143, 165, 168, .08); white-space: nowrap; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-bottom: 14px; }
.field-row.three { grid-template-columns: repeat(3, 1fr); }
.field-row.four { grid-template-columns: 1.2fr 1fr 1fr 1fr; }
.input-action-row { display: flex; align-items: stretch; gap: 8px; }
.input-action-row input { min-width: 0; flex: 1; }
.input-action-row .button { flex: 0 0 auto; white-space: nowrap; }
.field-help { display: block; margin: 7px 0 0 1px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.opcua-selection-card { display: flex; align-items: center; gap: 11px; min-height: 55px; padding: 9px 10px; border: 1px solid #2a414b; border-radius: 8px; background: #0d1a21; }
.opcua-selection-card.selected { border-color: rgba(85, 213, 191, .5); box-shadow: 0 0 0 3px rgba(85, 213, 191, .06); }
.selection-icon { display: grid; flex: 0 0 30px; place-items: center; width: 30px; height: 30px; color: var(--teal); border-radius: 8px; background: rgba(85, 213, 191, .1); font-size: 18px; }
.selection-details { min-width: 0; flex: 1; }
.selection-details strong, .selection-details span, .selection-details code { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selection-details strong { color: var(--text); font-size: 11px; font-weight: 620; }
.selection-details span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.selection-details code { margin-top: 4px; color: var(--teal); font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; }
.opcua-selection-card .button { flex: 0 0 auto; min-height: 34px; padding: 0 11px; }
.field { display: block; min-width: 0; }
.field > span { display: block; margin: 0 0 7px 1px; color: var(--muted); font-size: 10px; letter-spacing: .05em; }
.field em { color: #637b80; font-style: normal; }
input { width: 100%; padding: 11px 12px; color: var(--text); background: #0d1a21; border: 1px solid #2a414b; border-radius: 8px; outline: none; font-size: 12px; transition: .2s ease; }
input:focus { border-color: var(--teal-dim); box-shadow: 0 0 0 3px rgba(85, 213, 191, .08); }
input::placeholder { color: #587077; }
.browse-row { grid-template-columns: minmax(150px, .8fr) minmax(0, 1.2fr) 94px auto; align-items: end; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 39px; padding: 0 15px; border: 1px solid transparent; border-radius: 8px; font-size: 11px; font-weight: 680; letter-spacing: .02em; transition: .2s ease; }
.button span { font-size: 15px; line-height: 0; }
.button.primary { color: #09221f; background: var(--teal); }
.button.primary:hover { background: #7be4d0; transform: translateY(-1px); }
.button.secondary { color: var(--text); border-color: #31515a; background: rgba(49, 81, 90, .25); }
.button.secondary:hover { border-color: var(--teal-dim); color: var(--teal); }
.button.ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.button.ghost:hover { color: var(--text); border-color: #49636a; }
.button.full { width: 100%; margin-top: 23px; }
.result-meta { min-height: 18px; margin: 3px 0 11px; color: var(--muted); font-size: 10px; }
.browse-results { min-height: 170px; max-height: 370px; overflow: auto; padding-right: 3px; }
.tree-results { padding: 3px 4px 3px 0; }
.opc-tree { min-height: 170px; }
.tree-node { position: relative; }
.tree-row { display: flex; align-items: center; gap: 9px; min-height: 43px; padding: 6px 8px 6px 2px; border-bottom: 1px solid rgba(42, 65, 75, .55); border-radius: 7px; }
.tree-row:hover { background: rgba(85, 213, 191, .045); }
.tree-row.object .node-type { color: var(--violet); background: rgba(169, 151, 255, .1); }
.tree-toggle, .tree-toggle-spacer { flex: 0 0 20px; width: 20px; height: 24px; }
.tree-toggle { padding: 0; color: var(--teal); border: 0; background: transparent; font-size: 18px; line-height: 1; cursor: pointer; }
.tree-toggle:hover { color: #a1f5e4; }
.tree-toggle-spacer { display: block; }
.tree-label { min-width: 0; flex: 1; padding: 2px 0; color: var(--text); border: 0; background: transparent; text-align: left; }
.tree-label strong, .tree-label small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-label strong { font-size: 11px; font-weight: 600; }
.tree-label small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.tree-expand { cursor: pointer; }
.tree-expand:hover strong { color: var(--teal); }
.tree-children { margin-left: 20px; padding-left: 10px; border-left: 1px solid rgba(85, 213, 191, .2); }
.tree-children[hidden] { display: none; }
.tree-loading, .tree-empty, .tree-error { padding: 12px 12px 12px 18px; color: var(--muted); font-size: 10px; }
.tree-error { color: #ffaaa0; }
.loading-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px rgba(85, 213, 191, .1); animation: pulse 1.1s ease-in-out infinite; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 25px; color: var(--muted); text-align: center; border: 1px dashed #29414a; border-radius: 9px; }
.empty-icon { color: var(--teal); font-size: 27px; opacity: .7; }
.empty-state p { margin: 8px 0 4px; color: var(--text); font-size: 12px; }
.empty-state small { font-size: 10px; }
.browse-item { display: flex; align-items: center; gap: 12px; padding: 11px 10px; border-bottom: 1px solid rgba(42, 65, 75, .6); }
.browse-item:last-child { border-bottom: 0; }
.node-type { flex: 0 0 31px; padding: 5px 0; color: var(--blue); border-radius: 5px; background: rgba(107, 185, 255, .1); font-size: 9px; text-align: center; }
.node-type.object { color: var(--violet); background: rgba(169, 151, 255, .1); }
.node-info { min-width: 0; flex: 1; }
.node-info strong, .node-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-info strong { font-size: 11px; font-weight: 600; }
.node-info small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.node-value { color: var(--teal); font-size: 11px; }
.node-action { padding: 5px 7px; color: var(--muted); border: 0; border-radius: 5px; background: transparent; font-size: 10px; }
.node-action:hover { color: var(--teal); background: rgba(85, 213, 191, .08); }
.runtime-panel { background: linear-gradient(145deg, rgba(20, 46, 49, .9), rgba(17, 31, 39, .86)); }
.runtime-explainer { margin: -10px 0 20px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.runtime-big { padding: 7px 0 22px; border-bottom: 1px solid rgba(85, 213, 191, .15); }
.runtime-big strong { display: block; color: var(--teal); font-size: 43px; font-weight: 550; letter-spacing: -.07em; }
.runtime-big span { color: var(--muted); font-size: 11px; }
.runtime-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; padding-top: 19px; }
.runtime-stats div { min-width: 0; }
.runtime-stats span, .runtime-stats strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.runtime-stats span { color: var(--muted); font-size: 9px; }
.runtime-stats strong { margin-top: 6px; font-size: 14px; font-weight: 600; }
.panel-footnote { margin: 10px 0 0; color: var(--muted); font-size: 9px; text-align: center; }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 22px; }
.button-group { display: flex; gap: 8px; }
.switch-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; cursor: pointer; }
.switch-label input { display: none; }
.switch { width: 30px; height: 17px; padding: 2px; border-radius: 99px; background: #2a414b; transition: .2s ease; }
.switch::after { display: block; width: 13px; height: 13px; border-radius: 50%; background: #779095; content: ""; transition: .2s ease; }
.switch-label input:checked + .switch { background: var(--teal-dim); }
.switch-label input:checked + .switch::after { background: var(--teal); transform: translateX(13px); }
.text-button { padding: 5px; color: var(--teal); background: transparent; border: 0; font-size: 10px; }
.preview-info { min-height: 18px; margin: -8px 0 11px; color: var(--muted); font-size: 10px; }
.json-preview { min-height: 220px; max-height: 340px; overflow: auto; margin: 0; padding: 15px; color: #bfe9df; background: #0a151b; border: 1px solid #1d343c; border-radius: 8px; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 10px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.preview-footer { display: flex; justify-content: space-between; margin-top: 10px; color: var(--muted); font-size: 9px; }
.count-badge { min-width: 25px; padding: 6px 8px; color: var(--teal); background: rgba(85, 213, 191, .1); text-align: center; }
.table-panel { margin-bottom: 13px; }
.variables-list-panel { margin-bottom: 13px; }
.mapping-list-heading { align-items: center; margin-bottom: 18px; }
.mapping-list-heading .section-copy { max-width: 650px; margin: 6px 0 0; }
.mapping-list-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.mapping-list-actions .button { white-space: nowrap; }
.system-panel { margin-bottom: 13px; }
.section-copy { max-width: 820px; margin: -8px 0 22px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.section-copy code { color: var(--teal); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; }
.system-table-wrap { margin-top: 26px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th { padding: 0 12px 11px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 9px; font-weight: 600; letter-spacing: .11em; text-align: left; text-transform: uppercase; }
td { padding: 14px 12px; border-bottom: 1px solid rgba(42, 65, 75, .55); font-size: 11px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.table-empty { padding: 28px 12px; color: var(--muted); text-align: center; }
.table-main, .table-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-main { max-width: 250px; font-weight: 600; }
.table-sub { max-width: 250px; margin-top: 4px; color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; }
.frequency { color: var(--muted); font-size: 10px; line-height: 1.65; }
.frequency strong { color: var(--text); font-weight: 500; }
.table-status { display: inline-flex; align-items: center; gap: 6px; color: var(--teal); font-size: 10px; }
.table-status.off { color: var(--muted); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.row-actions { display: flex; justify-content: end; gap: 2px; }
.row-button { padding: 6px 8px; color: var(--muted); border: 0; border-radius: 5px; background: transparent; font-size: 10px; }
.row-button:hover { color: var(--teal); background: rgba(85, 213, 191, .08); }
.row-button.delete:hover { color: var(--red); background: rgba(237, 127, 135, .08); }
.toast { position: fixed; z-index: 4; right: 30px; bottom: 25px; max-width: min(390px, calc(100vw - 40px)); padding: 12px 14px; color: var(--text); border: 1px solid var(--teal-dim); border-radius: 8px; background: #132b2d; box-shadow: var(--shadow); font-size: 11px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: #874d58; background: #311e28; }
.footer { display: flex; justify-content: space-between; gap: 15px; padding-top: 22px; color: #60777c; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
@media (max-width: 980px) { .workspace-grid, .lower-grid { grid-template-columns: 1fr; } .runtime-panel { min-height: auto; } .runtime-dashboard { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .shell { padding: 0 17px 22px; } .topbar { height: 70px; } .hero { display: block; padding: 42px 0 30px; } .hero-stamp { margin-top: 28px; } .status-grid { grid-template-columns: 1fr; } .panel { padding: 19px; } .field-row, .field-row.three, .field-row.four, .browse-row { grid-template-columns: 1fr; } .browse-row .button { width: 100%; } .form-actions, .footer { align-items: start; flex-direction: column; } .button-group { width: 100%; } .button-group .button { flex: 1; } .footer { line-height: 1.6; } }

html { scroll-behavior: smooth; }
body { background: radial-gradient(circle at 82% -8%, rgba(35, 78, 81, .62) 0, transparent 31rem), linear-gradient(180deg, #0b151b 0%, #091117 100%); }
.topbar { position: sticky; top: 0; z-index: 5; height: 76px; background: rgba(11, 20, 26, .84); backdrop-filter: blur(18px); }
.topbar-nav { display: flex; align-items: center; gap: 3px; margin-left: auto; margin-right: 24px; }
.topbar-nav a { padding: 8px 10px; color: var(--muted); border-radius: 7px; font-size: 10px; letter-spacing: .05em; text-decoration: none; transition: .2s ease; }
.topbar-nav a:hover { color: var(--text); background: rgba(85, 213, 191, .08); }
.topbar-nav a.active { color: var(--teal); background: rgba(85, 213, 191, .1); }
.session-tools { display: flex; align-items: center; gap: 8px; margin-right: 5px; }
.session-user { max-width: 170px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.session-logout { min-height: 31px; padding: 0 10px; font-size: 9px; }
.auth-gate { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 22px; background: rgba(5, 12, 16, .82); backdrop-filter: blur(14px); }
.auth-gate[hidden] { display: none; }
.auth-card { width: min(100%, 420px); padding: 34px; border: 1px solid rgba(85, 213, 191, .28); border-radius: 16px; background: linear-gradient(145deg, #142c32, #0e1d25); box-shadow: 0 26px 90px rgba(0, 0, 0, .4); }
.auth-mark { display: grid; place-items: center; margin-bottom: 24px; }
.auth-card h1 { margin: 7px 0 0; font-size: 28px; letter-spacing: -.04em; }
.auth-copy { margin: 10px 0 24px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.auth-form .field { margin-bottom: 14px; }
.auth-form .button.full { margin-top: 10px; }
.auth-message { min-height: 16px; margin: 12px 0 0; color: var(--amber); font-size: 10px; line-height: 1.5; }
body.auth-locked > .shell > main { filter: blur(3px); pointer-events: none; user-select: none; }
.history-panel { margin-bottom: 13px; background: linear-gradient(145deg, rgba(18, 40, 47, .9), rgba(17, 31, 39, .86)); }
.catalog-panel { margin-bottom: 13px; background: linear-gradient(145deg, rgba(18, 40, 47, .9), rgba(17, 31, 39, .86)); }
.catalog-subheading { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin: 1px 0 18px; }
.catalog-subheading h3 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.catalog-subheading .section-copy { margin: 7px 0 0; }
.catalog-reference-table-wrap { margin-top: 4px; }
.catalog-reference-table-wrap { overflow-x: auto; }
.catalog-reference-table-wrap table { min-width: 780px; }
.catalog-reference-table-wrap td:last-child { white-space: nowrap; }
.catalog-reference-table-wrap .row-actions { flex-wrap: nowrap; }
.catalog-reference-table-wrap .row-button { flex: 0 0 auto; white-space: nowrap; }
.reference-modal-card { width: min(100%, 850px); }
.file-picker { display: flex; align-items: center; gap: 11px; min-height: 57px; padding: 8px 10px; border: 1px solid #2a414b; border-radius: 8px; background: #0d1a21; transition: .2s ease; }
.file-picker:focus-within { border-color: var(--teal-dim); box-shadow: 0 0 0 3px rgba(85, 213, 191, .08); }
.file-picker input[type="file"] { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.file-picker-button { flex: 0 0 auto; min-height: 36px; padding: 0 12px; }
.file-picker-name { min-width: 0; overflow: hidden; color: var(--text); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.file-picker-name::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 8px 1px 1px; border-radius: 50%; background: var(--teal); }
.file-picker.is-disabled { opacity: .58; }
.file-picker.is-disabled .file-picker-button { cursor: not-allowed; }
.catalog-editor { margin: -2px 0 22px; padding: 17px; border: 1px solid rgba(85, 213, 191, .2); border-radius: 10px; background: rgba(10, 22, 29, .44); }
.catalog-editor .connection-heading { margin-bottom: 12px; }
.catalog-editor .section-copy { margin-bottom: 17px; }
.catalog-editor .field-row { margin-bottom: 11px; }
.catalog-editor .form-actions { margin-top: 16px; }
.catalog-editor .form-note { white-space: normal; line-height: 1.45; }
.catalog-rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: -5px 0 20px; }
.catalog-rules > div { display: flex; align-items: flex-start; gap: 9px; min-width: 0; padding: 12px 13px; border: 1px solid rgba(42, 65, 75, .82); border-radius: 9px; background: rgba(10, 22, 29, .48); }
.catalog-rules strong, .catalog-rules small { display: block; }
.catalog-rules strong { color: var(--text); font-size: 10px; font-weight: 600; }
.catalog-rules small { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.rule-icon { display: grid; flex: 0 0 22px; place-items: center; width: 22px; height: 22px; color: var(--teal); border-radius: 6px; background: rgba(85, 213, 191, .1); font-size: 12px; }
.rule-icon.blue { color: var(--blue); background: rgba(107, 185, 255, .1); }
.rule-icon.amber { color: var(--amber); background: rgba(239, 192, 92, .1); }
.history-toolbar.catalog-toolbar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.history-toolbar.catalog-reference-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 16px; }
.history-toolbar.catalog-reference-toolbar-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.catalog-table-wrap { margin-top: 10px; }
.catalog-table-wrap table { min-width: 0; table-layout: fixed; }
.catalog-table-wrap th:nth-child(1) { width: 16%; }
.catalog-table-wrap th:nth-child(2) { width: 16%; }
.catalog-table-wrap th:nth-child(3) { width: 16%; }
.catalog-table-wrap th:nth-child(4) { width: 10%; }
.catalog-table-wrap th:nth-child(5) { width: 18%; }
.catalog-table-wrap th:nth-child(6) { width: 12%; }
.catalog-table-wrap th:nth-child(7) { width: 12%; }
.catalog-table-wrap th, .catalog-table-wrap td { overflow-wrap: anywhere; }
.catalog-table-wrap .table-main, .catalog-table-wrap .table-sub { max-width: none; white-space: normal; }
.catalog-table-wrap td:nth-child(1) .catalog-id,
.catalog-table-wrap td:nth-child(2) .table-main,
.catalog-table-wrap td:nth-child(4) .table-main { font-size: 11px; white-space: nowrap; }
.catalog-table-wrap td:nth-child(1) .catalog-id { font-family: inherit; font-size: 11px; font-weight: 600; }
.catalog-table-wrap .row-actions { flex-wrap: nowrap; }
.catalog-table-wrap .row-button { flex: 0 0 auto; white-space: nowrap; }
.table-sort { display: inline-flex; align-items: center; gap: 5px; padding: 0; color: inherit; border: 0; background: transparent; font: inherit; letter-spacing: inherit; text-align: left; text-transform: inherit; white-space: nowrap; cursor: pointer; }
.table-sort:hover, .table-sort.active { color: var(--teal); }
.sort-indicator { min-width: 9px; color: var(--teal); font-size: 11px; line-height: 1; }
.catalog-id { color: var(--teal); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; overflow-wrap: anywhere; }
.catalog-coordinates { color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; overflow-wrap: anywhere; }
.history-toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) 130px auto; align-items: end; gap: 11px; margin-bottom: 16px; }
.history-hours { min-width: 0; }
.history-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-bottom: 15px; }
.history-stats div { min-width: 0; padding: 13px 14px; border: 1px solid rgba(42, 65, 75, .82); border-radius: 9px; background: rgba(10, 22, 29, .48); }
.history-stats span, .history-stats strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-stats span { color: var(--muted); font-size: 9px; }
.history-stats strong { margin-top: 6px; color: var(--teal); font-size: 15px; font-weight: 600; }
.history-chart-card { padding: 17px; border: 1px solid rgba(42, 65, 75, .82); border-radius: 10px; background: rgba(10, 22, 29, .48); }
.history-chart-wrap { min-height: 240px; margin-top: 10px; overflow: hidden; border: 1px solid rgba(42, 65, 75, .7); border-radius: 8px; background: rgba(7, 17, 22, .72); }
.history-chart-wrap svg { display: block; width: 100%; height: 240px; }
.history-chart-wrap text { fill: var(--muted); font-family: inherit; font-size: 11px; }
.history-grid-line { stroke: rgba(143, 165, 168, .14); stroke-width: 1; }
.history-axis-label { fill: #6e8589 !important; font-size: 9px !important; }
.history-area { fill: rgba(85, 213, 191, .12); }
.history-line { fill: none; stroke: var(--teal); stroke-linecap: round; stroke-linejoin: round; stroke-width: 3; }
.history-point { fill: #0c1b21; stroke: var(--teal); stroke-width: 2; }
.history-table-wrap { margin-top: 15px; }
.history-table-wrap table { min-width: 670px; }
.history-value { color: var(--teal); font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; }
.history-status { color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; }
.admin-panel { margin-bottom: 13px; }
.admin-grid { display: grid; grid-template-columns: minmax(270px, .72fr) minmax(0, 1.28fr); gap: 11px; }
.admin-card { min-width: 0; padding: 17px; border: 1px solid rgba(42, 65, 75, .82); border-radius: 10px; background: rgba(10, 22, 29, .48); }
.audit-card { margin-top: 11px; }
.admin-card .connection-heading { margin-bottom: 15px; }
.admin-table-wrap { overflow-x: auto; }
.admin-table-wrap table { min-width: 660px; }
.role-badge { display: inline-block; padding: 5px 7px; border-radius: 5px; color: var(--muted); background: rgba(143, 165, 168, .1); font-size: 9px; white-space: nowrap; }
.role-badge.role-admin { color: var(--violet); background: rgba(169, 151, 255, .12); }
.role-badge.role-operator { color: var(--blue); background: rgba(107, 185, 255, .1); }
.role-badge.role-viewer { color: var(--teal); background: rgba(85, 213, 191, .1); }
.user-last-login { color: var(--muted); font-size: 10px; white-space: nowrap; }
.row-note, .form-note { color: var(--muted); font-size: 9px; white-space: nowrap; }
.audit-action { color: var(--text); font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; }
.topbar-nav a:focus-visible, .setup-step:focus-visible, .button:focus-visible, .icon-button:focus-visible, .text-button:focus-visible, .row-button:focus-visible, .node-action:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.icon-button:focus-visible { transform: none; }
.panel[id], .status-grid[id] { scroll-margin-top: 96px; }
.status-card { transition: border-color .2s ease, transform .2s ease, background .2s ease; }
.status-card:hover { border-color: rgba(85, 213, 191, .35); background: rgba(21, 40, 50, .9); transform: translateY(-2px); }
.setup-rail { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: -4px 0 26px; padding: 9px; border: 1px solid rgba(42, 65, 75, .72); border-radius: 13px; background: rgba(13, 27, 34, .62); }
.setup-step { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 11px 12px; border-radius: 9px; color: var(--text); text-decoration: none; transition: .2s ease; }
.setup-step:hover { background: rgba(85, 213, 191, .08); }
.setup-number { flex: 0 0 auto; color: var(--teal); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; font-weight: 700; }
.setup-copy { min-width: 0; flex: 1; }
.setup-copy small, .setup-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setup-copy small { margin-bottom: 4px; color: var(--muted); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.setup-copy strong { font-size: 11px; font-weight: 620; }
.setup-arrow { color: var(--muted); font-size: 15px; transition: .2s ease; }
.setup-step:hover .setup-arrow { color: var(--teal); transform: translate(2px, -2px); }
.guided-panel { scroll-margin-top: 96px; margin-bottom: 13px; padding: 25px; border: 1px solid rgba(85, 213, 191, .22); border-radius: 13px; background: linear-gradient(135deg, rgba(21, 52, 54, .9), rgba(17, 31, 39, .88)); box-shadow: var(--shadow); }
.guided-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.guided-heading .eyebrow { margin-bottom: 8px; }
.guided-description { max-width: 600px; margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.guided-progress-copy { flex: 0 0 auto; text-align: right; }
.guided-progress-copy strong, .guided-progress-copy span { display: block; }
.guided-progress-copy strong { color: var(--teal); font-size: 18px; letter-spacing: -.03em; }
.guided-progress-copy span { margin-top: 4px; color: var(--muted); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.guided-progress { height: 4px; margin: 20px 0 17px; overflow: hidden; border-radius: 99px; background: rgba(143, 165, 168, .15); }
.guided-progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--teal); box-shadow: 0 0 16px rgba(85, 213, 191, .45); transition: width .3s ease; }
.guided-body { display: flex; align-items: center; gap: 18px; }
.guided-steps { display: grid; grid-template-columns: repeat(4, 1fr); flex: 1; gap: 7px; }
.guided-step { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 10px 9px; color: var(--muted); border: 1px solid transparent; border-radius: 8px; text-decoration: none; transition: .2s ease; }
.guided-step:hover { color: var(--text); background: rgba(85, 213, 191, .07); }
.guided-step.active { color: var(--text); border-color: rgba(85, 213, 191, .3); background: rgba(85, 213, 191, .08); }
.guided-step.done { color: var(--teal); }
.guided-step-number { display: grid; place-items: center; flex: 0 0 27px; width: 27px; height: 27px; border: 1px solid #31515a; border-radius: 50%; color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; }
.guided-step.active .guided-step-number, .guided-step.done .guided-step-number { border-color: var(--teal-dim); color: var(--teal); background: rgba(85, 213, 191, .08); }
.guided-step small, .guided-step strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guided-step small { margin-bottom: 3px; font-size: 8px; letter-spacing: .08em; text-transform: uppercase; }
.guided-step strong { color: inherit; font-size: 10px; font-weight: 620; }
.guided-action { flex: 0 0 auto; white-space: nowrap; }
.panel { transition: border-color .2s ease, box-shadow .2s ease; }
.panel:hover { border-color: rgba(62, 100, 107, .9); box-shadow: 0 20px 54px rgba(0, 0, 0, .22); }
.panel-intro { margin-top: -10px; margin-bottom: 22px; padding: 10px 12px; border-left: 2px solid var(--teal-dim); background: rgba(85, 213, 191, .045); }
.runtime-summary { max-width: 190px; color: var(--muted); font-family: inherit; font-size: 9px; }
input:hover { border-color: #3a5660; }
input:disabled { color: var(--muted); cursor: not-allowed; opacity: .65; }
.button:disabled { cursor: wait; opacity: .62; transform: none; }
.browse-results, .json-preview { scrollbar-color: #31515a transparent; scrollbar-width: thin; }
.runtime-big strong { text-shadow: 0 0 28px rgba(85, 213, 191, .16); }
.modal-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 22px; background: rgba(4, 12, 16, .78); backdrop-filter: blur(12px); }
.modal-backdrop[hidden] { display: none; }
.modal-card { width: min(100%, 920px); max-height: min(820px, calc(100vh - 44px)); overflow: auto; padding: 25px; border: 1px solid rgba(85, 213, 191, .28); border-radius: 14px; background: linear-gradient(145deg, #142c32, #0e1d25); box-shadow: 0 26px 90px rgba(0, 0, 0, .45); }
.mapping-modal-card { width: min(100%, 1080px); }
.mapping-modal-card #mappingEditorTitle { color: var(--teal); }
.mapping-form-section { margin: 0 0 16px; padding: 15px 16px 5px; border: 1px solid #38383e; border-radius: 10px; background: #1c1c1f; }
.mapping-form-section:last-of-type { margin-bottom: 0; }
.mapping-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.mapping-section-heading h3 { color: var(--text); font-size: 14px; }
.mapping-section-heading p { margin: 0; color: var(--muted); font-size: 10px; }
.mapping-form-section .field-row { margin-bottom: 11px; }
.mapping-name-section { padding-bottom: 14px; }
.mapping-identity-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: 12px; }
.mapping-name-source-field, .mapping-enabled-field { min-height: 38px; margin-bottom: 0; padding: 0 12px; border: 1px solid #38383e; border-radius: 8px; background: #161618; white-space: nowrap; }
.mapping-name-source-field .switch, .mapping-enabled-field .switch { flex: 0 0 auto; }
.mapping-name-field input:disabled { color: var(--muted); cursor: not-allowed; opacity: .78; }
.mapping-form-section + .mapping-form-section { margin-top: 0; }
.mapping-form-section:last-of-type + .form-actions { justify-content: flex-end; }
.mapping-opcua-row { display: grid; grid-template-columns: minmax(0, 1fr) 180px 180px; align-items: start; gap: 11px; }
.mapping-node-field { min-width: 0; }
.mapping-read-field .button { width: 100%; min-height: 38px; }
.mapping-read-field .field-help { min-height: 26px; overflow-wrap: anywhere; }
.mapping-form-section .field > span { color: #c8c9cd; }
.mapping-form-section input[readonly] { color: #d3d4d8; background: #161618; border-color: #44454b; }
.mapping-catalog-hint { align-self: end; margin: 0 0 10px; line-height: 1.45; }
.mapping-certificate-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; margin: 0 0 11px; padding: 9px 11px; border: 1px solid #44454b; border-radius: 8px; background: #161618; color: var(--muted); font-size: 10px; }
.mapping-certificate-summary strong { color: var(--text); font-size: 11px; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.mapping-preview-section { padding-bottom: 15px; }
.mapping-json-preview { min-height: 190px; max-height: 300px; overflow: auto; margin: 0; padding: 13px; color: #d8e7ff; background: #111113; border: 1px solid #3b3c42; border-radius: 8px; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 10px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
@media (max-width: 820px) { .mapping-opcua-row { grid-template-columns: minmax(0, 1fr) 150px 150px; } }
@media (max-width: 700px) { .mapping-opcua-row { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .mapping-identity-row { grid-template-columns: 1fr; gap: 10px; } .mapping-name-source-field, .mapping-enabled-field { width: fit-content; max-width: 100%; } }
.catalog-modal-card { width: min(100%, 1040px); }
#opcuaSelector { z-index: 21; }
.modal-heading { margin-bottom: 14px; }
.modal-close { flex: 0 0 auto; color: var(--muted); font-size: 21px; }
.modal-copy { margin-bottom: 20px; }
.modal-card .browse-results { min-height: 210px; max-height: 390px; }
.modal-actions { display: flex; justify-content: end; margin-top: 17px; }
.confirm-dialog-backdrop { z-index: 30; }
.confirm-dialog-card { width: min(100%, 520px); padding: 24px; }
.confirm-dialog-card .modal-heading { margin-bottom: 12px; }
.confirm-dialog-card .modal-copy { max-width: none; margin-bottom: 0; }
.confirm-dialog-actions { gap: 8px; }
.confirm-dialog-actions .button { min-width: 108px; }
.confirm-dialog-actions .button.danger { color: #fff4f4; border-color: rgba(237, 127, 135, .35); background: rgba(146, 60, 72, .78); }
.confirm-dialog-actions .button.danger:hover { border-color: var(--red); background: rgba(169, 70, 82, .92); }
body.modal-open { overflow: hidden; }
.status-icon.green { animation: status-pulse 3.5s ease-in-out infinite; }
@keyframes status-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(85, 213, 191, 0); } 50% { box-shadow: 0 0 0 5px rgba(85, 213, 191, .05); } }
@media (max-width: 980px) { .topbar-nav { display: none; } .setup-rail { grid-template-columns: repeat(2, 1fr); } .guided-body { align-items: stretch; flex-direction: column; } .guided-action { width: 100%; } }
@media (max-width: 900px) { .status-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .history-toolbar { grid-template-columns: 1fr; } .history-toolbar .button { width: 100%; } .history-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) { .catalog-rules { grid-template-columns: 1fr; } }
@media (max-width: 1100px) { .catalog-table-wrap table { min-width: 1060px; table-layout: auto; } .catalog-table-wrap th, .catalog-table-wrap td { overflow-wrap: normal; } .catalog-table-wrap .table-main, .catalog-table-wrap .table-sub { white-space: nowrap; } .catalog-id { white-space: nowrap; } }
@media (max-width: 560px) { .setup-rail { grid-template-columns: 1fr; } .setup-step { padding: 10px; } .guided-panel { padding: 19px; } .guided-heading { align-items: start; flex-direction: column; } .guided-progress-copy { text-align: left; } .guided-steps { grid-template-columns: repeat(2, 1fr); width: 100%; } }
@media (max-width: 980px) { .admin-grid { grid-template-columns: 1fr; } }

[data-page][hidden], [data-page-container][hidden] { display: none !important; }
.page-container, [data-page] { scroll-margin-top: 96px; }
body[data-active-page="variables"] .lower-grid { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 980px) {
  .topbar { height: auto; min-height: 76px; flex-wrap: wrap; padding: 12px 0; }
  .topbar-nav { display: flex; order: 3; flex: 0 0 100%; margin: 9px 0 0; overflow-x: auto; padding-bottom: 2px; scrollbar-color: #31515a transparent; scrollbar-width: thin; white-space: nowrap; }
}

/* Navegación lateral de la consola */
:root { --sidebar-width: 174px; }
body { padding-left: var(--sidebar-width); }
.shell { max-width: 1440px; margin: 0 auto; padding-left: 34px; }
.topbar { backdrop-filter: none; background: rgba(11, 20, 26, .96); }
.topbar > .brand { display: none; }
.topbar-context { display: flex; flex-direction: column; gap: 4px; margin-right: auto; }
.topbar-context span { color: var(--muted); font-size: 9px; letter-spacing: .14em; }
.topbar-context strong { font-size: 14px; font-weight: 620; letter-spacing: -.02em; }
.topbar-nav { position: fixed; z-index: 8; inset: 0 auto 0 0; display: flex; width: var(--sidebar-width); flex-direction: column; align-items: stretch; gap: 3px; margin: 0; padding: 23px 14px 17px; overflow-y: auto; border-right: 1px solid rgba(42, 65, 75, .9); background: linear-gradient(180deg, #0e1c23 0%, #0b161d 100%); box-shadow: 12px 0 34px rgba(0, 0, 0, .12); scrollbar-color: #31515a transparent; scrollbar-width: thin; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 2px 9px 24px; }
.sidebar-brand > span:last-child { min-width: 0; }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand strong { color: var(--text); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.sidebar-brand small { margin-top: 4px; color: var(--muted); font-size: 8px; letter-spacing: .11em; white-space: nowrap; }
.sidebar-label { margin: 0 9px 8px; color: #5f797f; font-size: 9px; font-weight: 700; letter-spacing: .16em; }
.topbar-nav a { display: flex; align-items: center; min-height: 38px; padding: 0 11px; color: var(--muted); border-radius: 8px; font-size: 11px; letter-spacing: .02em; }
.topbar-nav a:hover { color: var(--text); background: rgba(85, 213, 191, .08); }
.topbar-nav a.active { color: var(--teal); background: rgba(85, 213, 191, .12); box-shadow: inset 2px 0 0 var(--teal); }
.sidebar-footer { display: flex; flex-direction: column; gap: 4px; margin-top: auto; padding: 17px 9px 2px; border-top: 1px solid rgba(42, 65, 75, .75); color: #60777c; font-size: 8px; letter-spacing: .12em; }
.sidebar-footer small { color: #4d666c; font-size: 8px; letter-spacing: .08em; }
.nav-toggle { display: none; }
@media (min-width: 701px) and (max-width: 980px) {
  body { padding-left: var(--sidebar-width); }
  .shell { padding-left: 34px; }
  .topbar > .brand { display: none; }
  .topbar-context { display: flex; }
  .topbar-nav { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; width: var(--sidebar-width); height: 100vh; flex: initial; flex-direction: column; margin: 0; padding: 23px 14px 17px; transform: none; }
  .nav-toggle { display: none; }
}
@media (max-width: 700px) {
  body { padding-left: 0; }
  .shell { padding-left: 17px; }
  .topbar > .brand { display: flex; }
  .topbar-context { display: none; }
  .topbar-nav { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; width: min(82vw, var(--sidebar-width)); height: 100vh; flex: initial; flex-direction: column; margin: 0; padding: 23px 14px 17px; transform: translateX(-105%); transition: transform .24s ease; }
  body.nav-open .topbar-nav { transform: translateX(0); }
  .nav-toggle { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; background: transparent; font-size: 17px; }
  .nav-toggle:hover { color: var(--teal); border-color: var(--teal-dim); }
}

/* Tema carbón inspirado en la interfaz oscura de Outlook. */
:root {
  --bg: #0a0a0b;
  --surface: #1b1b1d;
  --surface-2: #262628;
  --line: #3b3b40;
  --text: #f2f2f4;
  --muted: #b1b1b6;
  --teal: #f1d36b;
  --teal-dim: #9c8230;
  --blue: #80b2ff;
  --violet: #ba9cff;
  --amber: #dfb75b;
  --red: #ef8b92;
  --success: #57d39b;
  --shadow: 0 18px 50px rgba(0, 0, 0, .5);
}

body { background: radial-gradient(circle at 82% -8%, rgba(105, 88, 35, .12) 0, transparent 31rem), linear-gradient(180deg, #0c0c0d 0%, #070708 100%); }
.topbar { background: rgba(10, 10, 11, .94); border-bottom-color: rgba(177, 177, 182, .17); }
.topbar-nav { background: linear-gradient(180deg, #171719 0%, #101011 100%); border-right-color: #343438; box-shadow: 12px 0 34px rgba(0, 0, 0, .3); }
.topbar-nav a:hover { background: rgba(241, 211, 107, .12); }
.topbar-nav a.active { background: rgba(241, 211, 107, .16); box-shadow: inset 2px 0 0 var(--teal); }
.sidebar-label { color: #929298; }
.sidebar-footer { border-top-color: #36363b; color: #89898f; }
.sidebar-footer small { color: #69696f; }

.panel, .catalog-panel, .history-panel, .runtime-panel { background: linear-gradient(145deg, rgba(31, 31, 34, .97), rgba(21, 21, 23, .97)); border-color: var(--line); }
.status-card, .admin-card, .history-chart-card, .history-stats div, .setup-rail { background: rgba(27, 27, 29, .9); border-color: #37373c; }
.runtime-summary-panel { background: linear-gradient(120deg, rgba(36, 39, 58, .95), rgba(25, 25, 28, .94)); }
.guided-panel { background: linear-gradient(135deg, rgba(54, 48, 29, .92), rgba(25, 25, 29, .95)); border-color: rgba(241, 211, 107, .3); }
.panel:hover { border-color: #5a5a63; box-shadow: 0 20px 54px rgba(0, 0, 0, .35); }
.panel-intro { background: rgba(241, 211, 107, .08); }

input, select, .opcua-selection-card, .file-picker { color: var(--text); background: #171719; border-color: #414147; }
input:hover { border-color: #64646c; }
input:focus, select:focus { border-color: var(--teal-dim); box-shadow: 0 0 0 3px rgba(241, 211, 107, .14); }
input::placeholder { color: #85858d; }
.opcua-selection-card.selected { border-color: rgba(241, 211, 107, .62); box-shadow: 0 0 0 3px rgba(241, 211, 107, .1); }
.selection-icon { background: rgba(241, 211, 107, .13); }
.button.primary { color: #211c0a; background: var(--teal); }
.button.primary:hover { background: #ffe58a; }
.button.secondary { border-color: #505057; background: rgba(80, 80, 87, .26); }
.button.secondary:hover, .button.ghost:hover { border-color: var(--teal-dim); color: var(--teal); }
.button.ghost { border-color: #424248; }
.modal-card, .auth-card { background: linear-gradient(145deg, #242426, #171719); border-color: rgba(241, 211, 107, .38); }
.modal-backdrop, .auth-gate { background: rgba(3, 3, 4, .84); }
.catalog-editor { background: rgba(22, 22, 24, .7); border-color: rgba(241, 211, 107, .28); }

.status-icon.green, .dashboard-metric-success .dashboard-indicator { color: var(--success); background: rgba(87, 211, 155, .12); }
.dashboard-metric-success { border-color: rgba(87, 211, 155, .3); background: linear-gradient(135deg, rgba(87, 211, 155, .08), rgba(18, 18, 20, .5)); }
.dashboard-metric-success .dashboard-indicator { box-shadow: 0 0 0 3px rgba(87, 211, 155, .14); }
.dashboard-metric-success strong, .table-status:not(.off) { color: var(--success); }
.status-icon.blue { color: var(--blue); background: rgba(128, 178, 255, .12); }
.status-icon.violet { color: var(--violet); background: rgba(186, 156, 255, .12); }
.status-pill, .count-badge { background: rgba(241, 211, 107, .13); }
.status-pill.error { background: rgba(239, 139, 146, .12); }
.status-pill.amber { background: rgba(233, 198, 109, .12); }
.row-button:hover, .node-action:hover { background: rgba(241, 211, 107, .12); }
.row-button.delete:hover { background: rgba(239, 139, 146, .12); }
.tree-row:hover, .guided-step:hover, .guided-step.active { background: rgba(241, 211, 107, .1); }
.tree-children { border-left-color: rgba(241, 211, 107, .28); }
.loading-dot { background: var(--teal); box-shadow: 0 0 0 4px rgba(241, 211, 107, .13); }
.json-preview { color: #f0e7be; background: #111113; border-color: #35353b; }
.table-sort:hover, .table-sort.active, .empty-icon, .node-value, .text-button { color: var(--teal); }
th { border-bottom-color: var(--line); }
td { border-bottom-color: rgba(67, 67, 73, .7); }
.toast { border-color: var(--teal-dim); background: #202126; }
.toast.error { border-color: #8b4f59; background: #362126; }
.confirm-dialog-actions .button.danger { border-color: rgba(239, 139, 146, .4); background: rgba(146, 60, 72, .82); }
.runtime-big strong { text-shadow: 0 0 28px rgba(241, 211, 107, .2); }
.history-area { fill: rgba(241, 211, 107, .14); }
.history-point { fill: #141418; stroke: var(--teal); }
.switch-label input:checked + .switch { background: var(--teal-dim); }
.switch-label input:checked + .switch::after { background: var(--teal); }
@keyframes status-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(87, 211, 155, 0); } 50% { box-shadow: 0 0 0 5px rgba(87, 211, 155, .08); } }
.row-button[class*="edit-"] { color: var(--teal); }
.row-button[class*="edit-"]:hover { color: #ffe58a; background: rgba(241, 211, 107, .18); }
.row-button.delete { color: var(--red); }
.row-button.delete:hover { color: #ffb4ba; background: rgba(239, 139, 146, .18); }
table[data-reference-table="emitters"] td:first-child .table-main,
table[data-reference-table="certificates"] td:first-child .table-main { color: var(--teal); }
table[data-reference-table="certificates"] td:nth-child(4) .catalog-id { color: var(--text); }
table[data-reference-table] th { text-transform: none; letter-spacing: .04em; }
.sidebar-brand strong { font-size: 11px; letter-spacing: .06em; white-space: nowrap; }
.heading-count { color: var(--muted); font-size: .72em; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.button.create-button { color: #08111c; background: var(--blue); border-color: transparent; }
.button.create-button:hover { color: #08111c; background: #b4d2ff; border-color: transparent; }
.catalog-overview-panel { margin-bottom: 14px; }
.catalog-overview-panel .runtime-summary-topline { margin-bottom: 12px; }
.catalog-overview-dashboard { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 900px) { .catalog-overview-dashboard { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .catalog-overview-dashboard { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.runtime-summary-panel { padding: 10px 16px; }
.runtime-summary-panel .runtime-summary-topline,
.catalog-overview-panel .runtime-summary-topline { margin-bottom: 6px; }
.runtime-summary-panel .runtime-summary-topline h2 { margin-bottom: 0; font-size: 15px; }
.runtime-summary-panel .dashboard-metric { padding: 6px 10px; }
.runtime-summary-panel .dashboard-metric span { font-size: 8px; }
.runtime-summary-panel .dashboard-metric strong { margin-top: 2px; font-size: 15px; }
.runtime-summary-panel .dashboard-metric strong { color: var(--text); }
.runtime-summary-panel .dashboard-metric-success strong { color: var(--success); }
.runtime-summary-panel .dashboard-metric-error strong { color: var(--red); }
.runtime-summary-panel { background: linear-gradient(120deg, #242426 0%, #1c1c1e 56%, #151517 100%); border-color: #3b3b40; }
.runtime-summary-panel .dashboard-metric,
.runtime-summary-panel .dashboard-metric-success,
.runtime-summary-panel .dashboard-metric-error {
  border-color: #4a4a50;
  background: rgba(10, 22, 29, .4);
}
.runtime-summary-panel .dashboard-metric-success .dashboard-indicator {
  background: var(--success);
  box-shadow: none;
}
.runtime-summary-panel .dashboard-metric-error .dashboard-indicator {
  background: var(--red);
  box-shadow: none;
}
.catalog-panel { padding: 18px; }
.catalog-subheading { margin: 0 0 10px; }
.history-toolbar.catalog-toolbar,
.history-toolbar.catalog-reference-toolbar { margin-bottom: 16px; }
.catalog-table-wrap,
.catalog-reference-table-wrap { margin-top: 0; }
.catalog-panel .history-toolbar .field > span { margin-bottom: 4px; font-size: 9px; }
.catalog-panel .history-toolbar input,
.catalog-panel .history-toolbar select { padding: 7px 10px; font-size: 11px; }
.catalog-panel .history-toolbar .button { min-height: 34px; padding: 0 12px; }
.catalog-panel .history-toolbar {
  padding: 5px 12px;
  border: 1px solid #55565c;
  border-radius: 9px;
  background: #37383e;
}
.catalog-panel .history-toolbar .field > span { color: #d2d3d7; font-weight: 650; }
.catalog-panel .history-toolbar input::placeholder { color: #c0c1c6; }
.history-toolbar.catalog-toolbar { grid-template-columns: repeat(4, minmax(0, 1fr)) auto; }
.history-toolbar.catalog-reference-toolbar-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; }
.history-toolbar.catalog-reference-toolbar-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) auto; }
.clear-catalog-filters { white-space: nowrap; }
.history-toolbar.variables-toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; margin-bottom: 16px; }
@media (max-width: 700px) { .history-toolbar.variables-toolbar { grid-template-columns: 1fr; } }
.button.create-button { min-height: 30px; color: #ffffff; background: #2f74d0; border-color: transparent; }
.button.create-button:hover { color: #ffffff; background: #5597ed; border-color: transparent; }
.catalog-panel .clear-catalog-filters { color: var(--teal); background: #1b1b1d; border-color: #303136; }
.catalog-panel .clear-catalog-filters:hover { color: #ffe58a; background: #252527; border-color: var(--teal-dim); box-shadow: 0 0 0 2px rgba(241, 211, 107, .12), 0 0 12px rgba(241, 211, 107, .16); }
@media (max-width: 700px) {
  body[data-active-page="catalogo"] .topbar-context { display: flex; flex: 0 0 100%; order: 3; min-width: 0; margin: 8px 0 0; }
}

.catalog-section-nav { width: 100%; margin: 0 0 14px; padding: 4px; overflow: hidden; border: 1px solid #34353a; border-radius: 10px; background: #151517; }
.catalog-section-links { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; width: 100%; min-width: 0; overflow: visible; }
.catalog-section-button { position: relative; min-width: 0; min-height: 37px; padding: 0 12px; overflow: hidden; color: #aaaab1; border: 0; border-radius: 7px; background: transparent; font-size: 11px; font-weight: 560; letter-spacing: .01em; text-overflow: ellipsis; white-space: nowrap; transition: color .18s ease, background .18s ease, box-shadow .18s ease; }
.catalog-section-button:first-child { color: #d8c77d; font-weight: 680; }
.catalog-section-button:hover { color: #f7df83; background: rgba(241, 211, 107, .1); }
.catalog-section-button.active { color: #f1d36b; background: rgba(241, 211, 107, .14); font-weight: 720; box-shadow: inset 0 -2px 0 #f1d36b, 0 3px 12px rgba(241, 211, 107, .12); }
body[data-active-page="catalogo"] .catalog-section-nav { position: sticky; top: 76px; z-index: 4; margin-bottom: 14px; padding-bottom: 14px; border: 0; border-radius: 0; background: #0a0a0b; box-shadow: 0 10px 20px rgba(0, 0, 0, .45); }
body[data-active-page="catalogo"] .catalog-section-links { padding: 4px; border: 1px solid #34353a; border-radius: 10px; background: #151517; }
@media (max-width: 700px) { .catalog-section-links { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 430px) { .catalog-section-links { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Fuentes y destinos siguen el mismo patrón visual que la pantalla de Variables. */
.connections-page { margin-bottom: 13px; }
.connections-list-panel { margin-bottom: 13px; }
.connections-list-panel .mapping-list-heading { margin-bottom: 18px; }
.connections-toolbar { margin-bottom: 16px; }
.connections-toolbar.source-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)) auto; }
.connections-toolbar.broker-toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; }
.connections-list-panel table { min-width: 820px; }
.connections-list-panel .table-main { max-width: 280px; }
.connections-list-panel .connection-table-value { max-width: 360px; }
.connections-list-panel td { height: 62px; }
.connections-list-panel td:last-child { white-space: nowrap; }
.connection-editor-card { width: min(100%, 720px); }
.connection-editor-card .field-row { margin-bottom: 14px; }
.connection-editor-card .form-actions { margin-top: 22px; }
@media (max-width: 700px) {
  .connections-toolbar.source-toolbar,
  .connections-toolbar.broker-toolbar { grid-template-columns: 1fr; }
  .connections-toolbar .button { width: 100%; }
  .connections-list-panel table { min-width: 760px; }
}

.connection-type-nav { width: 100%; margin: 0 0 14px; padding: 4px; overflow: hidden; border: 1px solid #34353a; border-radius: 10px; background: #151517; }
.connection-type-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; width: 100%; min-width: 0; }
.connection-type-button { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; min-height: 37px; padding: 0 14px; overflow: hidden; color: #aaaab1; border: 0; border-radius: 7px; background: transparent; font-size: 12px; font-weight: 600; letter-spacing: .01em; text-overflow: ellipsis; white-space: nowrap; transition: color .18s ease, background .18s ease, box-shadow .18s ease; }
.connection-type-button small { color: #777980; font-size: 10px; font-weight: 600; }
.connection-type-button:hover { color: #f7df83; background: rgba(241, 211, 107, .1); }
.connection-type-button:hover small { color: inherit; }
.connection-type-button.active { color: #f1d36b; background: rgba(241, 211, 107, .14); font-weight: 720; box-shadow: inset 0 -2px 0 #f1d36b, 0 3px 12px rgba(241, 211, 107, .12); }
.connection-type-button.active small { color: inherit; }
.connection-type-button:focus-visible { outline: 2px solid #f1d36b; outline-offset: -2px; }
.connections-page .button.create-button:disabled { cursor: not-allowed; color: #92939a; background: #2a2a2d; border-color: #42434a; opacity: .78; }
.connections-page .button.create-button:disabled:hover { color: #92939a; background: #2a2a2d; border-color: #42434a; box-shadow: none; }
@media (max-width: 520px) {
  .connection-type-button { padding: 0 8px; font-size: 11px; }
  .connection-type-button small { font-size: 9px; }
}
