/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-h); padding: 0 14px; border-radius: var(--r-md);
  border: 1px solid var(--border-default); background: var(--bg-elevated); color: var(--text-primary);
  font-weight: 600; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap;
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-fast);
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: transparent; color: #fff; }
.btn.primary:hover { background: var(--primary-hover); box-shadow: var(--glow-primary); }
.btn.accent { background: var(--brand-gradient); border-color: transparent; color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn.ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn.danger { background: var(--danger-soft); border-color: rgba(239,68,68,0.35); color: #FCA5A5; }
.btn.danger:hover { background: rgba(239,68,68,0.28); }
.btn.success { background: var(--success-soft); border-color: rgba(34,197,94,0.35); color: #86EFAC; }
.btn.sm { height: 30px; padding: 0 10px; font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn.xs { height: 24px; padding: 0 8px; font-size: 11px; border-radius: 6px; }
.btn.icon { width: var(--control-h); padding: 0; }
.btn.icon.sm { width: 30px; }
.btn.icon.xs { width: 24px; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.sm svg { width: 14px; height: 14px; }
.btn.block { width: 100%; }

/* ===== Inputs ===== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
/* Hint: same size and colour inside a .field, after a textarea and on its own (CFG-2.4, ADM-2.5). */
.hint, .field .hint { font-size: var(--fs-xs); line-height: 1.45; color: var(--text-muted); font-weight: 400; }
.field .error { font-size: var(--fs-xs); color: #FCA5A5; }
.input, .select, textarea.input {
  height: var(--control-h); width: 100%; padding: 0 12px; border-radius: var(--r-md);
  background: var(--bg-input); border: 1px solid var(--border-default); color: var(--text-primary);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
textarea.input { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--glow-primary); }
.input::placeholder { color: var(--text-disabled); }
.input.mono { font-family: var(--font-mono); }
.input.invalid { border-color: var(--danger); }
.select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239FB0C8' stroke-width='2.5'><path d='m6 9 6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; cursor: pointer; }
.select option { background: var(--bg-elevated); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > svg { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.input-wrap .input { padding-left: 36px; }
.input-wrap .suffix { position: absolute; right: 10px; display: flex; gap: 4px; }
.input-group { display: flex; }
.input-group .input { border-radius: var(--r-md) 0 0 var(--r-md); }
.input-group .btn { border-radius: 0 var(--r-md) var(--r-md) 0; border-left: none; }

.toggle { display: inline-block; vertical-align: middle; position: relative; width: 40px; height: 22px; border-radius: 999px; background: var(--bg-hover); border: 1px solid var(--border-default); cursor: pointer; transition: background var(--dur-base); flex: none; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-muted); transition: transform var(--dur-base) var(--ease-out), background var(--dur-base); }
.toggle.on { background: var(--primary); border-color: transparent; }
.toggle.on::after { transform: translateX(18px); background: #fff; }
.toggle.sm { width: 32px; height: 18px; }
.toggle.sm::after { width: 12px; height: 12px; }
.toggle.sm.on::after { transform: translateX(14px); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-subtle); }
.toggle-row:last-child { border-bottom: none; }
.toggle-row .t { font-weight: 600; }
.toggle-row .d { font-size: var(--fs-xs); color: var(--text-muted); }

.checkbox { width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--border-strong); background: var(--bg-input); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; transition: all var(--dur-fast); }
.checkbox.on { background: var(--primary); border-color: var(--primary); }
.checkbox.on::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px,-1px); }

.radio-card { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: var(--r-lg); border: 1px solid var(--border-default); background: var(--bg-surface); cursor: pointer; transition: all var(--dur-fast); }
.radio-card:hover { border-color: var(--border-strong); background: var(--bg-elevated); }
.radio-card.on { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.radio-card .t { font-weight: 700; }
.radio-card.dashed { border-style: dashed; background: transparent; align-items: center; text-decoration: none; color: inherit; }
.radio-card .d { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }
.radio-card > .ic { width: 40px; height: 40px; border-radius: 10px; background: var(--bg-elevated); display: flex; align-items: center; justify-content: center; flex: none; color: var(--accent); }
.radio-card > .ic svg { width: 20px; height: 20px; }

/* ===== Cards ===== */
.card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--r-lg); padding: var(--sp-5); position: relative; }
.card.elevated { background: var(--bg-elevated); }
.card.flat { padding: 0; overflow: hidden; }
.card.clickable { cursor: pointer; transition: border-color var(--dur-fast), transform var(--dur-fast), background var(--dur-fast); }
.card.clickable:hover { border-color: var(--border-strong); transform: translateY(-1px); background: var(--bg-elevated); }
.card.danger-border { border-color: rgba(239,68,68,0.4); }
.card.warning-border { border-color: rgba(245,158,11,0.4); }
.card.accent-border { border-color: rgba(43,211,224,0.4); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: var(--sp-4); }
.card-head h3 { display: flex; align-items: center; gap: var(--sp-2); }
.card-head h3 svg { width: 18px; height: 18px; color: var(--accent); }
.card-sub { font-size: var(--fs-xs); color: var(--text-muted); }

/* ===== Status Pill ===== */
.pill.xs { height: 18px; padding: 0 7px; font-size: 10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill svg { width: 12px; height: 12px; }
.pill.success { background: var(--success-soft); color: #86EFAC; }
.pill.warning { background: var(--warning-soft); color: #FCD34D; }
.pill.danger { background: var(--danger-soft); color: #FCA5A5; }
.pill.info { background: var(--info-soft); color: #67E8F9; }
.pill.pending { background: var(--pending-soft); color: #C4B5FD; }
.pill.paused { background: var(--paused-soft); color: #CBD5E1; }
.pill.neutral { background: rgba(255,255,255,0.06); color: var(--text-secondary); }
.pill.primary { background: var(--primary-soft); color: #93C5FD; }
.pill.live .dot { animation: pulse 1.4s ease-in-out infinite; }
.pill.outline { background: transparent; border-color: currentColor; opacity: 0.9; }

.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font-size: 10px; font-weight: 800; background: var(--danger); color: #fff; }
.badge.warn { background: var(--warning); color: #111; }
.badge.info { background: var(--accent); color: #0B1220; }
.badge.muted { background: var(--bg-hover); color: var(--text-secondary); }

.scope { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 6px; border-radius: 5px; }
.scope svg { width: 10px; height: 10px; }
.scope.standard { background: rgba(167,139,250,0.16); color: #C4B5FD; }
.scope.site { background: var(--accent-soft); color: #67E8F9; }

.dot-status { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot-status.success { background: var(--success); box-shadow: 0 0 8px rgba(34,197,94,0.6); }
.dot-status.warning { background: var(--warning); box-shadow: 0 0 8px rgba(245,158,11,0.6); }
.dot-status.danger { background: var(--danger); box-shadow: 0 0 8px rgba(239,68,68,0.6); }
.dot-status.paused { background: var(--paused); }
.dot-status.info { background: var(--accent); box-shadow: 0 0 8px rgba(43,211,224,0.6); }

/* ===== Tables ===== */
.table-wrap { overflow: auto; border: 1px solid var(--border-subtle); border-radius: var(--r-lg); background: var(--bg-surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--border-default); background: var(--bg-surface); position: sticky; top: 0; z-index: var(--z-sticky); white-space: nowrap; }
.tbl td { padding: 0 14px; height: var(--row-h); border-bottom: 1px solid var(--border-subtle); vertical-align: middle; white-space: nowrap; }
.tbl td.wrap { white-space: normal; padding-top: 8px; padding-bottom: 8px; line-height: 1.4; }
.card .tbl th, .card .tbl td, .tx-detail .tbl th, .tx-detail .tbl td { padding-left: 10px; padding-right: 10px; }
.tbl .actions { align-items: center; }
.select.snooze-sel { height: 26px; width: auto; padding: 0 22px 0 8px; font-size: 11px; }
@media (max-width: 1500px) { .grid.stack-lg { grid-template-columns: 1fr; } }
.tbl tbody tr { transition: background var(--dur-fast); }
.tbl tbody tr:hover { background: var(--bg-hover); }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.selected { background: var(--primary-soft); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl td.mono, .tbl .mono { font-family: var(--font-mono); font-size: 12px; }
.tbl .actions { display: flex; gap: 4px; justify-content: flex-end; }
.tbl th.num, .tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: var(--sp-4); }
.toolbar .input-wrap { width: 280px; }
.toolbar .select { width: auto; min-width: 140px; }
.toolbar .spacer { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; background: var(--bg-elevated); border: 1px solid var(--border-default); font-size: var(--fs-xs); font-weight: 600; cursor: pointer; color: var(--text-secondary); transition: all var(--dur-fast); }
.chip:hover { border-color: var(--border-strong); color: var(--text-primary); }
.chip.on { background: var(--primary-soft); border-color: var(--primary); color: #BFDBFE; }
.chip svg { width: 12px; height: 12px; }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border-default); margin-bottom: var(--sp-5); overflow-x: auto; overflow-y: hidden; }
.tab { padding: 10px 14px; font-weight: 600; font-size: var(--fs-sm); color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; transition: color var(--dur-fast), border-color var(--dur-fast); }
.tab:hover { color: var(--text-primary); }
.tab.on { color: var(--text-primary); border-bottom-color: var(--accent); }
.tab .badge { margin-left: 2px; }
.segmented { display: inline-flex; background: var(--bg-input); border: 1px solid var(--border-default); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.segmented button { height: 28px; padding: 0 12px; border: none; border-radius: 7px; background: transparent; color: var(--text-muted); font-weight: 600; font-size: var(--fs-xs); cursor: pointer; transition: all var(--dur-fast); display: inline-flex; align-items: center; gap: 6px; }
.segmented button.on { background: var(--bg-elevated); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.segmented button svg { width: 14px; height: 14px; }

/* ===== KPI ===== */
.kpi { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--r-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--kpi-color, var(--primary)); opacity: 0.9; }
.kpi .l { font-size: var(--fs-xs); font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; display: flex; justify-content: space-between; align-items: center; }
.kpi .v { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 8px; animation: countUp var(--dur-slow) var(--ease-out) both; }
.kpi .u { font-size: var(--fs-xs); color: var(--text-muted); margin-top: -2px; }
.kpi .v small { font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); }
.kpi .trend { font-size: var(--fs-xs); font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.kpi .trend.up { color: #86EFAC; } .kpi .trend.down { color: #FCA5A5; } .kpi .trend.flat { color: var(--text-muted); }
.kpi .spark { height: 28px; margin-top: 2px; }
.kpi .spark svg { width: 100%; height: 100%; }

/* ===== Timeline ===== */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--border-default); }
.tl-item { position: relative; padding: 6px 0 14px; animation: fadeUp var(--dur-slow) var(--ease-out) both; }
.tl-item::before { content: ""; position: absolute; left: -23px; top: 10px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg-elevated); border: 2px solid var(--text-muted); }
.tl-item.ok::before { border-color: var(--success); background: var(--success); }
.tl-item.fail::before { border-color: var(--danger); background: var(--danger); }
.tl-item.warn::before { border-color: var(--warning); background: var(--warning); }
.tl-item.active::before { border-color: var(--accent); background: var(--accent); animation: pulseRing 1.4s ease-out infinite; }
.tl-item .t { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.tl-item .ts { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.tl-item .d { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }
.tl-item .dur { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--accent); }

/* ===== Steps (wizard) ===== */
.steps { display: flex; flex-direction: column; gap: 4px; }
.step { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); color: var(--text-muted); font-weight: 600; font-size: var(--fs-sm); transition: all var(--dur-fast); }
.step .n { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; flex: none; transition: all var(--dur-base); }
.step.done { color: var(--text-secondary); }
.step.done .n { background: var(--success); border-color: var(--success); color: #052e16; }
.step.on { color: var(--text-primary); background: var(--primary-soft); }
.step.on .n { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: var(--glow-primary); }

/* ===== Overlays ===== */
.overlay { position: fixed; inset: 0; background: var(--bg-overlay); backdrop-filter: blur(4px); z-index: var(--z-modal); display: flex; align-items: center; justify-content: center; animation: fadeIn var(--dur-fast) both; }
.modal { background: var(--bg-elevated); border: 1px solid var(--border-default); border-radius: var(--r-xl); width: min(560px, 92vw); max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: scaleIn var(--dur-base) var(--ease-out) both; }
.modal.lg { width: min(880px, 94vw); }
.modal.xl { width: min(1200px, 96vw); }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 22px; overflow: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border-subtle); display: flex; justify-content: flex-end; gap: 8px; }

.drawer-overlay { position: fixed; inset: 0; z-index: var(--z-drawer); background: rgba(5,9,18,0.4); animation: fadeIn var(--dur-fast) both; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 92vw); background: var(--bg-elevated); border-left: 1px solid var(--border-default); z-index: calc(var(--z-drawer) + 1); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slideInRight var(--dur-base) var(--ease-out) both; }
.drawer.wide { width: min(760px, 94vw); }
.drawer-head { padding: 18px 22px; border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.drawer-body { padding: 22px; overflow: auto; flex: 1; }
.drawer-foot { padding: 14px 22px; border-top: 1px solid var(--border-subtle); display: flex; justify-content: flex-end; gap: 8px; }

.toasts { position: fixed; right: 20px; bottom: 44px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; min-width: 300px; max-width: 420px; background: var(--bg-elevated); border: 1px solid var(--border-default); border-left: 3px solid var(--primary); border-radius: var(--r-md); padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; box-shadow: var(--shadow-md); animation: slideInRight var(--dur-base) var(--ease-out) both; }
.toast.success { border-left-color: var(--success); } .toast.warning { border-left-color: var(--warning); } .toast.danger { border-left-color: var(--danger); } .toast.info { border-left-color: var(--accent); }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.success svg { color: var(--success); } .toast.warning svg { color: var(--warning); } .toast.danger svg { color: var(--danger); } .toast.info svg { color: var(--accent); }
.toast .t { font-weight: 700; font-size: var(--fs-sm); }
.toast .d { font-size: var(--fs-xs); color: var(--text-muted); }
.toast.out { animation: fadeIn var(--dur-fast) reverse both; }

.tooltip { position: fixed; z-index: var(--z-tooltip); background: #0A0F1C; border: 1px solid var(--border-strong); color: var(--text-primary); font-size: var(--fs-xs); padding: 6px 10px; border-radius: 8px; pointer-events: none; max-width: 320px; box-shadow: var(--shadow-md); animation: fadeIn var(--dur-fast) both; }

.dropdown { position: absolute; top: calc(100% + 6px); right: 0; min-width: 200px; background: var(--bg-elevated); border: 1px solid var(--border-default); border-radius: var(--r-md); box-shadow: var(--shadow-md); padding: 6px; z-index: 50; animation: fadeDown var(--dur-fast) var(--ease-out) both; }
.dropdown .item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; font-size: var(--fs-sm); cursor: pointer; color: var(--text-secondary); }
.dropdown .item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown .item svg { width: 15px; height: 15px; }
.dropdown .item.danger { color: #FCA5A5; }
.dropdown .sep { height: 1px; background: var(--border-subtle); margin: 4px 0; }

/* ===== Empty state ===== */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 56px 24px; gap: 10px; color: var(--text-muted); }
.empty .art { width: 96px; height: 96px; border-radius: 28px; background: radial-gradient(circle at 30% 30%, rgba(43,211,224,0.25), rgba(2,116,254,0.08) 60%, transparent); display: flex; align-items: center; justify-content: center; color: var(--accent); margin-bottom: 6px; border: 1px solid var(--border-subtle); }
.empty .art svg { width: 40px; height: 40px; }
.empty h3 { color: var(--text-primary); }
.empty p { max-width: 420px; font-size: var(--fs-sm); }
.empty .btn { margin-top: 6px; }

/* ===== Code viewer ===== */
.code { background: #0A0F1C; border: 1px solid var(--border-subtle); border-radius: var(--r-md); padding: 12px 14px; font-family: var(--font-mono); font-size: 12px; line-height: 1.6; overflow: auto; white-space: pre; color: #CBD5E1; }
.code .seg { color: #67E8F9; font-weight: 700; }
.code .fld { color: #FCD34D; }
.code .sep { color: #475569; }
.code .cm { color: #64748B; font-style: italic; }
.code .k { color: #93C5FD; }
.code .s { color: #86EFAC; }
.code .n { color: #FCA5A5; }
.hl7 .line { display: flex; gap: 10px; }
.hl7 .line .ln { color: #475569; flex: 0 0 3ch; min-width: 3ch; text-align: right; font-variant-numeric: tabular-nums; user-select: none; }

/* ===== Progress ===== */
.progress { height: 6px; background: var(--bg-hover); border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: var(--brand-gradient); border-radius: 999px; transition: width var(--dur-slow) var(--ease-out); }
.progress.thin { height: 4px; }
.progress.danger > div { background: var(--danger); }
.progress.warning > div { background: var(--warning); }
.progress.success > div { background: var(--success); }

/* ===== Misc ===== */
.divider { height: 1px; background: var(--border-subtle); margin: var(--sp-4) 0; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; font-size: var(--fs-sm); }
.kv dt { color: var(--text-muted); } .kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.kv dd.mono { font-family: var(--font-mono); font-size: 12px; font-weight: 500; }
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid; font-size: var(--fs-sm); }
.banner svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.banner.info { background: var(--info-soft); border-color: rgba(43,211,224,0.3); color: #CFFAFE; }
.banner.warning { background: var(--warning-soft); border-color: rgba(245,158,11,0.3); color: #FDE68A; }
.banner.danger { background: var(--danger-soft); border-color: rgba(239,68,68,0.3); color: #FECACA; }
.banner.success { background: var(--success-soft); border-color: rgba(34,197,94,0.3); color: #BBF7D0; }
.banner .t { font-weight: 700; }
.banner .d { opacity: 0.9; font-size: var(--fs-xs); margin-top: 2px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-gradient); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.ic-box { width: 40px; height: 40px; border-radius: 11px; background: var(--bg-elevated); display: inline-flex; align-items: center; justify-content: center; color: var(--accent); flex: none; }
.ic-box svg { width: 20px; height: 20px; }
.ic-box.lg { width: 52px; height: 52px; border-radius: 14px; } .ic-box.lg svg { width: 26px; height: 26px; }
.ic-box.success { color: var(--success); background: var(--success-soft); }
.ic-box.danger { color: var(--danger); background: var(--danger-soft); }
.ic-box.warning { color: var(--warning); background: var(--warning-soft); }
.ic-box.primary { color: #93C5FD; background: var(--primary-soft); }
.kbd { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 5px; background: var(--bg-input); border: 1px solid var(--border-default); font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
.typed-confirm .input { font-family: var(--font-mono); letter-spacing: 0.1em; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 16px; margin-bottom: var(--sp-6); flex-wrap: wrap; }
.page-head > :first-child { flex: 1 1 280px; min-width: 0; }
.page-head h1 { display: flex; align-items: center; gap: 12px; }
.page-head .sub { color: var(--text-muted); font-size: var(--fs-sm); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: nowrap; justify-content: flex-end; flex: none; align-items: center; }
.page-head .actions .btn { white-space: nowrap; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--text-muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--text-muted); } .breadcrumb a:hover { color: var(--text-primary); text-decoration: none; }
.breadcrumb svg { width: 12px; height: 12px; }
.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-weight: 800; margin: var(--sp-5) 0 var(--sp-3); display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border-subtle); }

/* HL7 viewer wrapper */
.hl7wrap { display: flex; flex-direction: column; gap: 6px; }
.hl7bar { display: flex; align-items: center; gap: 10px; }
.hl7bar .segmented { margin-left: auto; }
.code .fld.chg { background: rgba(245,158,11,0.22); border-radius: 3px; outline: 1px solid rgba(245,158,11,0.5); }
.code .fld[data-tip]:hover { background: rgba(43,211,224,0.18); border-radius: 3px; cursor: help; }
.tbl tbody tr.selected td { box-shadow: inset 3px 0 0 var(--accent); }
.card.clickable.selected, .feed-row.selected, .wf-row.clickable.selected { outline: 2px solid var(--accent); outline-offset: -2px; }
.auth-foot { gap: 12px; flex-wrap: wrap; }
.bulkbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--r-md); background: var(--primary-soft); border: 1px solid rgba(2,116,254,0.4); margin-bottom: var(--sp-4); animation: fadeDown var(--dur-fast) both; }
.colchooser { position: relative; }

/* Raw instrument data previews keep their columns and scroll sideways (wrapping CSV columns would make them unreadable). */
.table-wrap.scroll-x { overflow-x: auto; scrollbar-width: thin; }

.radio-card.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* Card anatomy (03.11.2026): every card keeps the same rows whatever its text; long text is cut with … and shown in full in the tooltip. */
.line1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.card-status { display: flex; align-items: center; gap: 6px; height: 28px; flex: none; padding: 0 10px; border-radius: 8px; font-size: var(--fs-xs); white-space: nowrap; overflow: hidden; border: 1px solid transparent; }
.card-status > span { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.card-status svg.ic { width: 13px; height: 13px; flex: none; }
.card-status.ok { color: var(--text-muted); background: var(--bg-app); border-color: var(--border-subtle); }
.card-status.error { color: #FCA5A5; background: var(--danger-soft); }
.card-status.warning { color: #FCD34D; background: var(--warning-soft); }
.card-status.paused { color: var(--text-muted); background: var(--bg-elevated); }
.chip-line { display: flex; gap: 4px; flex-wrap: nowrap; overflow: hidden; min-width: 0; height: 24px; }
.chip-line .pill { flex: none; }

/* Key-value rows with a scope badge: label left, badge in its own column so badges line up. */
.kv dt:has(> .scope) { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kv dt > .scope { flex: none; margin-top: 1px; }
.kv:has(> dt > .scope), .card:has(.kv > dt > .scope) .kv { grid-template-columns: 250px 1fr; }

/* Second-level tabs inside a tab (e.g. Device Center): pill style so the hierarchy is clear. */
.tabs.sub { border-bottom: none; gap: 6px; margin-bottom: var(--sp-4); }
.tabs.sub .tab { border: 1px solid var(--border-subtle); border-radius: 999px; padding: 6px 14px; margin-bottom: 0; font-size: var(--fs-xs); display: inline-flex; align-items: center; gap: 6px; }
.tabs.sub .tab svg { width: 14px; height: 14px; }
.tabs.sub .tab.on { background: var(--primary-soft); border-color: var(--primary); color: var(--text-primary); }
/* Clickable cards turn --bg-elevated on hover; inner boxes with the same colour must stay visible. */
.card.clickable:hover .ic-box:not(.success):not(.danger):not(.warning):not(.primary),
.card.clickable:hover .wf-row .dir, .wf-row.clickable:hover .dir { background: var(--bg-hover); }

/* Date and time pickers (04.11.2026 rule: dates and times are picked, never typed). */
input[type=date], input[type=time], input[type=datetime-local] { color-scheme: dark; }
input[type=date]::-webkit-calendar-picker-indicator, input[type=time]::-webkit-calendar-picker-indicator, input[type=datetime-local]::-webkit-calendar-picker-indicator { opacity: 0.7; cursor: pointer; }

/* ---- Settings form sections (04.11.2026): title + description left, fields right at a readable width ---- */
.card.form-card { padding: 4px 28px; }
.fsec { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 720px); gap: 40px; padding: 28px 0; border-top: 1px solid var(--border-subtle); }
.fsec:first-child { border-top: none; }
.fsec-head h4 { margin: 0; font-size: var(--fs-md); font-weight: 700; }
.fsec-head p { margin: 6px 0 0; font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.5; }
.fsec-body { min-width: 0; }
.fsec-off { display: flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: var(--r-md); border: 1px dashed var(--border-default); color: var(--text-muted); font-size: var(--fs-sm); }
.frow { display: grid; gap: 16px; align-items: start; }
.frow.one { grid-template-columns: minmax(0, 460px); }
.frow.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.frow.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.frow.addr { grid-template-columns: minmax(0, 1fr) 140px; }
.frow.addr-rev { grid-template-columns: 140px minmax(0, 1fr); }
.frow.port-only, .frow.short { grid-template-columns: minmax(0, 220px); }
.frow.times { grid-template-columns: repeat(2, minmax(0, 180px)); }
.frow > .field:empty { display: none; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choices.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--border-default); background: var(--bg-surface); cursor: pointer; transition: border-color var(--dur-fast), background var(--dur-fast); }
.choice:hover { border-color: var(--border-strong); }
.choice.on { border-color: var(--primary); background: var(--primary-soft); }
.choice[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.choice .t { font-weight: 600; font-size: var(--fs-sm); }
.choice .d { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; line-height: 1.45; }
.radio-dot { width: 16px; height: 16px; flex: none; margin-top: 2px; border-radius: 50%; border: 2px solid var(--border-strong); position: relative; }
.choice.on .radio-dot { border-color: var(--primary); }
.choice.on .radio-dot::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--primary); }
.choice-ic { display: inline-flex; color: var(--accent); margin-top: 1px; }
.choice-ic svg { width: 16px; height: 16px; }
.inline-toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; border-radius: var(--r-md); background: var(--bg-app); border: 1px solid var(--border-subtle); }
.inline-toggle .t { font-weight: 600; font-size: var(--fs-sm); }
.inline-toggle .d { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }
.static-val { display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border-radius: var(--r-md); background: var(--bg-app); border: 1px solid var(--border-subtle); font-size: var(--fs-sm); width: fit-content; }
.field label.remember { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: var(--fs-sm); color: var(--text-secondary); cursor: pointer; }
.token-box { display: flex; align-items: center; gap: 16px; padding: 12px 14px; border-radius: var(--r-md); background: var(--bg-app); border: 1px solid var(--border-subtle); }
.token-box .t { font-weight: 600; font-size: var(--fs-sm); }
.token-box .d { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }
.field label .opt { margin-left: 8px; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--text-disabled); }
.input.invalid { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15); }

/* ---------- W2-A shared components (23.11.2026) ---------- */
/* Menu on the top layer: ui.js menu(). */
.dropdown.ui-menu { position: fixed; top: auto; right: auto; z-index: var(--z-menu); min-width: 200px; max-width: min(360px, calc(100vw - 16px)); }
.dropdown.ui-menu .item:focus { outline: none; background: var(--bg-hover); color: var(--text-primary); }
.dropdown.ui-menu .item:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.dropdown.ui-menu .item.ui-menu-off { opacity: 0.5; cursor: default; }
.dropdown.ui-menu .item.ui-menu-off:hover { background: transparent; color: var(--text-secondary); }

/* Select: the small size keeps room for its arrow. */
.select.sm { height: 30px; font-size: var(--fs-xs); padding: 0 28px 0 10px; background-position: right 10px center; }

/* Value with a unit box: the box takes the width of its text. */
.unit-box { display: inline-flex; align-items: stretch; max-width: 100%; }
.unit-box .input { width: 92px; flex: none; border-radius: var(--r-md) 0 0 var(--r-md); text-align: right; font-variant-numeric: tabular-nums; }
.unit-box .unit, .input-group > .unit { display: inline-flex; align-items: center; flex: none; width: auto; padding: 0 var(--sp-3); border: 1px solid var(--border-default); border-left: none; border-radius: 0 var(--r-md) var(--r-md) 0; background: var(--bg-elevated); color: var(--text-muted); font-size: var(--fs-sm); white-space: nowrap; }

/* Status badge with a fixed width, so the next column does not move from row to row. */
.pill.fixed { min-width: 112px; justify-content: flex-start; }

/* Empty state: one component (icon, title, one sentence, one action). The clear tone replaces the old All Clear block. */
.empty.compact { padding: var(--sp-6) var(--sp-4); }
.empty.compact .art { width: 56px; height: 56px; border-radius: 18px; }
.empty.compact .art svg { width: 26px; height: 26px; }
.empty.clear .art { background: var(--success-soft); color: #86EFAC; }

/* Label and value as a row list (narrow places): label left and wraps, value right and wraps. */
.kv-rows { display: flex; flex-direction: column; font-size: var(--fs-sm); }
.kv-rows > .kv-row { display: grid; grid-template-columns: minmax(0, 180px) minmax(0, 1fr); gap: var(--sp-4); padding: var(--sp-2) 0; border-bottom: 1px solid var(--border-subtle); align-items: baseline; }
.kv-rows > .kv-row:last-child { border-bottom: none; }
.kv-rows .kv-l { color: var(--text-muted); overflow-wrap: break-word; }
.kv-rows .kv-v { font-weight: 600; min-width: 0; overflow-wrap: break-word; }

/* Toolbar group: a label and its control wrap together. */
.toolbar-group { display: inline-flex; align-items: center; gap: var(--sp-2); white-space: nowrap; flex: none; }
.toolbar-group > label, .toolbar-group > .toolbar-l { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 600; }

/* Table with fixed columns: one flexible column (no width), the others get a width from their <col> or <th>. */
.tbl.tbl-fixed { table-layout: fixed; width: 100%; }
.tbl.tbl-fixed td { white-space: normal; overflow-wrap: break-word; }
.tbl.tbl-fixed td, .tbl.tbl-fixed th { min-width: 0; }
