﻿/* Checkara — design tokens + base styles + shared components
   Loaded by every mockup page. Ported later to MudBlazor theme (see DESIGN.md). */

/* ---------- 1. Tokens (light = default) ---------- */
:root {
  color-scheme: light;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, "Courier New", monospace;

  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f9f8;
  --surface-3: #eef1ef;
  --border: #e6eae8;
  --border-strong: #cfd6d2;
  --selected: #eef1ef;
  --hover: #f3f5f4;

  --text: #111a16;
  --text-2: #4b5953;
  --text-3: #66736d;

  --accent: #13804d;
  --accent-hover: #0f6d41;
  --accent-soft: #e0f4e9;
  --accent-text: #0d6a3f;
  --on-accent: #ffffff;
  --focus: rgba(19, 128, 77, 0.35);

  /* status — fixed semantics, never reused for series */
  --ok: #3f9e1a;        --ok-soft: #ebf6e3;   --ok-text: #2e7712;
  --warn: #fab219;      --warn-soft: #fff3d1; --warn-text: #8a5a00;
  --crit: #d03b3b;      --crit-soft: #fbe7e7; --crit-text: #b02a2a;
  --unk: #94a0b1;       --unk-soft: #eef1f5;  --unk-text: #5b6776;
  --poll: var(--accent); --poll-soft: var(--accent-soft);

  /* dependency edge kinds (categorical, not status) */
  --kind-rabbit: #eb6834;
  --kind-http: #2a78d6;
  --kind-camunda: #4a3aa7;

  /* log levels */
  --lvl-debug: var(--text-3);
  --lvl-info: var(--accent);
  --lvl-warn: var(--warn-text);
  --lvl-error: var(--crit);
  --lvl-fatal: var(--crit);

  /* code viewer */
  --code-kw: #7c3aed;
  --code-str: #0f766e;
  --code-num: #b45309;
  --code-fn: #1d4ed8;
  --code-cm: var(--text-3);

  --shadow-sm: 0 1px 2px rgba(11, 46, 34, 0.06);
  --shadow-md: 0 6px 20px -8px rgba(11, 46, 34, 0.18);
  --shadow-lg: 0 16px 40px -12px rgba(11, 46, 34, 0.28);
  --scrim: rgba(11, 46, 34, 0.45);

  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px;

  --nav-w: 236px;
  --top-h: 56px;
  --page-max: 1560px;

  --canvas-dot: #d5dbd8;
  /* stability calendar on «Головна»: share of failed health checks, none → many; grey = no data */
  --heat-0: #4fb36b; --heat-1: #e9cf6a; --heat-2: #f0a64a; --heat-3: #e5704f; --heat-4: #c93636; --heat-none: #e9edeb;

  /* brand surface (sign-in hero) — dark green in both themes, like the mark's tile */
  --brand-bg: #0b2e22;
  --brand-border: #1f5440;
  --brand-text: #e6f2ec;
  --brand-text-2: #a8c8b9;
  --brand-accent: #2bd47d;   /* the done / current step marks on the first-run panel */

  /* Google sign-in button — Google's branding colours, not ours */
  --google-bg: #ffffff;
  --google-border: #747775;
  --google-text: #1f1f1f;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111413;
    --surface: #171a19;
    --surface-2: #1d211f;
    --surface-3: #242927;
    --border: #2a2f2d;
    --border-strong: #3a403d;
    --selected: #242927;
    --hover: #1d211f;
    --text: #e8ecea;
    --text-2: #a9b1ad;
    --text-3: #808a85;
    --accent: #2bd47d;
    --accent-hover: #4fe096;
    --accent-soft: #15382a;
    --accent-text: #5ee6a0;
    --on-accent: #062016;
    --focus: rgba(43, 212, 125, 0.45);
    --ok: #7cc93a;   --ok-soft: #22401a;   --ok-text: #9bdc5e;
    --warn: #fab219; --warn-soft: #3a2d0c; --warn-text: #fac54d;
    --crit: #e05252; --crit-soft: #3b1717; --crit-text: #f08080;
    --unk: #6f7d91;  --unk-soft: #232826;  --unk-text: #a7b3c4;
    --kind-rabbit: #f0834f;
    --kind-http: #3987e5;
    --kind-camunda: #9085e9;
    --code-kw: #c4b5fd;
    --code-str: #5eead4;
    --code-num: #fbbf24;
    --code-fn: #93c5fd;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 6px 20px -8px rgba(0, 0, 0, 0.55);
    --shadow-lg: 0 16px 40px -12px rgba(0, 0, 0, 0.65);
    --scrim: rgba(0, 0, 0, 0.6);
    --canvas-dot: #2a2f2d;
    --heat-0: #1f5a33; --heat-1: #7a6a1c; --heat-2: #a8661f; --heat-3: #b8422e; --heat-4: #e05252; --heat-none: #242927;
    --google-bg: #131314;
    --google-border: #8e918f;
    --google-text: #e3e3e3;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111413;
  --surface: #171a19;
  --surface-2: #1d211f;
  --surface-3: #242927;
  --border: #2a2f2d;
  --border-strong: #3a403d;
  --selected: #242927;
  --hover: #1d211f;
  --text: #e8ecea;
  --text-2: #a9b1ad;
  --text-3: #808a85;
  --accent: #2bd47d;
  --accent-hover: #4fe096;
  --accent-soft: #15382a;
  --accent-text: #5ee6a0;
  --on-accent: #062016;
  --focus: rgba(43, 212, 125, 0.45);
  --ok: #7cc93a;   --ok-soft: #22401a;   --ok-text: #9bdc5e;
  --warn: #fab219; --warn-soft: #3a2d0c; --warn-text: #fac54d;
  --crit: #e05252; --crit-soft: #3b1717; --crit-text: #f08080;
  --unk: #6f7d91;  --unk-soft: #232826;  --unk-text: #a7b3c4;
  --kind-rabbit: #f0834f;
  --kind-http: #3987e5;
  --kind-camunda: #9085e9;
  --code-kw: #c4b5fd;
  --code-str: #5eead4;
  --code-num: #fbbf24;
  --code-fn: #93c5fd;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 20px -8px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 16px 40px -12px rgba(0, 0, 0, 0.65);
  --scrim: rgba(0, 0, 0, 0.6);
  --canvas-dot: #2a2f2d;
  --heat-0: #1f5a33; --heat-1: #7a6a1c; --heat-2: #a8661f; --heat-3: #b8422e; --heat-4: #e05252; --heat-none: #242927;
  --google-bg: #131314;
  --google-border: #8e918f;
  --google-text: #e3e3e3;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
svg.ic { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.ic.sm { width: 14px; height: 14px; }
svg.ic.xs { width: 12px; height: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12px; }
.foot-note { margin: 14px 0 0; font-size: 12px; color: var(--text-3); }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.row { display: flex; align-items: center; gap: var(--s-2); }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: var(--s-3); }
.hr { height: 1px; background: var(--border); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- 3. App shell ---------- */
.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: var(--top-h) minmax(0, 1fr);
  flex: 1; min-height: 0;
  overflow: hidden;
}
/* A page without a TopBar (Home): its main takes both rows instead of the 56 px header slot. */
.app > .main:first-child { grid-row: 1 / -1; }
/* App shell: AppNav (left) + page column. Page headers (.topbar) now only carry the page's own title/actions. */
.shell { display: flex; height: 100vh; overflow: hidden; }
.shell-body { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }

.appnav {
  position: relative; flex: none; box-sizing: border-box; width: var(--nav-w);
  display: flex; flex-direction: column; gap: 2px; padding: 20px 12px 14px;
  background: var(--surface); border-right: 1px solid var(--border);
  font-size: 14px; color: var(--text);
  transition: width 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}
.appnav-brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 18px; font-weight: 600; font-size: 15px; color: var(--text); }
.appnav-brand:hover { text-decoration: none; }
.appnav-brand img { width: 24px; height: 24px; flex: none; }
/* Brand row: logo on the left, the collapse icon on the right; in the 60 px rail they stack. */
.appnav-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 4px; }
.appnav-collapse { flex: none; width: 28px; height: 28px; margin-top: -2px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 7px; background: transparent; color: var(--text-3); cursor: pointer; }
.appnav-collapse:hover { background: var(--hover); color: var(--text); }
.appnav-collapse:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.appnav-collapse .ic { width: 18px; height: 18px; }
.appnav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-2);
  font: inherit; text-align: left; cursor: pointer; text-decoration: none;
}
.appnav-item:hover { background: var(--hover); text-decoration: none; }
.appnav-item[aria-current="page"], .appnav-item.is-open { background: var(--selected); color: var(--text); font-weight: 500; }
.appnav-item svg.ic { flex: none; width: 18px; height: 18px; }
.appnav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.appnav-spacer { flex: 1; min-height: 20px; }
.appnav-user { margin-top: 6px; height: auto; padding: 8px 10px; color: var(--text); }
.appnav-avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-size: 12px; }
.appnav-who { flex: 1; min-width: 0; line-height: 1.3; }
.appnav-who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appnav-who span:first-child { font-size: 13px; }
.appnav-who span + span { font-size: 12px; color: var(--text-3); }

.appnav-menu {
  position: absolute; left: 12px; bottom: 60px; z-index: 40; width: 272px; padding: 6px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-lg);
}
.dd-scrim { position: fixed; inset: 0; z-index: 39; }

/* Collapsed rail (60 px): the user's choice (data-nav on <html>, set before first paint), the Collapsed parameter, or a narrow window. */
.appnav.is-collapsed, :root[data-nav="collapsed"] .appnav { width: 60px; padding-inline: 10px; }
.appnav.is-collapsed .appnav-brand, :root[data-nav="collapsed"] .appnav .appnav-brand { padding-inline: 8px; }
.appnav.is-collapsed .appnav-top, :root[data-nav="collapsed"] .appnav .appnav-top { flex-direction: column; align-items: center; gap: 0; }
:root[data-nav="collapsed"] .appnav .appnav-collapse { margin: 0 0 14px; }
.appnav.is-collapsed .appnav-item, :root[data-nav="collapsed"] .appnav .appnav-item { justify-content: center; padding-inline: 0; }
.appnav.is-collapsed .appnav-text, :root[data-nav="collapsed"] .appnav .appnav-text,
.appnav.is-collapsed .appnav-who, :root[data-nav="collapsed"] .appnav .appnav-who { display: none; }
.appnav.is-collapsed .appnav-menu, :root[data-nav="collapsed"] .appnav .appnav-menu { left: 64px; }
@media (max-width: 1100px) {
  .appnav { width: 60px; padding-inline: 10px; }
  .appnav-brand { padding-inline: 8px; }
  .appnav-item { justify-content: center; padding-inline: 0; }
  .appnav-text, .appnav-who, .appnav-collapse { display: none; }
  .appnav-menu { left: 64px; }
}
@media (prefers-reduced-motion: reduce) { .appnav { transition: none; } }
.appnav-body { display: contents; }
/* The flow editor's chevron opens the full menu OVER the page: the rail keeps its 60 px slot (placeholder), the menu floats above the canvas. */
.shell { position: relative; }
.appnav-ph { flex: none; width: 60px; }
.appnav.is-overlay { position: absolute; z-index: 60; inset: 0 auto 0 0; width: var(--nav-w); box-shadow: var(--shadow-lg); transition: none; }
.appnav.is-collapsed .appnav-collapse { margin: 0 0 14px; }

/* Phone (≤ 720 px): the left menu gives way to the bottom bar of AppNavMobile; the page column takes the rest. */
@media (max-width: 720px) {
  .shell { flex-direction: column; height: 100dvh; }
  .appnav, .appnav-ph { display: none; }
}

/* «Перейти до змісту»: visible only while it has focus. */
.skip-link { position: absolute; z-index: 2000; left: 8px; top: -48px; padding: 8px 14px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-weight: 500; text-decoration: none; }
.skip-link:focus { top: 8px; outline: 2px solid var(--focus); outline-offset: 2px; }
.shell-main { flex: 1; min-height: 0; min-width: 0; display: flex; flex-direction: column; outline: none; }

/* Dropdown shared by EnvPicker and MultiSelect. */
.dd { position: relative; display: inline-block; font-size: 13px; }
.dd-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px 0 12px; max-width: 280px;
  border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font: inherit; white-space: nowrap; cursor: pointer;
}
.dd-btn b { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.dd-btn[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.dd-btn .prod { font-size: 11px; color: var(--warn-text); }
.dd-panel { position: absolute; top: 40px; left: 0; z-index: 40; width: 260px; padding: 6px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-lg); }
.dd-panel.right { left: auto; right: 0; }
.dd-search { box-sizing: border-box; width: 100%; height: 32px; margin-bottom: 6px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.dd-list { max-height: 260px; overflow-y: auto; }
.dd-opt { display: flex; width: 100%; align-items: center; gap: 10px; padding: 7px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.dd-opt:hover, .dd-opt.on { background: var(--hover); }
.dd-opt .grow { flex: 1; }
.dd-opt .note { font-size: 11px; color: var(--text-3); }
.dd-opt .note.prod { color: var(--warn-text); }
.dd-opt input { accent-color: var(--accent); pointer-events: none; }
.dd-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.envpick-seg { display: inline-flex; background: var(--selected); border-radius: 9px; padding: 3px; }
.envpick-seg button { border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 13px; padding: 5px 11px; border-radius: 7px; cursor: pointer; }
.envpick-seg button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* StatusDot: dot + word, never colour alone. */
.sdot { display: inline-flex; align-items: center; gap: 6px; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s-4);
  padding: 0 var(--s-6);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; }
.topbar-title .crumb { overflow: hidden; text-overflow: ellipsis; }
.topbar-title .crumb { color: var(--text-3); font-weight: 400; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); }
.topbar-right .btn,
.topbar-right .input,
.topbar-right select {
  height: 32px;
  min-height: 32px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}
.topbar-right .btn {
  padding: 0 12px;
  font-size: 13px;
  line-height: 30px;
  gap: 7px;
}
.topbar-right .btn svg.ic {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.topbar-right .btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.topbar-right .btn-icon svg.ic {
  width: 16px;
  height: 16px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-2);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; border: 1px solid var(--border);
}
button.avatar {
  cursor: pointer; padding: 0; font: inherit; transition: opacity .15s ease, border-color .15s ease;
}
button.avatar:hover {
  opacity: .9; border-color: var(--accent);
}

.main { padding: var(--s-6); display: flex; flex-direction: column; gap: var(--s-5); max-width: var(--page-max); width: 100%; margin: 0 auto; min-width: 0; height: 100%; overflow-y: auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.page-head .sub { color: var(--text-2); margin-top: 4px; font-size: 13px; }

/* env switcher — compact dropdown (MudMenu trigger), replaces the old chip row so it fits the
   sticky topbar; each item still carries the env's worst-status dot. */
.envsw-trigger {
  display: inline-flex; align-items: center; gap: 7px; height: 32px;
  padding: 5px 10px; border-radius: var(--r-pill); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 12.5px; font-weight: 600;
}
.envsw-trigger:hover { background: var(--surface-2); }
.envsw-trigger .dot { width: 7px; height: 7px; }
.envsw-item { display: inline-flex; align-items: center; gap: 8px; }
.envsw-popover { max-height: min(60vh, 320px); overflow-y: auto; }
.save-error { display: inline-flex; align-items: center; gap: 6px; max-width: 320px; padding: 5px 10px; border-radius: var(--r-sm); background: var(--crit-soft); color: var(--crit-text); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.envsw-item.active { font-weight: 700; color: var(--accent-text); }

/* ---------- 4. Components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.card-h { display: flex; align-items: center; gap: var(--s-3); padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-h h2 { font-size: 14.5px; }
.card-h .spacer { flex: 1; }
.card-b { padding: 18px; }
.card-b.flush { padding: 0; }
.card-f { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: var(--s-3); color: var(--text-2); font-size: 12.5px; flex-wrap: wrap; overflow-wrap: anywhere; }
.card-f > * { min-width: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-weight: 500; font-size: 13px; line-height: 1.2;
  white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn svg.ic { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-ghost.del:hover { background: var(--crit-faint); color: var(--crit); }
.btn-danger { color: var(--crit-text); border-color: var(--crit-soft); background: var(--crit-soft); }
.btn-sm {
  height: 32px;
  min-height: 32px;
  padding: 0 11px;
  font-size: 12.5px;
  gap: 6px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
}
.btn-sm svg.ic { width: 15px; height: 15px; }
.btn-icon.btn-sm { width: 32px; height: 32px; padding: 0; justify-content: center; }

.table.dense .btn-sm {
  height: 26px;
  min-height: 26px;
  padding: 0 8px;
  font-size: 11.5px;
  gap: 4px;
}
.table.dense .btn-sm svg.ic { width: 13px; height: 13px; }
.table.dense .btn-icon.btn-sm { width: 26px; height: 26px; padding: 0; }
.btn[disabled] { opacity: .5; cursor: default; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--unk); flex: none; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.crit { background: var(--crit); }
.dot.unk { background: var(--unk); }
.dot.poll { background: var(--poll); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--focus); } 50% { box-shadow: 0 0 0 5px transparent; } }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px 2px 7px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 500; line-height: 1.6;
  background: var(--surface-3); color: var(--text-2); border: 1px solid transparent;
}
.chip .dot { width: 7px; height: 7px; }
.chip.ok { background: var(--ok-soft); color: var(--ok-text); }
.chip.warn { background: var(--warn-soft); color: var(--warn-text); }
.chip.crit { background: var(--crit-soft); color: var(--crit-text); }
.chip.unk { background: var(--unk-soft); color: var(--unk-text); }
.chip.poll { background: var(--poll-soft); color: var(--accent-text); }
.chip.accent { background: var(--accent-soft); color: var(--accent-text); }
.chip.outline { background: transparent; border-color: var(--border-strong); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 6px; border-radius: var(--r-xs);
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  background: var(--surface-3); color: var(--text-2); line-height: 1.6; white-space: nowrap;
}
.badge.iis { background: var(--surface-3); color: var(--text-2); }
.badge.docker { background: var(--accent-soft); color: var(--accent-text); }
.badge.kind-rabbit { background: color-mix(in srgb, var(--kind-rabbit) 14%, transparent); color: var(--kind-rabbit); }
.badge.kind-http { background: color-mix(in srgb, var(--kind-http) 14%, transparent); color: var(--kind-http); }
.badge.kind-camunda { background: color-mix(in srgb, var(--kind-camunda) 14%, transparent); color: var(--kind-camunda); }
.badge.impact { background: var(--crit-soft); color: var(--crit-text); }

.method { font-family: var(--mono); font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: var(--r-xs); letter-spacing: .03em; min-width: 44px; text-align: center; display: inline-block; }
.method.get { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok-text); }
.method.post { background: var(--accent-soft); color: var(--accent-text); }
.method.put { background: var(--warn-soft); color: var(--warn-text); }
.method.delete { background: var(--crit-soft); color: var(--crit-text); }

.lvl { font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: var(--r-xs); display: inline-block; letter-spacing: .03em; }
.lvl.DEBUG, .lvl.Debug, .lvl.TRACE, .lvl.Trace { color: var(--lvl-debug); background: var(--surface-3); }
.lvl.INFO, .lvl.Info { color: var(--accent-text); background: var(--accent-soft); }
.lvl.WARN, .lvl.Warn { color: var(--warn-text); background: var(--warn-soft); }
.lvl.ERROR, .lvl.Error { color: var(--crit-text); background: var(--crit-soft); }
.lvl.FATAL, .lvl.Fatal { color: var(--on-accent); background: var(--crit); }

/* tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-3); padding: 9px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
.table td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table.dense td, .table.dense th { padding: 6px 12px; font-size: 12.5px; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table tr.clickable { cursor: pointer; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 6px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0; background: transparent; padding: 10px 14px; font-size: 13.5px; font-weight: 500; color: var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.tab .count { font-size: 11px; background: var(--surface-3); color: var(--text-2); padding: 0 6px; border-radius: var(--r-pill); }
[data-panel] { display: none; }
[data-panel].active { display: block; }

/* form controls */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; padding: 7px 10px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: 13px;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); outline: 0; }
.select { appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237f8b9c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.input-icon { position: relative; }
.input-icon svg.ic { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-3); }
.input-icon .input { padding-left: 30px; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 11px; font-size: 12.5px; font-weight: 500; color: var(--text-2); border-right: 1px solid var(--border); }
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--accent-soft); color: var(--accent-text); }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 34px; height: 20px; border-radius: var(--r-pill); background: var(--border-strong); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .5; cursor: default; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); }
.kpi { padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; position: relative; }
.kpi .label { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.kpi .value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.kpi .delta { font-size: 12px; color: var(--text-3); }

/* tooltips */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%) translateY(4px);
  background: var(--text); color: var(--bg); font-size: 11.5px; font-weight: 500; padding: 5px 8px; border-radius: var(--r-sm);
  white-space: pre; pointer-events: none; opacity: 0; transition: opacity .12s, transform .12s; z-index: 30; box-shadow: var(--shadow-md);
  font-family: var(--mono); line-height: 1.5;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translateX(-50%) translateY(0); }

/* topbar tooltips — show below to avoid clipping by screen top / .app overflow */
.topbar [data-tip]::after {
  bottom: auto; top: calc(100% + 6px); transform: translateX(-50%) translateY(-4px);
}
.topbar [data-tip]:hover::after, .topbar [data-tip]:focus-visible::after {
  transform: translateX(-50%) translateY(0);
}
.topbar-right [data-tip]::after {
  left: auto; right: 0; transform: translateY(-4px);
}
.topbar-right [data-tip]:hover::after, .topbar-right [data-tip]:focus-visible::after {
  transform: translateY(0);
}

/* code / log viewers */
.code {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 12px 14px; overflow-x: auto; white-space: pre; color: var(--text); margin: 0;
}
.code .kw { color: var(--code-kw); font-weight: 600; }
.code .str { color: var(--code-str); }
.code .n { color: var(--code-num); }
.code .fn { color: var(--code-fn); }
.code .cm { color: var(--code-cm); font-style: italic; }
.code .ln { display: inline-block; width: 2.2em; color: var(--text-3); user-select: none; text-align: right; margin-right: 12px; }
.tpl { display: inline-flex; align-items: center; gap: 3px; background: var(--accent-soft); color: var(--accent-text); font-family: var(--mono); font-size: 11.5px; padding: 0 6px; border-radius: var(--r-xs); font-weight: 600; }

/* notices */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r-md); font-size: 12.5px; border: 1px solid transparent; }
.notice.warn { background: var(--warn-soft); color: var(--warn-text); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.notice.info { background: var(--accent-soft); color: var(--accent-text); }
.notice svg.ic { width: 16px; height: 16px; margin-top: 1px; }

/* misc */
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); align-items: center; }
.legend .item { display: inline-flex; align-items: center; gap: 6px; }
.kbd { font-family: var(--mono); font-size: 11px; padding: 0 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); color: var(--text-2); }
.empty { padding: 32px; text-align: center; color: var(--text-3); font-size: 13px; }
.divider-v { width: 1px; align-self: stretch; background: var(--border); }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5); }
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }

/* Slide-in right panel — shared entrance animation for the Settings/Service popup edit drawers
   (`.slide-panel.drawer`, see below) AND the Deps selected-node / Flow node-props side panels
   (`.slide-panel` alone, which stay inline in their own layout). Two-phase: mounted off-screen
   (translateX(100%), opacity 0), then ".open" is added a tick later so the browser has a
   starting state to animate from. The global reduced-motion rule above (`transition: none
   !important`) already turns this into an instant, non-animated state change for users who
   asked for less motion. */
.slide-panel { transform: translateX(100%); opacity: 0; transition: transform .2s ease-out, opacity .2s ease-out; }
/* `none`, not translateX(0): a transform makes the panel the containing block of its fixed children, so a
   modal opened from inside a drawer (shared access «Документи стануть входами») would be clipped to it. */
.slide-panel.open { transform: none; opacity: 1; }

/* Backdrop shown behind a `.slide-panel.drawer` while it's open. Click closes the drawer. */
.slide-panel-scrim { position: fixed; inset: 0; z-index: 39; background: var(--scrim); opacity: 0; transition: opacity .2s ease-out; }
.slide-panel-scrim.open { opacity: 1; }

/* Centered modal dialogs (z-index above drawers) */
.modal-dialog-wrap {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  pointer-events: none;
}
.modal-dialog-wrap > * {
  pointer-events: auto;
}
.modal-dialog-scrim {
  position: fixed; inset: 0; z-index: 49;
  background: var(--scrim);
  backdrop-filter: blur(2px);
  animation: fadeIn .15s ease-out;
}
.modal-dialog {
  position: relative; z-index: 51;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* ---------- 5. Responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col, .three-col { grid-template-columns: 1fr; }
  .topbar-title .crumb { display: none; }
}
@media (max-width: 720px) {
  .app { grid-template-rows: auto minmax(0, 1fr); }
  .topbar { padding: 0 var(--s-4); position: sticky; top: env(safe-area-inset-top, 0px); flex-wrap: wrap; height: auto; min-height: var(--top-h); row-gap: 8px; padding-block: 8px; }
  .topbar-right { margin-left: auto; }
  .topbar { overflow-x: clip; }
  .envsw { order: 3; width: 100%; min-width: 0; max-width: 100%; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .envsw::-webkit-scrollbar { display: none; }
  .envsw button { flex: none; }
  .main { padding: var(--s-4) var(--s-4) calc(var(--s-4) + 72px); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .value { font-size: 22px; }
  .card-h, .card-b { padding-left: 14px; padding-right: 14px; }
}

/* ---------- MudBlazor font bridge — keep Inter everywhere, including inside Mud components ---------- */
.mud-typography, .mud-button-root, .mud-input-control, .mud-select, .mud-tabs, .mud-alert,
.mud-appbar, .mud-drawer, .mud-list-item, .mud-chip, .mud-table {
  font-family: var(--font) !important;
}

/* ===== T3.2 shared UI patterns (ConfirmDialog, ErrorBanner, Skeleton) — tokens only ===== */
.confirm-msg { white-space: pre-line; margin: 0 0 16px; color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }
.confirm-actions .btn-danger { background: var(--crit); border-color: var(--crit); color: var(--on-accent); }
.err-banner { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.err-banner-body { flex: 1; min-width: 0; }
.err-banner-details pre { margin: 6px 0 0; white-space: pre-wrap; font-size: 12px; color: var(--text-2); }
.skel { display: flex; flex-direction: column; gap: 10px; }
.skel-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.skel-trow { display: flex; gap: 16px; }
