/* ============================================================================
 * components.css — buttons, cards, chips, search+filter, forms, modal/sheet,
 * chat, badges, avatars, charts, states. All token-driven; reused everywhere.
 * ========================================================================== */

/* ---- buttons ------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--pill); padding: 10px 18px;
  font-size: 14px; font-weight: var(--fw-semibold); cursor: pointer; white-space: nowrap;
  transition: transform var(--t-fast), background var(--t-fast), border-color var(--t-fast), opacity var(--t-fast);
  background: var(--cta); color: var(--on-cta); }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--glow); }
.btn.accent { background: var(--accent); color: var(--on-accent); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.subtle { background: var(--primary-weak); color: var(--primary); }
.btn.danger { background: var(--danger-weak); color: var(--danger); }
.btn.sm { padding: 7px 13px; font-size: 13px; }
.btn.lg { padding: 13px 24px; font-size: 15px; }
.btn .ico { width: 18px; height: 18px; }
.iconbtn { width: 40px; height: 40px; border-radius: var(--pill); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); display: grid; place-items: center; cursor: pointer;
  transition: var(--t-fast); }
.iconbtn:hover { background: var(--surface-2); }
.iconbtn.accent { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.iconbtn.plain { background: transparent; border-color: transparent; color: var(--muted); }
.iconbtn.plain:hover { color: var(--text); background: var(--surface-2); }

/* ---- cards --------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 18px; box-shadow: var(--sh-sm); transition: box-shadow var(--t), transform var(--t-fast), border-color var(--t-fast); }
.card.pad-lg { padding: 24px; }
.card.clickable { cursor: pointer; }
.card.clickable:hover { box-shadow: var(--sh); transform: translateY(-2px); border-color: var(--border-2); }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head .t { font-weight: var(--fw-semibold); font-size: 1rem; }
.card-title { font-size: 1.15rem; font-weight: var(--fw-bold); font-family: var(--font-display); }
.card-sub { color: var(--muted); font-size: 13px; }
/* hero / accent-filled cards (BrightPath-style) */
.card.hero { color: #fff; border: 0; }
.card.hero.blue { background: var(--c1); } .card.hero.accent { background: var(--accent); color: var(--on-accent); }
.card.hero.ink { background: var(--text); } .card.hero.cta { background: var(--cta); color: var(--on-cta); }
.card.hero .card-sub { color: rgba(255,255,255,.8); }

/* stat tile */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; }
.stat .v { font-size: 2rem; font-weight: var(--fw-bold); font-family: var(--font-display); letter-spacing: -.02em; }
.stat .k { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stat .v.sm { font-size: 1.4rem; }

/* ---- chips, badges, segmented ------------------------------------------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--pill);
  background: var(--surface-2); color: var(--text-2); font-size: 12.5px; font-weight: var(--fw-medium); border: 1px solid transparent; }
.chip.solid { background: var(--primary); color: var(--on-primary); }
.chip.outline { background: transparent; border-color: var(--border-2); color: var(--text-2); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--pill);
  font-size: 11.5px; font-weight: var(--fw-semibold); background: var(--surface-2); color: var(--text-2); }
.badge.ok { background: var(--ok-weak); color: var(--ok); }
.badge.warn { background: var(--warn-weak); color: var(--warn); }
.badge.danger { background: var(--danger-weak); color: var(--danger); }
.badge.info { background: var(--primary-weak); color: var(--primary); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.seg { display: inline-flex; padding: 4px; background: var(--surface-2); border-radius: var(--pill); gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--text-2); padding: 7px 16px; border-radius: var(--pill);
  font-size: 13.5px; font-weight: var(--fw-semibold); cursor: pointer; transition: var(--t-fast); }
.seg button.active { background: var(--cta); color: var(--on-cta); }

/* filter pills (BrightPath category style) */
.pillfilters { display: flex; gap: 8px; flex-wrap: wrap; }
.pillfilter { border: 1px solid var(--border-2); background: transparent; color: var(--text-2);
  padding: 8px 16px; border-radius: var(--pill); font-size: 13px; font-weight: var(--fw-medium); cursor: pointer; transition: var(--t-fast); }
.pillfilter:hover { border-color: var(--primary); color: var(--primary); }
.pillfilter.active { background: var(--primary); color: var(--on-primary); border-color: transparent; }

/* ---- universal search + filter bar -------------------------------------- */
.searchfilter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.searchbox { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--pill); padding: 6px 6px 6px 16px; }
.searchbox input { flex: 1; border: 0; background: transparent; color: var(--text); font-size: 14px; outline: none; padding: 6px 0; }
.searchbox .go { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; cursor: pointer; }
.filterselect { position: relative; }
.filterselect select { appearance: none; border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  padding: 9px 34px 9px 14px; border-radius: var(--pill); font-size: 13.5px; cursor: pointer; outline: none; }
.filterselect::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-65%) rotate(45deg); pointer-events: none; }

/* ---- forms --------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: var(--fw-medium); }
input, select, textarea { width: 100%; font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--surface-2); border: 1px solid transparent; border-radius: var(--r-sm); padding: 11px 13px; outline: none;
  transition: var(--t-fast); }
textarea { resize: none; min-height: 90px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
input::placeholder, textarea::placeholder { color: var(--muted); }
.row { display: flex; gap: 12px; flex-wrap: wrap; } .row > * { flex: 1; min-width: 160px; }
.checkrow { display: flex; align-items: center; gap: 10px; }
.checkrow input { width: auto; accent-color: var(--primary); }

/* ---- avatars ------------------------------------------------------------- */
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-weak); color: var(--primary);
  display: grid; place-items: center; font-size: 12px; font-weight: var(--fw-bold); border: 2px solid var(--surface); flex: none; }
.avatar-stack { display: flex; } .avatar-stack .avatar { margin-left: -10px; } .avatar-stack .avatar:first-child { margin-left: 0; }
.avatar.more { background: var(--surface-3); color: var(--text-2); }

/* project icon */
.proj-ico { width: 44px; height: 44px; border-radius: var(--r); display: grid; place-items: center;
  font-weight: var(--fw-bold); font-size: 1rem; background: var(--primary-weak); color: var(--primary); flex: none; }

/* ---- split panel (the ONE primitive for large sections) -----------------
 * Desktop: a right-docked, full-height side panel (list stays visible on the
 * left). Mobile: a full-screen push/pop. Used everywhere via App.nav.openDrill.
 * Small UI (filters, emoji, confirms) use popovers, NOT this. */
.modal-scrim { position: fixed; inset: 0; background: rgba(10,12,20,.42); z-index: 60; display: flex;
  justify-content: flex-end; align-items: stretch; opacity: 0; pointer-events: none; transition: opacity var(--t);
  backdrop-filter: blur(1px); }
.modal-scrim.show { opacity: 1; pointer-events: auto; }
.modal { width: min(640px, 94vw); height: 100vh; max-height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--sh-lg); overflow: hidden;
  transform: translateX(100%); transition: transform var(--t); }
.modal.wide { width: min(900px, 96vw); }
.modal-scrim.show .modal { transform: none; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); flex: none; }
.modal-head .ttl { font-weight: var(--fw-bold); font-size: 1.2rem; font-family: var(--font-display); flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-body { padding: 20px; overflow-y: auto; overflow-x: hidden; flex: 1; display: flex; flex-direction: column; }
.modal-body > * { flex: none; }                 /* normal stacking… */
.modal-body > .chat, .modal-body > [data-fill] { flex: 1; min-height: 0; }  /* …except a chat fills (input pins to bottom) */
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center;
  background: var(--surface); flex: none; }
@media (max-width: 980px) { .modal, .modal.wide { width: 100vw; border-left: 0; } }

/* ---- in-pane drill (R2) -------------------------------------------------
 * Drills no longer overlay the whole screen — they push INSIDE the left
 * content column (.content-col), so the permanent chat on the right is never
 * covered. The frame reuses .modal-head / .modal-body / .modal-foot internals
 * (so existing section render code is unchanged); only the container differs. */
.drill-host { position: absolute; inset: 0; z-index: 15; display: none; }
.drill-host.show { display: block; }
/* frames STACK (parent stays mounted underneath). Push = top slides in from the
 * right (df-in); pop = top slides out to the right (df-out), revealing the parent
 * already in place — smooth both ways, no re-mount, no jump to root. */
.drill-frame { position: absolute; inset: 0; display: flex; flex-direction: column;
  background: var(--bg); overflow: hidden; }
.drill-frame.df-in { animation: drill-in .24s cubic-bezier(.32, .72, 0, 1); }
.drill-frame.df-out { animation: drill-out .2s cubic-bezier(.32, .72, 0, 1) forwards; }
@keyframes drill-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes drill-out { from { transform: none; opacity: 1; } to { transform: translateX(30px); opacity: 0; } }
/* the drill head sits flush under the appbar like a section band (opaque) */
.drill-frame > .modal-head { padding: 14px 24px; background: var(--bg); }
.drill-frame > .modal-body { padding: 20px 24px 24px; }
@media (max-width: 980px) { .drill-frame > .modal-head, .drill-frame > .modal-body { padding-left: 16px; padding-right: 16px; } }
/* Back — the ONE nav affordance for drills: a bold, theme-coloured icon button,
 * upper-left, no label. (Replaces the unintuitive X; back-only, one level/click.) */
.iconbtn.back-nav { width: 40px; height: 40px; background: var(--surface-2); border-color: transparent;
  color: var(--primary); }
.iconbtn.back-nav:hover { background: var(--primary-weak); color: var(--primary); }
.iconbtn.back-nav .ico { width: 23px; height: 23px; stroke-width: 2.4; }
/* attachment chips above the composer — elegant thumbnail tiles; clear on send */
.media-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); max-width: 200px; box-shadow: var(--sh-sm); }
.media-thumb { width: 30px; height: 30px; border-radius: var(--r-xs); flex: none; background: var(--surface-2) center/cover no-repeat;
  display: grid; place-items: center; color: var(--muted); }
.media-thumb.vid { background: var(--text); color: #fff; }
.media-thumb.pdf { background: var(--danger-weak); color: var(--danger); }
.media-thumb .ico { width: 16px; height: 16px; }
.media-name { font-size: 12.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-x { width: 22px; height: 22px; flex: none; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: var(--r-xs); display: grid; place-items: center; }
.media-x:hover { background: var(--surface-2); color: var(--text); }

/* Media Library — polished gallery grid of square preview tiles */
.media-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.media-tile { position: relative; aspect-ratio: 1 / 1; border-radius: var(--r-sm); overflow: hidden;
  border: 1px solid var(--border); background: var(--surface-2); box-shadow: var(--sh-sm);
  transition: transform .12s ease, box-shadow .12s ease; }
.media-tile.clickable { cursor: pointer; }
.media-tile:hover { transform: translateY(-2px); box-shadow: var(--sh-md, var(--sh-sm)); }
.media-tile-media { width: 100%; height: 100%; object-fit: cover; background: center/cover no-repeat var(--surface-2); display: block; }
.media-tile-badge { position: absolute; left: 8px; bottom: 8px; backdrop-filter: blur(6px); }
.media-tile-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff;
  background: linear-gradient(transparent, #0006); pointer-events: none; }
.media-tile-play .ico { width: 34px; height: 34px; filter: drop-shadow(0 1px 3px #0008); }
@media (max-width: 640px) { .media-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); } }

/* messenger-style media in chat — media sit OUTSIDE the text bubble, no boxy frame */
.msg-stack { display: flex; flex-direction: column; gap: 6px; min-width: 0; max-width: 78%; }
.bubble-row.user .msg-stack { align-items: flex-end; }
.bubble-row.agent .msg-stack, .bubble-row:not(.user) .msg-stack { align-items: flex-start; }
.chat-media-img { max-width: 280px; max-height: 340px; width: auto; border-radius: 16px; display: block;
  cursor: pointer; object-fit: cover; box-shadow: var(--sh-sm); background: var(--surface-2); }
.chat-doc { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 14px;
  background: var(--surface-2); color: var(--text); font-size: 13px; max-width: 260px; }
.chat-doc .ico { color: var(--danger); flex: none; }
.chat-doc span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* voice message — sleek, no box: round play button + waveform + time + transcript */
.voice { display: flex; flex-direction: column; gap: 4px; max-width: 300px; }
.voice-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border-radius: 22px;
  background: var(--surface-2); }
.bubble-row.user .voice-row { background: color-mix(in srgb, var(--primary) 16%, var(--surface-2)); }
.voice-play { width: 38px; height: 38px; flex: none; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--primary); color: var(--on-primary); display: grid; place-items: center; }
.voice-play .ico { width: 17px; height: 17px; }
.voice-wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 26px; cursor: pointer; min-width: 90px; }
.voice-wave span { flex: 1; min-width: 2px; border-radius: 2px; background: var(--border);
  transition: background .08s linear; align-self: center; }
.voice-wave span.on { background: var(--primary); }
.voice-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.voice-tr { font-size: 12.5px; line-height: 1.4; color: var(--muted); padding: 0 6px; }
.voice-tr.pending { opacity: .6; font-style: italic; }

/* full-screen media lightbox (chat thumbs / library / attachments) */
.media-lightbox { position: fixed; inset: 0; z-index: 1000; background: #000a; backdrop-filter: blur(8px);
  display: grid; place-items: center; opacity: 0; transition: opacity .18s ease; padding: 24px; }
.media-lightbox.show { opacity: 1; }
.media-lightbox-inner { max-width: 92vw; max-height: 90vh; border-radius: 14px; overflow: hidden; box-shadow: 0 20px 60px #000a; }
.media-lightbox-inner img, .media-lightbox-inner video { max-width: 92vw; max-height: 90vh; display: block; }
.media-lightbox-x { position: absolute; top: 18px; right: 18px; width: 42px; height: 42px; border-radius: 50%;
  border: 0; background: #ffffff33; color: #fff; cursor: pointer; display: grid; place-items: center; }
.media-lightbox-x:hover { background: #ffffff55; }

/* voice recording bar (replaces the composer while recording) */
.rec-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--surface); box-shadow: var(--sh-sm); }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger, #e5484d); flex: none; animation: recPulse 1.1s ease-in-out infinite; }
@keyframes recPulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.rec-hint { font-size: 12.5px; color: var(--muted); }

/* clean focus: keyboard ring only, no click-artifact ring on buttons */
button:focus { outline: none; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--r-xs); }

/* ---- AI panel (persistent universal assistant; a rounded card) ----------- */
.ai-panel-head { padding: 15px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; flex: none; }
.ai-panel-head .ico { color: var(--primary); }
.ai-panel-head .t { font-weight: var(--fw-bold); font-family: var(--font-display); flex: 1; font-size: 1.02rem; }

/* ---- chat / agent builder (fills the card; input pinned bottom) ---------- */
.chat { display: flex; flex-direction: column; gap: 12px; height: 100%; min-height: 0; padding: 16px 18px 18px; }
.chat-log { display: flex; flex-direction: column; gap: 16px; padding: 2px; overflow-y: auto; flex: 1; min-height: 0; }
/* a bold, themed banner announcing an "edit/create with AI" context (attention) */
.chat-banner { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-radius: var(--r);
  background: var(--primary-weak); color: var(--primary); font-weight: var(--fw-semibold); font-size: 14px;
  line-height: 1.45; box-shadow: var(--sh-sm); }
.chat-banner .ico { width: 20px; height: 20px; flex: none; }
.bubble-row { display: flex; gap: 10px; align-items: flex-start; }
.bubble-row.user { flex-direction: row-reverse; }
.bubble { max-width: 82%; padding: 11px 15px; border-radius: var(--r-lg); font-size: 14px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.bubble.agent { background: var(--surface-2); color: var(--text); border-top-left-radius: var(--r-xs); }
.bubble.user { background: var(--primary); color: var(--on-primary); border-top-right-radius: var(--r-xs); }
.bubble.sys { background: var(--accent-weak); color: var(--on-accent); font-size: 13px; align-self: center; text-align: center; max-width: 90%; }
/* AI assistant reply — clean full-width text, NO bubble/box (ChatGPT-style) */
.bubble-row.plain { display: block; }
.msg-agent { font-size: 14.5px; line-height: 1.62; color: var(--text); word-break: break-word; }
.msg-agent > :first-child { margin-top: 0; } .msg-agent > :last-child { margin-bottom: 0; }
/* composer — a single rounded box wrapping the textarea + send button */
.chat-input { display: flex; gap: 8px; align-items: flex-end; padding: 7px 7px 7px 14px;
  border: 1px solid var(--border-2); border-radius: var(--r-lg); background: var(--surface); }
.chat-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.chat-input textarea { min-height: 30px; max-height: 160px; border: 0; background: transparent;
  padding: 6px 0; border-radius: 0; }
.chat-input textarea:focus { background: transparent; border: 0; box-shadow: none; }
.chat-input .btn { flex: none; width: 40px; height: 40px; padding: 0; border-radius: var(--pill); }
/* mobile (incl. Telegram Mini App): the AI opens full-screen and the bottom-nav is
   fixed on top — lift the composer above it + the device safe area so it isn't clipped. */
@media (max-width: 980px) {
  .chat { padding-bottom: calc(18px + var(--bottomnav-h) + env(safe-area-inset-bottom, 0px)); }
}
.working-card { background: var(--surface-2); border-radius: var(--r-lg); padding: 12px 14px; }
.step { display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 13px; color: var(--text-2); }
.step .ico { width: 16px; height: 16px; color: var(--muted); }
.step.active { color: var(--text); } .step.active .ico { color: var(--primary); }
.step .x { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.step .cnt { color: var(--muted); font-size: 12px; }
.step.total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 9px; font-weight: var(--fw-semibold); color: var(--text); }
.step.total .t-x { color: var(--text); }

/* ---- live run timeline (code-driven progress: startup → Думаю → tools) ------
 * Inline, NO bubble/box. Light step lines; the active one carries a quiet pulse;
 * completed lines fade. Seconds stay (subtle, tabular, right-aligned). When done,
 * it collapses to a one-line "Готово · N шаг. · 36s" you can click to expand. */
.run-row .avatar { align-self: flex-start; }
.run { flex: 1 1 auto; min-width: 0; padding: 3px 0 2px; }
.run-steps { display: flex; flex-direction: column; gap: 1px; }
.run-steps.collapsed { display: none; }
.run-step, .run-summary { display: flex; align-items: center; gap: 9px; font-size: 13px; line-height: 1.55; color: var(--text-2); padding: 1.5px 0; }
.run-step .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .2s ease; }
.run-step .sec, .run-summary .sec { margin-left: auto; padding-left: 12px; font-size: 11px; color: var(--muted); opacity: .75; font-variant-numeric: tabular-nums; letter-spacing: .2px; }
.run-step .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border-2); flex: none; transition: background .2s ease; }
.run-step.active { color: var(--text); }
.run-step.active .lbl { font-weight: var(--fw-medium); }
.run-step.active .dot { background: var(--primary); animation: run-pulse 1.15s ease-in-out infinite; }
.run-step.done { color: var(--muted); opacity: .68; }
.run-summary { cursor: pointer; color: var(--text-2); font-weight: var(--fw-medium); user-select: none; }
.run-summary:hover { color: var(--text); }
.run-summary .dot.ok { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
@keyframes run-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.65); opacity: .4; } }

@keyframes content-fade { from { opacity: .25; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.spin { animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }
.typing span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); margin: 0 1px; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,60%,100% { opacity: .25; } 30% { opacity: 1; } }

/* ---- empty / loading / skeleton ----------------------------------------- */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .ico { width: 40px; height: 40px; margin: 0 auto 12px; color: var(--border-2); }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: var(--r-sm); }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---- toast --------------------------------------------------------------- */
#toaster { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: var(--pill); font-size: 13.5px; box-shadow: var(--sh-lg);
  animation: toastin .25s var(--ease); max-width: 90vw; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }

/* ---- progress bar -------------------------------------------------------- */
.bar { height: 8px; border-radius: var(--pill); background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--cta); border-radius: var(--pill); }

/* ============================================================================
 * Per-theme CARD TREATMENTS — cards are ONE component; each theme restyles them
 * via tokens. The accent colour comes from the theme's own chart palette
 * (--c1..), so it stays coherent and no colour is hard-coded. `.accent.a0..a3`
 * cycle the palette; BrightPath fills solid (its signature), other themes use a
 * coloured top bar + tinted icon tile.
 * ========================================================================== */
.card.accent.a0 { --ac: var(--c1); }
.card.accent.a1 { --ac: var(--c2); }
.card.accent.a2 { --ac: var(--c4); }
.card.accent.a3 { --ac: var(--c3); }
.card.accent { border-top: 3px solid var(--ac); }
.card.accent .proj-ico { background: color-mix(in srgb, var(--ac) 20%, transparent); color: var(--ac); }

/* BrightPath — solid vivid hero cards (blue / coral / ink / lime) */
:root[data-theme="brightpath"] .card.accent { background: var(--ac); color: #fff; border: 0; box-shadow: var(--sh); }
:root[data-theme="brightpath"] .card.accent .card-sub,
:root[data-theme="brightpath"] .card.accent .dim,
:root[data-theme="brightpath"] .card.accent .muted,
:root[data-theme="brightpath"] .card.accent .stat .k { color: rgba(255,255,255,.82) !important; }
:root[data-theme="brightpath"] .card.accent .proj-ico { background: rgba(255,255,255,.22); color: #fff; }
:root[data-theme="brightpath"] .card.accent .chip { background: rgba(255,255,255,.2); color: #fff; }
:root[data-theme="brightpath"] .card.accent .bar { background: rgba(255,255,255,.25); }
:root[data-theme="brightpath"] .card.accent.a3 { color: #151313; }       /* lime → dark text */
:root[data-theme="brightpath"] .card.accent.a3 .card-sub,
:root[data-theme="brightpath"] .card.accent.a3 .stat .k { color: rgba(21,19,19,.7) !important; }
:root[data-theme="brightpath"] .card.accent.a3 .proj-ico { background: rgba(21,19,19,.14); color: #151313; }

/* Capture — soft dark capsule cards, mint accent bar */
:root[data-theme="capture"] .card { background: var(--surface); border-color: transparent; box-shadow: var(--sh-sm); }
:root[data-theme="capture"] .card.accent .proj-ico { background: color-mix(in srgb, var(--ac) 26%, var(--surface)); }

/* Space Grotesk — crisp dark cards, vivid accent bar + chips */
:root[data-theme="spacegrotesk"] .card.accent { border-top-width: 3px; }
:root[data-theme="spacegrotesk"] .card { border-color: var(--border-2); }

/* Care — clean white cards, coloured icon tile + thin accent (default look) */

/* ---- rule view (labeled fields; shared App.ruleView) --------------------- */
.rf-row { display: flex; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.rf-row:last-child { border-bottom: 0; }
.rf-k { color: var(--muted); min-width: 130px; flex: none; font-weight: var(--fw-medium); }
.rf-v { color: var(--text); word-break: break-word; }

/* ---- blocking loader (long ops: provider switch / gateway restart) ------- */
.busy-scrim { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: rgba(10,12,20,.55); backdrop-filter: blur(2px); opacity: 0; transition: opacity var(--t); }
.busy-scrim.show { opacity: 1; }
.busy-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 28px 32px; max-width: 340px; text-align: center; box-shadow: var(--sh-lg);
  display: flex; flex-direction: column; align-items: center; gap: 14px; }
.busy-card .ico { width: 30px; height: 30px; color: var(--primary); }
.busy-msg { color: var(--text); font-size: 14.5px; line-height: 1.5; }

/* ---- popover (small UI: filters, emoji) ---------------------------------- */
.popover { position: absolute; z-index: 70; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--sh-lg); padding: 14px; min-width: 240px; }
.popover-scrim { position: fixed; inset: 0; z-index: 69; }

/* ---- project Automation drill (reports + sheet rules) -------------------- */
.autom { display: flex; flex-direction: column; gap: 26px; }
.autom-group { display: flex; flex-direction: column; gap: 12px; }
.autom-head { display: flex; align-items: center; gap: 10px; }
.autom-head h3 { font-size: 1.08rem; font-weight: var(--fw-bold); margin: 0; }
.autom-head .autom-ico { display: flex; color: var(--muted); }
.autom-head .chip { font-size: 12px; }
.autom-head .spacer { flex: 1; }
.autom-list { display: flex; flex-direction: column; gap: 10px; }
.autom-empty { color: var(--muted); font-size: 13.5px; padding: 16px; text-align: center;
  background: var(--surface-2); border: 1px dashed var(--border); border-radius: var(--r-sm); }

/* ---- rendered markdown (reports, KB) ------------------------------------- */
.md { line-height: 1.65; font-size: 14.5px; color: var(--text); overflow-wrap: anywhere; }
.md pre { white-space: pre-wrap; word-break: break-word; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--font-display); margin: 18px 0 8px; line-height: 1.25; }
.md h1 { font-size: 1.5rem; } .md h2 { font-size: 1.25rem; } .md h3 { font-size: 1.08rem; } .md h4 { font-size: .98rem; }
.md p { margin: 8px 0; } .md ul, .md ol { margin: 8px 0; padding-left: 22px; } .md li { margin: 3px 0; }
.md a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.md strong { font-weight: var(--fw-bold); } .md em { font-style: italic; }
.md code { background: var(--surface-2); border-radius: var(--r-xs); padding: 1px 6px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .9em; }
.md pre { background: var(--surface-2); border-radius: var(--r-sm); padding: 14px; overflow-x: auto; margin: 10px 0; }
.md pre code { background: none; padding: 0; }
.md blockquote { border-left: 3px solid var(--primary); margin: 10px 0; padding: 4px 14px; color: var(--text-2); background: var(--surface-2); border-radius: 0 var(--r-xs) var(--r-xs) 0; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.md .wiki { color: var(--primary); background: var(--primary-weak); border-radius: var(--r-xs); padding: 0 6px; font-weight: var(--fw-medium); }
.md h1:first-child, .md h2:first-child, .md p:first-child { margin-top: 0; }
/* graceful table fallback (assistant is told not to emit tables; if one slips
 * through we render a real table, never raw |pipe| rows) */
.md table.md-table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13.5px; display: block; overflow-x: auto; }
.md table.md-table th, .md table.md-table td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top; }
.md table.md-table th { background: var(--surface-2); font-weight: var(--fw-semibold); }
.md table.md-table tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.msg-agent table.md-table { font-size: 13px; }

/* ---- login --------------------------------------------------------------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: 32px; box-shadow: var(--sh-lg); }
.login-card .logo { width: 52px; height: 52px; border-radius: var(--r); background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; font-weight: var(--fw-bold); font-size: 1.3rem; margin-bottom: 18px; box-shadow: var(--glow); }

/* per-rule daily-report send-hour control (rule view footer) */
.send-hour { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }
.send-hour select { width: auto; border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  border-radius: var(--r-sm); padding: 5px 8px; font-size: 13px; }
/* timezone trigger button + curated popover (FIX C/D) — opaque, anchored, scrollable */
.tz-btn { width: auto; border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  border-radius: var(--r-sm); padding: 5px 10px; font-size: 13px; cursor: pointer; white-space: nowrap; transition: var(--t-fast); }
.tz-btn:hover { border-color: var(--primary); }
.tz-caret { color: var(--muted); margin-left: 2px; }
.tz-pop { padding: 6px; }
.tz-group { font-size: 11px; font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 9px 8px 4px; }
.tz-group:first-child { padding-top: 4px; }
.tz-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: transparent; border: 0; border-radius: var(--r-sm); padding: 7px 9px; font-size: 13px; color: var(--text); cursor: pointer; }
.tz-row:hover { background: var(--surface-2); }
.tz-row.active { background: var(--primary-weak); color: var(--primary); font-weight: var(--fw-medium); }

/* ---- daily report: per-date breakdown page ------------------------------ */
.report-day { display: flex; flex-direction: column; gap: 18px; }
.report-proj { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--sh-sm); }
.report-proj-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.report-proj-head .rp-title { font-weight: var(--fw-bold); font-size: 1.05rem; font-family: var(--font-display); }
.report-proj-head .spacer { flex: 1; }

/* per-rule report topic (message_thread_id) input — narrow, in the rule footer */
.send-hour .thread-inp { width: 130px; border: 1px solid var(--border-2); background: var(--surface);
  color: var(--text); border-radius: var(--r-sm); padding: 5px 8px; font-size: 13px; }

/* per-rule weekday picker (rule view footer) — compact horizontal toggles that
   adapt to the theme accent. Stays on ONE row (no vertical stacking). */
.wd-picker { display: inline-flex; gap: 5px; flex-wrap: nowrap; }
.wd-day { width: 33px; height: 33px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  padding: 0; border: 1px solid var(--border-2); background: var(--surface); color: var(--muted);
  border-radius: var(--r-sm); font-size: 12px; font-weight: var(--fw-semibold); cursor: pointer; transition: var(--t-fast); }
.wd-day:hover { border-color: var(--primary); color: var(--text); }
.wd-day.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: var(--sh-sm); }
.wd-day.on:hover { color: var(--on-primary); }
@media (max-width: 560px) { .wd-day { width: 30px; height: 30px; } .wd-picker { gap: 4px; } }

/* daily-report rule config — a proper vertical form (replaces the cramped footer
   bar): a side panel on desktop, a full scrollable page on mobile. */
.rule-form { display: flex; flex-direction: column; gap: 24px; margin-top: 22px; }
.rule-form .rf-sec { display: flex; flex-direction: column; gap: 13px; }
.rule-form .rf-sec-title { font-size: 11.5px; font-weight: var(--fw-semibold); text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); }
.rule-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.rule-field > .rf-lbl { font-size: 12.5px; color: var(--muted); font-weight: var(--fw-medium); }
.rule-field > .rf-hint { font-size: 11.5px; color: var(--faint); line-height: 1.4; }
.rule-field input, .rule-field select, .rule-field .tz-btn { width: 100%; }
.rule-field .tz-btn { text-align: left; display: flex; align-items: center; justify-content: space-between; }
.rule-row2 { display: flex; gap: 12px; }
.rule-row2 > .rule-field { flex: 1 1 0; }
.rule-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-top: 2px; padding-top: 20px; border-top: 1px solid var(--border); }
.rule-actions .danger-right { margin-left: auto; }
@media (max-width: 560px) {
  .rule-row2 { flex-direction: column; }
  .rule-actions .btn { flex: 1 1 100%; justify-content: center; }
  .rule-actions .danger-right { margin-left: 0; }
}

/* ---- Unified rule editor (daily-report + sheet-fill) — two-pane ---------- */
/* WEB: controls in a LEFT side panel, rule content on the right (like Справочник).
   MOBILE (<860px): stacks to the current report-rule vertical UX — content FIRST
   (order:1), then schedule / delivery / actions (order:2). */
.rule2-wrap { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.rule2-side { flex: 1 1 300px; min-width: 0; max-width: 380px; align-self: flex-start; }
.rule2-main { flex: 2 1 360px; min-width: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: clamp(18px, 2.4vw, 30px) clamp(16px, 2.4vw, 30px);
  box-shadow: var(--sh-sm); max-height: calc(100vh - 180px); overflow-y: auto; }
.rule2-side .rule-form { margin-top: 0; gap: 22px; }
.rule2-side .rule-actions { flex-direction: column; align-items: stretch; gap: 8px; }
.rule2-side .rule-actions .btn { width: 100%; justify-content: center; }
.rule2-side .rule-actions .danger-right { margin-left: 0; margin-top: 4px; }
.rule2-main .rf-row { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.rule2-main .rf-row .rf-k { color: var(--muted); font-size: 13px; }
.rule2-main .rf-row .rf-v { text-align: right; min-width: 0; word-break: break-word; }
@media (max-width: 860px) {
  .rule2-wrap { flex-direction: column; }
  .rule2-side { flex: none; width: 100%; max-width: none; order: 2; }
  .rule2-main { flex: none; width: 100%; max-height: none; order: 1; }
  .rule2-side .rule-actions { flex-direction: row; flex-wrap: wrap; }
  .rule2-side .rule-actions .btn { flex: 1 1 100%; }
}

/* project detail — active-campaign card: cost-per-conversion is the hero (labelled,
   left-aligned for readability), spend + results as a quiet footer row. */
.camp-card .cc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.camp-card .cc-name { flex: 1; min-width: 0; font-weight: var(--fw-semibold); font-size: .92rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.camp-card .cc-hero { margin-bottom: 14px; }
.camp-card .cc-cap { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.camp-card .cc-val { font-size: 1.55rem; font-weight: var(--fw-bold); font-family: var(--font-display);
  line-height: 1.05; letter-spacing: -.015em; color: var(--text); }
.camp-card .cc-foot { display: flex; gap: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.camp-card .cc-stat { flex: 1; min-width: 0; }
.camp-card .cc-stat.r { text-align: right; }
.camp-card .cc-stat .v { font-size: .9rem; font-weight: var(--fw-medium); color: var(--text); }
.camp-card .cc-stat .k { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---- Справочник (help / handbook) — two-pane ---------------------------- */
/* flex-wrap → container-responsive (stacks when squeezed by the assistant panel). */
.help-wrap { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.help-side { flex: 1 1 230px; min-width: 0; align-self: flex-start;
  max-height: calc(100vh - 150px); display: flex; flex-direction: column; }
.help-search { display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--pill); padding: 6px 14px; margin-bottom: 12px; }
.help-search .hs-ico { color: var(--muted); display: flex; }
.help-search input { border: 0; background: transparent; padding: 6px 0; font-size: 14px; }
.help-search input:focus { box-shadow: none; background: transparent; }
.help-nav { overflow-y: auto; padding-right: 4px; flex: 1; }
.help-group { font-size: 11px; font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 14px 10px 6px; }
.help-group:first-child { padding-top: 2px; }
.help-topic { display: block; width: 100%; text-align: left; background: transparent; border: 0;
  border-radius: var(--r-sm); padding: 9px 12px; font-size: 13.5px; color: var(--text-2); cursor: pointer;
  transition: var(--t-fast); line-height: 1.35; }
.help-topic:hover { background: var(--surface-2); color: var(--text); }
.help-topic.active { background: var(--primary-weak); color: var(--primary); font-weight: var(--fw-semibold); }
.help-noresults { padding: 14px 10px; font-size: 13px; }
.help-main { flex: 3 1 340px; min-width: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: clamp(18px, 2.6vw, 32px) clamp(16px, 2.6vw, 34px); box-shadow: var(--sh-sm);
  max-height: calc(100vh - 150px); overflow-y: auto; }
.help-md { max-width: 760px; }
.help-md h1 { font-size: 1.7rem; margin: 0 0 18px; font-family: var(--font-display); }
.help-md h2 { font-size: 1.2rem; margin: 26px 0 10px; font-family: var(--font-display); }
.help-md h3 { font-size: 1.02rem; margin: 20px 0 8px; }
.help-md p, .help-md li { line-height: 1.65; }
.help-md ol, .help-md ul { padding-left: 22px; margin: 10px 0; }
.help-md li { margin: 5px 0; }
.help-md blockquote { border-left: 3px solid var(--primary); background: var(--surface-2);
  border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: 10px 16px; margin: 14px 0; color: var(--text-2); }
.help-md code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; font-size: .9em; }
.help-md pre { background: var(--surface-2); padding: 14px 16px; border-radius: var(--r-sm); overflow-x: auto; }
.help-md pre code { background: transparent; padding: 0; }
.help-md hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
@media (max-width: 860px) {
  .help-wrap { flex-direction: column; }
  .help-side { flex: none; width: 100%; position: static; max-height: none; }
  .help-nav { max-height: 240px; }
  .help-main { width: 100%; max-height: none; padding: 22px 18px; }
}

/* ---- Инструкция (onboarding guide) — two-pane, bold & visual ------------- */
/* flex-wrap + flexible bases = container-responsive: panes stack when the section
   is squeezed (e.g. the assistant panel docked), not only on small viewports. */
.onb-wrap { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.onb-side { flex: 1 1 250px; min-width: 0; }
.onb-progress { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 18px 20px; box-shadow: var(--sh-sm); margin-bottom: 16px; }
.onb-prog-top { display: flex; align-items: baseline; gap: 8px; }
.onb-prog-count { font-size: 1.9rem; font-weight: var(--fw-bold); font-family: var(--font-display); letter-spacing: -.02em; }
.onb-bar { height: 8px; border-radius: var(--pill); background: var(--surface-3); margin-top: 12px; overflow: hidden; }
.onb-bar-fill { height: 100%; border-radius: var(--pill); background: var(--primary); transition: width .4s ease; }
.onb-steps { display: flex; flex-direction: column; gap: 8px; }
.onb-step { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md, 14px); padding: 13px 14px;
  transition: var(--t-fast); }
.onb-step:hover { border-color: var(--border-2); box-shadow: var(--sh-sm); }
.onb-step.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.onb-num { flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2); font-weight: var(--fw-bold); font-size: 14px; }
.onb-step.done .onb-num { background: var(--ok); color: #fff; }
.onb-step.active .onb-num { background: var(--primary); color: var(--on-primary); }
.onb-step.done.active .onb-num { background: var(--ok); }
.onb-step-title { font-weight: var(--fw-semibold); font-size: 14px; line-height: 1.3; color: var(--text); }
.onb-step.done .onb-step-title { color: var(--text-2); }
.onb-main { flex: 3 1 340px; min-width: 0; }
.onb-detail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: clamp(18px, 2.6vw, 32px) clamp(16px, 2.6vw, 34px); box-shadow: var(--sh-sm); width: 100%; max-width: 760px; }
.onb-detail-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.onb-detail-num { flex: 0 0 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-weak); color: var(--primary); font-weight: var(--fw-bold); font-size: 22px; font-family: var(--font-display); }
.onb-detail-num.done { background: var(--ok-weak); color: var(--ok); }
.onb-detail-title { font-size: clamp(1.2rem, 2.2vw, 1.5rem); font-weight: var(--fw-bold); font-family: var(--font-display); margin-bottom: 6px; overflow-wrap: anywhere; }
.onb-lead { font-size: 1.02rem; line-height: 1.6; color: var(--text-2); margin: 0 0 16px; }
.onb-warn { display: flex; gap: 10px; align-items: flex-start; background: var(--warn-weak); color: var(--warn);
  border-radius: var(--r-sm); padding: 12px 16px; margin: 0 0 18px; font-weight: var(--fw-medium); line-height: 1.45; }
.onb-list { padding-left: 0; list-style: none; counter-reset: onb; margin: 0 0 18px; }
.onb-list li { counter-increment: onb; position: relative; padding: 8px 0 8px 38px; line-height: 1.55; border-bottom: 1px solid var(--border); }
.onb-list li:last-child { border-bottom: 0; }
.onb-list li::before { content: counter(onb); position: absolute; left: 0; top: 8px; width: 24px; height: 24px;
  border-radius: 50%; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: var(--fw-bold);
  display: grid; place-items: center; }
.onb-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 4px; }
.onb-confirm { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--border); cursor: pointer; font-weight: var(--fw-medium); }
.onb-confirm input { width: auto; accent-color: var(--primary); width: 18px; height: 18px; }
@media (max-width: 900px) {
  .onb-wrap { flex-direction: column; }
  .onb-side { flex: none; width: 100%; position: static; }
  .onb-detail { padding: 22px 18px; }
}

/* ---- AI-provider gate: designed "locked until a provider is connected" states ------
 * Reuses the card / btn system so a lock reads as part of the product, never a dead box. */
.card.ai-lock { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.ai-lock-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--primary); flex: 0 0 auto; }
.ai-lock-ic .ico { width: 20px; height: 20px; }
.ai-lock-body { flex: 1; min-width: 200px; }
.ai-lock-ttl { font-weight: var(--fw-semibold); margin-bottom: 2px; }
.ai-lock .btn { flex: 0 0 auto; }
/* a gated action button: clearly muted/locked, still clickable to show the connect CTA */
button.gate-locked { opacity: .5; filter: grayscale(.3); cursor: not-allowed; }
button.gate-locked:hover { opacity: .66; box-shadow: none; transform: none; }
/* chat composer lock bar — replaces the input row while no provider is connected */
.chat-lock { align-items: center; gap: 10px; margin: 8px 0 2px; padding: 12px 14px;
  border: 1px dashed var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
.chat-lock-ic { color: var(--primary); display: flex; }
.chat-lock-ic .ico { width: 18px; height: 18px; }
.chat-lock-msg { flex: 1; font-size: 13px; color: var(--muted); line-height: 1.35; }
