/* AiHummer Admin UI — EMCHummer Design-System stylesheet (§6.16).
   Framework-free; served at /admin/style.css. Composition:
   1) webfonts + icon font (Onest / Manrope / JetBrains Mono / Phosphor)
   2) design tokens (colors, typography, spacing, motion) — dark-first + light theme
   3) the realized design component system (app.css) — shell, cards, lists,
      tables, badges, buttons, forms, modals, drawers, toasts, palette, chat
   4) the admin-UI screen rules (the existing per-screen markup) — kept intact so
      every screen stays styled and functional while adopting the design look
   5) a shell layer mapping the admin shell onto the design's .app/.side/.main grid
   Set data-theme="dark" (default) | "light" on <html>. */

/* ---- 1) webfonts + icon font ---- */
@import url('https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700;800&family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&family=Anton&display=swap');

/* ---- 2) design tokens ----
   Warm-charcoal + ember language. Dark-first with a native warm-cream light theme.
   Use semantic --em-* tokens in product code; raw hex only belongs in this file.
   Set the theme with data-theme="dark" | "light" on <html>. */

:root {
  /* Brand constants — identical in both themes */
  --em-accent: #F0632E;          /* signature ember — actions, active, key data */
  --em-accent-bright: #FF8A4C;   /* hover / gradient top */
  --em-accent-ink: #ffffff;      /* text on accent fills */
  --em-glow: 255, 128, 46;
}

:root,
[data-theme="dark"] {
  color-scheme: dark;

  /* Backgrounds */
  --em-bg: #070504;          /* app canvas */
  --em-bg-sub: #0B0807;      /* sidebar / subtle bands */
  /* Surfaces */
  --em-surface: #100B09;
  --em-surface-2: #150E0B;
  --em-surface-3: #1C140F;
  /* Lines */
  --em-line: #241B16;
  --em-line-strong: #33271F;

  /* Text */
  --em-text: #F4ECE2;
  --em-text-dim: #B6A99C;
  --em-text-muted: #7C6F63;
  --em-text-faint: #4D4138;

  /* Accent surfaces (theme-tuned) */
  --em-accent-soft: rgba(240, 99, 46, 0.14);
  --em-accent-edge: rgba(240, 99, 46, 0.42);
  --em-accent-text: #FF9A5E;   /* accent legible on dark surfaces */
  --em-amber: #E89A4E;         /* warm data / units */

  /* Status — fg + soft bg */
  --em-ok: #6FBF8A;  --em-ok-soft: rgba(111, 191, 138, 0.14);
  --em-warn: #E0A53A; --em-warn-soft: rgba(224, 165, 58, 0.14);
  --em-err: #E5604A; --em-err-soft: rgba(229, 96, 74, 0.14);
  --em-info: #6FA8D8; --em-info-soft: rgba(111, 168, 216, 0.14);

  /* Elevation */
  --em-shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.4);
  --em-shadow-md: 0 18px 44px rgba(0, 0, 0, 0.5);
  --em-shadow-glow: 0 8px 22px rgba(240, 99, 46, 0.4);
}

[data-theme="light"] {
  color-scheme: light;

  --em-bg: #F4EEE6;
  --em-bg-sub: #EFE7DB;
  --em-surface: #FFFFFF;
  --em-surface-2: #F8F2EA;
  --em-surface-3: #F2EADF;
  --em-line: #E8DDD0;
  --em-line-strong: #D9CCBB;

  --em-text: #1A130D;
  --em-text-dim: #5A4F44;
  --em-text-muted: #8B7E6F;
  --em-text-faint: #B4A795;

  --em-accent-soft: rgba(240, 99, 46, 0.12);
  --em-accent-edge: rgba(240, 99, 46, 0.34);
  --em-accent-text: #C2491A;   /* deepened for contrast on cream */
  --em-amber: #B5780F;

  --em-ok: #2E9156;  --em-ok-soft: rgba(46, 145, 86, 0.10);
  --em-warn: #B5840C; --em-warn-soft: rgba(181, 132, 12, 0.12);
  --em-err: #CF4B36; --em-err-soft: rgba(207, 75, 54, 0.10);
  --em-info: #2C7BB6; --em-info-soft: rgba(44, 123, 182, 0.10);

  --em-shadow-sm: 0 8px 22px rgba(60, 46, 34, 0.10);
  --em-shadow-md: 0 18px 40px rgba(60, 46, 34, 0.14);
  --em-shadow-glow: 0 8px 20px rgba(240, 99, 46, 0.26);
}
/* ---- typography ----
   Display/headings: Onest. Body/UI: Manrope. Data/labels/code: JetBrains Mono.
   Poster (optional, Latin-only): Anton. Numbers use tabular figures in data contexts. */

:root {
  --em-font-display: "Onest", system-ui, sans-serif;
  --em-font-sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --em-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --em-font-poster: "Anton", "Onest", sans-serif; /* Latin only — fallback to Onest for Cyrillic */

  /* Type scale — size / weight / track per role */
  --em-display-lg-size: 64px; --em-display-lg-weight: 800; --em-display-lg-track: -0.045em;
  --em-display-md-size: 44px; --em-display-md-weight: 800; --em-display-md-track: -0.04em;
  --em-heading-lg-size: 30px; --em-heading-lg-weight: 700; --em-heading-lg-track: -0.03em;
  --em-heading-md-size: 20px; --em-heading-md-weight: 700; --em-heading-md-track: -0.02em;
  --em-heading-sm-size: 15px; --em-heading-sm-weight: 700; --em-heading-sm-track: -0.01em;
  --em-body-lg-size: 16px; --em-body-lg-weight: 500;
  --em-body-md-size: 14px; --em-body-md-weight: 500;
  --em-body-sm-size: 13px; --em-body-sm-weight: 500;
  --em-label-size: 11px; --em-label-weight: 500; --em-label-track: 0.1em;
  --em-code-size: 13px; --em-code-weight: 400;

  /* Line-heights (unitless) */
  --em-display-lg-line: 0.92;
  --em-display-md-line: 0.96;
  --em-heading-lg-line: 1.0;
  --em-heading-md-line: 1.1;
  --em-heading-sm-line: 1.2;
  --em-body-lg-line: 1.6;
  --em-body-md-line: 1.55;
  --em-body-sm-line: 1.5;
  --em-label-line: 1.2;
  --em-code-line: 1.5;
}
/* ---- radius / spacing / elevation ----
   4px base. Separation comes from hairline borders + surface contrast first;
   shadows are reserved for floating overlays; ember glow for one highlighted action. */

:root {
  /* Radius — the language runs tight-to-medium */
  --em-radius-xs: 5px;
  --em-radius-sm: 7px;
  --em-radius-md: 9px;
  --em-radius-lg: 14px;
  --em-radius-xl: 18px;
  --em-radius-full: 999px;

  /* Spacing — 4px base */
  --em-space-1: 4px;
  --em-space-2: 8px;
  --em-space-3: 12px;
  --em-space-4: 16px;
  --em-space-5: 20px;
  --em-space-6: 24px;
  --em-space-8: 32px;
  --em-space-10: 40px;
  --em-space-12: 48px;
  --em-space-16: 64px;

  /* Motion — calm fades, ease-out */
  --em-dur-fast: 130ms;
  --em-dur-normal: 190ms;
  --em-dur-slow: 280ms;
  --em-ease: cubic-bezier(.2, .8, .2, 1);

  /* Stacking */
  --em-z-sticky: 20;
  --em-z-dropdown: 40;
  --em-z-modal: 70;
  --em-z-toast: 90;
}
/* ---- motion ----
   Calm, purposeful animation. Every entrance fades+moves (never a bare appear);
   hover/press are subtle and usability-safe. All gated on prefers-reduced-motion.
   Use the --em-dur-* / --em-ease tokens (tokens/spacing.css) for ad-hoc transitions. */

@keyframes em-fade-in      { from { opacity: 0; } to { opacity: 1; } }
@keyframes em-fade-up      { from { opacity: 0; transform: translateY(8px); }  to { opacity: 1; transform: none; } }
@keyframes em-fade-down    { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes em-scale-in     { from { opacity: 0; transform: scale(.96); }       to { opacity: 1; transform: none; } }
@keyframes em-pop-in       { 0% { opacity: 0; transform: scale(.9); } 60% { transform: scale(1.02); } 100% { opacity: 1; transform: none; } }
@keyframes em-slide-right  { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
@keyframes em-slide-in-r   { from { transform: translateX(110%); } to { transform: none; } }
@keyframes em-spin         { to { transform: rotate(360deg); } }
@keyframes em-pulse        { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes em-shimmer      { from { background-position: -160% 0; } to { background-position: 260% 0; } }

/* ---- entrance utilities ---- */
.em-anim-fade   { animation: em-fade-in    var(--em-dur-slow) var(--em-ease) both; }
.em-anim-up     { animation: em-fade-up    var(--em-dur-slow) var(--em-ease) both; }
.em-anim-down   { animation: em-fade-down  var(--em-dur-slow) var(--em-ease) both; }
.em-anim-scale  { animation: em-scale-in   var(--em-dur-normal) var(--em-ease) both; }
.em-anim-pop    { animation: em-pop-in     var(--em-dur-slow) var(--em-ease-emphasized, var(--em-ease)) both; }
.em-anim-slide  { animation: em-slide-right var(--em-dur-slow) var(--em-ease) both; }

/* staggered children — for lists, grids, stat rows */
.em-stagger > * { animation: em-fade-up var(--em-dur-slow) var(--em-ease) both; }
.em-stagger > *:nth-child(1){ animation-delay: 40ms; }
.em-stagger > *:nth-child(2){ animation-delay: 90ms; }
.em-stagger > *:nth-child(3){ animation-delay: 140ms; }
.em-stagger > *:nth-child(4){ animation-delay: 190ms; }
.em-stagger > *:nth-child(5){ animation-delay: 240ms; }
.em-stagger > *:nth-child(6){ animation-delay: 290ms; }
.em-stagger > *:nth-child(7){ animation-delay: 340ms; }
.em-stagger > *:nth-child(8){ animation-delay: 390ms; }

/* ---- interaction utilities (usability-safe) ---- */
.em-press   { transition: transform var(--em-dur-fast) var(--em-ease); }
.em-press:active { transform: translateY(1px) scale(.985); }
.em-lift    { transition: transform var(--em-dur-normal) var(--em-ease), box-shadow var(--em-dur-normal) var(--em-ease); }
.em-lift:hover { transform: translateY(-2px); box-shadow: var(--em-shadow-sm); }

/* ---- loading affordances ---- */
.em-spin { animation: em-spin .7s linear infinite; }
.em-pulse { animation: em-pulse 1.4s var(--em-ease) infinite; }
.em-skeleton {
  background: linear-gradient(90deg, var(--em-surface-2) 0%, var(--em-surface-3) 50%, var(--em-surface-2) 100%);
  background-size: 220% 100%;
  animation: em-shimmer 1.5s linear infinite;
  border-radius: var(--em-radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  .em-anim-fade, .em-anim-up, .em-anim-down, .em-anim-scale, .em-anim-pop, .em-anim-slide,
  .em-stagger > * { animation: em-fade-in var(--em-dur-fast) var(--em-ease) both; }
  .em-press:active { transform: none; }
  .em-lift:hover { transform: none; }
  .em-spin, .em-pulse, .em-skeleton { animation-duration: .001ms; animation-iteration-count: 1; }
}

/* ---- 3) design component system (app.css) ---- */
/* AiHummer — production web app prototype
   Built entirely on EMCHummer design tokens (var(--em-*)). No raw hex outside brand gradients. */

html, body{ height:100%; }
body{
  background:var(--em-bg); color:var(--em-text);
  font-family:var(--em-font-sans); font-size:14px; line-height:1.55;
  -webkit-font-smoothing:antialiased;
}
::selection{ background:var(--em-accent-soft); color:var(--em-accent-text); }
.mono{ font-family:var(--em-font-mono); }
.tnum{ font-variant-numeric:tabular-nums; }
.sp{ flex:1; }
[hidden]{ display:none !important; }
::-webkit-scrollbar{ width:10px; height:10px; }
::-webkit-scrollbar-thumb{ background:var(--em-line-strong); border-radius:99px; border:3px solid var(--em-bg); }
::-webkit-scrollbar-thumb:hover{ background:var(--em-text-faint); }

/* ============ SHELL ============ */
.app{ display:grid; grid-template-columns:236px 1fr; height:100vh; }
.app.auth-mode{ grid-template-columns:1fr; }
.app.auth-mode .side{ display:none; }

/* ---- sidebar ---- */
.side{ border-right:1px solid var(--em-line); background:var(--em-bg-sub); display:flex; flex-direction:column; padding:16px 12px; gap:2px; min-height:0; }
.brand{ display:flex; align-items:center; gap:10px; padding:6px 8px 14px; cursor:pointer; }
/* BUGS_8 #47: the sidebar brand lockup is a <button> that returns to «Панель».
   Strip the native button chrome so it keeps the plain brand look, and give it a
   full-width, left-aligned hit target + a subtle hover/focus affordance. */
.brand--home{ width:100%; text-align:left; background:transparent; border:0; border-radius:9px; font:inherit; color:inherit; transition:background var(--em-dur-fast) var(--em-ease); }
.brand--home:hover{ background:var(--em-surface); }
.brand--home:focus-visible{ outline:2px solid var(--em-accent); outline-offset:2px; }
.brand i{ width:30px; height:30px; border-radius:9px; background:linear-gradient(150deg,var(--em-accent-bright),var(--em-accent)); display:grid; place-items:center; color:#fff; box-shadow:0 4px 16px rgba(var(--em-glow),.4); flex:0 0 auto; }
.brand i svg{ width:17px; height:17px; stroke:currentColor; fill:none; stroke-width:2; }
.brand b{ font-family:var(--em-font-display); font-weight:700; font-size:16px; letter-spacing:-.02em; }
.brand small{ display:block; font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-muted); margin-top:2px; }

.ngrp{ font-size:11px; font-weight:600; color:var(--em-text-faint); padding:16px 9px 6px; }
.nav{ position:relative; display:flex; align-items:center; gap:11px; padding:8px 9px; border-radius:7px; color:var(--em-text-dim); font-size:13.5px; font-weight:500; cursor:pointer; border:0; background:transparent; width:100%; text-align:left; font-family:inherit; transition:background var(--em-dur-fast) var(--em-ease), color var(--em-dur-fast) var(--em-ease); }
.nav svg{ width:17px; height:17px; stroke:currentColor; fill:none; stroke-width:1.7; flex:0 0 auto; }
.nav .ct{ margin-left:auto; font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-muted); }
.nav:hover{ background:var(--em-surface); color:var(--em-text); }
.nav.on{ background:var(--em-surface); color:var(--em-text); }
.nav.on::before{ content:""; position:absolute; left:-12px; top:7px; bottom:7px; width:3px; border-radius:0 3px 3px 0; background:var(--em-accent); box-shadow:0 0 12px rgba(var(--em-glow),.6); }
.nav.on svg{ color:var(--em-accent-bright); }

.side__foot{ margin-top:auto; padding-top:10px; border-top:1px solid var(--em-line); display:flex; flex-direction:column; gap:8px; }
.workspace{ display:flex; align-items:center; gap:10px; padding:8px; border-radius:9px; border:1px solid var(--em-line); background:var(--em-surface); cursor:pointer; transition:border-color var(--em-dur-fast) var(--em-ease); width:100%; font-family:inherit; text-align:left; }
.workspace:hover{ border-color:var(--em-line-strong); }
.workspace .a{ width:30px; height:30px; border-radius:8px; background:var(--em-surface-3); border:1px solid var(--em-line-strong); display:grid; place-items:center; font-family:var(--em-font-display); font-weight:700; font-size:12px; color:var(--em-text-dim); flex:0 0 auto; }
.workspace .w{ min-width:0; }
.workspace .w b{ font-size:12.5px; font-weight:600; display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:var(--em-text); }
.workspace .w small{ font-family:var(--em-font-mono); font-size:9.5px; color:var(--em-text-muted); }
.workspace .chev{ margin-left:auto; width:14px; height:14px; stroke:var(--em-text-muted); fill:none; stroke-width:2; flex:0 0 auto; }

/* ---- main / view host ---- */
.main{ min-width:0; min-height:0; position:relative; display:flex; flex-direction:column; overflow:hidden; }
.view{ flex:1; min-height:0; display:none; flex-direction:column; }
.view.on{ display:flex; }

/* topbar (per view) */
.top{ display:flex; align-items:center; gap:14px; padding:16px 24px; border-bottom:1px solid var(--em-line); flex:0 0 auto; }
.top__l{ min-width:0; }
.top__bc{ font-family:var(--em-font-mono); font-size:11px; color:var(--em-text-muted); margin-bottom:5px; }
.top h1{ font-family:var(--em-font-display); font-size:21px; font-weight:700; letter-spacing:-.025em; line-height:1.05; }
.top__r{ margin-left:auto; display:flex; align-items:center; gap:9px; }

.scroll{ flex:1; min-height:0; overflow:auto; }
.pad{ padding:22px 24px 40px; }

/* ============ PRIMITIVES ============ */
.btn{ height:36px; padding:0 14px; border-radius:var(--em-radius-md); border:1px solid var(--em-line-strong); background:var(--em-surface); color:var(--em-text); font-family:var(--em-font-sans); font-weight:600; font-size:13px; display:inline-flex; align-items:center; justify-content:center; gap:7px; cursor:pointer; white-space:nowrap; transition:border-color var(--em-dur-fast) var(--em-ease), background var(--em-dur-fast) var(--em-ease), transform var(--em-dur-fast) var(--em-ease); }
.btn svg{ width:15px; height:15px; stroke:currentColor; fill:none; stroke-width:2; }
.btn:hover{ border-color:var(--em-text-faint); }
.btn:active{ transform:translateY(1px) scale(.99); }
.btn--p{ background:linear-gradient(180deg,var(--em-accent-bright),var(--em-accent)); color:#fff; border-color:transparent; box-shadow:var(--em-shadow-glow); }
.btn--p:hover{ border-color:transparent; filter:brightness(1.04); }
.btn--ghost{ background:transparent; border-color:transparent; color:var(--em-text-dim); }
.btn--ghost:hover{ background:var(--em-surface); border-color:var(--em-line); color:var(--em-text); }
.btn--danger{ color:var(--em-err); border-color:var(--em-line-strong); background:var(--em-surface); }
.btn--danger:hover{ border-color:var(--em-err); background:var(--em-err-soft); }
.btn--sm{ height:30px; padding:0 11px; font-size:12px; }
.btn--block{ width:100%; }

.iconbtn{ width:34px; height:34px; border:1px solid var(--em-line-strong); border-radius:var(--em-radius-md); background:var(--em-surface); color:var(--em-text-dim); display:grid; place-items:center; cursor:pointer; flex:0 0 auto; transition:border-color var(--em-dur-fast) var(--em-ease), color var(--em-dur-fast) var(--em-ease); }
.iconbtn svg{ width:16px; height:16px; stroke:currentColor; fill:none; stroke-width:2; }
.iconbtn:hover{ border-color:var(--em-text-faint); color:var(--em-text); }
.iconbtn.sm{ width:28px; height:28px; } .iconbtn.sm svg{ width:14px; height:14px; }

.field{ display:flex; align-items:center; gap:9px; border:1px solid var(--em-line-strong); border-radius:var(--em-radius-md); background:var(--em-surface); padding:0 12px; height:36px; }
.field:focus-within{ border-color:var(--em-accent-edge); box-shadow:0 0 0 3px var(--em-accent-soft); }
.field svg{ width:15px; height:15px; stroke:var(--em-text-muted); fill:none; stroke-width:2; flex:0 0 auto; }
.field input{ flex:1; min-width:0; border:0; background:transparent; outline:0; color:var(--em-text); font:inherit; font-size:13px; }
.field .kbd, .kbd{ font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-muted); border:1px solid var(--em-line-strong); border-radius:4px; padding:2px 6px; }

.input{ width:100%; border:1px solid var(--em-line-strong); border-radius:var(--em-radius-md); background:var(--em-surface); padding:10px 12px; color:var(--em-text); font:inherit; font-size:13px; outline:0; transition:border-color var(--em-dur-fast) var(--em-ease), box-shadow var(--em-dur-fast) var(--em-ease); }
.input:focus{ border-color:var(--em-accent-edge); box-shadow:0 0 0 3px var(--em-accent-soft); }
/* BUGS_4 #2/#3: the `.input` background shorthand outranks the element rule and
   was ERASING the design chevron on every `select.input` — restore it, so a
   dropdown never masquerades as a text field. */
select.input{
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a8178' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat:no-repeat;
  background-position:right 10px center;
  padding-right:32px;
  cursor:pointer;
}
textarea.input{ resize:vertical; min-height:78px; line-height:1.55; }
.flabel{ font-size:12.5px; font-weight:600; color:var(--em-text-dim); margin-bottom:7px; display:block; }
.fhint{ font-family:var(--em-font-mono); font-size:10.5px; color:var(--em-text-muted); margin-top:6px; }
.fgroup{ margin-bottom:18px; }

/* badges + status */
.badge{ display:inline-flex; align-items:center; gap:6px; font-family:var(--em-font-mono); font-size:11px; border-radius:var(--em-radius-full); padding:4px 10px; border:1px solid var(--em-line-strong); color:var(--em-text-dim); white-space:nowrap; }
.badge i{ width:6px; height:6px; border-radius:50%; background:currentColor; }
.badge--ok{ color:var(--em-ok); background:var(--em-ok-soft); border-color:transparent; }
.badge--warn{ color:var(--em-warn); background:var(--em-warn-soft); border-color:transparent; }
.badge--err{ color:var(--em-err); background:var(--em-err-soft); border-color:transparent; }
.badge--info{ color:var(--em-info); background:var(--em-info-soft); border-color:transparent; }
.badge--ember{ color:var(--em-accent-text); background:var(--em-accent-soft); border-color:transparent; }
.badge--run i{ animation:em-pulse 1.4s var(--em-ease) infinite; }
/* Idea 7 phase C: "higher plan" chip on a locked catalog module + its upgrade CTA. */
.plan-badge{ display:inline-flex; align-items:center; margin-left:8px; font-family:var(--em-font-mono); font-size:10.5px; font-weight:600; border-radius:var(--em-radius-full); padding:2px 9px; color:var(--em-accent-text); background:var(--em-accent-soft); white-space:nowrap; }
.catalog-upgrade{ color:var(--em-accent-text); background:var(--em-accent-soft); border-color:transparent; }

.tag{ font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-muted); border:1px solid var(--em-line); border-radius:var(--em-radius-full); padding:3px 9px; white-space:nowrap; }

.card{ border:1px solid var(--em-line); border-radius:var(--em-radius-lg); background:var(--em-surface); }
.card__h{ display:flex; align-items:center; gap:10px; padding:14px 16px; border-bottom:1px solid var(--em-line); }
.card__h h3{ font-family:var(--em-font-display); font-size:14px; font-weight:700; letter-spacing:-.01em; }
.card__h .lbl{ font-size:11px; font-weight:600; color:var(--em-text-muted); }

/* BUGS_2 WEB UI №15: section labels carry a uniform 10px vertical margin. */
.sectlabel{ font-size:12px; font-weight:600; color:var(--em-text-dim); margin:10px 0; display:flex; align-items:center; gap:11px; }
.sectlabel::after{ content:""; flex:1; height:1px; background:var(--em-line); }

/* progress bar */
.bar{ height:6px; border-radius:99px; background:var(--em-surface-3); overflow:hidden; }
.bar > i{ display:block; height:100%; border-radius:99px; background:linear-gradient(90deg,var(--em-accent),var(--em-accent-bright)); }

/* ============ OVERVIEW ============ */
.metrics{ display:grid; grid-template-columns:repeat(4,1fr); border:1px solid var(--em-line); border-radius:var(--em-radius-lg); overflow:hidden; background:var(--em-surface); }
.metric{ padding:16px 17px; border-right:1px solid var(--em-line); position:relative; overflow:hidden; }
.metric:last-child{ border-right:0; }
.metric.lead{ background:linear-gradient(165deg,rgba(var(--em-glow),.13),transparent 62%); }
.metric__k{ font-size:11.5px; font-weight:500; color:var(--em-text-muted); display:flex; align-items:center; gap:7px; }
.metric__k svg{ width:13px; height:13px; stroke:currentColor; fill:none; stroke-width:2; color:var(--em-text-faint); }
.metric.lead .metric__k svg{ color:var(--em-accent-bright); }
.metric__v{ font-family:var(--em-font-display); font-size:33px; font-weight:800; letter-spacing:-.04em; line-height:1; margin:13px 0 9px; font-variant-numeric:tabular-nums; }
.metric__v u{ text-decoration:none; font-size:.4em; color:var(--em-amber); margin-left:3px; }
.metric__f{ display:flex; align-items:center; gap:8px; }
.delta{ font-family:var(--em-font-mono); font-size:10.5px; } .delta.up{ color:var(--em-ok); } .delta.dn{ color:var(--em-err); }
.metric__f .vs{ font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-faint); }

.grid2{ display:grid; grid-template-columns:1.5fr 1fr; gap:16px; }
@media (max-width:1100px){ .grid2{ grid-template-columns:1fr; } .metrics{ grid-template-columns:repeat(2,1fr); } }

.activity{ display:flex; flex-direction:column; }
.act{ display:flex; align-items:center; gap:12px; padding:12px 16px; border-bottom:1px solid var(--em-line); }
.act:last-child{ border-bottom:0; }
.act__i{ width:30px; height:30px; border-radius:8px; display:grid; place-items:center; flex:0 0 auto; border:1px solid var(--em-line); }
.act__i svg{ width:15px; height:15px; stroke:currentColor; fill:none; stroke-width:2; }
.act__t{ min-width:0; flex:1; }
.act__t b{ font-size:13px; font-weight:600; color:var(--em-text); }
.act__t span{ font-size:12px; color:var(--em-text-dim); }
.act__m{ font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-muted); white-space:nowrap; }

.health{ padding:8px 16px 16px; }
.health .hrow{ display:flex; align-items:center; gap:10px; padding:11px 0; border-bottom:1px solid var(--em-line); }
.health .hrow:last-child{ border-bottom:0; }
.health .hrow .nm{ font-size:13px; font-weight:600; }
.health .hrow .nm small{ display:block; font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-muted); font-weight:400; }

/* ============ CHATS ============ */
.chats{ display:grid; grid-template-columns:248px 1fr 288px; flex:1; min-height:0; }
@media (max-width:1180px){ .chats{ grid-template-columns:1fr 280px; } .chats .chatlist{ display:none; } }
.chatlist{ border-right:1px solid var(--em-line); background:var(--em-bg-sub); display:flex; flex-direction:column; min-height:0; }
/* BUGS_3 #23: the «+ Новая сессия» button must not butt against the heading —
   flex the header so the `.sp` spacer pushes the button to the right edge. */
.chatlist__h{ padding:14px; border-bottom:1px solid var(--em-line); display:flex; align-items:center; gap:10px; }
.chatlist__h > .sp{ flex:1 1 auto; }
.chatlist__h .session-new{ flex:0 0 auto; margin-left:auto; }
.chatlist__items{ flex:1; overflow:auto; padding:8px; display:flex; flex-direction:column; gap:3px; }
.ci{ padding:10px 11px; border-radius:var(--em-radius-md); cursor:pointer; border:1px solid transparent; }
.ci:hover{ background:var(--em-surface); }
.ci.on{ background:var(--em-surface); border-color:var(--em-line); }
.ci__t{ display:flex; align-items:center; gap:8px; }
.ci__t b{ font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ci__t .dot{ width:6px; height:6px; border-radius:50%; flex:0 0 auto; }
.ci__s{ font-size:12px; color:var(--em-text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:3px; }
.ci__m{ font-family:var(--em-font-mono); font-size:9.5px; color:var(--em-text-faint); margin-top:5px; }

.conv{ display:flex; flex-direction:column; min-height:0; background:var(--em-bg); }
.conv__top{ display:flex; align-items:center; gap:12px; padding:13px 20px; border-bottom:1px solid var(--em-line); flex:0 0 auto; }
.conv__top h2{ font-family:var(--em-font-display); font-size:15px; font-weight:700; letter-spacing:-.02em; }
.thread{ flex:1; overflow:auto; padding:22px 20px; display:flex; flex-direction:column; gap:18px; overflow-anchor:none; }
.msg{ display:flex; gap:12px; max-width:780px; }
.msg .av{ width:30px; height:30px; flex:0 0 auto; border-radius:9px; display:grid; place-items:center; font-family:var(--em-font-display); font-weight:600; font-size:12px; }
.msg .av.user{ background:var(--em-surface-3); color:var(--em-text-dim); border:1px solid var(--em-line-strong); }
.msg .av.ai{ background:linear-gradient(150deg,var(--em-accent-bright),var(--em-accent)); color:#fff; }
.bubble{ font-size:14px; line-height:1.65; color:var(--em-text-dim); min-width:0; }
.bubble .who{ font-family:var(--em-font-mono); font-size:11px; color:var(--em-text-muted); margin-bottom:5px; }
.bubble strong{ color:var(--em-text); font-weight:600; }
.tool{ margin-top:10px; border:1px solid var(--em-line); border-radius:var(--em-radius-md); background:var(--em-surface); overflow:hidden; max-width:560px; }
.tool__h{ display:flex; align-items:center; gap:8px; padding:8px 11px; font-family:var(--em-font-mono); font-size:11px; color:var(--em-amber); border-bottom:1px solid var(--em-line); cursor:pointer; }
.tool__h svg{ width:13px; height:13px; stroke:currentColor; fill:none; stroke-width:2; }
.tool__h .st{ margin-left:auto; color:var(--em-ok); }
.tool__b{ padding:10px 11px; font-family:var(--em-font-mono); font-size:11.5px; color:var(--em-text-muted); line-height:1.6; }
.tool__b .k{ color:var(--em-accent-text); }
.typing{ display:inline-flex; gap:4px; align-items:center; padding:4px 0; }
.typing i{ width:6px; height:6px; border-radius:50%; background:var(--em-text-muted); animation:em-pulse 1s var(--em-ease) infinite; }
.typing i:nth-child(2){ animation-delay:.18s; } .typing i:nth-child(3){ animation-delay:.36s; }
.composer{ padding:14px 20px 18px; border-top:1px solid var(--em-line); flex:0 0 auto; }
.composer .box{ display:flex; align-items:flex-end; gap:10px; border:1px solid var(--em-line-strong); border-radius:var(--em-radius-lg); background:var(--em-surface); padding:9px 10px 9px 14px; }
.composer .box:focus-within{ border-color:var(--em-accent-edge); box-shadow:0 0 0 3px var(--em-accent-soft); }
.composer textarea{ flex:1; border:0; background:transparent; outline:0; color:var(--em-text); font:inherit; font-size:14px; resize:none; max-height:120px; line-height:1.5; padding:6px 0; }
.composer .tools{ display:flex; gap:4px; }
.send{ width:36px; height:36px; border:0; border-radius:9px; background:linear-gradient(180deg,var(--em-accent-bright),var(--em-accent)); color:#fff; display:grid; place-items:center; cursor:pointer; box-shadow:var(--em-shadow-glow); flex:0 0 auto; }
.send svg{ width:16px; height:16px; stroke:currentColor; fill:none; stroke-width:2.2; }
.composer__hint{ display:flex; gap:14px; margin-top:9px; font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-faint); }

.agentpanel{ border-left:1px solid var(--em-line); background:var(--em-bg-sub); padding:16px 14px; overflow:auto; min-height:0; }
.rh{ font-size:11.5px; font-weight:600; color:var(--em-text-faint); margin-bottom:10px; display:flex; align-items:center; }
.rh .ct{ margin-left:auto; color:var(--em-text-muted); }
.agentmini{ border:1px solid var(--em-line); border-radius:var(--em-radius-md); background:var(--em-surface); padding:12px; margin-bottom:9px; cursor:pointer; transition:border-color var(--em-dur-fast) var(--em-ease); }
.agentmini:hover{ border-color:var(--em-line-strong); }
.agentmini__t{ display:flex; align-items:center; gap:9px; margin-bottom:9px; }
.agentmini__t i{ width:28px; height:28px; border-radius:8px; display:grid; place-items:center; flex:0 0 auto; }
.agentmini__t i svg{ width:15px; height:15px; stroke:currentColor; fill:none; stroke-width:2; }
.agentmini__t b{ font-size:13px; font-weight:600; letter-spacing:-.01em; }
.agentmini__t small{ display:block; font-family:var(--em-font-mono); font-size:9.5px; color:var(--em-text-muted); margin-top:1px; }
.agentmini__m{ display:flex; justify-content:space-between; font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-muted); margin-top:7px; }

/* ============ AGENTS ============ */
.agrid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:14px; }
.acard{ border:1px solid var(--em-line); border-radius:var(--em-radius-lg); background:var(--em-surface); padding:16px; cursor:pointer; transition:border-color var(--em-dur-normal) var(--em-ease), transform var(--em-dur-normal) var(--em-ease); display:flex; flex-direction:column; }
.acard:hover{ border-color:var(--em-line-strong); transform:translateY(-2px); }
.acard__t{ display:flex; align-items:center; gap:11px; margin-bottom:13px; }
.acard__t i{ width:38px; height:38px; border-radius:10px; display:grid; place-items:center; flex:0 0 auto; }
.acard__t i svg{ width:19px; height:19px; stroke:currentColor; fill:none; stroke-width:2; }
.acard__t b{ font-family:var(--em-font-display); font-size:15px; font-weight:700; letter-spacing:-.01em; }
.acard__t small{ display:block; font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-muted); margin-top:2px; }
.acard__d{ font-size:13px; color:var(--em-text-dim); line-height:1.55; flex:1; }
.acard__stats{ display:grid; grid-template-columns:repeat(3,1fr); gap:1px; margin-top:14px; background:var(--em-line); border:1px solid var(--em-line); border-radius:var(--em-radius-sm); overflow:hidden; }
.acard__stats div{ background:var(--em-surface); padding:9px 10px; }
.acard__stats .k{ font-size:10.5px; color:var(--em-text-muted); }
.acard__stats .v{ font-family:var(--em-font-display); font-size:16px; font-weight:700; margin-top:3px; font-variant-numeric:tabular-nums; }

/* agent detail */
.adetail{ display:grid; grid-template-columns:1fr 320px; gap:18px; align-items:start; }
@media (max-width:1000px){ .adetail{ grid-template-columns:1fr; } }
.ahero{ display:flex; align-items:center; gap:14px; margin-bottom:18px; }
.ahero i{ width:54px; height:54px; border-radius:14px; display:grid; place-items:center; flex:0 0 auto; }
.ahero i svg{ width:26px; height:26px; stroke:currentColor; fill:none; stroke-width:2; }
.ahero h2{ font-family:var(--em-font-display); font-size:24px; font-weight:800; letter-spacing:-.03em; }
.ahero .sub{ font-family:var(--em-font-mono); font-size:11px; color:var(--em-text-muted); margin-top:3px; }

/* ============ TRACE ============ */
.tracelayout{ display:grid; grid-template-columns:260px 1fr; flex:1; min-height:0; }
@media (max-width:1000px){ .tracelayout{ grid-template-columns:1fr; } }
.runlist{ border-right:1px solid var(--em-line); background:var(--em-bg-sub); overflow:auto; min-height:0; }
.run{ padding:13px 16px; border-bottom:1px solid var(--em-line); cursor:pointer; border-left:3px solid transparent; }
.run:hover{ background:var(--em-surface); }
.run.on{ background:var(--em-surface); border-left-color:var(--em-accent); }
.run__t{ display:flex; align-items:center; gap:8px; }
.run__t b{ font-size:13px; font-weight:600; }
.run__id{ font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-muted); margin-top:5px; }
.run__m{ display:flex; gap:12px; font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-faint); margin-top:6px; }

.timeline{ position:relative; padding-left:6px; }
.step{ position:relative; padding:0 0 4px 30px; }
.step::before{ content:""; position:absolute; left:9px; top:22px; bottom:-4px; width:1px; background:var(--em-line); }
.step:last-child::before{ display:none; }
.step__dot{ position:absolute; left:3px; top:5px; width:13px; height:13px; border-radius:50%; border:2px solid var(--em-bg); background:var(--em-text-muted); }
.step__dot.ok{ background:var(--em-ok); } .step__dot.run{ background:var(--em-accent); box-shadow:0 0 0 4px var(--em-accent-soft); } .step__dot.err{ background:var(--em-err); }
.step__card{ border:1px solid var(--em-line); border-radius:var(--em-radius-md); background:var(--em-surface); padding:12px 14px; margin-bottom:14px; cursor:pointer; transition:border-color var(--em-dur-fast) var(--em-ease); }
.step__card:hover{ border-color:var(--em-line-strong); }
.step__h{ display:flex; align-items:center; gap:9px; }
.step__h b{ font-size:13px; font-weight:600; }
.step__h .who{ font-family:var(--em-font-mono); font-size:10px; color:var(--em-accent-text); }
.step__h .dur{ margin-left:auto; font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-muted); }
.step__b{ font-size:12.5px; color:var(--em-text-dim); margin-top:7px; line-height:1.5; }
.step__io{ font-family:var(--em-font-mono); font-size:11px; color:var(--em-text-muted); margin-top:8px; background:var(--em-surface-2); border:1px solid var(--em-line); border-radius:var(--em-radius-sm); padding:8px 10px; }
.step__io .k{ color:var(--em-accent-text); }

/* ============ MEMORY ============ */
.memlayout{ display:grid; grid-template-columns:1fr 300px; flex:1; min-height:0; }
@media (max-width:1000px){ .memlayout{ grid-template-columns:1fr; } .memlayout .memright{ display:none; } }
.memmain{ display:flex; flex-direction:column; min-height:0; }
.memmain__q{ padding:18px 24px; border-bottom:1px solid var(--em-line); flex:0 0 auto; }
.searchbig{ display:flex; align-items:center; gap:11px; border:1px solid var(--em-line-strong); border-radius:var(--em-radius-lg); background:var(--em-surface); padding:13px 15px; }
.searchbig:focus-within{ border-color:var(--em-accent-edge); box-shadow:0 0 0 3px var(--em-accent-soft); }
.searchbig svg{ width:18px; height:18px; stroke:var(--em-text-muted); fill:none; stroke-width:2; flex:0 0 auto; }
.searchbig input{ flex:1; border:0; background:transparent; outline:0; color:var(--em-text); font:inherit; font-size:15px; }
.qmeta{ display:flex; gap:18px; margin-top:12px; font-family:var(--em-font-mono); font-size:11px; color:var(--em-text-muted); flex-wrap:wrap; }
.qmeta b{ color:var(--em-amber); }
.hits{ flex:1; overflow:auto; padding:16px 24px; display:flex; flex-direction:column; gap:11px; }
.hit{ border:1px solid var(--em-line); border-radius:var(--em-radius-lg); background:var(--em-surface); padding:15px 16px; cursor:pointer; transition:border-color var(--em-dur-fast) var(--em-ease), transform var(--em-dur-fast) var(--em-ease); }
.hit:hover{ border-color:var(--em-line-strong); transform:translateY(-1px); }
.hit__h{ display:flex; align-items:center; gap:10px; margin-bottom:8px; flex-wrap:wrap; }
.hit__id{ font-family:var(--em-font-mono); font-size:11px; color:var(--em-accent-text); }
.hit__src{ font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-muted); }
.hit__score{ margin-left:auto; font-family:var(--em-font-mono); font-size:11px; color:var(--em-text-muted); }
.hit__score b{ color:var(--em-amber); }
.hit__t{ font-size:14px; line-height:1.6; color:var(--em-text-dim); }
.hit__t mark{ background:var(--em-accent-soft); color:var(--em-accent-text); border-radius:3px; padding:0 3px; }
.hit__tags{ display:flex; gap:6px; margin-top:10px; flex-wrap:wrap; }
.memright{ border-left:1px solid var(--em-line); background:var(--em-bg-sub); padding:18px 16px; overflow:auto; min-height:0; }
.statbox{ border:1px solid var(--em-line); border-radius:var(--em-radius-md); background:var(--em-surface); padding:13px; margin-bottom:9px; }
.statbox .k{ font-size:11px; color:var(--em-text-muted); }
.statbox .v{ font-family:var(--em-font-display); font-size:24px; font-weight:800; letter-spacing:-.03em; margin-top:7px; font-variant-numeric:tabular-nums; }
.statbox .v u{ text-decoration:none; font-size:.45em; color:var(--em-amber); }
.confrow{ display:flex; justify-content:space-between; font-family:var(--em-font-mono); font-size:10.5px; color:var(--em-text-muted); margin-bottom:6px; }

/* ============ TOOLS ============ */
.tgrid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:14px; }
.tcard{ border:1px solid var(--em-line); border-radius:var(--em-radius-lg); background:var(--em-surface); padding:16px; display:flex; flex-direction:column; }
.tcard__t{ display:flex; align-items:center; gap:11px; margin-bottom:11px; }
.tcard__t i{ width:38px; height:38px; border-radius:10px; display:grid; place-items:center; flex:0 0 auto; border:1px solid var(--em-line); background:var(--em-surface-2); color:var(--em-text-dim); }
.tcard__t i svg{ width:19px; height:19px; stroke:currentColor; fill:none; stroke-width:2; }
.tcard__t b{ font-size:14px; font-weight:700; letter-spacing:-.01em; }
.tcard__t small{ display:block; font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-muted); margin-top:2px; }
.tcard__d{ font-size:12.5px; color:var(--em-text-dim); line-height:1.5; flex:1; margin-bottom:14px; }
.tcard__f{ display:flex; align-items:center; gap:9px; }

/* ============ SETTINGS ============ */
.settings{ display:grid; grid-template-columns:200px 1fr; gap:26px; max-width:980px; }
@media (max-width:820px){ .settings{ grid-template-columns:1fr; } }
.settabs{ display:flex; flex-direction:column; gap:2px; position:sticky; top:0; }
.settab{ text-align:left; border:0; background:transparent; color:var(--em-text-dim); font:inherit; font-size:13px; font-weight:500; padding:9px 11px; border-radius:var(--em-radius-md); cursor:pointer; display:flex; align-items:center; gap:10px; }
.settab svg{ width:16px; height:16px; stroke:currentColor; fill:none; stroke-width:1.8; }
.settab:hover{ background:var(--em-surface); color:var(--em-text); }
.settab.on{ background:var(--em-surface); color:var(--em-text); }
.settab.on svg{ color:var(--em-accent-bright); }
.setpanel{ display:none; }
.setpanel.on{ display:block; animation:em-fade-up var(--em-dur-normal) var(--em-ease) both; }
.setrow{ display:flex; align-items:center; gap:16px; padding:16px 0; border-bottom:1px solid var(--em-line); }
.setrow:last-child{ border-bottom:0; }
.setrow__t{ flex:1; min-width:0; }
.setrow__t b{ font-size:13.5px; font-weight:600; display:block; }
.setrow__t span{ font-size:12.5px; color:var(--em-text-muted); }

/* switch */
.switch{ width:42px; height:24px; border-radius:99px; background:var(--em-surface-3); border:1px solid var(--em-line-strong); position:relative; cursor:pointer; flex:0 0 auto; transition:background var(--em-dur-fast) var(--em-ease); padding:0; }
.switch::after{ content:""; position:absolute; left:2px; top:50%; transform:translateY(-50%); width:18px; height:18px; border-radius:50%; background:var(--em-text-muted); transition:transform var(--em-dur-fast) var(--em-ease), background var(--em-dur-fast) var(--em-ease); }
.switch.on{ background:var(--em-accent); border-color:transparent; }
.switch.on::after{ transform:translateY(-50%) translateX(18px); background:#fff; }

/* segmented */
.seg{ display:inline-flex; padding:3px; border:1px solid var(--em-line-strong); border-radius:var(--em-radius-md); background:var(--em-surface); gap:2px; }
.seg button{ border:0; background:transparent; color:var(--em-text-muted); font:inherit; font-family:var(--em-font-mono); font-size:11px; padding:6px 12px; border-radius:6px; cursor:pointer; transition:background var(--em-dur-fast) var(--em-ease), color var(--em-dur-fast) var(--em-ease); }
.seg button.on{ background:var(--em-surface-3); color:var(--em-text); box-shadow:inset 0 0 0 1px var(--em-line-strong); }

/* ============ TABLE ============ */
.table{ width:100%; border-collapse:collapse; }
.table th{ text-align:left; font-size:11px; color:var(--em-text-muted); padding:11px 14px; border-bottom:1px solid var(--em-line); font-weight:600; }
.table td{ padding:12px 14px; border-bottom:1px solid var(--em-line); font-size:13px; color:var(--em-text-dim); }
.table tr:last-child td{ border-bottom:0; }
.table tbody tr{ cursor:pointer; transition:background var(--em-dur-fast) var(--em-ease); }
.table tbody tr:hover{ background:var(--em-surface-2); }
.table .num{ font-family:var(--em-font-mono); font-variant-numeric:tabular-nums; color:var(--em-text); }

/* ============ EMPTY STATE ============ */
.empty{ display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; padding:60px 20px; color:var(--em-text-muted); }
.empty i{ width:52px; height:52px; border-radius:14px; border:1px solid var(--em-line); background:var(--em-surface); display:grid; place-items:center; margin-bottom:16px; }
.empty i svg{ width:24px; height:24px; stroke:var(--em-text-faint); fill:none; stroke-width:1.6; }
.empty b{ font-family:var(--em-font-display); font-size:16px; font-weight:700; color:var(--em-text); margin-bottom:6px; }
.empty p{ font-size:13px; max-width:300px; line-height:1.5; }

/* ============ OVERLAYS ============ */
.scrim{ position:fixed; inset:0; background:rgba(0,0,0,.55); backdrop-filter:blur(3px); z-index:var(--em-z-modal); display:none; align-items:flex-start; justify-content:center; padding:60px 20px; opacity:0; transition:opacity var(--em-dur-normal) var(--em-ease); overflow:auto; }
.scrim.on{ display:flex; opacity:1; }
[data-theme="light"] .scrim{ background:rgba(60,46,34,.32); }

.modal{ width:100%; max-width:520px; background:var(--em-surface); border:1px solid var(--em-line-strong); border-radius:var(--em-radius-xl); box-shadow:var(--em-shadow-md); transform:translateY(12px) scale(.98); transition:transform var(--em-dur-normal) var(--em-ease); overflow:hidden; }
.scrim.on .modal{ transform:none; }
.modal--wide{ max-width:680px; }
.modal__h{ display:flex; align-items:center; gap:12px; padding:18px 20px; border-bottom:1px solid var(--em-line); }
.modal__h .ic{ width:34px; height:34px; border-radius:9px; background:var(--em-accent-soft); color:var(--em-accent-text); display:grid; place-items:center; flex:0 0 auto; }
.modal__h .ic svg{ width:17px; height:17px; stroke:currentColor; fill:none; stroke-width:2; }
.modal__h h2{ font-family:var(--em-font-display); font-size:17px; font-weight:700; letter-spacing:-.02em; }
.modal__h p{ font-size:12px; color:var(--em-text-muted); margin-top:2px; }
.modal__b{ padding:20px; max-height:60vh; overflow:auto; }
.modal__f{ display:flex; align-items:center; gap:10px; padding:14px 20px; border-top:1px solid var(--em-line); background:var(--em-surface-2); }
.modal__f .sp{ flex:1; }

/* drawer (trace step) */
.drawer{ position:fixed; top:0; right:0; bottom:0; width:440px; max-width:92vw; background:var(--em-surface); border-left:1px solid var(--em-line-strong); box-shadow:var(--em-shadow-md); z-index:var(--em-z-modal); transform:translateX(100%); transition:transform var(--em-dur-slow) var(--em-ease); display:flex; flex-direction:column; }
.drawer.on{ transform:none; }
.drawer__h{ display:flex; align-items:center; gap:12px; padding:18px 20px; border-bottom:1px solid var(--em-line); flex:0 0 auto; }
.drawer__h h2{ font-family:var(--em-font-display); font-size:16px; font-weight:700; letter-spacing:-.02em; }
.drawer__b{ flex:1; overflow:auto; padding:20px; }
.codeblk{ font-family:var(--em-font-mono); font-size:12px; line-height:1.6; color:var(--em-text-dim); background:var(--em-bg); border:1px solid var(--em-line); border-radius:var(--em-radius-md); padding:13px 14px; overflow:auto; white-space:pre; }
.codeblk .k{ color:var(--em-accent-text); } .codeblk .s{ color:var(--em-ok); } .codeblk .n{ color:var(--em-amber); }
.kv{ display:grid; grid-template-columns:120px 1fr; gap:8px 14px; font-size:13px; }
.kv dt{ font-family:var(--em-font-mono); font-size:11px; color:var(--em-text-muted); }
.kv dd{ color:var(--em-text); }

/* command palette */
.cmdk{ width:100%; max-width:600px; background:var(--em-surface); border:1px solid var(--em-line-strong); border-radius:var(--em-radius-xl); box-shadow:var(--em-shadow-md); transform:translateY(-8px) scale(.99); transition:transform var(--em-dur-normal) var(--em-ease); overflow:hidden; }
.scrim.on .cmdk{ transform:none; }
.cmdk__in{ display:flex; align-items:center; gap:12px; padding:16px 18px; border-bottom:1px solid var(--em-line); }
.cmdk__in svg{ width:18px; height:18px; stroke:var(--em-text-muted); fill:none; stroke-width:2; flex:0 0 auto; }
.cmdk__in input{ flex:1; border:0; background:transparent; outline:0; color:var(--em-text); font:inherit; font-size:16px; }
.cmdk__list{ max-height:50vh; overflow:auto; padding:8px; }
.cmdk__grp{ font-size:11px; font-weight:600; color:var(--em-text-faint); padding:10px 10px 5px; }
.cmditem{ display:flex; align-items:center; gap:12px; padding:10px 11px; border-radius:var(--em-radius-md); cursor:pointer; }
.cmditem svg{ width:16px; height:16px; stroke:currentColor; fill:none; stroke-width:1.8; color:var(--em-text-muted); flex:0 0 auto; }
.cmditem b{ font-size:13.5px; font-weight:500; color:var(--em-text); }
.cmditem .hint{ margin-left:auto; font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-faint); }
.cmditem.sel, .cmditem:hover{ background:var(--em-surface-3); }
.cmditem.sel svg, .cmditem:hover svg{ color:var(--em-accent-bright); }

/* dropdown menu */
.menu{ position:fixed; z-index:var(--em-z-dropdown); min-width:220px; background:var(--em-surface); border:1px solid var(--em-line-strong); border-radius:var(--em-radius-lg); box-shadow:var(--em-shadow-md); padding:6px; display:none; animation:em-fade-up var(--em-dur-fast) var(--em-ease) both; }
.menu.on{ display:block; }
/* BUGS_3 #34: the ⋯ row-menu items are plain rows — explicitly reset the broad
   legacy `button{background:var(--accent)}` rule that otherwise painted every
   menu item solid orange and stretched its layout. */
.menu__item{ display:flex; align-items:center; gap:11px; width:100%; margin:0; padding:9px 10px; border-radius:var(--em-radius-sm); cursor:pointer; font-size:13px; font-weight:500; text-align:left; background:transparent; color:var(--em-text-dim); }
.menu__item svg{ width:15px; height:15px; stroke:currentColor; fill:none; stroke-width:1.8; flex:0 0 auto; }
.menu__item:hover{ background:var(--em-surface-3); color:var(--em-text); }
.menu__item.danger{ color:var(--em-err); }
.menu__item.danger:hover{ background:var(--em-err-soft, rgba(220,60,60,.12)); color:var(--em-err); }
.menu__sep{ height:1px; background:var(--em-line); margin:6px 4px; }
.menu__head{ padding:9px 10px 7px; }
.menu__head b{ font-size:13px; font-weight:600; display:block; }
.menu__head small{ font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-muted); }

/* Общее №7: the toast stack (layout + enter/exit transition) is defined once,
   next to the toast.ts markup it targets (`.toast__ic`/`.toast__msg`/`.on`/
   `.off`), further down. An older `.toast{ animation:… }` lockup used to also
   live here; it forced opacity via an animation `both` fill that overrode the
   `.off` exit state, so toasts vanished instantly instead of fading out — it is
   removed so the transition-based enter/exit is the single source of truth. */

/* ---- auth ---- */
/* BUGS_2 №1: min-height (not a fixed height) so the left block's background
   stretches the FULL page height even when the form column grows taller than
   the viewport (small screens, zoom, long error lists). */
.auth{ width:100%; min-height:100vh; min-height:100dvh; display:grid; grid-template-columns:1fr 1fr; }
.auth__art{ background:var(--em-bg-sub); border-right:1px solid var(--em-line); position:relative; overflow:hidden; padding:48px; display:flex; flex-direction:column; }
.auth__art::before{ content:""; position:absolute; inset:0; background:radial-gradient(80% 60% at 20% 10%, rgba(var(--em-glow),.18), transparent 60%); pointer-events:none; }
/* BUGS_2 №2/№5: the brand lockup renders the REAL AiHummer mark — the inline
   favicon-tile SVG carries its own colors, so no gradient tile behind it and no
   stroke/fill overrides that used to mangle it into a white outline glyph.
   Scoped to the auth/wizard lockup: `.legend .lg` (chart legends) is unrelated. */
.auth .lg, .wiz .lg{ display:flex; align-items:center; gap:11px; position:relative; }
.auth .lg i, .wiz .lg i{ width:34px; height:34px; flex:0 0 auto; display:grid; place-items:center; border-radius:10px; overflow:hidden; box-shadow:0 4px 16px rgba(var(--em-glow),.25); }
.auth .lg i svg, .wiz .lg i svg{ width:34px; height:34px; display:block; }
.auth .lg b, .wiz .lg b{ font-family:var(--em-font-display); font-size:18px; font-weight:700; letter-spacing:-.02em; }
/* BUGS_2 №3: "Powered by AiHummer" pinned to the BOTTOM of the left block
   (the pitch already carries margin-top:auto; the badge follows it). */
.auth__art .auth__foot{ justify-content:flex-start; margin-top:26px; position:relative; }
/* BUGS_2 №4: on narrow screens the art panel collapses into a compact top bar
   (brand left, powered-by right) instead of disappearing, and the form column
   gets phone-sized padding. */
@media (max-width:860px){
  .auth{ grid-template-columns:1fr; grid-template-rows:auto 1fr; }
  .auth__art{ flex-direction:row; flex-wrap:wrap; align-items:center; gap:12px; padding:14px 20px; border-right:0; border-bottom:1px solid var(--em-line); }
  .auth__art .pitch{ display:none; }
  .auth__art .auth__foot{ margin:0 0 0 auto; }
  .auth__form{ padding:28px 16px 40px; align-items:flex-start; }
  .auth__box{ max-width:440px; margin:0 auto; }
}
.auth__art .pitch{ margin-top:auto; position:relative; }
.auth__art .pitch h2{ font-family:var(--em-font-display); font-size:34px; font-weight:800; letter-spacing:-.035em; line-height:1.05; max-width:380px; }
.auth__art .pitch h2 em{ font-style:normal; color:var(--em-accent-text); }
.auth__art .pitch p{ font-size:14px; color:var(--em-text-dim); margin-top:14px; max-width:340px; line-height:1.6; }
.auth__art .stats{ display:flex; gap:28px; margin-top:26px; }
.auth__art .stats .k{ font-size:11px; color:var(--em-text-muted); }
.auth__art .stats .v{ font-family:var(--em-font-display); font-size:24px; font-weight:800; letter-spacing:-.03em; margin-top:5px; }
.auth__art .stats .v u{ text-decoration:none; color:var(--em-amber); font-size:.5em; }
.auth__form{ display:flex; align-items:center; justify-content:center; padding:40px; }
.auth__box{ width:100%; max-width:340px; }
.auth__box .ey{ font-size:11.5px; font-weight:600; color:var(--em-accent-text); }
.auth__box h1{ font-family:var(--em-font-display); font-size:26px; font-weight:800; letter-spacing:-.03em; margin:10px 0 6px; }
.auth__box .lead{ font-size:13.5px; color:var(--em-text-dim); margin-bottom:24px; }
.oauth{ display:flex; gap:9px; }
.divider{ display:flex; align-items:center; gap:12px; margin:20px 0; font-size:11.5px; color:var(--em-text-faint); }
.divider::before, .divider::after{ content:""; flex:1; height:1px; background:var(--em-line); }

/* Views appear instantly on navigation — no opacity-based entrance on persistent
   content (keeps screenshots, print and PDF export from catching a blank frame).
   Motion lives in hovers, switches, modals and toasts instead. */

/* ============ NAV GROUP SCROLL (long sidebar) ============ */
.side__nav{ flex:1; min-height:0; overflow:auto; display:flex; flex-direction:column; gap:2px; margin:0 -4px; padding:0 4px; }
.side__nav::-webkit-scrollbar{ width:6px; }

/* ============ GENERIC LIST ROWS ============ */
.lrow{ display:flex; align-items:center; gap:12px; padding:13px 16px; border:1px solid var(--em-line); border-radius:var(--em-radius-md); background:var(--em-surface); margin-bottom:8px; }
.lrow:hover{ border-color:var(--em-line-strong); }
.lrow__ic{ width:34px; height:34px; border-radius:9px; display:grid; place-items:center; flex:0 0 auto; border:1px solid var(--em-line); background:var(--em-surface-2); color:var(--em-text-dim); }
.lrow__ic svg{ width:17px; height:17px; stroke:currentColor; fill:none; stroke-width:2; }
.lrow__t{ flex:1; min-width:0; }
.lrow__t b{ font-size:13.5px; font-weight:600; display:block; letter-spacing:-.01em; }
/* Each sub-line stacks (inline <small>s used to run together: «общийОписание…») */
.lrow__t small, .lrow__t .sub{ display:block; font-family:var(--em-font-mono); font-size:10.5px; color:var(--em-text-muted); }
.lrow__m{ font-family:var(--em-font-mono); font-size:10.5px; color:var(--em-text-muted); white-space:nowrap; }
.lrow__a{ display:flex; align-items:center; gap:7px; flex:0 0 auto; }

/* count grid (overview) */
.countgrid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(204px,1fr)); gap:12px; }
.countcell{ display:flex; align-items:center; gap:13px; border:1px solid var(--em-line); border-radius:var(--em-radius-lg); background:var(--em-surface); padding:15px 16px; transition:border-color var(--em-dur-fast) var(--em-ease); }
.countcell:hover{ border-color:var(--em-line-strong); }
.countcell .ic{ width:40px; height:40px; border-radius:11px; display:grid; place-items:center; flex:0 0 auto; border:1px solid var(--em-line); background:var(--em-surface-2); color:var(--em-text-dim); }
.countcell .ic svg{ width:19px; height:19px; stroke:currentColor; fill:none; stroke-width:1.9; }
.countcell .v{ font-family:var(--em-font-display); font-size:25px; font-weight:800; letter-spacing:-.035em; font-variant-numeric:tabular-nums; line-height:1; }
.countcell .k{ font-size:12px; color:var(--em-text-muted); margin-top:5px; }

/* ============ CHAT (real: template gallery + conversation + canvas) ============ */
.chatwrap{ display:grid; grid-template-columns:1fr 360px; flex:1; min-height:0; }
@media (max-width:1100px){ .chatwrap{ grid-template-columns:1fr; } .chatwrap .canvas{ display:none; } }
.chatcol{ display:flex; flex-direction:column; min-height:0; }
.tgallery{ padding:16px 20px; border-bottom:1px solid var(--em-line); flex:0 0 auto; }
.tgallery__row{ display:flex; gap:9px; overflow:auto; padding-bottom:2px; }
.tpl{ flex:0 0 auto; width:190px; text-align:left; border:1px solid var(--em-line); border-radius:var(--em-radius-md); background:var(--em-surface); padding:12px 13px; cursor:pointer; transition:border-color var(--em-dur-fast) var(--em-ease), transform var(--em-dur-fast) var(--em-ease); }
.tpl:hover{ border-color:var(--em-accent-edge); transform:translateY(-2px); }
.tpl b{ font-size:13px; font-weight:600; display:block; }
.tpl span{ font-size:11.5px; color:var(--em-text-muted); display:block; margin-top:4px; line-height:1.4; }
.canvas{ border-left:1px solid var(--em-line); background:var(--em-bg-sub); display:flex; flex-direction:column; min-height:0; }
.canvas__h{ display:flex; align-items:center; gap:9px; padding:13px 16px; border-bottom:1px solid var(--em-line); font-size:11.5px; font-weight:600; color:var(--em-text-faint); }
.canvas__b{ flex:1; overflow:auto; padding:16px; }
.canvas__art{ border:1px solid var(--em-line); border-radius:var(--em-radius-md); background:var(--em-surface); overflow:hidden; }
.canvas__art .bar{ display:flex; align-items:center; gap:8px; padding:8px 11px; border-bottom:1px solid var(--em-line); font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-muted); }
.canvas__art .bd{ padding:12px; font-size:13px; line-height:1.6; color:var(--em-text-dim); }
.canvas__art h4{ font-family:var(--em-font-display); font-size:14px; font-weight:700; margin-bottom:8px; color:var(--em-text); }
.canvas__art ul{ padding-left:18px; } .canvas__art li{ margin-bottom:5px; }
.streamdot{ display:inline-block; width:7px; height:7px; border-radius:50%; background:var(--em-accent); margin-left:6px; animation:em-pulse 1.2s var(--em-ease) infinite; }

/* mention routing chip in group chat */
.mention{ color:var(--em-accent-text); font-weight:600; }

/* chat bubbles — agent left, user (you) right */
.thread .bubble{ background:var(--em-surface); border:1px solid var(--em-line); border-radius:14px 14px 14px 4px; padding:11px 14px; }
.msg.me{ flex-direction:row-reverse; align-self:flex-end; }
.msg.me .bubble{ background:var(--em-accent-soft); border-color:var(--em-accent-edge); color:var(--em-text); border-radius:14px 14px 4px 14px; }
.msg.me .who{ text-align:right; color:var(--em-accent-text); }

/* ============ AGENT PROFILE EDITOR ============ */
.profile{ display:grid; grid-template-columns:1fr 300px; gap:18px; align-items:start; }
@media (max-width:1000px){ .profile{ grid-template-columns:1fr; } }
.psection{ border:1px solid var(--em-line); border-radius:var(--em-radius-md); background:var(--em-surface); margin-bottom:9px; overflow:hidden; }
.psection__h{ display:flex; align-items:center; gap:10px; padding:11px 14px; cursor:pointer; }
.psection__h b{ font-size:13px; font-weight:600; }
.psection__h .chev{ width:14px; height:14px; stroke:var(--em-text-muted); fill:none; stroke-width:2; transition:transform var(--em-dur-fast) var(--em-ease); }
.psection.open .psection__h .chev{ transform:rotate(90deg); }
.psection__b{ display:none; padding:0 14px 14px; }
.psection.open .psection__b{ display:block; }
.fgrid2{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.linkchip{ display:inline-flex; align-items:center; gap:8px; font-size:12.5px; padding:6px 10px; border:1px solid var(--em-line-strong); border-radius:var(--em-radius-full); background:var(--em-surface-2); }

/* ============ ANALYTICS ============ */
.lat{ display:flex; gap:1px; background:var(--em-line); border:1px solid var(--em-line); border-radius:var(--em-radius-md); overflow:hidden; margin-bottom:14px; }
.lat > div{ flex:1; background:var(--em-surface); padding:13px 15px; }
.lat .v{ font-family:var(--em-font-display); font-size:22px; font-weight:800; letter-spacing:-.03em; font-variant-numeric:tabular-nums; }
.lat .v u{ text-decoration:none; font-size:.5em; color:var(--em-amber); }
.lat .k{ font-size:11px; color:var(--em-text-muted); margin-top:6px; }

/* ============ LOG / CODE VIEWER ============ */
.logview{ font-family:var(--em-font-mono); font-size:12px; line-height:1.7; color:var(--em-text-dim); background:var(--em-bg); border:1px solid var(--em-line); border-radius:var(--em-radius-md); padding:14px 16px; overflow:auto; flex:1; min-height:0; white-space:pre-wrap; }
.logpad{ display:flex; flex-direction:column; height:100%; }
.view[data-view="knowledge"] .lrow, .view[data-view="shared"] .lrow, .view[data-view="skills"] .lrow, .view[data-view="channels"] .lrow{ cursor:pointer; }
.logview .lvl-err{ color:var(--em-err); } .logview .lvl-warn{ color:var(--em-warn); } .logview .lvl-ok{ color:var(--em-ok); } .logview .ts{ color:var(--em-text-faint); }

/* ============ STATUS PILLS ROW ============ */
.statline{ display:flex; flex-wrap:wrap; gap:10px; }
.statline .pill{ display:flex; align-items:center; gap:9px; border:1px solid var(--em-line); border-radius:var(--em-radius-md); background:var(--em-surface); padding:11px 14px; }
.statline .pill .v{ font-family:var(--em-font-display); font-size:18px; font-weight:700; font-variant-numeric:tabular-nums; }
.statline .pill .k{ font-size:11px; color:var(--em-text-muted); }

/* ============ ONBOARDING WIZARD ============ */
.wiz{ width:100%; max-width:560px; margin:0 auto; }
.wizsteps{ display:flex; gap:8px; margin-bottom:26px; }
.wizsteps .s{ flex:1; height:4px; border-radius:99px; background:var(--em-surface-3); }
.wizsteps .s.on{ background:var(--em-accent); }
.wizsteps .s.done{ background:var(--em-accent-edge); }

/* claim (memory review) extras */
.claimcard{ border:1px solid var(--em-line); border-radius:var(--em-radius-md); background:var(--em-surface); padding:14px 16px; margin-bottom:9px; }
.claimcard__t{ font-size:14px; line-height:1.55; color:var(--em-text); }
.claimcard__spo{ font-family:var(--em-font-mono); font-size:11px; color:var(--em-text-muted); margin-top:7px; }
.claimcard__spo .k{ color:var(--em-accent-text); }
.claimcard__f{ display:flex; align-items:center; gap:9px; margin-top:12px; }
.claimcard__src{ font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-faint); margin-left:auto; }

/* module config form */
.mcfg{ margin-top:11px; padding-top:12px; border-top:1px dashed var(--em-line-strong); display:none; }
.module-row.expanded .mcfg{ display:block; }
.mcfg .check{ font-family:var(--em-font-mono); font-size:11px; margin-top:6px; }
.mcfg .check.ok{ color:var(--em-ok); } .mcfg .check.err{ color:var(--em-err); }

/* small helper text rows in forms */
.banner{ display:flex; align-items:flex-start; gap:10px; border:1px solid var(--em-warn); background:var(--em-warn-soft); color:var(--em-warn); border-radius:var(--em-radius-md); padding:11px 13px; font-size:12.5px; line-height:1.5; }
.banner svg{ width:16px; height:16px; stroke:currentColor; fill:none; stroke-width:2; flex:0 0 auto; margin-top:1px; }
.intro{ font-size:13px; color:var(--em-text-dim); line-height:1.6; margin-bottom:16px; max-width:680px; }

/* ============ DOCUMENTATION PORTAL ============ */
.docslayout{ display:grid; grid-template-columns:256px 1fr; flex:1; min-height:0; }
@media (max-width:900px){ .docslayout{ grid-template-columns:1fr; } .docslayout .docnav{ display:none; } }
.docnav{ border-right:1px solid var(--em-line); background:var(--em-bg-sub); overflow:auto; min-height:0; padding:16px 12px; }
.docnav__grp{ font-size:11px; font-weight:600; color:var(--em-text-faint); padding:14px 9px 6px; }
.docnav__grp:first-child{ padding-top:2px; }
.docnav__item{ display:flex; align-items:center; gap:9px; width:100%; text-align:left; border:0; background:transparent; font:inherit; font-size:13px; color:var(--em-text-dim); padding:8px 9px; border-radius:7px; cursor:pointer; transition:background var(--em-dur-fast) var(--em-ease), color var(--em-dur-fast) var(--em-ease); }
.docnav__item svg{ width:15px; height:15px; stroke:currentColor; fill:none; stroke-width:1.8; flex:0 0 auto; color:var(--em-text-faint); }
.docnav__item:hover{ background:var(--em-surface); color:var(--em-text); }
.docnav__item.on{ background:var(--em-surface); color:var(--em-text); }
.docnav__item.on svg{ color:var(--em-accent-bright); }
.docreader{ overflow:auto; min-height:0; }
.docpanel{ display:none; padding:34px 44px 60px; }
.docpanel.on{ display:block; }
.doc{ max-width:760px; }
.doc .crumb{ font-family:var(--em-font-mono); font-size:11px; color:var(--em-text-muted); margin-bottom:14px; display:flex; align-items:center; gap:8px; }
.doc .crumb .src{ margin-left:auto; border:1px solid var(--em-line); border-radius:var(--em-radius-full); padding:3px 9px; color:var(--em-text-faint); }
.doc h1{ font-family:var(--em-font-display); font-size:30px; font-weight:800; letter-spacing:-.03em; line-height:1.1; margin-bottom:8px; }
.doc .lead{ font-size:15px; color:var(--em-text-dim); line-height:1.6; margin-bottom:26px; }
.doc h2{ font-family:var(--em-font-display); font-size:18px; font-weight:700; letter-spacing:-.02em; margin:28px 0 12px; padding-top:18px; border-top:1px solid var(--em-line); }
.doc h2:first-of-type{ border-top:0; padding-top:0; }
.doc p{ font-size:14px; line-height:1.7; color:var(--em-text-dim); margin-bottom:14px; }
.doc p strong, .doc li strong{ color:var(--em-text); font-weight:600; }
.doc code{ font-family:var(--em-font-mono); font-size:12.5px; background:var(--em-surface-2); border:1px solid var(--em-line); border-radius:5px; padding:1px 6px; color:var(--em-accent-text); }
.doc ul{ padding-left:20px; margin-bottom:14px; }
.doc li{ font-size:14px; line-height:1.65; color:var(--em-text-dim); margin-bottom:8px; }
.doc .callout{ display:flex; gap:12px; border:1px solid var(--em-accent-edge); background:var(--em-accent-soft); border-radius:var(--em-radius-md); padding:14px 16px; margin:18px 0; }
.doc .callout svg{ width:18px; height:18px; stroke:var(--em-accent-text); fill:none; stroke-width:2; flex:0 0 auto; margin-top:1px; }
.doc .callout p{ margin:0; font-size:13px; color:var(--em-text); }
.doc .pre{ font-family:var(--em-font-mono); font-size:12px; line-height:1.6; color:var(--em-text-dim); background:var(--em-bg); border:1px solid var(--em-line); border-radius:var(--em-radius-md); padding:14px 16px; overflow:auto; white-space:pre; margin:0 0 18px; }
.doc .toc{ display:flex; flex-direction:column; gap:0; border:1px solid var(--em-line); border-radius:var(--em-radius-lg); overflow:hidden; margin-top:8px; }
.doc .toc a{ display:flex; align-items:center; gap:11px; padding:13px 15px; border-bottom:1px solid var(--em-line); text-decoration:none; color:var(--em-text); cursor:pointer; transition:background var(--em-dur-fast) var(--em-ease); }
.doc .toc a:last-child{ border-bottom:0; }
.doc .toc a:hover{ background:var(--em-surface-2); }
.doc .toc a svg{ width:16px; height:16px; stroke:var(--em-text-muted); fill:none; stroke-width:1.8; flex:0 0 auto; }
.doc .toc a .t{ flex:1; } .doc .toc a .t b{ font-size:13.5px; font-weight:600; display:block; } .doc .toc a .t span{ font-size:12px; color:var(--em-text-muted); }
.doc .toc a .arr{ color:var(--em-text-faint); }
/* API endpoint rows */
.ep{ display:flex; align-items:center; gap:12px; border:1px solid var(--em-line); border-radius:var(--em-radius-md); background:var(--em-surface); padding:11px 14px; margin-bottom:8px; }
.ep .m{ font-family:var(--em-font-mono); font-size:10px; font-weight:600; padding:3px 8px; border-radius:5px; flex:0 0 auto; min-width:46px; text-align:center; }
.ep .m.get{ color:var(--em-ok); background:var(--em-ok-soft); } .ep .m.post{ color:var(--em-info); background:var(--em-info-soft); } .ep .m.any{ color:var(--em-text-muted); background:var(--em-surface-3); }
.ep .path{ font-family:var(--em-font-mono); font-size:12.5px; color:var(--em-text); }
.ep .d{ margin-left:auto; font-size:12px; color:var(--em-text-muted); text-align:right; }

/* ============ ANALYTICS CHARTS ============ */
.bars{ display:flex; align-items:flex-end; gap:5px; height:180px; padding-top:6px; }
.bars .col{ flex:1; display:flex; flex-direction:column; justify-content:flex-end; align-items:center; gap:7px; height:100%; }
.bars .col i{ width:100%; max-width:26px; background:linear-gradient(180deg,var(--em-accent-bright),var(--em-accent)); border-radius:5px 5px 0 0; display:block; transition:height var(--em-dur-slow) var(--em-ease); }
.bars .col i.alt{ background:linear-gradient(180deg,var(--em-info),color-mix(in oklch,var(--em-info),#000 18%)); }
.bars .col span{ font-family:var(--em-font-mono); font-size:9px; color:var(--em-text-faint); }
.chartlegend{ display:flex; gap:16px; flex-wrap:wrap; margin-top:14px; }
.chartlegend span{ display:flex; align-items:center; gap:7px; font-size:12px; color:var(--em-text-dim); }
.chartlegend span i{ width:10px; height:10px; border-radius:3px; flex:0 0 auto; }
.donutwrap{ display:flex; align-items:center; gap:22px; padding:8px 4px; }
.donut{ width:148px; height:148px; border-radius:50%; position:relative; flex:0 0 auto; }
.donut::after{ content:""; position:absolute; inset:26px; border-radius:50%; background:var(--em-surface); }
.donut__c{ position:absolute; inset:0; display:grid; place-items:center; text-align:center; z-index:1; }
.donut__c b{ font-family:var(--em-font-display); font-size:24px; font-weight:800; letter-spacing:-.03em; display:block; line-height:1; }
.donut__c small{ font-size:11px; color:var(--em-text-muted); }
.legend{ display:flex; flex-direction:column; gap:11px; flex:1; }
.legend .lg{ display:flex; align-items:center; gap:9px; font-size:13px; }
.legend .lg i{ width:10px; height:10px; border-radius:3px; flex:0 0 auto; }
.legend .lg b{ margin-left:auto; font-family:var(--em-font-mono); font-variant-numeric:tabular-nums; color:var(--em-text); }
.legend .lg span{ color:var(--em-text-dim); }
.pbar{ display:grid; grid-template-columns:54px 1fr 56px; align-items:center; gap:12px; padding:9px 0; }
.pbar .pk{ font-family:var(--em-font-mono); font-size:11px; color:var(--em-text-muted); }
.pbar .pv{ font-family:var(--em-font-mono); font-size:12px; color:var(--em-text); text-align:right; font-variant-numeric:tabular-nums; }
.grid3{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:16px; }
@media (max-width:1100px){ .grid3{ grid-template-columns:1fr; } }

/* ---- 4) admin-UI screen rules (kept) ---- */
/* Admin-UI semantic vars aliased to Design-System tokens, so existing rules
   adopt the ember/charcoal look without being rewritten. */
:root {
  --bg: var(--em-bg);
  --panel: var(--em-surface);
  --panel-2: var(--em-surface-2);
  --border: var(--em-line);
  --fg: var(--em-text);
  --muted: var(--em-text-muted);
  --accent: var(--em-accent);
  --accent-2: var(--em-accent-bright);
  --ok: var(--em-ok);
  --warn: var(--em-warn);
  --err: var(--em-err);
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 var(--em-font-sans);
}

#app { max-width: 1040px; margin: 0 auto; padding: 28px 20px 64px; }

h1 { font-size: 22px; margin: 0 0 16px; letter-spacing: 0.2px; font-family: var(--em-font-display); font-weight: 700; }
h4 { margin: 18px 0 8px; color: var(--muted); font-weight: 600; font-family: var(--em-font-display); }
p { color: var(--muted); }

/* Onboarding wizard — a full-bleed design surface (BUGS_2 №5/№10): the wizard
   body (`.wiz`, max-width 560) centres itself inside `.auth__form`, so the old
   460px legacy card frame around it is gone (it cropped the wizard and framed
   it in the pre-design panel look). */
.onboarding, .onboarding-done { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.onboarding > .auth__form, .onboarding-done > .auth__form { flex: 1 1 auto; align-items: flex-start; }
.onboarding label, .onboarding-done label { display: block; margin: 14px 0 4px; color: var(--muted); font-size: 13px; }

/* Inputs + buttons */
input {
  background: var(--panel-2); color: var(--fg);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; margin: 3px 6px 3px 0; min-width: 180px; font: inherit;
}
input::placeholder { color: #5d6678; }
input:focus { outline: none; border-color: var(--accent); }
button {
  background: var(--accent); color: #fff; border: 0; border-radius: 8px;
  padding: 8px 14px; margin: 3px 4px 3px 0; font: inherit; font-weight: 600; cursor: pointer;
}
button:hover { background: var(--accent-2); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Identity + nav */
.identity { display: flex; gap: 20px; align-items: center; }
nav.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
nav.tabs button.tab { background: transparent; color: var(--muted); padding: 6px 12px; font-weight: 500; }
nav.tabs button.tab:hover { color: var(--fg); background: var(--panel-2); }
nav.tabs button.tab.active { background: var(--accent); color: #fff; }

/* Panels (fieldsets) */
fieldset { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); padding: 18px; margin: 0 0 16px; }
legend { padding: 0 8px; color: var(--fg); font-weight: 600; }

ul { list-style: none; padding: 0; margin: 8px 0; }
li { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; margin: 6px 0; background: var(--panel-2); }
li.empty { color: var(--muted); background: transparent; border-style: dashed; }

/* Status colours */
.errors { color: var(--err); min-height: 0; margin: 6px 0; font-size: 13px; }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
/* status-msg holds either a success (.ok child) or an error (.error child); it
   is a neutral container so messages don't inherit the red errors styling. */
.status-msg { min-height: 0; margin: 6px 0; font-size: 13px; }
/* Friendly empty-state for a disabled/empty section (not an error). Covers the
   div variant emitted by showEmptyState (li.empty handles list rows). */
.empty { color: var(--muted); margin: 6px 0; font-size: 13px; }
.error { color: var(--err); margin: 6px 0; font-size: 13px; }

/* Horizontal control row: inline groups of inputs/buttons that should wrap. */
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Plugin/module status badge, infra banner, and Test-validation checks */
.module-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: #444; color: #fff; vertical-align: middle; }
.module-badge.ok { background: var(--ok); color: #04210f; }
.module-badge.err { background: var(--err); color: #2a0606; }
.module-banner { margin: 6px 0; padding: 6px 10px; border-radius: 6px; background: rgba(220, 160, 40, 0.15); border: 1px solid var(--warn); color: var(--warn); font-size: 13px; }
.module-checks { margin: 6px 0; font-size: 13px; }
.module-checks .check { padding: 1px 0; }
.module-checks .check.ok { color: var(--ok); }
.module-checks .check.err { color: var(--err); }
.cfg-test { margin-right: 6px; }

/* System / Updates */
.system div { margin: 4px 0; }
.system-current { font-weight: 600; }

/* Logs */
pre.logs { background: #0b0e13; border: 1px solid var(--border); border-radius: 8px; padding: 14px; max-height: 460px; overflow: auto; font: 13px/1.45 "DejaVu Sans Mono", ui-monospace, Menlo, Consolas, monospace; color: #cdd3df; white-space: pre-wrap; }

/* Chat */
.chat-log { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.chat-user, .chat-assistant { padding: 8px 12px; border-radius: 10px; max-width: 80%; white-space: pre-wrap; }
.chat-user { align-self: flex-end; background: var(--accent-2); color: #fff; }
.chat-assistant { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--border); }

/* Brand header (#89 white-label) */
h1.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 28px; height: 28px; border-radius: 7px; object-fit: contain; }
.brand-name { font-weight: 700; }
/* Theme-aware brand mark (BUGS_4 #1/#6): the inline brand SVG embeds BOTH the
   owner's dark-tile (.bm-d) and light-tile (.bm-l) variants; exactly one shows
   per <html data-theme>. Applies everywhere the mark is inlined (sidebar slot,
   auth lockup, powered-by badge, official plugin-source row). */
.brand-logo--mark { display: inline-flex; flex: 0 0 auto; }
.brand-logo--mark svg { width: 100%; height: 100%; display: block; }
.bm-l { display: none; }
[data-theme="light"] .bm-l { display: inline; }
[data-theme="light"] .bm-d { display: none; }

/* Rich plan checklist (#14) */
.rich-plan { margin: 8px 0; }
.rich-plan-title { font-weight: 600; margin-bottom: 6px; }
.rich-plan-steps { list-style: none; padding: 0; margin: 0; }
.rich-plan-step { display: flex; align-items: baseline; gap: 8px; padding: 4px 8px; margin: 4px 0; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); }
.rich-plan-marker { width: 1.2em; text-align: center; color: var(--muted); }
.rich-plan-step.done .rich-plan-marker { color: var(--ok); }
.rich-plan-step.active .rich-plan-marker { color: var(--accent); }
.rich-plan-step.done .rich-plan-label { color: var(--muted); text-decoration: line-through; }
.rich-plan-step.active .rich-plan-label { font-weight: 600; }

/* Rich diagram (#34) */
.rich-diagram { margin: 8px 0; }
.rich-diagram-svg { overflow: auto; }
.rich-diagram-svg svg { max-width: 100%; }
.rich-diagram-src { background: #0b0e13; border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow: auto; white-space: pre; }

/* Code blocks + copy/run (#94) */
.code-block { margin: 8px 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #0b0e13; }
.code-block .code-bar { display: flex; gap: 6px; justify-content: flex-end; padding: 6px 8px; border-bottom: 1px solid var(--border); background: var(--panel-2); }
.code-block .code-bar button { margin: 0; padding: 3px 10px; font-size: 12px; font-weight: 500; background: var(--panel); color: var(--fg); border: 1px solid var(--border); }
.code-block .code-bar button:hover { border-color: var(--accent); color: var(--accent-2); background: var(--panel); }
.code-block .code-run { color: var(--ok) !important; }
.code-block pre { margin: 0; padding: 12px; overflow: auto; }
.code-block pre code { font: 13px/1.5 var(--em-font-mono); color: #cdd3df; }

/* MathML (#94) — native rendering; just spacing/sizing. */
math { font-size: 1.05em; }
math[display="block"] { display: block; margin: 10px 0; text-align: center; overflow-x: auto; }

/* Command palette (#95) */
.cmdk-trigger { background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); font-family: var(--em-font-mono); font-size: 12px; padding: 4px 10px; }
.cmdk-trigger:hover { color: var(--fg); border-color: var(--accent); background: var(--panel-2); }
.cmdk-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: flex-start; justify-content: center; z-index: 1000; padding-top: 12vh; }
.cmdk-panel { width: min(560px, 92vw); background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 18px 48px rgba(0,0,0,0.5); overflow: hidden; }
.cmdk-input { width: 100%; min-width: 0; margin: 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 14px 16px; font-size: 16px; background: var(--panel); }
.cmdk-input:focus { border-color: var(--accent); }
.cmdk-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
.cmdk-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 12px; margin: 0; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.cmdk-item.active { background: var(--accent); color: #fff; }
.cmdk-item.active .cmdk-hint { color: rgba(255,255,255,0.8); }
.cmdk-title { font-weight: 500; }
.cmdk-hint { color: var(--muted); font-size: 12px; }
.cmdk-empty { padding: 14px 12px; color: var(--muted); }

/* Onboarding tour (#96) */
.tour-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1100; }
.tour-spotlight { position: fixed; border: 2px solid var(--accent); border-radius: 10px; box-shadow: 0 0 0 9999px rgba(0,0,0,0.45); pointer-events: none; transition: all 0.15s ease; }
.tour-bubble { position: fixed; width: min(320px, 88vw); background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: 0 12px 36px rgba(0,0,0,0.5); }
.tour-bubble.centered { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.tour-title { margin: 0 0 6px; font-size: 16px; font-family: var(--em-font-display); }
.tour-body { margin: 0 0 10px; color: var(--text-dim, var(--muted)); }
.tour-progress { color: var(--muted); font-size: 12px; }
.tour-controls { display: flex; gap: 6px; margin: 10px 0 8px; }
.tour-controls .tour-skip { background: transparent; color: var(--muted); border: 1px solid var(--border); margin-right: auto; }
.tour-dsa { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.tour-dsa input { min-width: 0; margin: 0; }

/* Starter-template gallery (#96) */
.template-gallery-wrap { margin: 4px 0 14px; }
.template-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.template-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 12px; margin: 0; background: var(--panel-2); color: var(--fg); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.template-card:hover { border-color: var(--accent); background: var(--panel-2); }
.template-title { font-weight: 600; }
.template-desc { color: var(--muted); font-size: 12px; font-weight: 400; }
/* Canvas / Artifacts (#8–#11) */
.chat-layout { display: flex; gap: 16px; align-items: flex-start; }
.chat-main { flex: 1 1 auto; min-width: 0; }
/* Stack chat + canvas vertically on narrow screens so neither is squeezed. */
@media (max-width: 900px) {
  .chat-layout { flex-direction: column; }
  .canvas { flex: 1 1 auto; max-width: 100%; width: 100%; }
}
.rich-artifact-open { margin-top: 8px; background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.rich-artifact-open:hover { border-color: var(--accent); }
.canvas { flex: 0 0 420px; max-width: 50%; align-self: stretch; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); display: flex; flex-direction: column; max-height: 70vh; overflow: hidden; }
.canvas[hidden] { display: none; }
.canvas-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.canvas-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.canvas-close { background: transparent; color: var(--muted); border: 0; font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; }
.canvas-close:hover { color: var(--text); }
.canvas-body { padding: 12px; overflow: auto; }
.canvas-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.canvas-tools button { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; cursor: pointer; }
.canvas-tools button:hover { border-color: var(--accent); }
.canvas-content { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: var(--panel-2); }
.canvas-code { margin: 0; overflow: auto; white-space: pre; font-family: var(--em-font-mono); font-size: 12px; }
.canvas-editor { width: 100%; box-sizing: border-box; font-family: var(--em-font-mono); font-size: 12px; }
.canvas-diff { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-top: 10px; font-family: var(--em-font-mono); font-size: 12px; }
.canvas-diff-line { display: flex; gap: 8px; padding: 1px 8px; white-space: pre-wrap; }
.canvas-diff-line.add { background: rgba(111, 191, 138, 0.15); }
.canvas-diff-line.remove { background: rgba(229, 96, 74, 0.15); }
.canvas-diff-mark { width: 1ch; color: var(--muted); }
.canvas-diff-line.add .canvas-diff-mark { color: var(--ok); }
.canvas-diff-line.remove .canvas-diff-mark { color: var(--err); }
.canvas-diff-actions { display: flex; gap: 8px; margin-top: 8px; }
.canvas-versions { display: flex; flex-direction: column; gap: 6px; }
.canvas-version { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); }
.canvas-version.current { border-color: var(--accent); }
.canvas-version-num { font-weight: 600; min-width: 2.5em; }
.canvas-version-summary { flex: 1 1 auto; color: var(--text-dim); }
.canvas-version-author { color: var(--muted); font-size: 12px; }
.canvas-version-restore { background: transparent; color: var(--accent); border: 1px solid var(--accent); border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.canvas-run-output, .canvas-output { margin-top: 10px; }
.canvas-output-frame { width: 100%; min-height: 120px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.canvas-error { color: var(--err); }

/* ──────────────────────────────────────────────────────────────────────
   UX pass — readable, structured layout (esp. the Plugins page). Later
   rules override the base above; no DOM changes required.
   ────────────────────────────────────────────────────────────────────── */
#app { max-width: 1180px; padding: 32px 28px 72px; }
h1 { font-size: 24px; margin-bottom: 20px; }
fieldset { padding: 22px 24px; margin-bottom: 20px; }
legend { font-family: var(--em-font-display); font-size: 15px; }

/* Identity panel — compact, muted */
.identity { gap: 24px; padding: 4px 0; }

/* Nav tabs — pill row with clear active state */
nav.tabs { gap: 4px 6px; margin: 20px 0 22px; }
nav.tabs button.tab { border-radius: 999px; padding: 7px 15px; font-size: 14px; }

/* Primary vs secondary buttons: only key actions are ember-filled */
button { padding: 9px 16px; }
.module-row button, .catalog-row button, .module-config button {
  background: var(--panel-2); color: var(--fg); border: 1px solid var(--border); font-weight: 500;
}
.module-row button:hover, .catalog-row button:hover, .module-config button:hover { border-color: var(--accent); color: var(--accent-2); background: var(--panel-2); }
.catalog-row button, .module-config .cfg-save { background: var(--accent); color: #fff; border-color: transparent; font-weight: 600; }
.catalog-row button:hover, .module-config .cfg-save:hover { background: var(--accent-2); color: #fff; }

/* Catalog — cards in a grid, each with an Install on the right */
.catalog-list, ul:has(> .catalog-row) { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.catalog-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--panel); }
.catalog-icon { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: 0 0 auto; background: var(--panel-2); }
.catalog-meta { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-width: 0; }
.catalog-desc { margin: 0; color: var(--em-text-muted); font-size: 0.85em; line-height: 1.4; }
.catalog-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.official-badge { font-weight: 600; }
.catalog-shots { display: flex; gap: 6px; flex-wrap: wrap; }
.catalog-shot { height: 40px; width: auto; border-radius: 6px; object-fit: cover; }

/* Installed module — a card: header row wraps, config form spans full width below */
.module-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 16px 18px; border-radius: 12px; background: var(--panel); line-height: 1.6; }
.module-row > strong { font-size: 16px; font-family: var(--em-font-display); margin-right: 2px; }
/* BUGS_4 #2/#3: background-COLOR only — the `background:` shorthand was wiping
   the design chevron (the global select background-image). */
.module-row select.module-auto-update { background-color: var(--panel-2); color: var(--fg); border: 1px solid var(--border); border-radius: 8px; padding: 7px 8px 7px 8px; }

/* Config form — clean two-column grid, label above the input */
.module-config { flex: 0 0 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin: 8px 0 0; padding: 18px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; }
.module-config label { display: flex; flex-direction: column; gap: 6px; margin: 0; color: var(--text-dim, var(--muted)); font-size: 12.5px; font-weight: 500; }
.module-config .cfg-input { width: 100%; min-width: 0; margin: 0; }
.module-config .cfg-test, .module-config .cfg-save { margin: 6px 0 0; justify-self: start; }
.module-config > span.ok { grid-column: 1 / -1; }

/* BUGS_8 #10: a SET secret shows a masked-dots indicator whose dot count matches
   the stored secret's byte length, in the FILLED text colour (--em-text) — not
   the muted placeholder colour (which read as "empty/wiped"). The mask overlays
   the empty password input and is hidden on focus / while typing a replacement. */
.secret-field { position: relative; display: block; }
.secret-field > input { width: 100%; }
.secret-set-mask {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--em-text); letter-spacing: 2px; line-height: 1;
  pointer-events: none; overflow: hidden; max-width: calc(100% - 24px); white-space: nowrap;
}

/* Banner + validation checks — own full-width rows inside the card */
.module-banner { flex: 0 0 100%; margin: 8px 0 0; padding: 10px 14px; border-radius: 10px; }
.module-config .module-checks { grid-column: 1 / -1; margin: 6px 0 0; padding: 12px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.module-checks .check { padding: 2px 0; }

/* Status badge — clearer pill */
.module-badge { padding: 3px 11px; font-size: 11px; letter-spacing: 0.4px; text-transform: uppercase; border-radius: 999px; }

/* Generic list rows a touch roomier */
li { padding: 12px 14px; border-radius: 10px; }

/* API & SDK docs screen: embed the self-hosted API Explorer full-height. */
.docs-frame {
  width: 100%;
  height: 75vh;
  border: 1px solid var(--em-line);
  border-radius: 14px;
  background: var(--em-surface);
}

/* Prominent call-to-action linking to the hosted developer documentation
   (docs.aihummer.ru) — the docs site is framed by X-Frame-Options so it is
   opened in a new tab rather than embedded. */
.docs-portal {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 12px;
  background: var(--accent, #ff6a2c);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.docs-portal:hover { filter: brightness(1.08); }

/* Grouped nav (Emchummer design): mono uppercase section labels — the
   "instrument" signature — separating the five navigation groups. */
.tabs .navgrp {
  font-family: var(--em-font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--em-text-muted);
  margin: 12px 6px 4px;
}
.tabs .navgrp:first-child { margin-top: 0; }

/* ============================================================================
   Emchummer design language — shared layer (§7). Applies the "instrument" look
   to the structure EVERY screen already uses (fieldset/legend/table/inputs), so
   all 28 pages adopt the design without per-screen rewrites: hairline structure
   over shadows, mono uppercase section labels + metadata, tabular numbers, tight
   radii, a single ember accent, status = colour + word.
   ============================================================================ */

/* Section header — the signature mono uppercase "instrument" label. */
legend {
  font-family: var(--em-font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--em-text-dim);
  font-weight: 500;
}

/* L8: text links adopt the ember accent (legible per theme) instead of the
   browser-default blue underline that clashes with the orange theme. Buttons
   rendered as anchors (.btn*, .dl-btn, .docs-portal, .btn-upgrade, .tab,
   .codex-link, .doc .toc a) keep their own look via class specificity. */
a {
  color: var(--em-accent-text);
  /* BUGS_3 #86: links are NOT underlined — the ember colour is the affordance;
     hover brightens. (Prose/docs links that need an underline opt back in via
     `.underline` below.) */
  text-decoration: none;
  text-underline-offset: 2px;
}
a:hover {
  color: var(--em-accent-bright);
}
/* Opt-in underline for the rare place an underline is semantically needed. */
a.underline, .prose a, .doc__body a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--em-accent-text) 45%, transparent); }
a.underline:hover, .prose a:hover, .doc__body a:hover { text-decoration-color: var(--em-accent-bright); }

/* Cards = hairline + surface contrast, tight-to-medium radius, no heavy shadow. */
fieldset {
  border: 1px solid var(--em-line);
  border-radius: 16px;
  background: var(--em-surface);
}

/* Controls: tight md radius + ember focus ring. */
input, select, textarea {
  border-radius: 9px;
  border: 1px solid var(--em-line);
  background: var(--em-surface-2);
  color: var(--em-text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--em-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--em-accent) 30%, transparent);
}

/* One ember CTA per area; secondary actions are quiet ghost buttons. */
button { border-radius: 9px; }
button.ghost, button.secondary {
  background: transparent;
  color: var(--em-text-dim);
  border: 1px solid var(--em-line);
}
button.ghost:hover, button.secondary:hover { color: var(--em-text); background: var(--em-surface-2); }

/* Data tables: hairline rules, mono uppercase headers, tabular figures so
   columns of numbers align (the design's "data as hero"). */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th {
  font-family: var(--em-font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--em-text-muted);
  text-align: left;
  font-weight: 500;
  border-bottom: 1px solid var(--em-line);
  padding: 8px 10px;
}
td { border-bottom: 1px solid var(--em-line); padding: 8px 10px; color: var(--em-text); }
tr:last-child td { border-bottom: none; }

/* Metrics + ids + units render in tabular mono — numbers are the hero. */
.stat-value, .metric, .num, .overview b, .mono { font-variant-numeric: tabular-nums; }
.mono, .unit, .meta { font-family: var(--em-font-mono); }

/* Status = colour AND a word/dot, never colour alone. */
.status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 999px;
  margin-right: 6px; vertical-align: middle; background: var(--em-text-muted);
}
.status-dot.ok { background: var(--em-ok); }
.status-dot.warn { background: var(--em-warn); }
.status-dot.err { background: var(--em-err); }
.status-label {
  font-family: var(--em-font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.06em;
}
.status-label.ok { color: var(--em-ok); }
.status-label.warn { color: var(--em-warn); }
.status-label.err { color: var(--em-err); }

/* Respect reduced motion for the entrance/interaction utilities. */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* curl snippets on the docs screen — mono block, hairline, scrollable. */
.docs-curl {
  font-family: var(--em-font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--em-text-dim);
  background: var(--em-surface-2);
  border: 1px solid var(--em-line);
  border-radius: 12px;
  padding: 14px 16px;
  overflow-x: auto;
  white-space: pre;
}

/* Nav group header: line icon + mono label, aligned. */
.tabs .navgrp { display: flex; align-items: center; gap: 6px; }
.navgrp-ic { display: inline-flex; color: var(--em-text-muted); }
.navgrp-ic svg { display: block; }

/* Tabs are icon-led: align the line glyph with the label. */
nav.tabs button.tab { display: inline-flex; align-items: center; gap: 6px; }
nav.tabs button.tab .navgrp-ic { color: inherit; }


/* P6.3 connected-device status panel (Connections page). */
.device-row {
  padding: 8px 0;
  border-top: 1px solid var(--em-border, #2a2a2a);
}
.device-detail { margin-top: 4px; }
.device-sources .chip {
  display: inline-block;
  padding: 1px 8px;
  margin: 0 4px 4px 0;
  border-radius: 999px;
  background: var(--em-surface-2, #2a2a2a);
  font-family: var(--em-font-mono);
  font-size: 11px;
}
.device-metrics .status-label { margin-right: 8px; }
.status-label.muted { color: var(--em-text-muted); }

/* License / Plan panel */
.license h4 { margin: 14px 0 6px; font-size: 13px; }
.lic-active { color: var(--em-accent-bright, #4caf50); }
.lic-grace { color: var(--warn, #e0a800); }
.lic-expired, .lic-invalid { color: var(--em-danger, #d9534f); }
.lic-unlicensed { color: var(--muted); }
.usage-row { margin: 6px 0; }
.usage-label { font-size: 12px; margin-bottom: 3px; }
.usage-track { height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.usage-fill { height: 100%; background: var(--accent); transition: width .2s ease; }
.usage-fill.usage-over { background: var(--em-danger, #d9534f); }
.feature-matrix { list-style: none; padding: 0; margin: 4px 0; }
.feature-matrix li { font-size: 12px; padding: 2px 0; }
.feature-matrix li.feat-on { color: var(--em-accent-bright, #4caf50); }
.feature-matrix li.feat-off { color: var(--muted); }
.btn-upgrade {
  display: inline-block; margin: 10px 0; padding: 6px 14px; border-radius: 6px;
  background: var(--accent); color: #fff; text-decoration: none; font-size: 13px;
}

/* App-download buttons (point 10): multi-store download set on the AiHummer app
   plugin (slug ios-proxy). Available stores are real links; unavailable ones are
   disabled "Скоро" buttons. */
.app-downloads { flex: 0 0 100%; margin: 10px 0 0; }
.app-downloads-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; }

/* Canonical AiHummer multi-platform download button set (matches aihummer.ru landing). */
.dl-set{display:flex;flex-wrap:wrap;gap:8px}
.dl-btn{display:inline-flex;align-items:center;gap:8px;padding:9px 13px;border-radius:10px;font-size:13px;font-weight:600;line-height:1;text-decoration:none;border:1px solid var(--em-line-strong);background:var(--em-surface);color:var(--em-text);transition:border-color .15s,background .15s,transform .15s}
.dl-btn img{display:block;flex:none}
a.dl-btn:hover{border-color:var(--em-accent-edge);background:var(--em-surface-2);transform:translateY(-1px)}
.dl-btn--soon{border-style:dashed;border-color:var(--em-line);color:var(--em-text-muted);cursor:default;opacity:.72}
.dl-btn--soon img{filter:grayscale(1);opacity:.85}
.dl-soon-tag{font-family:var(--em-font-mono);font-size:9.5px;letter-spacing:.05em;text-transform:uppercase;color:var(--em-text-dim);border:1px solid var(--em-line);border-radius:5px;padding:1px 5px}

/* Codex (ChatGPT subscription) connect panel (alfa2): the in-product "connect an
   LLM" flow. Connect shows a verification link + one-time code; the panel polls
   until the server-side device-auth flips to connected. */
.codex-connect { margin: 0 0 12px; }
.codex-connect h4 { margin: 0 0 4px; }
.codex-sep { border: none; border-top: 1px solid var(--border, rgba(255,255,255,0.12)); margin: 14px 0; }
.codex-state { margin: 6px 0; }
.codex-status {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--panel-2, rgba(255,255,255,0.06)); color: var(--muted);
}
.codex-status.connected { background: rgba(40,167,69,0.18); color: #41c463; }
.codex-status.pending { background: rgba(255,193,7,0.18); color: #e2b007; }
.codex-status.error { background: rgba(220,53,69,0.18); color: #e0566a; }
.codex-detail { margin: 8px 0; }
.codex-step { font-weight: 600; margin: 8px 0 2px; }
.codex-link { word-break: break-all; }
.codex-code {
  display: inline-block; font-size: 22px; letter-spacing: 3px; font-weight: 700;
  padding: 6px 14px; border-radius: 8px; user-select: all;
  background: var(--panel-2, rgba(255,255,255,0.08)); color: var(--text, #e8e8e8);
}
.codex-actions { margin-top: 8px; }
.codex-error { color: var(--err); }

/* ============================================================================
   5) SHELL LAYER — map the admin control plane onto the design's .app grid.
   The dashboard renders <section class="app dashboard"> with a <aside class="side">
   sidebar (brand + grouped nav + tools) and a <div class="main"> column
   (sticky .top bar + scrolling .pad of screens). Auth/onboarding screens render
   directly in #app and keep their centred column.
   ============================================================================ */

* { box-sizing: border-box; }
html, body { height: 100%; }

/* Full-bleed the mount root when it hosts the dashboard shell. */
#app:has(> .app) { max-width: none; margin: 0; padding: 0; height: 100vh; }
body:has(.app) { overflow: hidden; }
/* BUGS_2 №1: the auth/onboarding screens are full-bleed too — the old centred
   1180px column left page background around the `.auth` split, so the left
   block's backdrop never reached the viewport edges. */
#app:has(> .auth),
#app:has(> .onboarding),
#app:has(> .onboarding-done) { max-width: none; margin: 0; padding: 0; }

/* The grid shell + sidebar come straight from app.css (.app/.side/.main/.top/
   .scroll/.pad). Below: tune the admin shell's existing elements to fit. */

/* ---- brand (sidebar header) ---- */
.side .brand { padding: 6px 8px 14px; gap: 10px; margin: 0; }
.side .brand .brand-logo { width: 28px; height: 28px; border-radius: 8px; object-fit: contain; flex: 0 0 auto; }
.side .brand .brand-name { font-family: var(--em-font-display); font-weight: 700; font-size: 16px; letter-spacing: -.02em; color: var(--em-text); }

/* ---- grouped vertical nav (reuses nav.tabs / .navgrp / button.tab) ---- */
.side nav.tabs {
  display: flex; flex-direction: column; flex-wrap: nowrap; gap: 2px;
  margin: 0; padding: 4px 0 8px; border-bottom: 0;
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden;
}
/* L7: section headers are Title Case (matches the reference `.ngrp`), not the
   mono UPPERCASE + letter-spacing that read as shouty ("РАБОТА"). */
.side nav.tabs .navgrp {
  font-size: 11px; font-weight: 600;
  color: var(--em-text-faint); padding: 14px 9px 6px; margin: 0;
  display: flex; align-items: center; gap: 7px;
  /* L7: override the base .tabs .navgrp uppercase/letter-spacing so the sidebar
     group headers read as Title Case ("Работа") per the reference design, not
     shouty "РАБОТА". The base rule is more general but sets text-transform, so
     this same-or-higher-specificity rule must explicitly reset it. */
  text-transform: none; letter-spacing: normal;
}
.side nav.tabs .navgrp:first-child { padding-top: 2px; }
.side nav.tabs .navgrp-ic { color: var(--em-text-faint); display: inline-flex; }
.side nav.tabs button.tab,
.side nav.tabs a.tab {
  position: relative; width: 100%; text-align: left; justify-content: flex-start;
  display: flex; align-items: center; gap: 11px;
  padding: 8px 9px; border-radius: 7px; border: 0;
  background: transparent; color: var(--em-text-dim);
  font-family: var(--em-font-sans); font-size: 13.5px; font-weight: 500;
  transition: background var(--em-dur-fast) var(--em-ease), color var(--em-dur-fast) var(--em-ease);
}
/* p.45: the external Documentation nav entry is an <a>, styled like a tab. */
.side nav.tabs a.tab { text-decoration: none; cursor: pointer; box-sizing: border-box; }
.side nav.tabs a.tab .navgrp-ic { color: inherit; opacity: .72; flex: 0 0 auto; }
.side nav.tabs button.tab:hover,
.side nav.tabs a.tab:hover { background: var(--em-surface); color: var(--em-text); }
.side nav.tabs button.tab.active,
.side nav.tabs button.tab.on { background: var(--em-surface); color: var(--em-text); }
.side nav.tabs button.tab.active::before,
.side nav.tabs button.tab.on::before {
  content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--em-accent);
  box-shadow: 0 0 12px rgba(var(--em-glow), .6);
}
.side nav.tabs button.tab .navgrp-ic { color: inherit; }
.side nav.tabs button.tab.active .navgrp-ic svg,
.side nav.tabs button.tab.on .navgrp-ic svg { color: var(--em-accent-bright); }
/* BUGS_8 #35: a plan-gated nav item — unavailable ONLY because the current plan
   lacks the feature. A `$` marker + a warm highlight tint tell the operator it is
   an upgrade-gated page (not broken); the item stays clickable (the page shows its
   own upgrade empty-state). */
.side nav.tabs button.tab.tab--gated { color: var(--em-warn); }
.side nav.tabs button.tab.tab--gated:hover { background: var(--em-warn-soft); color: var(--em-warn); }
.side nav.tabs button.tab.tab--gated .navgrp-ic svg { color: var(--em-warn); }
.side nav.tabs button.tab .tab-gate {
  margin-left: auto; flex: 0 0 auto;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--em-font-mono); font-size: 11px; font-weight: 700; line-height: 1;
  color: var(--em-warn); background: var(--em-warn-soft);
  border: 1px solid color-mix(in srgb, var(--em-warn) 40%, transparent);
}

/* ---- sidebar footer (theme toggle + palette trigger) ---- */
.side__foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--em-line); display: flex; flex-direction: column; gap: 8px; }
.side__tools { display: flex; align-items: center; gap: 8px; }
/* p.4: flex-center the theme-toggle glyph — the wrapping icon span carries
   inline baseline metrics that nudged the SVG off-center inside the button. */
.iconbtn.theme-toggle { display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.iconbtn.theme-toggle .navgrp-ic { display: flex; align-items: center; justify-content: center; line-height: 0; }
.iconbtn.theme-toggle .navgrp-ic svg { display: block; width: 16px; height: 16px; }
.side__tools .cmdk-trigger { flex: 1; height: 34px; }

/* ---- main column top bar + scroll ---- */
.main .top h1.page-title { font-family: var(--em-font-display); font-size: 21px; font-weight: 700; letter-spacing: -.025em; line-height: 1.05; margin: 0; }
.main .top__sp { flex: 1; }
.main .scroll { background: var(--em-bg); }
/* Content fills the available main-column width (matches the mockup's wide content
   area). A generous cap only kicks in on ultra-wide displays so long single-column
   text screens don't sprawl — but no narrow gutter on normal/laptop widths. */
.main .pad { max-width: 1680px; }

/* ---- top-level page = content on the canvas (faithful to the mockup) ----
   Each screen is a top-level `> fieldset` page. The design's screens are a top
   bar (title) + content sitting directly on the app canvas — NOT one giant
   bordered card with a mono section label duplicating the top-bar title. So the
   page-level fieldset drops its border/background/padding and its legend (the
   `.pad` already supplies the outer gutter). NESTED fieldsets (sub-sections
   inside a page) keep their card styling — this rule is direct-child scoped. */
.main .pad > fieldset {
  border: 0;
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin: 0 0 22px;
}
.main .pad > fieldset > legend { display: none; }

/* BUGS_8 #39-#43: page-level categories on the composite «Система и настройки»
   page. A `.set-section--page` wraps a former standalone page (License / External
   access / IP allowlist) whose own fieldset would otherwise draw a second card +
   duplicate title under the category header — flatten it so the content flows
   directly inside the category body. */
.set-section--page .set-section__body > fieldset {
  border: 0; background: transparent; border-radius: 0; padding: 0; margin: 0;
}
.set-section--page .set-section__body > fieldset > legend { display: none; }

/* ---- sidebar workspace chip (folded identity scope) ----
   The tenant/subject scope is surfaced as the design `.workspace` chip in the
   sidebar footer instead of a raw-UUID card on every screen. The editable inputs
   live in a collapsed `.scope-edit` disclosure toggled by the chip. */
.side__foot .workspace { width: 100%; }
.side__foot .workspace .a { font-family: var(--em-font-display); }
/* BUGS_2 WEB UI №17: footer row = identity chip (display only, no GUID
   disclosure) + account-settings and logout icon buttons. */
.side__foot-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.side__foot-row .workspace { flex: 1; min-width: 0; cursor: default; }
.side__foot-row .workspace:hover { border-color: var(--em-line); }
.side__foot-row .iconbtn { flex: 0 0 auto; }
.side__foot-row .iconbtn .navgrp-ic { display: inline-flex; }
/* BUGS_2 WEB UI №18: external-site indicator on the Documentation nav link. */
.side nav.tabs a.tab .tab-ext { margin-left: auto; display: inline-flex; opacity: .6; flex: 0 0 auto; }
.side nav.tabs a.tab .tab-ext svg { width: 12px; height: 12px; stroke: currentColor; fill: none; }
.side__foot .scope-edit .input { min-width: 0; width: 100%; margin: 0; }
.side__foot .scope-edit .flabel { font-size: 11px; color: var(--em-text-muted); }

/* ---- demote the surviving manual refresh buttons ----
   Every page auto-loads its data whenever its tab is shown (p.9 — the "Load X"
   buttons are gone from the DOM). The few remaining `-refresh`-id buttons are
   genuine re-check actions (memory review, system update check); render them as
   quiet ghost buttons. Genuine create/save actions keep the ember accent. */
.main .pad button[id$="-refresh"] {
  background: transparent;
  color: var(--em-text-dim);
  border: 1px solid var(--em-line);
  box-shadow: none;
  font-weight: 500;
  padding: 7px 12px;
  font-size: 13px;
}
.main .pad button[id$="-refresh"]:hover {
  background: var(--em-surface-2);
  color: var(--em-text);
  border-color: var(--em-line-strong);
}

/* ---- faithful Dashboard (overview) + shell tweaks (alfa2 rebuild) ----
   The mockup's Dashboard = metric hero (.metrics) + resource tiles (.countgrid)
   + a two-up .grid2 (recent-sessions feed + host-health). The page fieldset
   stacks these as a flex column with the design's 18px rhythm. */
.main .pad > fieldset.dash { display: flex; flex-direction: column; gap: 18px; }
.main .pad > fieldset.dash .metrics,
.main .pad > fieldset.dash .grid2 { margin: 0; }
.main .pad > fieldset.dash #overview-box .sectlabel { margin-top: 2px; }

/* brand name + "control plane" subtitle (sidebar) */
.side .brand { align-items: center; }
.side .brand .brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.side .brand .brand-sub { display: block; font-family: var(--em-font-mono); font-size: 10px; color: var(--em-text-muted); margin-top: 2px; }

/* nav count badge (design .ct) inside the grouped sidebar tabs */
.side nav.tabs button.tab .ct {
  margin-left: auto; font-family: var(--em-font-mono); font-size: 10px;
  color: var(--em-text-muted); font-variant-numeric: tabular-nums;
}

/* top bar: breadcrumb above the page title + right-aligned action cluster */
.main .top__l { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.main .top__r { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.main .top .top__bc { font-family: var(--em-font-mono); font-size: 11px; color: var(--em-text-muted); }
.main .top .field.cmdk-trigger { width: 210px; }

/* ============================================================================
   ALFA2 UI conformance fixes (owner complaints 1-6)
   ============================================================================ */

/* (2) Native controls — every <select>/<input>/<textarea> adopts the design
   `.input` look. Selects lose the OS chrome and gain the design chevron so they
   match the styled form components on every platform. Search/composer fields
   keep their own (more specific) borderless rules. */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="color"]),
select,
textarea {
  border-radius: var(--em-radius-md);
  border: 1px solid var(--em-line-strong);
  background: var(--em-surface);
  color: var(--em-text);
  font: inherit;
  font-size: 13px;
  padding: 9px 12px;
  outline: 0;
  transition: border-color var(--em-dur-fast) var(--em-ease), box-shadow var(--em-dur-fast) var(--em-ease);
}

/* «Свой дизайн» colorpicker — a compact DS-styled swatch (native OS picker on
   click). Themed to match the form controls; the swatch itself is the value. */
input[type="color"].color-input {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  width: 46px; height: 34px; padding: 3px; cursor: pointer;
  border: 1px solid var(--em-line-strong); border-radius: var(--em-radius-md);
  background: var(--em-surface);
}
input[type="color"].color-input::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"].color-input::-webkit-color-swatch { border: 0; border-radius: 5px; }
input[type="color"].color-input::-moz-color-swatch { border: 0; border-radius: 5px; }
input[type="color"].color-input:focus { border-color: var(--em-accent-edge); box-shadow: 0 0 0 3px var(--em-accent-soft); }
.design-block .design-form { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.design-block .field-block { display: block; }
.design-block .design-colors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.design-block .color-field { display: flex; align-items: center; gap: 12px; }
.design-block .color-field .flabel { margin: 0; }
@media (max-width: 560px) { .design-block .design-colors { grid-template-columns: 1fr; } }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--em-accent-edge);
  box-shadow: 0 0 0 3px var(--em-accent-soft);
}
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 32px;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a8178' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
/* keep borderless inline fields (search/composer/cmdk) borderless */
.field input, .searchbig input, .composer textarea, .cmdk__in input {
  border: 0; background: transparent; padding: 0; box-shadow: none;
}

/* (1) Styled language switcher — pill trigger (flag + code) + popover list. */
.langsel { position: relative; flex: 0 0 auto; }
.langsel__btn {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 10px;
  border: 1px solid var(--em-line-strong); border-radius: var(--em-radius-md);
  background: var(--em-surface); color: var(--em-text-dim); cursor: pointer;
  font: inherit; transition: border-color var(--em-dur-fast) var(--em-ease), color var(--em-dur-fast) var(--em-ease);
}
.langsel__btn:hover { border-color: var(--em-text-faint); color: var(--em-text); }
.langsel__flag { font-size: 15px; line-height: 1; }
.langsel__code { font-size: 11px; font-weight: 600; letter-spacing: .03em; }
.langsel__chev { width: 14px; height: 14px; stroke: var(--em-text-muted); fill: none; stroke-width: 2; transition: transform var(--em-dur-fast) var(--em-ease); }
.langsel.on .langsel__chev { transform: rotate(180deg); }
.langsel__menu {
  position: absolute; top: calc(100% + 6px); right: 0; left: auto; min-width: 200px;
  max-height: 320px; overflow: auto; z-index: var(--em-z-dropdown, 60);
}
.langsel__opt { width: 100%; text-align: left; border: 0; background: transparent; font: inherit; }
.langsel__opt .langsel__flag { font-size: 15px; }
.langsel__opt.on { color: var(--em-accent-text); }
.langsel__opt.on::after { content: "✓"; margin-left: auto; color: var(--em-accent-bright); }

/* (5) Settings & Authentication: these pages reuse `.settings` as a *rows*
   container, NOT the design's 200px tab-rail layout. Render full-width, single
   column, so the per-field Save sits in its own track instead of overflowing
   into a neighbouring grid column. */
.main .pad fieldset.settings,
.main .pad #authcfg-box.settings,
.main .pad #settings-box.settings,
.main .pad div.settings {
  display: block;
  grid-template-columns: none;
  max-width: none;
}
.setting-row { display: block; }
.setting-row .set-field { display: flex; gap: 8px; align-items: center; min-width: 0; max-width: 640px; }
.setting-row .set-field .input { flex: 1 1 auto; min-width: 0; width: auto; }
.setting-row .set-field .btn { flex: 0 0 auto; }
.setting-row .flabel { display: block; margin-bottom: 6px; }
.setting-row .set-source { display: block; margin-top: 6px; }

/* (7) — REMOVED (stage-0 W2): the Shared-blocks / Skills inline create
   fieldsets moved into form modals (п.14); their page-level layout rules are
   gone with them (the modal layout lives in the W2 section at the end). */

/* (8) License page — same inline-flow defect. The plan fieldset stacks a
   status card (div), an upgrade link (<a>), a token <textarea> and an install
   <button>; the fieldset is display:block but those three controls are
   inline-level, so the upgrade link, the tall token textarea and the install
   button flowed onto ONE line and the textarea floated up over the button row.
   Stack them in a column: the status card stays full-width, the token box is
   capped, and the upgrade/install/refresh buttons sit on their own rows. */
.main .pad fieldset.license {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
}
.main .pad fieldset.license > #license-token { width: 100%; max-width: 720px; }
.main .pad fieldset.license > .btn-upgrade,
.main .pad fieldset.license > button { align-self: flex-start; }

/* (9) Moderation + Knowledge — same inline-flow defect. Each page fieldset has
   a direct <textarea> immediately followed by its Save/Add <button>; both are
   inline-level so the button floated up beside the tall textarea instead of
   sitting under it. Stack the page as a column: the textarea is full-width, its
   action button drops to the next row, and the paired input .rows stay tidy. */
.main .pad fieldset.moderation,
.main .pad fieldset.knowledge {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}
.main .pad fieldset.moderation > #mod-patterns,
.main .pad fieldset.knowledge > textarea { width: 100%; max-width: 720px; }
.main .pad fieldset.knowledge > .row { max-width: 720px; }
.main .pad fieldset.moderation > button,
.main .pad fieldset.knowledge > button { align-self: flex-start; }

/* (10) Orchestration (Graphs) — the JSON editor <textarea> is a direct child of
   the graph card (between two flex .rows), not inside a layout wrapper, so as an
   inline-block with no width it collapsed to its ~200px default and the JSON was
   cramped against a ~500px empty gutter. Make the editor fill the card width. */
.main .pad .graph-card > textarea { display: block; width: 100%; }

/* ============================================================================
   UI OVERHAUL 2026-07-04 — sidebar (collapsible groups + per-item icons) +
   responsive shell (mobile drawer). Appended last so it wins the cascade.
   ============================================================================ */

/* --- Collapsible nav groups --- */
.tabs .navgrp{
  display:flex; align-items:center; gap:8px; width:100%;
  background:transparent; border:0; cursor:pointer;
  padding:9px 8px 5px; margin:10px 0 2px; text-align:left;
  color:var(--em-text-dim); font-family:var(--em-font-mono);
  font-size:10.5px; text-transform:uppercase; letter-spacing:.09em;
  /* Финал#2 (audit:ds): interactive elements always carry a transition. */
  transition:color var(--em-dur-fast) var(--em-ease);
}
.tabs .navgrp:first-child{ margin-top:2px; }
.tabs .navgrp:hover{ color:var(--em-text); }
.tabs .navgrp .navgrp__label{ flex:1 1 auto; }
.tabs .navgrp .navgrp-ic{ color:currentColor; opacity:.85; }
.tabs .navgrp__chev{ width:12px; height:12px; flex:0 0 auto; opacity:.7; transition:transform .18s ease; }
.tabs .navgrp__chev::before{
  content:""; display:block; width:6px; height:6px; margin:2px auto 0;
  border-right:1.5px solid currentColor; border-bottom:1.5px solid currentColor;
  transform:rotate(45deg);            /* points down = expanded */
}
.tabs .navgrp[aria-expanded="false"] .navgrp__chev{ transform:rotate(-90deg); }
/* Общее №5: the nav group folds with a grid-rows accordion (1fr ⇄ 0fr). */
.navgrp-items{ display:grid; grid-template-rows:1fr; transition:grid-template-rows var(--em-dur-normal) var(--em-ease); }
.navgrp-items.is-collapsed{ grid-template-rows:0fr; }
.navgrp-items__in{ min-height:0; overflow:hidden; display:flex; flex-direction:column; gap:2px; }
/* Per-item glyphs: give each item icon a touch of muted colour so the label leads. */
nav.tabs button.tab .navgrp-ic{ opacity:.72; flex:0 0 auto; }
nav.tabs button.tab.active .navgrp-ic{ opacity:1; }
nav.tabs button.tab{ width:100%; justify-content:flex-start; }

/* --- Mobile drawer (sidebar off-canvas) --- */
.nav-toggle{ display:none; }
.nav-backdrop{ display:none; }
@media (max-width:900px){
  .app{ grid-template-columns:1fr; }
  .side{
    position:fixed; top:0; left:0; bottom:0; width:264px; z-index:60;
    transform:translateX(-100%); transition:transform .22s ease;
    box-shadow:2px 0 24px rgba(0,0,0,.4);
  }
  .app.nav-open .side{ transform:translateX(0); }
  .nav-backdrop{
    display:block; position:fixed; inset:0; z-index:55;
    background:rgba(0,0,0,.5); opacity:0; pointer-events:none; transition:opacity .22s ease;
  }
  .app.nav-open .nav-backdrop{ opacity:1; pointer-events:auto; }
  .nav-toggle{
    display:inline-flex; align-items:center; justify-content:center;
    width:38px; height:38px; flex:0 0 auto; margin-right:2px;
    background:var(--em-bg-sub); border:1px solid var(--em-line); border-radius:10px;
    color:var(--em-text); cursor:pointer;
  }
  .top{ padding:12px 14px; gap:10px; flex-wrap:wrap; }
  .top h1{ font-size:18px; }
  .pad{ padding:14px !important; }
  /* BUGS_3 #20: free the top bar on small screens — the command-palette search
     is redundant beside the nav drawer, and it crowded the theme/lang switchers
     off the edge. */
  .main .top .field.cmdk-trigger{ display:none; }
  /* BUGS_3 #20: the analytics stat strip (`.lat`) wraps to a grid instead of
     overflowing off-screen (its big tabular numbers can't shrink under flex). */
  .lat{ display:grid; grid-template-columns:repeat(3,1fr); }
}
@media (max-width:560px){
  .side{ width:86vw; }
  .top .cmdk, .top form.cmdk, .top input[type="search"]{ display:none; }  /* hide desktop command box on tiny */
  .lat{ grid-template-columns:repeat(2,1fr); }
}

/* --- Settings page overhaul (search + collapsible groups + subtle source chip) --- */
.set-toolbar{ margin:0 0 16px; }
.set-search{ max-width:420px; }
.set-section{ border:1px solid var(--em-line); border-radius:12px; margin:0 0 12px; overflow:hidden; background:var(--em-bg-sub); }
.set-section__hdr{
  display:flex; align-items:center; gap:10px; width:100%;
  background:transparent; border:0; cursor:pointer; text-align:left;
  padding:13px 16px; color:var(--em-text);
}
.set-section__hdr:hover{ background:rgba(255,255,255,.02); }
.set-section__title{ flex:1 1 auto; font-weight:600; font-size:14px; }
.set-section__count{
  font-family:var(--em-font-mono); font-size:11px; color:var(--em-text-dim);
  background:var(--em-bg); border:1px solid var(--em-line); border-radius:999px; padding:1px 8px;
}
.set-section__hdr .navgrp__chev{ width:12px; height:12px; opacity:.7; }
.set-section__hdr .navgrp__chev::before{ content:""; display:block; width:6px; height:6px; margin:2px auto 0; border-right:1.5px solid currentColor; border-bottom:1.5px solid currentColor; transform:rotate(45deg); }
.set-section__hdr[aria-expanded="false"] .navgrp__chev{ transform:rotate(-90deg); }
.set-section__body{ padding:6px 16px 14px; border-top:1px solid var(--em-line); }
.set-section__body.is-collapsed{ display:none; }
.set-section__body .setting-row{ margin:0 0 14px; padding-top:12px; }
.set-section__body .setting-row:first-child{ padding-top:6px; }
.set-labelrow{ display:flex; align-items:center; gap:8px; margin-bottom:5px; }
.set-labelrow .flabel{ margin:0; }
.set-source-chip{
  font-family:var(--em-font-mono); font-size:10px; letter-spacing:.04em;
  color:var(--em-text-dim); background:var(--em-bg); border:1px solid var(--em-line);
  border-radius:999px; padding:0 7px; line-height:16px;
}
.set-field{ display:flex; gap:8px; align-items:center; }
.set-field .input{ flex:1 1 auto; }
.set-status{ display:block; margin-top:4px; color:var(--em-text-dim); min-height:0; }
.set-status:empty{ margin:0; }

/* №53 (BUGS_2): on wide screens the settings INSIDE a category flow in two
   columns (sections themselves stay full-width so group headers read as clear
   dividers). align-items:start keeps a tall row from stretching its partner. */
@media (min-width: 1400px){
  .set-section__body:not(.is-collapsed){ display:grid; grid-template-columns:1fr 1fr; gap:0 26px; align-items:start; }
}

/* №52: the per-category glyph in a settings section header. */
.set-section__icon{ display:inline-flex; width:15px; height:15px; margin-right:2px; color:var(--em-accent, #E89A4E); flex:0 0 auto; }
.set-section__icon svg{ display:block; }

/* #24: the «?» help bubble next to a field label. */
.hintq{
  display:inline-flex; align-items:center; justify-content:center;
  width:15px; height:15px; margin-left:6px; border-radius:50%;
  border:1px solid var(--em-line); color:var(--em-text-dim);
  font-size:10px; font-weight:700; line-height:1; cursor:help; user-select:none;
  vertical-align:middle; flex:0 0 auto;
}
.hintq:hover, .hintq:focus{ color:var(--em-accent, #E89A4E); border-color:var(--em-accent, #E89A4E); outline:none; }

/* #78: the role permission checkbox grid. */
.perm-grid{ border:1px solid var(--em-line); border-radius:10px; overflow:hidden; }
.perm-grid__hdr, .perm-grid__row{
  display:grid; grid-template-columns:1fr 64px 64px; align-items:center;
  padding:7px 12px; gap:8px;
}
.perm-grid__hdr{ font-size:11px; letter-spacing:.05em; text-transform:uppercase; color:var(--em-text-dim); background:var(--em-bg-sub); border-bottom:1px solid var(--em-line); }
.perm-grid__row{ border-bottom:1px solid var(--em-line); cursor:default; }
.perm-grid__row:last-child{ border-bottom:0; }
.perm-grid__row:hover{ background:rgba(255,255,255,.02); }
.perm-grid__c{ text-align:center; }

/* #79: the stored-secrets list. */
.secrets-list{ list-style:none; margin:0 0 12px; padding:0; }
.secrets-list .secret-row{ align-items:center; }

/* #93: channel↔agent binding rows. */
.channel-bindings .binding-row{ align-items:center; }
.channel-bindings select{ min-width:220px; }

/* #81: the collapsed advanced-payload block in the schedule modal. */
.schedule-advanced{ margin:4px 0 0; }
.schedule-advanced summary{ cursor:pointer; color:var(--em-text-dim); font-size:12.5px; margin-bottom:6px; }

/* --- Plugins catalog cards overhaul (was: ragged full-text walls) --- */
.catalog-list, ul:has(> .catalog-row){ grid-template-columns:repeat(auto-fill, minmax(300px,1fr)); align-items:stretch; }
.catalog-row{
  flex-direction:column; align-items:stretch; gap:10px; height:100%;
  padding:16px; justify-content:flex-start;
}
.catalog-row > .lrow__ic{ align-self:flex-start; }
.catalog-icon{ width:42px; height:42px; }
.catalog-meta{ flex:1 1 auto; gap:5px; }
.catalog-meta > b{ font-size:15px; line-height:1.25; }
.catalog-meta > small{ color:var(--em-text-dim); font-family:var(--em-font-mono); font-size:11px; }
.catalog-desc{
  display:-webkit-box; -webkit-line-clamp:3; line-clamp:3; -webkit-box-orient:vertical;
  overflow:hidden; text-overflow:ellipsis; margin:2px 0 0; min-height:calc(1.4em * 2);
}
.catalog-badges{ margin-top:2px; }
.catalog-row > .lrow__a{ margin-top:auto; padding-top:6px; }
.catalog-row > .lrow__a .btn{ width:100%; justify-content:center; }

/* --- Models (BYOK) page overhaul (was one cramped row of unlabelled inputs) --- */
.models-intro{ max-width:640px; margin:0 0 14px; line-height:1.5; }
.models-form-grid{ display:grid; grid-template-columns:repeat(2, minmax(220px,1fr)); gap:14px 18px; max-width:760px; margin:10px 0 4px; }
.models-fld{ margin:0; }
.models-fld .flabel{ display:block; margin-bottom:5px; }
.models-fld .input, .models-fld input{ width:100%; }
.models-actions{ display:flex; gap:8px; margin-top:16px; }
@media (max-width:680px){ .models-form-grid{ grid-template-columns:1fr; } }

/* --- Logs page: readable structured rows (was raw JSON dump) --- */
.logview{ font-family:var(--em-font-mono); font-size:12px; }
.logrow{ display:flex; align-items:baseline; gap:10px; padding:3px 8px; border-radius:6px; line-height:1.5; }
.logrow:hover{ background:rgba(255,255,255,.03); }
.logrow .logtime{ color:var(--em-text-dim); flex:0 0 auto; font-variant-numeric:tabular-nums; }
.logrow .loglvl{ flex:0 0 auto; min-width:44px; text-align:center; font-size:10px; font-weight:700; letter-spacing:.04em; padding:1px 6px; border-radius:4px; text-transform:uppercase; }
.logrow .loglvl.lvl-ok{ color:#7bd88f; background:rgba(123,216,143,.1); }
.logrow .loglvl.lvl-warn{ color:#f0b562; background:rgba(240,181,98,.12); }
.logrow .loglvl.lvl-err{ color:#f2777a; background:rgba(242,119,122,.12); }
.logrow .loglvl.lvl-dim{ color:var(--em-text-dim); background:rgba(255,255,255,.05); }
.logrow .logmsg{ flex:1 1 auto; color:var(--em-text); min-width:0; word-break:break-word; }
.logrow .logextra{ flex:0 0 auto; max-width:38%; color:var(--em-text-dim); font-size:11px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
@media (max-width:820px){ .logrow{ flex-wrap:wrap; } .logrow .logextra{ max-width:100%; flex-basis:100%; } }

/* --- Inline control rows: let create-form fields breathe (were glued/clipped) ---
   The shared `.row` flex container wrapped, but its inputs kept the browser's
   default ~170px width, so long placeholders ("URL аватара (необязательно)",
   "chat, admin:read, admin:write") clipped and adjacent fields read as one glued
   strip. Give text/select fields flex-grow + a readable min-width so they fill
   the row and show their full placeholder; keep buttons, labels and small number
   fields at natural size. Fixes Agents / Users / API keys / Webhooks / Knowledge. */
.main .pad .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.main .pad .row > input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="number"]),
.main .pad .row > select {
  flex: 1 1 200px;
  min-width: 190px;
}
.main .pad .row > input[type="number"] { flex: 0 0 auto; width: 92px; }
.main .pad .row > button,
.main .pad .row > label,
.main .pad .row > .btn { flex: 0 0 auto; }
/* a page-header row: the workspace-scope fgroup keeps a sane width and the
   trailing "+ Create" opener (after the .sp spacer) stays right-aligned */
.main .pad .row > .fgroup { flex: 0 1 320px; min-width: 220px; }
.main .pad .row > .fgroup > select { width: 100%; }
.main .pad .row > .sp { flex: 1 1 auto; }
/* Don't let a lone field in a row stretch the full page width — cap the row so a
   single input (e.g. "ID пользователя" + button) stays a sensible reading width. */
.main .pad fieldset .row,
.main .pad .card .row { max-width: 980px; }
/* BUGS_3 #21: a page TOOLBAR row (a `.sp` spacer pushes a trailing button to the
   right edge — Members, Workspaces, …) must span the SAME width as the list it
   sits above, so the button doesn't float at 980px over a full-width list.
   Only rows WITH a spacer opt out of the reading-width cap (a lone-input row
   keeps it). */
.main .pad fieldset .row:has(> .sp),
.main .pad .card .row:has(> .sp) { max-width: none; }

/* ============================================================================
   STAGE-0 W2 (owner bug pass 2026-07-05):
   п.14 form modals · п.17 native-control theming · п.13b sessions composer
   ============================================================================ */

/* --- п.14: formModal / panelModal ---------------------------------------- */
.modal--xl{ max-width:920px; }
.modal--xl .modal__b{ max-height:74vh; }
/* the form body stacks field groups; every control fills the modal width */
.formmodal__b{ display:flex; flex-direction:column; gap:14px; }
.formmodal__b .fgroup{ margin:0; }
.formmodal__b .fgroup .flabel{ display:block; margin-bottom:6px; }
.formmodal__b input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),
.formmodal__b select,
.formmodal__b textarea{ width:100%; }
.formmodal__b .fgrid2{ gap:14px 18px; }
.formmodal__b .errors:empty{ display:none; }
/* nested legacy create containers flow as plain columns inside the modal */
.formmodal__b .shared-create,
.formmodal__b .skill-create-form{ display:flex; flex-direction:column; gap:14px; border:0; padding:0; margin:0; }
@media (max-width:560px){ .formmodal__b .fgrid2{ grid-template-columns:1fr; } }

/* --- п.13b: Sessions composer — the message input fills the box ---------- */
.composer .box{ align-items:center; }
.composer .box input:not([type="checkbox"]):not([type="radio"]){
  flex:1 1 auto; min-width:0; border:0; background:transparent;
  padding:6px 0; box-shadow:none; border-radius:0;
}
.composer .box .btn, .composer .box button{ flex:0 0 auto; }
.session-messages .composer{ padding:14px 0 0; border-top:1px solid var(--em-line); margin-top:14px; }

/* --- п.17: native controls in the design system --------------------------- */
/* checkbox / radio: appearance:none + --em tokens; the check glyph is an
   inline SVG data-URI so no icon font / external asset is needed */
input[type="checkbox"], input[type="radio"]{
  -webkit-appearance:none; -moz-appearance:none; appearance:none;
  /* BUGS_3 #10: reset the legacy global `input{min-width:180px}` (§"Inputs +
     buttons") that stretched every checkbox/radio into a full-width bar. */
  width:17px; height:17px; min-width:0; margin:0; padding:0; flex:0 0 auto;
  border:1px solid var(--em-line-strong); background:var(--em-surface);
  cursor:pointer; vertical-align:middle; display:inline-block;
  transition:background var(--em-dur-fast) var(--em-ease), border-color var(--em-dur-fast) var(--em-ease);
}
input[type="checkbox"]{ border-radius:5px; }
input[type="radio"]{ border-radius:50%; }
input[type="checkbox"]:hover, input[type="radio"]:hover{ border-color:var(--em-text-faint); }
input[type="checkbox"]:checked{
  background-color:var(--em-accent); border-color:var(--em-accent);
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'><path d='m5 13 4 4L19 7'/></svg>");
  background-size:12px; background-position:center; background-repeat:no-repeat;
}
input[type="radio"]:checked{ border:5px solid var(--em-accent); background:#fff; }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible{
  outline:none; border-color:var(--em-accent-edge); box-shadow:0 0 0 3px var(--em-accent-soft);
}
input[type="checkbox"]:disabled, input[type="radio"]:disabled{ opacity:.5; cursor:not-allowed; }
/* a labelled checkbox/radio row (agent-profile "Включено", graphs "Включён", …).
   BUGS_2 №6: width:fit-content + align-self:flex-start — inside a column flex
   parent (form modals, wizard steps) the label used to be cross-axis-stretched
   to the full container width, reading as a giant full-width checkbox row. */
label.check{ display:inline-flex; align-items:center; gap:8px; cursor:pointer;
  font-size:13px; color:var(--em-text-dim); margin:0 0 10px;
  width:fit-content; align-self:flex-start; }
label.check:hover{ color:var(--em-text); }

/* file input: themed pick button (::file-selector-button) + muted file name */
input[type="file"]{ border:0; background:transparent; padding:0;
  font:inherit; font-size:12.5px; color:var(--em-text-muted); box-shadow:none; }
input[type="file"]::file-selector-button{
  border:1px solid var(--em-line-strong); border-radius:var(--em-radius-md);
  background:var(--em-surface); color:var(--em-text); font:inherit; font-size:12.5px;
  padding:7px 12px; margin-right:10px; cursor:pointer;
  transition:border-color var(--em-dur-fast) var(--em-ease), background var(--em-dur-fast) var(--em-ease);
}
input[type="file"]::file-selector-button:hover{ border-color:var(--em-text-faint); background:var(--em-surface-2); }

/* range: themed track + accent thumb */
input[type="range"]{
  -webkit-appearance:none; appearance:none; height:22px; padding:0;
  border:0; background:transparent; cursor:pointer; box-shadow:none;
}
input[type="range"]::-webkit-slider-runnable-track{
  height:4px; border-radius:99px; background:var(--em-surface-3);
  border:1px solid var(--em-line);
}
input[type="range"]::-moz-range-track{
  height:4px; border-radius:99px; background:var(--em-surface-3);
  border:1px solid var(--em-line);
}
input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none; width:16px; height:16px; margin-top:-7px; border-radius:50%;
  background:var(--em-accent); border:2px solid var(--em-surface); box-shadow:var(--em-shadow-sm, 0 1px 3px rgba(0,0,0,.3));
}
input[type="range"]::-moz-range-thumb{
  width:14px; height:14px; border-radius:50%;
  background:var(--em-accent); border:2px solid var(--em-surface);
}
input[type="range"]:focus-visible{ outline:none; }
input[type="range"]:focus-visible::-webkit-slider-thumb{ box-shadow:0 0 0 3px var(--em-accent-soft); }

/* date/time pickers: the native popup + indicator follow the active theme */
input[type="date"], input[type="time"], input[type="datetime-local"],
input[type="month"], input[type="week"]{ color-scheme:dark; }
[data-theme="light"] input[type="date"], [data-theme="light"] input[type="time"],
[data-theme="light"] input[type="datetime-local"], [data-theme="light"] input[type="month"],
[data-theme="light"] input[type="week"]{ color-scheme:light; }

/* --- п.18–21: Sessions two-column chat ------------------------------------ */
/* Left: the session list (design .chatlist/.ci); right: the live chat of the
   selected session (design .conv/.thread/.composer). Nothing selected → the
   right side shows an invitation placeholder. On narrow screens the columns
   collapse like a mobile messenger: list first, `chat-open` swaps to the chat
   with a ← back button. */
.sessions-split{
  display:grid; grid-template-columns:300px minmax(0,1fr);
  border:1px solid var(--em-line); border-radius:var(--em-radius-lg);
  overflow:hidden; background:var(--em-bg);
  height:calc(100vh - 210px); min-height:420px;
}
.sessions-split .chatlist{ min-width:0; }
.sessions-split .session-conv{ display:none; min-width:0; }
.sessions-split.chat-open .session-conv{ display:flex; }
.sessions-split .session-empty{
  display:grid; place-items:center; padding:40px 24px;
  color:var(--em-text-muted); font-size:13.5px;
}
.sessions-split.chat-open .session-empty{ display:none; }
.session-conv .conv__top h2{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; }
.session-conv .composer{ padding:14px 20px 16px; border-top:1px solid var(--em-line); margin-top:0; }
.ci .rowmenu{ flex:0 0 auto; }
.ci .session-menu{ padding:0 8px; line-height:1; opacity:.55; }
.ci:hover .session-menu, .ci.on .session-menu{ opacity:1; }
/* BUGS_2 #72: the inline-flex override dropped the grid centering — the 14px
   chat glyph sat off-center in its 34px box. Center it explicitly. */
.ci .lrow__ic{ flex:0 0 auto; display:inline-flex; align-items:center; justify-content:center; }
.ci .lrow__ic svg{ width:14px; height:14px; stroke:currentColor; fill:none; stroke-width:2; }
/* system/tool messages: neutral, centered, muted (п.19) */
.msg.sys{ align-self:center; max-width:640px; opacity:.8; }
.msg.sys .bubble{
  background:var(--em-surface-2); border:1px dashed var(--em-line);
  border-radius:12px; font-size:12.5px; color:var(--em-text-muted);
}
/* attachments (п.20): chip + inline image preview */
.bubble .attachment{ margin-top:8px; }
.attchip{
  display:inline-flex; align-items:center; gap:6px; max-width:100%;
  border:1px solid var(--em-line-strong); border-radius:var(--em-radius-full);
  background:var(--em-surface-2); color:var(--em-text-dim);
  font-size:12.5px; padding:6px 12px; cursor:pointer;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.attchip:hover{ border-color:var(--em-accent-edge); color:var(--em-text); }
.attimg{ display:block; max-width:280px; max-height:220px; border-radius:10px; margin-top:8px; border:1px solid var(--em-line); }
.msg-attach svg{ display:block; }
@media (max-width:900px){
  .sessions-split{ grid-template-columns:1fr; height:calc(100vh - 180px); }
  .sessions-split .chatlist{ display:flex; }
  .sessions-split.chat-open .chatlist{ display:none; }
  .sessions-split .session-empty{ display:none; }
  .session-conv .conv__back{ display:inline-flex; }
}
@media (min-width:901px){ .session-conv .conv__back{ display:none; } }

/* ============================================================================
   STAGE-0 W4 (owner bug pass 2026-07-05):
   п.25 channels compact · п.26-31 plugins store/installed rework ·
   п.29 inline action results · п.32 OAuth preflight · п.47 pinned official source
   ============================================================================ */

/* --- plugin logo (п.26): real catalog icon with a letter-glyph fallback ---- */
.plugin-logo{ overflow:hidden; }
.plugin-logo img.catalog-icon{ width:100%; height:100%; object-fit:contain; border-radius:8px; background:transparent; display:block; }
.plugin-logo--glyph{
  font-family:var(--em-font-display); font-weight:700; font-size:12px;
  color:var(--em-text-dim); letter-spacing:.02em;
}

/* --- official check (п.27): tiny check next to the name, tooltip explains --- */
.official-check{
  display:inline-flex; vertical-align:-2px; margin-left:6px; color:var(--em-ok);
  cursor:help; flex:0 0 auto;
}
.official-check svg{ width:14px; height:14px; display:block; }

/* --- compact store cards (п.26): denser grid, 2-line blurbs, small button --- */
.catalog-list, ul:has(> .catalog-row){ grid-template-columns:repeat(auto-fill, minmax(250px,1fr)); gap:10px; }
.catalog-row{ padding:12px 14px; gap:8px; }
.catalog-icon{ width:34px; height:34px; }
.plugin-logo.lrow__ic{ width:34px; height:34px; }
.catalog-meta > b.catalog-name{ font-size:14px; display:flex; align-items:center; min-width:0; }
.catalog-desc{
  -webkit-line-clamp:2; line-clamp:2; min-height:0; font-size:12px;
}
/* the Install button is compact (btn--sm), never a full-width slab */
.catalog-row > .lrow__a{ margin-top:auto; padding-top:4px; }
.catalog-row > .lrow__a .btn{ width:auto; justify-content:center; align-self:flex-start; }

/* --- inline action results (п.29): render at the card/row, not page-top ---- */
.action-status:empty{ display:none; }
.action-status{ flex-basis:100%; font-size:12.5px; }
.action-status .error{ margin:0; }
.action-status .ok{ color:var(--em-ok); }
.action-status .busy{ color:var(--em-text-dim); }
.action-status .busy::before{
  content:""; display:inline-block; width:10px; height:10px; margin-right:7px;
  border:2px solid var(--em-line-strong); border-top-color:var(--em-accent-edge);
  border-radius:50%; animation:w4spin .7s linear infinite; vertical-align:-1px;
}
@keyframes w4spin{ to{ transform:rotate(360deg); } }
.oauth-status .btn{ margin-top:6px; }

/* --- provision progress (BUGS_3 #5): determinate bar + % for a module that is
   mid-«развертывание» (installing/deploying/updating). The width is derived from
   the known provision step; the whole row spans full width under the module. --- */
.provision-bar{ flex-basis:100%; display:flex; align-items:center; gap:10px; margin-top:8px; }
.provision-bar__track{ flex:1; height:7px; border-radius:999px; background:var(--em-line); overflow:hidden; }
.provision-bar__fill{
  display:block; height:100%; border-radius:999px;
  background:linear-gradient(90deg, var(--em-accent-edge), var(--em-accent));
  transition:width .5s ease;
}
.provision-bar__pct{ font-size:12px; font-weight:600; color:var(--em-text-muted); min-width:36px; text-align:right; }

/* --- installed plugins (п.28/31): readable rows, config panel collapsed ----- */
/* .module-config used to force display:grid over .mcfg's display:none (the
   config wall was ALWAYS open — the "unreadable dump"); scope the grid to the
   expanded state so "Настроить" actually toggles it. */
.module-row .mcfg.module-config{ display:none; }
.module-row.expanded .mcfg.module-config{ display:grid; }
.module-row{ padding:12px 16px; }
.module-row .lrow__t b{ display:flex; align-items:center; min-width:0; }
.module-configure[aria-expanded="true"]{ border-color:var(--em-accent-edge); }
.mcfg-lifecycle{
  grid-column:1 / -1; display:flex; align-items:center; gap:10px;
  margin-top:12px; padding-top:12px; border-top:1px dashed var(--em-line);
}
.mcfg-lifecycle .module-auto-update{ width:auto; }
.module-auto-update-wrap{ display:inline-flex; align-items:center; gap:7px; margin:0; }
.module-auto-update-wrap .sub{ font-size:11px; color:var(--em-text-muted); }

/* --- catalog sources (п.47): the pinned official row has no URL/actions ---- */
.source-row .action-status{ padding-left:46px; }

/* --- channels page (п.25): compact rows, features + voice folded ----------- */
.channel-glyph{ width:18px; height:18px; object-fit:contain; display:block; }
.channel-features-toggle.on{ border-color:var(--em-accent-edge); color:var(--em-text); }
.voice-detail{ margin-top:14px; border:1px solid var(--em-line); border-radius:var(--em-radius-md); background:var(--em-surface); }
.voice-detail-summary{
  cursor:pointer; padding:12px 16px; font-weight:600; font-size:13.5px;
  color:var(--em-text); list-style:none; display:flex; align-items:center; gap:8px;
}
.voice-detail-summary::-webkit-details-marker{ display:none; }
.voice-detail-summary::before{
  content:""; width:7px; height:7px; border-right:2px solid var(--em-text-dim);
  border-bottom:2px solid var(--em-text-dim); transform:rotate(-45deg);
  transition:transform .15s ease; flex:0 0 auto;
}
.voice-detail[open] .voice-detail-summary::before{ transform:rotate(45deg); }
.voice-detail-body{ padding:0 16px 14px; }
.doclink{ color:var(--em-accent-text); text-decoration:underline; text-underline-offset:2px; }
.doclink:hover{ color:var(--em-text); }

/* --- W8: collapsible filter bar (п.12) --- */
.filterbar{ margin:0 0 14px; }
.filterbar__toggle{ display:inline-flex; align-items:center; gap:6px; }
.filterbar__toggle .filterbar__ic{ display:inline-flex; }
.filterbar__toggle.on{ border-color:var(--em-accent); color:var(--em-text); }
.filterbar__count{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:18px; height:18px; padding:0 5px; margin-left:2px;
  border-radius:9px; background:var(--em-accent); color:var(--em-accent-ink);
  font-size:11px; font-weight:700; line-height:1;
}
.filterpanel{
  margin-top:10px; padding:12px 14px; border:1px solid var(--em-line);
  border-radius:12px; background:var(--em-bg-sub);
  display:flex; flex-wrap:wrap; gap:12px; align-items:flex-end;
}
.filterpanel[hidden]{ display:none; }
/* BUGS_2 WEB UI №21: every filter panel / list toolbar ends with a reset button. */
.filterbar__reset{ margin-left:auto; }
.list-toolbar .list-reset{ flex:0 0 auto; }

/* --- W8: reusable long-list toolbar (search + sort) + pagination (п.24) --- */
.list-toolbar{ display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin:0 0 12px; }
.list-toolbar .list-search{ flex:1 1 240px; max-width:420px; }
.list-toolbar .list-sort{ flex:0 0 auto; max-width:220px; }
/* BUGS_3 #39: the module-search input and the «Фильтры» toggle must sit on the
   SAME line at the SAME height — drop the filterbar's stacking bottom-margin
   inside a toolbar and give both controls one shared control height. */
.list-toolbar > .filterbar{ margin:0; flex:0 0 auto; }
.list-toolbar > .list-search,
.list-toolbar > .filterbar > .filterbar__toggle{ min-height:40px; box-sizing:border-box; }
.list-more{ display:flex; align-items:center; gap:12px; margin-top:12px; }
.list-more .list-info{ font-size:12px; }
.list-showmore{ flex:0 0 auto; }

/* --- W8: graphs (Оркестрация) editor + live preview (п.16) --- */
.graph-editsplit{ display:grid; grid-template-columns:1fr 1fr; gap:14px; margin:6px 0 10px; }
.graph-editsplit .flabel{ display:block; margin-bottom:4px; }
.graph-editcol textarea{ width:100%; box-sizing:border-box; }
.graph-preview{
  border:1px solid var(--em-line); border-radius:10px; background:var(--em-bg-sub);
  padding:8px 10px; min-height:120px; max-height:360px; overflow:auto;
}
.graph-preview .sectlabel{ margin:2px 0 8px; }
.graph-node-row{ padding:6px 4px; }
.graph-node-row b{ color:var(--em-text); }
.graph-node-row .graph-node-edges{ display:block; margin-top:2px; color:var(--em-text-dim); font-family:var(--em-font-mono); font-size:11.5px; }
.graph-preview__err{ color:var(--em-danger, #ff6b5e); font-family:var(--em-font-mono); font-size:12px; white-space:pre-wrap; }
@media (max-width:720px){
  .graph-editsplit{ grid-template-columns:1fr; }
}

/* ── "Powered by AiHummer" vendor badge (Idea 9) ──────────────────────────────
   ONE reusable badge: an inline brand mark (currentColor, so it follows the
   muted text colour and swaps automatically between the dark/light data-theme)
   + the brand-constant "Powered by AiHummer" wordmark, linking to aihummer.ru. */
.powered-by{
  display:inline-flex; align-items:center; gap:7px;
  color:var(--em-text-muted); text-decoration:none;
  font-size:11.5px; line-height:1; letter-spacing:.01em;
  opacity:.85; transition:opacity .15s ease, color .15s ease;
}
.powered-by:hover{ opacity:1; color:var(--em-text-dim); }
.powered-by__logo{ display:inline-flex; width:16px; height:16px; }
.powered-by__logo svg{ width:16px; height:16px; }
.powered-by__txt{ white-space:nowrap; }
.powered-by__txt b{ font-weight:700; color:inherit; }
.powered-by__ai{ color:#E89A4E; }
/* Общее №8: EVERY textual "AiHummer" renders as an accented "Ai" + "Hummer".
   Applied via brandNameEl()/brandify() in views.ts. */
.brand-ai{ color:#E89A4E; }

/* Shell footer: sits under the scrolled page content, one per Web UI page. */
.app-foot{
  display:flex; flex-direction:column; justify-content:center; align-items:center; gap:10px;
  padding:18px 12px 22px; margin-top:8px;
  border-top:1px solid var(--em-line);
}
.app-foot[hidden]{ display:none; }

/* Vendor social/brand links (Idea 8 phase B): inline-SVG icon links. currentColor so
   the theme swap is automatic; used in the footer, the About block and the Community
   page. Hidden until links resolve (nav[hidden]). */
.vendor-social[hidden]{ display:none; }
.vendor-social__heading{ margin:0 0 8px; }
.vendor-social__row{ display:flex; flex-wrap:wrap; gap:12px; align-items:center; }
.vendor-social__link{
  display:inline-flex; align-items:center; justify-content:center;
  width:34px; height:34px; border-radius:9px;
  color:var(--em-text-dim); border:1px solid var(--em-line);
  transition:color .15s, border-color .15s, background .15s;
}
.vendor-social__link:hover{ color:var(--em-text); border-color:var(--em-text-dim); background:var(--em-surface-2, transparent); }
.vendor-social__icon{ display:inline-flex; width:18px; height:18px; }
.vendor-social__icon svg{ width:18px; height:18px; }
/* Meta (FB/IG) superscript asterisk — pairs with the footer legal disclaimer. */
.vendor-social__meta-star{ font-size:10px; line-height:1; margin-left:1px; align-self:flex-start; color:var(--em-text-dim); }
/* RU-law Meta disclaimer: small muted fine-print under the social row. */
.vendor-social__legal{ margin:10px 0 0; font-size:11px; line-height:1.4; color:var(--em-text-dim); }
.system-about .vendor-social{ margin-top:16px; }
.community .vendor-social{ margin-top:18px; padding-top:16px; border-top:1px solid var(--em-line); }

/* Auth/login footer: centered under the sign-in form. */
.auth__foot{ display:flex; justify-content:center; margin-top:22px; }

/* System "About" attribution block (always shown) + white-label footer toggle. */
.system-about{ margin-top:18px; padding-top:16px; border-top:1px solid var(--em-line); }
.about-brand__badge{ margin-bottom:6px; }
.about-brand__note{ margin:0; }
.about-brand__toggle{
  display:flex; align-items:flex-start; gap:10px; margin-top:14px; cursor:pointer;
}
.about-brand__toggle input{ margin-top:3px; }
.about-brand__toggle small{ margin-top:3px; color:var(--em-text-muted); }

/* ── Notifications (Idea 6 phase A) ────────────────────────────────────────── */
/* Header bell + dropdown */
.bell-wrap{ position:relative; display:inline-flex; }
.bell{
  position:relative; display:inline-flex; align-items:center; justify-content:center;
  width:34px; height:34px; border-radius:var(--em-radius-sm);
  background:transparent; border:1px solid transparent; color:var(--em-text-dim); cursor:pointer;
}
.bell:hover{ background:var(--em-surface-2); color:var(--em-text); }
/* BUGS_2 WEB UI №14: the bell glyph is explicitly sized so it can never
   collapse to nothing inside the header button. */
.bell .bell__ic{ display:inline-flex; }
.bell svg{ width:18px; height:18px; stroke:currentColor; fill:none; flex:0 0 auto; display:block; }
.bell__count{
  position:absolute; top:2px; right:2px; min-width:16px; height:16px; padding:0 4px;
  border-radius:9px; background:var(--em-accent); color:var(--em-accent-ink);
  font-size:10.5px; font-weight:700; line-height:16px; text-align:center;
}
.bell__menu{
  position:absolute; top:calc(100% + 8px); right:0; width:340px; max-width:88vw; z-index:60;
  background:var(--em-surface); border:1px solid var(--em-line); border-radius:var(--em-radius-md);
  box-shadow:var(--em-shadow-md); overflow:hidden;
}
.bell__head{ display:flex; align-items:center; justify-content:space-between; padding:10px 12px; border-bottom:1px solid var(--em-line); }
/* BUGS_2 WEB UI №57: the dropdown scrolls vertically ONLY — long titles wrap
   instead of producing a horizontal scrollbar. */
.bell__list{ max-height:360px; overflow-y:auto; overflow-x:hidden; }
.bell__empty{ padding:18px 12px; text-align:center; font-size:13px; }
.bell__item{
  display:flex; gap:9px; width:100%; min-width:0; text-align:left; padding:10px 12px; cursor:pointer;
  background:transparent; border:0; border-bottom:1px solid var(--em-line); color:var(--em-text);
}
.bell__item:hover{ background:var(--em-surface-2); }
.bell__dot{ flex:0 0 auto; width:7px; height:7px; margin-top:5px; border-radius:50%; background:transparent; }
.bell__item.is-unread .bell__dot{ background:var(--em-accent); }
.bell__body{ display:flex; flex-direction:column; gap:2px; min-width:0; }
.bell__title{ font-size:13px; font-weight:600; overflow-wrap:anywhere; }
.bell__meta{ font-size:11.5px; overflow-wrap:anywhere; }
/* BUGS_8 «Биллинг» #5: the per-item «Открыть» deeplink CTA in the bell dropdown. */
.bell__open{
  flex:0 0 auto; align-self:center; margin-left:auto; padding:3px 10px;
  font-size:11.5px; font-weight:600; border-radius:var(--em-radius-sm);
  border:1px solid var(--em-line); background:var(--em-surface); color:var(--em-text);
  cursor:pointer; text-decoration:none; white-space:nowrap;
}
.bell__open:hover{ background:var(--em-surface-2); border-color:var(--em-accent); }
.bell__foot{ padding:8px 12px; border-top:1px solid var(--em-line); text-align:center; }

/* Notifications page: feed */
.notif-toolbar{ align-items:center; }
.notif-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:8px; }
.notif-item{
  border:1px solid var(--em-line); border-radius:var(--em-radius-sm); padding:11px 13px;
  background:var(--em-surface); display:flex; gap:10px;
}
.notif-item.is-unread{ border-left:3px solid var(--em-accent); }
.notif-item.is-link{ cursor:pointer; }
.notif-item.is-link:hover{ background:var(--em-surface-2); }
.notif-item__main{ flex:1; min-width:0; }
.notif-item__top{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.notif-item__body{ margin-top:3px; font-size:12.5px; line-height:1.5; }
.notif-item__time{ margin-top:5px; font-size:11px; }
/* BUGS_8 «Биллинг» #5: the explicit «Открыть» deeplink CTA column on feed rows. */
.notif-item__actions{ display:flex; align-items:center; flex:0 0 auto; }
a.notif-item__open{ text-decoration:none; }
.notif-badges{ display:inline-flex; gap:6px; flex-wrap:wrap; }

/* Notifications page: matrix */
.notif-table-wrap{ overflow-x:auto; }
.notif-table{ border-collapse:collapse; width:100%; min-width:520px; }
.notif-table th, .notif-table td{ padding:8px 12px; border-bottom:1px solid var(--em-line); text-align:left; vertical-align:middle; }
.notif-table th{ font-size:12px; color:var(--em-text-dim); font-weight:600; white-space:nowrap; }
.notif-table th.is-inactive{ color:var(--em-text-muted); }
.notif-cell{ justify-content:center; }
.notif-cell.is-inactive{ opacity:0.45; }
.notif-actions{ white-space:nowrap; text-align:right; }
.notif-actions .btn{ margin-left:4px; }
.btn--xs{ padding:2px 7px; font-size:11px; }
.notif-subtable{ width:100%; border-collapse:collapse; margin:2px 0 4px; }
.notif-subtable td{ padding:5px 12px; border-bottom:1px dashed var(--em-line); font-size:12.5px; }
tr.notif-events > td{ padding:0 0 6px; background:var(--em-surface-2); }

/* ============================================================================
   BUGS_2 WEB UI №7/№8 — provider modal: model dropdown + embedded Codex connect
   ============================================================================ */
/* №8: the model field is a stacked pair — the dropdown (shown once the provider
   enumerated its models) above the free-text input (custom/fallback). */
.llm-model-wrap{ display:flex; flex-direction:column; gap:8px; }

/* BUGS_8 #1: provider TYPE picker — brand logo chip beside the closed <select>
   and per-option logos in the design listbox showcase native provider support. */
.llm-type-row{ display:flex; align-items:center; gap:9px; }
.llm-type-row .input{ flex:1 1 auto; }
.llm-type-logo{ display:inline-flex; align-items:center; justify-content:center; width:26px; height:26px; flex:0 0 auto; }
.llm-type-logo svg, .llm-type-logo:empty{ width:20px; height:20px; }
.llm-type-logo:empty{ display:none; }
.dsel-menu__opt.has-ico{ gap:8px; }
.dsel-menu__ico{ display:inline-flex; align-items:center; justify-content:center; width:20px; height:20px; flex:0 0 auto; }
.dsel-menu__ico svg{ width:18px; height:18px; }

/* BUGS_8 #33(b/c): BYOK override + global LLM parameters are secondary — a plain
   disclosure so they never crowd the primary add-provider flow. */
.models-advanced{ margin-top:22px; border-top:1px solid var(--em-line, rgba(128,128,128,.2)); padding-top:12px; }
.models-advanced > summary{ cursor:pointer; font-weight:600; padding:6px 0; list-style:revert; }

/* BUGS_8 #2: the one-time Codex device code must be unmissable. */
.codex-code-box{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin:6px 0 4px; }
.codex-code{
  display:inline-block; font-family:var(--em-mono, ui-monospace, "SF Mono", Menlo, monospace);
  font-size:1.7rem; font-weight:700; letter-spacing:.16em; line-height:1.1;
  padding:12px 18px; border-radius:10px; user-select:all; -webkit-user-select:all;
  color:var(--em-fg, #0d0d12); background:var(--em-code-bg, rgba(120,120,140,.14));
  border:2px solid var(--em-accent, #ff7a1a);
}
.codex-code-copy.ok{ color:var(--em-ok, #1a9d4b); }
/* №7: the Codex (ChatGPT subscription) connect card embedded in the add/edit
   provider modal — same panel as the Models page, compact spacing inside. */
.llm-codex-panel{ display:flex; flex-direction:column; gap:8px; }
.llm-codex-panel .codex-connect{ margin:0; }
.llm-codex-panel .codex-body{ padding:12px 14px; }

/* ============================================================================
   BUGS_2 design batch (№23, 34, 36, 60, 67, 80, 82, 84, 86-88)
   ============================================================================ */

/* ── №60: toast stack — bottom-right, auto-dismiss, hover-hold, dismissable ── */
.toasts{
  position:fixed; right:18px; bottom:18px; z-index:200;
  display:flex; flex-direction:column; gap:10px; align-items:flex-end;
  max-width:min(420px, calc(100vw - 36px)); pointer-events:none;
}
.toast{
  display:flex; align-items:flex-start; gap:10px; pointer-events:auto;
  background:var(--em-surface); border:1px solid var(--em-line-strong);
  border-radius:var(--em-radius-lg); box-shadow:var(--em-shadow-md);
  padding:11px 12px 11px 14px; min-width:220px; max-width:100%;
  font-size:13px; color:var(--em-text);
  opacity:0; transform:translateY(8px);
  transition:opacity var(--em-dur-normal) var(--em-ease), transform var(--em-dur-normal) var(--em-ease);
}
.toast.on{ opacity:1; transform:none; }
.toast.off{ opacity:0; transform:translateY(8px); }
.toast__ic{ flex:0 0 auto; width:18px; height:18px; margin-top:1px; }
.toast__ic svg{ width:18px; height:18px; display:block; }
.toast--error{ border-left:3px solid var(--em-err); }
.toast--error .toast__ic{ color:var(--em-err); }
.toast--success{ border-left:3px solid var(--em-ok); }
.toast--success .toast__ic{ color:var(--em-ok); }
.toast--warn{ border-left:3px solid var(--em-warn); }
.toast--warn .toast__ic{ color:var(--em-warn); }
.toast--info{ border-left:3px solid var(--em-info); }
.toast--info .toast__ic{ color:var(--em-info); }
.toast__msg{ flex:1 1 auto; line-height:1.45; overflow-wrap:anywhere; }
.toast__x{
  flex:0 0 auto; margin:-2px -4px 0 0; padding:0 6px; height:22px;
  background:transparent; border:0; color:var(--em-text-muted);
  font-size:16px; line-height:1; cursor:pointer; border-radius:6px;
}
.toast__x:hover{ background:var(--em-surface-3); color:var(--em-text); }

/* ── №23: a modal is ONE surface — no box-in-box-in-box. Section wrappers
   (fieldset / .card / .psection) inside a modal body lose their borders and
   backgrounds; sections separate via headers + spacing (.sectlabel keeps its
   hairline underline as the section divider). ── */
.modal__b fieldset{ border:0; background:transparent; padding:0; margin:0 0 22px; }
.modal__b fieldset:last-child{ margin-bottom:0; }
.modal__b fieldset > legend{ padding:0; margin:0 0 10px; font-size:13px; }
.modal__b .card{ border:0; background:transparent; border-radius:0; box-shadow:none; }
.modal__b .card > div[style]{ padding:0 !important; }
.modal__b .card__h{ padding:0 0 8px; }
.modal__b .psection{ border:0; border-top:1px solid var(--em-line); border-radius:0; background:transparent; margin-bottom:0; overflow:visible; }
.modal__b .psection__h{ padding:12px 2px; }
.modal__b .psection__b{ padding:0 2px 14px; }
.modal__b .sectlabel{ margin-top:0; }

/* ── №82: Models page — clean provider rows. Grid: [priority group][identity]
   [actions right-aligned]; badges wrap under the name, actions never cram. ── */
.llm-provider.card{ display:flex; align-items:center; gap:14px; padding:12px 16px; margin-bottom:10px; flex-wrap:wrap; }
.llm-provider.off{ opacity:.6; }
.llm-provider__prio{ display:flex; align-items:center; gap:2px; flex:0 0 auto; }
.llm-provider__prio .llm-prio{
  min-width:26px; height:26px; display:inline-flex; align-items:center; justify-content:center;
  border:1px solid var(--em-line-strong); border-radius:8px; font-size:12px; color:var(--em-text-dim);
  margin-right:6px;
}
.llm-provider__prio .btn{ padding:0 7px; }
.llm-provider__t{ flex:1 1 240px; min-width:200px; display:flex; flex-direction:column; gap:5px; }
.llm-provider__t strong{ font-size:14px; }
.llm-provider__meta{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.llm-provider__meta .mono{ font-size:12px; }
.llm-provider__a{ display:flex; gap:6px; align-items:center; flex-wrap:wrap; margin-left:auto; flex:0 0 auto; }
.llm-test-result{ flex-basis:100%; font-size:12px; }
.llm-test-result:empty{ display:none; }
.llm-test-result.ok{ color:var(--em-ok); }
.llm-test-result.fail{ color:var(--em-err); }

/* ── №36/№67/№80: checkbox grids (webhook events, allowed models, API scopes) ── */
.checkgrid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:8px 14px; margin:8px 0; }
.checkgrid label.checkrow{
  display:flex; align-items:flex-start; gap:9px; margin:0; padding:8px 10px;
  border:1px solid var(--em-line); border-radius:var(--em-radius-md); background:var(--em-surface);
  cursor:pointer; font-size:13px; width:auto; max-width:none;
}
.checkgrid label.checkrow:hover{ border-color:var(--em-line-strong); }
.checkgrid label.checkrow input[type="checkbox"]{ margin-top:1px; flex:0 0 auto; }
.checkgrid .checkrow__t{ display:flex; flex-direction:column; gap:2px; min-width:0; }
.checkgrid .checkrow__t small{ color:var(--em-text-muted); font-size:11.5px; }
.checkgrid .checkrow__t code{ font-family:var(--em-font-mono); font-size:12px; }

/* ── №84: one-time credentials modal — mono value rows with copy buttons ── */
.cred-row{ display:flex; align-items:center; gap:8px; margin:8px 0; }
.cred-row code{
  flex:1 1 auto; min-width:0; overflow-wrap:anywhere; font-family:var(--em-font-mono);
  font-size:12.5px; background:var(--em-surface-2); border:1px solid var(--em-line);
  border-radius:var(--em-radius-md); padding:9px 11px; user-select:all;
}
.cred-once{ color:var(--em-warn); font-size:12.5px; margin:2px 0 10px; }

/* ── №86-88: License page — ONE plan card (name once + human status badge),
   usage meters, ✓/✗ feature grid, upgrade CTA, unobtrusive offline-token link ── */
.plan-card{ max-width:860px; }
.plan-card__b{ padding:16px; display:flex; flex-direction:column; gap:14px; }
.plan-card .usage-row{ max-width:520px; }
.feature-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(230px, 1fr)); gap:8px 14px; padding:0; margin:4px 0 0; }
.feature-grid li{ display:flex; align-items:center; gap:9px; padding:8px 10px; border:1px solid var(--em-line); border-radius:var(--em-radius-md); background:var(--em-surface); font-size:13px; margin:0; }
.feature-grid li .feat-ic{ width:16px; height:16px; flex:0 0 auto; display:inline-flex; }
.feature-grid li .feat-ic svg{ width:16px; height:16px; }
.feature-grid li.feat-on .feat-ic{ color:var(--em-ok); }
.feature-grid li.feat-off{ opacity:.62; }
.feature-grid li.feat-off .feat-ic{ color:var(--em-text-muted); }
.license-offline-link{
  background:transparent; border:0; padding:0; margin:0; color:var(--em-text-muted);
  font-size:12.5px; text-decoration:underline; text-underline-offset:3px; cursor:pointer;
}
.license-offline-link:hover{ color:var(--em-text); background:transparent; }
.license-offline{ margin-top:10px; max-width:720px; }
.license-offline[hidden]{ display:none; }

/* ── BUGS_2 plugins+connections batch (№27-47, №77) ──────────────────────── */
/* №28: catalog card header — logo + (name/version) side by side, never stacked */
.catalog-head{ display:flex; align-items:center; gap:12px; min-width:0; }
.catalog-head .plugin-logo{ flex:0 0 auto; }
.catalog-title{ display:flex; flex-direction:column; gap:2px; min-width:0; }
.catalog-title > b{ display:flex; align-items:center; flex-wrap:wrap; gap:6px; font-size:15px; line-height:1.25; min-width:0; }
.catalog-title > small{ color:var(--em-text-dim); font-family:var(--em-font-mono); font-size:11px; }
/* №27: plugin type chip in the card/row header */
.kind-badge{ font-size:10px; text-transform:uppercase; letter-spacing:.04em; flex:0 0 auto; }
/* №77: built-in («Встроенный») module badge */
.builtin-badge{ flex:0 0 auto; }
/* BUGS_8 #6: third-party community plugin badge («Сообщество») */
.community-badge{ font-size:10px; text-transform:uppercase; letter-spacing:.04em; flex:0 0 auto; }
/* №40: pulsing placeholder cards while the catalog loads (.catalog-skel keeps
   the card layout without matching the live `.catalog-row` selector) */
.catalog-skel{ display:flex; flex-direction:column; gap:10px; padding:16px; border-radius:12px; background:var(--panel); }
ul:has(> .catalog-skel){ display:grid; grid-template-columns:repeat(auto-fill, minmax(250px,1fr)); gap:10px; }
.module-skel{ pointer-events:none; }
.module-skel .plugin-logo.em-skeleton{ border-radius:8px; }
/* №41: the official source row carries the AiHummer brand mark */
.source-brand-logo svg{ width:100%; height:100%; border-radius:8px; display:block; }
/* №31: mobile / desktop download spoilers */
.dl-group{ border:1px solid var(--em-line); border-radius:var(--em-radius-md); background:var(--em-surface); margin:6px 0 0; }
.dl-group > summary.dl-group__s{ cursor:pointer; padding:9px 12px; font-size:13px; color:var(--em-text); list-style:revert; }
.dl-group[open] > summary.dl-group__s{ border-bottom:1px solid var(--em-line); }
.dl-group > .dl-set{ padding:10px 12px; }
/* №45: auto-derived config-field hint under its input */
.fhint{ display:block; margin-top:4px; color:var(--em-text-muted); font-size:11.5px; line-height:1.4; }
/* №32: the config modal grid — two columns on wide viewports, labels above.
   BUGS_3 #6: neutralise the LEGACY `.module-config{display:grid;2col}` +
   panel-box + `.cfg-input{width:100%}` rules inside the modal — they were
   laying the fields-grid / Test button / checks / lifecycle into 2 mismatched
   grid cells (Test floated over "Имя бота", the bool became a full-width bar).
   Inside `.formmodal__b` the body is a plain vertical stack; only `.fgrid2`
   grids the fields. Modals are ONE surface (№23): no inner border/background. */
.formmodal__b .module-config{ display:block; grid-template-columns:none; padding:0; margin:0; background:none; border:0; border-radius:0; }
.formmodal__b .module-config > *{ grid-column:auto; }
.formmodal__b .module-config .fgrid2{ display:grid; grid-template-columns:repeat(2, minmax(200px,1fr)); gap:12px 16px; }
@media (max-width:680px){ .formmodal__b .module-config .fgrid2{ grid-template-columns:1fr; } }
.formmodal__b .module-config .mcfg-actions{ margin-top:12px; }
.formmodal__b .module-config .cfg-bool{ align-self:center; }
/* BUGS_3 #7/#10: the boolean row is a COMPACT inline checkbox — undo the legacy
   `.module-config label{flex-direction:column;align-items:stretch}` that stretched
   the checkbox into a full-width bar. */
.formmodal__b .module-config .cfg-bool label.check{ display:inline-flex; flex-direction:row; align-items:center; gap:8px; width:fit-content; margin:0; }
.formmodal__b .module-config .cfg-bool label.check input[type="checkbox"]{ width:17px; height:17px; flex:0 0 auto; }
.formmodal__b .module-config .mcfg-lifecycle{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:14px; padding-top:12px; border-top:1px solid var(--em-line); }
/* №42/№39: page toolbars — search grows, the filter bar sits beside it */
.list-toolbar > .list-search{ flex:1 1 240px; min-width:200px; }

/* ── BUGS_2 WEB UI batch (sessions/skills/prompts/flow editor) ─────────────── */

/* №74: staged (pending) attachment chips above the composer.
   BUGS_3 #33: breathing room below the chips so they don't butt against the box. */
.pending-atts{ display:flex; flex-wrap:wrap; gap:6px; padding:6px 10px; margin:0 0 8px; }
.attchip--pending{ display:inline-flex; align-items:center; gap:6px; }
.attchip__rm{ border:0; background:none; color:var(--em-text-dim); cursor:pointer; font-size:14px; line-height:1; padding:0 2px; }
.attchip__rm:hover{ color:var(--em-danger, #d33); }

/* №75/№98: the session view toggles bar. */
.session-viewbar{ display:flex; gap:18px; padding:6px 20px; border-bottom:1px solid var(--em-line); font-size:12px; color:var(--em-text-dim); flex:0 0 auto; }
.session-viewbar .check{ display:inline-flex; align-items:center; gap:6px; }

/* №97: subagent runs of a session. */
.subagent-runs{ margin:10px 0; padding:10px 12px; }
.subagent-turn{ font-size:11px; color:var(--em-text-dim); margin:8px 0 4px; }
.subagent-run{ padding:6px 8px; border-left:2px solid var(--em-line); margin-left:8px; }
.subagent-run__head{ display:flex; align-items:center; gap:8px; }
.subagent-run__arrow{ color:var(--em-text-dim); }
.subagent-run__result{ font-size:12px; color:var(--em-text-dim); margin:4px 0 0 22px; white-space:pre-wrap; overflow-wrap:anywhere; }
.subagent-run__result.err{ color:var(--em-danger, #d33); }

/* BUGS_3 #35: subagent runs rendered INLINE next to their turn, collapsed by
   default (a themed <details>), expandable on click. */
/* flex-shrink:0 (BUGS_4 #14): .thread is a column flex container — without it
   an overflowing thread CRUSHES the details block to its 2px borders and the
   subagent/tool panel renders as a bare line. Bubbles (.msg) never shrink for
   the same reason. */
.subagent-inline{ flex-shrink:0; align-self:flex-start; max-width:780px; margin:-6px 0 0 42px; border:1px solid var(--em-line); border-radius:10px; background:var(--em-surface-2, var(--em-surface)); overflow:hidden; }
.subagent-inline > summary{ list-style:none; cursor:pointer; display:flex; align-items:center; gap:8px; padding:7px 11px; font-size:12px; color:var(--em-text-dim); user-select:none; }
.subagent-inline > summary::-webkit-details-marker{ display:none; }
.subagent-inline > summary:hover{ color:var(--em-text); }
.subagent-inline[open] > summary{ border-bottom:1px solid var(--em-line); }
.subagent-inline .subagent-run{ padding:6px 11px; border-left:0; margin:0; }
.subagent-inline .subagent-run__result{ margin-left:0; }

/* BUGS_3 #26: tool invocations rendered inline next to their turn, collapsed,
   revealed by the «show tool usage» toggle. Shares the inline-details idiom. */
.toolcalls-inline{ flex-shrink:0; align-self:flex-start; max-width:780px; margin:-6px 0 0 42px; border:1px solid var(--em-line); border-radius:10px; background:var(--em-surface-2, var(--em-surface)); overflow:hidden; }
.toolcalls-inline > summary{ list-style:none; cursor:pointer; display:flex; align-items:center; gap:8px; padding:7px 11px; font-size:12px; color:var(--em-text-dim); user-select:none; font-family:var(--em-font-mono); }
.toolcalls-inline > summary::-webkit-details-marker{ display:none; }
.toolcalls-inline > summary:hover{ color:var(--em-text); }
.toolcalls-inline[open] > summary{ border-bottom:1px solid var(--em-line); }
.toolcalls-inline .subagent-run{ padding:6px 11px; border-left:0; margin:0; }
.toolcalls-inline .subagent-run__result{ margin-left:0; font-family:var(--em-font-mono); }

/* BUGS_3 #24: the «печатает…» typing bubble shown before the first token. */
.typing{ display:inline-flex; align-items:center; gap:8px; padding:2px 0 4px; color:var(--em-text-muted); font-size:12px; }
.typing__dots{ display:inline-flex; gap:3px; }
.typing__dots i{ width:5px; height:5px; border-radius:50%; background:var(--em-text-muted); display:inline-block; animation:em-typing 1.1s infinite ease-in-out; }
.typing__dots i:nth-child(2){ animation-delay:.18s; }
.typing__dots i:nth-child(3){ animation-delay:.36s; }
@keyframes em-typing{ 0%,60%,100%{ transform:translateY(0); opacity:.4; } 30%{ transform:translateY(-4px); opacity:1; } }

/* BUGS_3 #27: the agent avatar can be a real image (avatar_url), not just initials. */
.msg .av.av--img{ object-fit:cover; }

/* BUGS_4 #16: per-message ↑input/↓output token counters on the meta line. */
.msg-tokens{ font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-dim); white-space:nowrap; }

/* BUGS_3 #37: the per-message «копировать» control (appears on bubble hover). */
.msg-tools{ display:flex; justify-content:flex-end; gap:6px; margin-top:4px; opacity:0; transition:opacity var(--em-dur-fast, .15s) var(--em-ease, ease); }
.msg:hover .msg-tools, .msg:focus-within .msg-tools{ opacity:1; }
.msg.me .msg-tools{ justify-content:flex-start; }
.msg-copy{ border:1px solid var(--em-line); background:var(--em-surface); color:var(--em-text-dim); border-radius:7px; width:24px; height:22px; font-size:12px; line-height:1; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; }
.msg-copy:hover{ color:var(--em-text); border-color:var(--em-line-strong); }
.msg-copy.ok{ color:var(--em-ok, #2fa36b); border-color:var(--em-ok, #2fa36b); }

/* BUGS_3 #28: the AiHummer-styled tooltip (replaces native `title=` bubbles). */
.tt{ position:fixed; z-index:calc(var(--em-z-dropdown, 900) + 60); max-width:280px; padding:6px 9px; border-radius:8px; background:var(--em-surface-inv, #22242b); color:var(--em-text-inv, #f4f5f7); border:1px solid var(--em-line-strong, rgba(0,0,0,.2)); box-shadow:var(--em-shadow-md, 0 6px 20px rgba(0,0,0,.18)); font-size:12px; line-height:1.4; pointer-events:none; opacity:0; transform:translateY(2px); transition:opacity var(--em-dur-fast, .12s) var(--em-ease, ease), transform var(--em-dur-fast, .12s) var(--em-ease, ease); }
.tt.on{ opacity:1; transform:translateY(0); }

/* №66: the prompts explainer card + modal field hints. */
.prompts-help{ padding:12px 14px; margin:0 0 12px; }
.prompts-help__list{ margin:8px 0; padding-left:18px; }
.prompts-help__list li{ margin:3px 0; }
.fhint{ display:block; color:var(--em-text-dim); font-size:11px; margin:-2px 0 6px; }

/* №48: the visual flow editor. */
.flowedit{ border:1px solid var(--em-line); border-radius:10px; overflow:hidden; background:var(--em-surface); }
.flowedit__bar{ display:flex; align-items:center; gap:10px; padding:8px 10px; border-bottom:1px solid var(--em-line); }
.flowedit__meta{ display:inline-flex; align-items:center; gap:6px; font-size:12px; color:var(--em-text-dim); }
.flowedit__maxsteps{ width:72px; }
.flowedit__err{ color:var(--em-danger, #d33); padding:6px 10px; font-size:12px; }
.flowedit__split{ display:grid; grid-template-columns:minmax(0,1fr) 300px; min-height:340px; }
@media (max-width: 900px){ .flowedit__split{ grid-template-columns:1fr; } }
.flowedit__canvas{ position:relative; overflow:auto; min-height:340px; background:
  radial-gradient(circle at 1px 1px, var(--em-line) 1px, transparent 0) 0 0/22px 22px; }
.flowedit__edges{ position:absolute; top:0; left:0; pointer-events:none; color:var(--em-text-dim); }
.flowedit__edge{ fill:none; stroke:currentColor; stroke-width:1.6; opacity:.75; }
.flowedit__edgelabel{ fill:currentColor; font-size:10px; }
.flowedit__endlabel{ fill:currentColor; font-size:11px; }
.flowedit__node{ position:absolute; width:180px; box-sizing:border-box; border:1px solid var(--em-line); border-radius:10px;
  background:var(--em-surface-2); padding:8px 10px; cursor:grab; user-select:none; box-shadow:0 1px 3px rgba(0,0,0,.08); }
.flowedit__node.on{ border-color:var(--em-accent, #7aa2ff); box-shadow:0 0 0 2px color-mix(in srgb, var(--em-accent, #7aa2ff) 30%, transparent); }
.flowedit__node.start{ border-left:3px solid var(--em-accent, #7aa2ff); }
.flowedit__nodehead{ display:flex; align-items:center; gap:6px; font-size:13px; }
.flowedit__startdot{ color:var(--em-accent, #7aa2ff); font-size:10px; }
.flowedit__nodeagent{ font-size:11px; color:var(--em-text-dim); margin-top:2px; }
.flowedit__nodeedges{ font-size:10px; color:var(--em-text-dim); margin-top:4px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.flowedit__empty{ position:absolute; inset:0; display:grid; place-items:center; }
.flowedit__panel{ border-left:1px solid var(--em-line); padding:10px 12px; overflow:auto; max-height:520px; }
.flowedit__panel .fgroup{ margin:0 0 8px; }
.flowedit__panelfoot{ margin-top:12px; }
.flowedit__edgesbox{ display:flex; flex-direction:column; gap:6px; margin-bottom:8px; }
.flowedit__edgerow{ display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) auto; gap:4px; align-items:center; }
.flow-edge-add{ margin-bottom:6px; }
.graph-advanced{ margin-top:10px; }
.graph-json-toggle.on{ background:var(--em-surface-2); }

/* №99: the out-of-box badge on skill cards. */
.skill-builtin{ margin-left:6px; vertical-align:middle; }

/* ═══════════════════════════════════════════════════════════════════════════
   BUGS_2 final batch: mascot (Общее №9) · animation pass (Общее №5) ·
   External access cards (№50) · Logs toolbar (№54/№69) · channel features
   groups (№70) · Analytics spacing (№68) · Support page (tickets) · session
   list filters (№69).
   ═══════════════════════════════════════════════════════════════════════════ */

/* ---- Hum the Fennec mascot (Общее №9) ---- */
.hum-mascot{ display:block; user-select:none; pointer-events:none; -webkit-user-drag:none; }
.empty--mascot{ gap:4px; }
.empty--mascot .hum-mascot{ margin:0 auto 10px; opacity:.92; }
li.empty--mascot{ list-style:none; }
.upgrade-state .hum-mascot{ margin:0 auto 12px; }
.pitch .hum-mascot{ margin-top:26px; opacity:.95; }
.wiz .hum-mascot{ margin:0 0 14px; }
.license-upgrade-row .hum-mascot{ flex:0 0 auto; }
.toast__hum{ flex:0 0 auto; width:32px; height:32px; margin:-2px 0; }

/* ---- page docs link (№62) ---- */
/* BUGS_3 #19: the Workspaces row avatar needs breathing room from the left edge. */
.workspaces-list > .workspace-row{ padding-left:6px; }
.workspaces-list .avatar-glyph{ margin-left:4px; }
.top__titlerow{ display:flex; align-items:center; gap:9px; min-width:0; }
.top__titlerow .page-title{ min-width:0; }
.top .page-docs{ flex:0 0 auto; }
.top .page-docs:hover{ color:var(--em-text); border-color:var(--em-line-strong); }

/* ---- External access as topic cards (№50) ---- */
.ext-grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(340px, 1fr)); gap:16px; align-items:start; }
.ext-section__b{ padding:14px 16px 6px; }
.ext-section .setting-row{ margin:0 0 12px; }

/* ---- Logs toolbar + live badge (№54/№69) ---- */
.logs-toolbar{ margin-bottom:10px; gap:10px; align-items:center; }
.logs-toolbar .logs-search{ max-width:260px; }
.logs-live i{ animation:em-pulse 1.6s var(--em-ease) infinite; }

/* ---- Analytics rhythm (№68): clear air between the stat band and cards ---- */
.analytics#analytics-box, #analytics-box{ display:flex; flex-direction:column; gap:16px; }
#analytics-box .grid2, #analytics-box .grid3{ gap:16px; }

/* ---- Channel features: grouped compact toggles (№70) ---- */
.chfeat-grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(240px, 1fr)); gap:6px 22px; padding:8px 14px 14px; }
.chfeat-group{ min-width:0; }
.chfeat-group .sectlabel{ margin:8px 0 4px; }
.chfeat-row{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding:6px 2px; border-bottom:1px dashed var(--em-line); }
.chfeat-row:last-child{ border-bottom:0; }
.chfeat-row__t{ font-size:13px; color:var(--em-text); min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chfeat-row.is-unsupported{ opacity:.45; }
.channel-errline{ color:var(--em-err); }

/* ---- Sessions list filters (№69) ---- */
.chatlist__filters{ display:flex; gap:8px; padding:0 10px 10px; }
.chatlist__filters .session-search{ flex:1; min-width:0; }
.chatlist__filters .session-kind-filter{ width:auto; max-width:45%; }

/* ---- Support («Поддержка») ---- */
.support-tickets{ margin:0; padding:0; }
.support-row{ cursor:pointer; transition:border-color var(--em-dur-fast) var(--em-ease), background var(--em-dur-fast) var(--em-ease); }
.support-row.is-unread{ border-color:var(--em-accent, #E89A4E); }
.support-unread-dot{ display:inline-block; width:8px; height:8px; border-radius:50%; background:var(--em-accent, #E89A4E); margin-right:7px; vertical-align:baseline; }
.support-thread{ max-height:min(48vh, 460px); overflow:auto; display:flex; flex-direction:column; gap:10px; padding:4px 2px; }
.support-msg{ max-width:82%; align-self:flex-start; background:var(--em-surface-2); border:1px solid var(--em-line); border-radius:12px 12px 12px 4px; padding:9px 12px; animation:em-fade-up var(--em-dur-normal) var(--em-ease) both; }
.support-msg.me{ align-self:flex-end; background:var(--em-accent-soft, var(--em-surface-3)); border-radius:12px 12px 4px 12px; }
.support-msg .who{ font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-muted); margin-bottom:4px; }
.support-msg__body{ font-size:13px; line-height:1.5; white-space:pre-wrap; word-break:break-word; }
.support-atts{ margin-top:4px; display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.support-composer{ margin-top:12px; }
/* Unread count pill flavour on the Support nav item. */
.tab .ct--unread{ background:var(--em-accent, #E89A4E); color:#fff; }

/* ═══ Общее №5 — one framework pass: consistent micro-motion ═══ */
/* Buttons: press feedback everywhere (hover transitions already exist). */
.btn:active:not(:disabled), .iconbtn:active:not(:disabled){ transform:translateY(1px) scale(.985); }
.btn:focus-visible, .iconbtn:focus-visible, .tab:focus-visible{ outline:2px solid var(--em-accent, #E89A4E); outline-offset:2px; }
/* Checkboxes/radios: color + press transitions. */
input[type="checkbox"], input[type="radio"]{ transition:accent-color var(--em-dur-fast) var(--em-ease), transform var(--em-dur-fast) var(--em-ease); }
input[type="checkbox"]:active:not(:disabled), input[type="radio"]:active:not(:disabled){ transform:scale(.88); }
/* Page/tab switch: a short fade-slide on the activated page (JS bounces the class). */
.page-anim{ animation:em-fade-up var(--em-dur-fast) var(--em-ease) both; }
/* Table rows + list rows: gentle background hover (rows already transition). */
.lrow{ transition:border-color var(--em-dur-fast) var(--em-ease), background var(--em-dur-fast) var(--em-ease); }
/* Details/summary marker rotation. */
details > summary{ transition:color var(--em-dur-fast) var(--em-ease); }
/* Filter panel expands with a fade-down. */
.filterpanel:not([hidden]){ animation:em-fade-down var(--em-dur-fast) var(--em-ease) both; }
/* Nav chevron rotation already transitions via transform — ensure duration. */
.navgrp__chev{ transition:transform var(--em-dur-fast) var(--em-ease); }

@media (prefers-reduced-motion: reduce) {
  .navgrp-items{ transition:none; }
  .page-anim, .filterpanel:not([hidden]), .support-msg{ animation:none; }
  .btn:active:not(:disabled), .iconbtn:active:not(:disabled),
  input[type="checkbox"]:active:not(:disabled), input[type="radio"]:active:not(:disabled){ transform:none; }
  .logs-live i{ animation:none; }
}

/* ═══ BUGS_4 #2/#3 — design-system dropdown (custom <select> listbox) ═══
   The native popup can't be themed (the OS paints it), so src/dropdown.ts
   suppresses it and opens this floating listbox instead. The trigger stays the
   themed <select>; while open it shows the focus ring + rotated chevron. */
select.dsel-open{
  border-color:var(--em-accent-edge);
  box-shadow:0 0 0 3px var(--em-accent-soft);
}
.dsel-menu{
  position:fixed; z-index:calc(var(--em-z-modal, 70) + 5);
  min-width:160px; max-width:min(92vw, 480px); max-height:320px; overflow:auto;
  background:var(--em-surface); border:1px solid var(--em-line-strong);
  border-radius:var(--em-radius-lg, 12px); box-shadow:var(--em-shadow-md);
  padding:5px; outline:0;
  animation:em-fade-down var(--em-dur-fast) var(--em-ease) both;
}
.dsel-menu__opt{
  display:flex; align-items:center; gap:8px;
  padding:8px 10px; border-radius:8px; cursor:pointer;
  font-size:13px; color:var(--em-text); line-height:1.35;
  transition:background var(--em-dur-fast) var(--em-ease), color var(--em-dur-fast) var(--em-ease);
}
.dsel-menu__opt.is-active{ background:var(--em-accent-soft); }
.dsel-menu__opt.is-selected{ color:var(--em-accent); font-weight:600; }
.dsel-menu__opt.is-disabled{ opacity:.45; cursor:default; }
.dsel-menu__tick{ display:inline-flex; width:13px; flex:0 0 auto; visibility:hidden; }
.dsel-menu__opt.is-selected .dsel-menu__tick{ visibility:visible; }
.dsel-menu__label{ flex:1 1 auto; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dsel-menu__grp{
  padding:7px 10px 3px; font-size:10.5px; font-weight:700; letter-spacing:.06em;
  text-transform:uppercase; color:var(--em-text-muted);
}
@media (prefers-reduced-motion: reduce){ .dsel-menu{ animation:none; } }

/* ═══ BUGS_4 #6 — «Задано, нажмите для изменения» is a STATE, not a hint:
   accent-tinted so a stored secret reads differently from an empty field. */
input[data-secret-set="true"]::placeholder{ color:var(--em-accent); opacity:.85; font-style:italic; }

/* ═══ BUGS_8 #32 — analytics progress-bar labels never overlap the bar: the
   label track ellipsizes, and the tools card gets a wider label column for
   long snake_case tool names. */
.pbar .pk{ min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pbar.pbar--tool{ grid-template-columns:minmax(90px,180px) 1fr 56px; }

/* ═══ BUGS_4 #9 — sidebar footer: the account/logout buttons live on their OWN
   row under the identity chip (never squeezed beside the name).
   BUGS_8 #4: the action buttons are CENTERED on their row (they used to hang
   off the left edge under the full-width chip — «кнопки не по центру»). */
.side__foot-row{ flex-wrap:wrap; }
.side__foot-row .workspace{ flex:1 1 100%; }
.side__foot-actions{ display:flex; gap:6px; width:100%; justify-content:center; }
.side__foot-actions .iconbtn{ flex:0 0 auto; }

/* ═══ BUGS_8 #5 — workspace name in the sidebar footer: the meta line is an
   inline <small>, so its nowrap text was CLIPPED mid-word with no ellipsis
   («Рабочее пространство: …» rendered as a bare cut). Block it + ellipsize;
   the text column takes the leftover chip width. */
.side__foot .workspace .w{ flex:1 1 auto; min-width:0; }
.side__foot .workspace .w small{ display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* ═══ BUGS_4 #25 — an OPEN filter panel must not reflow the page: it floats
   over the content as a popover anchored to the «Фильтры» toggle. */
.filterbar{ position:relative; display:inline-block; }
.filterpanel{
  position:absolute; top:calc(100% + 8px); left:0; z-index:var(--em-z-dropdown, 40);
  margin-top:0; min-width:min(480px, calc(100vw - 48px)); width:max-content;
  max-width:min(92vw, 640px);
  background:var(--em-surface); border-color:var(--em-line-strong);
  box-shadow:var(--em-shadow-md);
}

/* ═══ BUGS_8 #29/#30 — «Привязка» accordion (Design-System Gateway mockup):
   per-channel .chnode accordion of scoped rules (.brow), agent chips (.ag),
   the mute chip (.mute), the ghost row and the chip picker (.chiprow/.chip). */
.chnode{ border:1px solid var(--em-line); border-radius:var(--em-radius-lg); background:var(--em-surface); margin-bottom:10px; overflow:hidden; }
.chnode__h{ display:flex; align-items:center; gap:11px; padding:11px 14px; cursor:pointer; transition:background var(--em-dur-fast) var(--em-ease); }
.chnode__h:hover{ background:var(--em-surface-2); }
.chnode__h .w{ min-width:0; flex:1; }
.chnode__h .w b{ font-family:var(--em-font-display); font-size:14px; font-weight:700; letter-spacing:-.01em; display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chnode__h .cnt{ margin-left:auto; font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-muted); white-space:nowrap; flex:0 0 auto; }
.chnode__h .chev{ width:15px; height:15px; color:var(--em-text-muted); flex:0 0 auto; transition:transform var(--em-dur-normal) var(--em-ease); display:inline-flex; }
.chnode__h .chev svg{ width:15px; height:15px; }
.chnode.open .chnode__h .chev{ transform:rotate(180deg); }
.chnode__b{ display:none; }
.chnode.open .chnode__b{ display:block; }
.brow{ display:flex; align-items:center; gap:10px; padding:10px 14px; border-top:1px solid var(--em-line); }
.brow:hover{ background:var(--em-surface-2); }
.brow .t{ flex:1; min-width:0; }
.brow .t b{ font-size:13px; font-weight:600; display:block; letter-spacing:-.01em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.brow .t small{ font-family:var(--em-font-mono); font-size:10px; color:var(--em-text-muted); display:block; margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.brow .ub{ opacity:0; width:26px; height:26px; transition:opacity var(--em-dur-fast) var(--em-ease); }
.brow .ub svg{ width:13px; height:13px; }
.brow:hover .ub{ opacity:1; }
@media (hover:none){ .brow .ub{ opacity:1; } }
.ag{ display:inline-flex; align-items:center; gap:7px; border:1px solid var(--em-line); border-radius:var(--em-radius-full); background:var(--em-surface-2); padding:4px 10px 4px 5px; font-weight:600; font-size:12px; color:var(--em-text); white-space:nowrap; flex:0 0 auto; }
.ag i{ width:18px; height:18px; border-radius:6px; display:grid; place-items:center; font-family:var(--em-font-display); font-style:normal; font-weight:700; font-size:9px; color:#fff; background:linear-gradient(150deg,var(--em-accent-bright),var(--em-accent)); flex:0 0 auto; }
.mute{ display:inline-flex; align-items:center; gap:7px; border:1px dashed var(--em-line-strong); border-radius:var(--em-radius-full); background:transparent; padding:4px 10px; font-weight:600; font-size:12px; color:var(--em-text-muted); white-space:nowrap; flex:0 0 auto; }
.mute svg{ width:13px; height:13px; stroke:currentColor; fill:none; stroke-width:2; flex:0 0 auto; }
.ghostrow{ display:flex; align-items:center; gap:10px; padding:11px 14px; border-top:1px dashed var(--em-line-strong); font-size:12.5px; color:var(--em-text-muted); }
.chiprow{ display:flex; gap:7px; flex-wrap:wrap; }
.chip{ display:inline-flex; align-items:center; gap:8px; height:32px; padding:0 12px; border:1px solid var(--em-line-strong); border-radius:var(--em-radius-full); background:var(--em-surface); color:var(--em-text-dim); font-family:inherit; font-size:12.5px; font-weight:600; cursor:pointer; white-space:nowrap; transition:border-color var(--em-dur-fast) var(--em-ease), background var(--em-dur-fast) var(--em-ease), color var(--em-dur-fast) var(--em-ease); }
.chip svg{ width:14px; height:14px; stroke:currentColor; fill:none; stroke-width:2; flex:0 0 auto; }
.chip:hover{ border-color:var(--em-text-faint); color:var(--em-text); }
.chip.on{ background:var(--em-accent-soft); border-color:var(--em-accent-edge); color:var(--em-accent-text); }
.fhint{ font-size:11.5px; color:var(--em-text-muted); margin-top:6px; min-height:14px; }
#binding-default{ margin-top:14px; }
#credential-bindings .brow{ border:1px solid var(--em-line); border-radius:var(--em-radius-md); margin-bottom:8px; background:var(--em-surface); }
