:root {
  color-scheme: dark;
  --bg: #05090a;
  --surface: #0a1113;
  --surface-2: #0e171a;
  --surface-3: #121e21;
  --line: rgba(var(--accent-rgb),.14);
  --line-strong: rgba(var(--accent-rgb),.24);
  --text: #f2f7f6;
  --muted: #8d9c9d;
  --muted-2: #607174;
  --mint: #65e1cd;
  --mint-soft: #adfff0;
  --gold: #e8bd6f;
  --danger: #ff8f97;
  --radius: 22px;
  --shadow: 0 30px 90px rgba(var(--surface-rgb),.38);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { min-height: 100vh; margin: 0; color: var(--text); background:
  radial-gradient(circle at 15% -20%, rgba(var(--accent-rgb),.16), transparent 32rem),
  radial-gradient(circle at 90% 0%, rgba(48, 90, 113, .14), transparent 34rem),
  var(--bg); font-size: 16px; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.is-hidden { display: none !important; }
.ambient { position: fixed; width: 32rem; height: 32rem; border-radius: 50%; filter: blur(100px); opacity: .08; pointer-events: none; }
.ambient-one { top: -20rem; left: 12%; background: var(--mint); }
.ambient-two { right: -18rem; bottom: -22rem; background: #3f7cc9; }

.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: max-content; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid rgba(var(--accent-rgb),.4); border-radius: 14px; color: var(--mint-soft); background: linear-gradient(145deg, rgba(var(--accent-rgb),.42), rgba(var(--surface-rgb),.8)); box-shadow: inset 0 1px rgba(var(--ink-rgb),.06); font-weight: 700; }
.brand small, .brand strong { display: block; }
.brand small { margin-bottom: 3px; color: var(--muted); font-size:12px; font-weight: 800; letter-spacing: .2em; }
.brand strong { font-size: 1.02rem; letter-spacing: -.02em; }
.brand-large .brand-mark { width: 54px; height: 54px; border-radius: 17px; }
.brand-large strong { font-size: 1.24rem; }

.auth-layout { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .75fr); width: min(1180px, calc(100% - 48px)); min-height: 720px; margin: max(5vh, 36px) auto; overflow: hidden; border: 1px solid var(--line); border-radius: 30px; background: rgba(var(--surface-rgb),.9); box-shadow: var(--shadow); }
.auth-story { position: relative; display: flex; flex-direction: column; padding: 48px; overflow: hidden; background:
  linear-gradient(135deg, rgba(var(--surface-rgb),.88), rgba(var(--surface-rgb),.95)),
  repeating-linear-gradient(120deg, transparent 0 60px, rgba(var(--accent-rgb),.025) 61px 62px); }
.auth-story::after { content: ""; position: absolute; width: 430px; height: 430px; right: -170px; top: 100px; border: 1px solid rgba(var(--accent-rgb),.18); border-radius: 50%; box-shadow: 0 0 0 55px rgba(var(--accent-rgb),.025), 0 0 0 110px rgba(var(--accent-rgb),.015); }
.auth-copy { position: relative; z-index: 1; margin: auto 0; max-width: 650px; }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; color: var(--mint); font-size:12px; font-weight: 800; letter-spacing: .18em; }
.eyebrow i { width: 17px; height: 1px; background: currentColor; }
.auth-copy h1 { margin: 22px 0 20px; font-size: clamp(2.7rem, 5vw, 4.7rem); line-height: .98; letter-spacing: -.065em; }
.auth-copy p { max-width: 560px; margin: 0; color: var(--muted); font-size: 1.15rem; line-height: 1.65; }
.auth-proof { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 10px; }
.auth-proof span { padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .78rem; }
.auth-card { display: flex; flex-direction: column; justify-content: center; padding: 58px; background: rgba(var(--surface-rgb),.96); }
.auth-tabs { display: grid; grid-template-columns: 1fr; gap: 4px; padding: 4px; margin-bottom: 34px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.auth-tab { min-height: 43px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; }
.auth-tab.is-active { color: var(--text); background: var(--surface-3); box-shadow: 0 8px 18px rgba(var(--surface-rgb),.25); }
.auth-text-button { justify-self: center; border: 0; color: var(--mint); background: transparent; font-size: .83rem; cursor: pointer; }
.auth-form { display: grid; gap: 18px; }
.auth-form header { margin-bottom: 6px; }
.auth-form h2 { margin: 0 0 8px; font-size: 2rem; letter-spacing: -.04em; }
.auth-form p { margin: 0; color: var(--muted); }
label { display: grid; gap: 8px; color: var(--muted); font-size: .85rem; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 50px; padding: 0 15px; border: 1px solid var(--line); border-radius: 12px; outline: none; color: var(--text); background: var(--surface); transition: border-color .18s, box-shadow .18s, background .18s; }
textarea { min-height: 82px; padding: 13px 15px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: rgba(var(--accent-rgb),.62); background: var(--surface-2); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.09); }
input::placeholder { color: var(--muted-2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-error { min-height: 20px; color: var(--danger) !important; font-size: .84rem; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border: 1px solid transparent; border-radius: 12px; font-weight: 750; cursor: pointer; transition: transform .16s, border-color .16s, background .16s, box-shadow .16s; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { cursor: wait; opacity: .65; }
.button-primary { color: var(--on-accent); background: linear-gradient(135deg, var(--accent-solid), var(--accent-solid)); box-shadow: 0 12px 30px rgba(var(--accent-rgb),.17), inset 0 1px rgba(255,255,255,.65); }
.button-primary:hover { box-shadow: 0 14px 36px rgba(var(--accent-rgb),.24); }
.button-secondary { border-color: var(--line); color: var(--text); background: var(--surface); }
.button-wide { width: 100%; margin-top: 4px; }

.app-shell { position: relative; z-index: 1; width: min(1540px, calc(100% - 36px)); min-height: calc(100vh - 36px); margin: 18px auto; overflow: hidden; border: 1px solid var(--line); border-radius: 28px; background: rgba(var(--surface-rgb),.92); box-shadow: var(--shadow); }
.topbar { display: flex; align-items: center; min-height: 76px; padding: 0 22px; border-bottom: 1px solid var(--line); background: rgba(var(--surface-rgb),.92); backdrop-filter: blur(24px); }
.topnav { display: flex; flex-wrap: wrap; gap: 4px; margin-left: 24px; }
.nav-item { min-height: 42px; padding: 0 15px; border: 1px solid transparent; border-radius: 11px; color: var(--muted); background: transparent; font-size: .88rem; font-weight: 650; cursor: pointer; }
.nav-item span { margin-right: 6px; color: var(--muted-2); }
.nav-item.is-active { border-color: var(--line); color: var(--text); background: var(--surface-2); }
.top-actions { position: relative; display: flex; align-items: center; gap: 14px; margin-left: auto; }
.demo-button { min-height: 38px; display: inline-flex; align-items: center; padding: 0 15px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 700; transition: .18s ease; }
.demo-button:hover { color: var(--text); border-color: rgba(var(--accent-rgb),.45); background: rgba(var(--accent-rgb),.08); }
.demo-mode .demo-button { color: var(--surface); border-color: var(--mint); background: var(--mint); }
.demo-mode .system-status::after { content: " · ДЕМО"; color: var(--gold); font-weight: 800; }
.demo-safety-banner { position: sticky; top: 0; z-index: 120; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 34px; padding: 6px 16px; border-bottom: 1px solid rgba(var(--accent-rgb),.24); color: var(--text); background: var(--surface); font-size: .75rem; }
.demo-safety-banner strong { color: var(--accent); }
.demo-safety-banner span { color: var(--muted); }
.system-status { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--muted); font-size: .76rem; font-weight: 750; text-transform: uppercase; letter-spacing: .1em; }
.system-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 14px var(--mint); }
.account-button { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 4px 10px 4px 5px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); cursor: pointer; }
.account-button span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--mint-soft); background: rgba(var(--accent-rgb),.09); }
.account-button b { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .84rem; }
.account-button em { color: var(--muted); font-style: normal; }
.account-menu { position: absolute; z-index: 20; top: calc(100% + 10px); right: 0; min-width: 160px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 18px 45px rgba(var(--surface-rgb),.45); }
.account-menu button { width: 100%; padding: 10px; border: 0; border-radius: 8px; text-align: left; background: transparent; cursor: pointer; }
.account-menu button:hover { background: var(--surface-3); }

.workspace-frame { display: block; min-height: calc(100dvh - 178px); }
@media (min-width: 761px) {
  .workspace-frame > .sidebar { display: none; }
}
.sidebar { display: flex; flex-direction: column; padding: 24px 16px 18px; border-right: 1px solid var(--line); background: rgba(var(--surface-rgb),.7); }
.workspace-switcher { display: flex; align-items: center; gap: 11px; padding: 8px; }
.workspace-icon { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 11px; color: var(--mint); background: rgba(var(--accent-rgb),.08); }
.workspace-switcher label { gap: 1px; min-width: 0; }
.workspace-switcher small { color: var(--muted-2); font-size:12px; letter-spacing: .15em; }
.workspace-switcher select { min-height: 28px; padding: 0 22px 0 0; border: 0; border-radius: 0; font-size: .9rem; background: transparent; }
.sidebar-divider { height: 1px; margin: 18px 8px 24px; background: var(--line); }
.sidebar-label { margin: 0 12px 10px; color: var(--muted-2); font-size:12px; font-weight: 800; letter-spacing: .18em; }
.side-item { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border: 1px solid transparent; border-radius: 12px; color: var(--muted); background: transparent; cursor: pointer; }
.side-item span { width: 22px; color: var(--muted); text-align: center; }
.side-item b { font-size: .9rem; }
.side-item em { min-width: 24px; margin-left: auto; padding: 3px 7px; border-radius: 999px; color: var(--muted); background: rgba(var(--ink-rgb),.035); font-size:12px; font-style: normal; }
.side-item.is-active { border-color: rgba(var(--accent-rgb),.15); color: var(--text); background: linear-gradient(90deg, rgba(var(--accent-rgb),.1), rgba(var(--accent-rgb),.035)); }
.side-item.is-active span { color: var(--mint); }
.sidebar-spacer { flex: 1; min-height: 70px; }
.plan-card { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(145deg, rgba(var(--surface-rgb),.9), rgba(var(--surface-rgb),.9)); }
.plan-card > div:first-child { display: flex; align-items: center; gap: 8px; }
.plan-orbit { width: 8px; height: 8px; border: 2px solid var(--mint); border-radius: 50%; box-shadow: 0 0 12px rgba(var(--accent-rgb),.5); }
.plan-card small { color: var(--muted); font-size:12px; font-weight: 800; letter-spacing: .15em; }
.plan-card strong { display: block; margin: 14px 0 4px; font-size: .96rem; }
.plan-card p { margin: 0; color: var(--muted); font-size: .78rem; }
.plan-manage { width: 100%; margin-top: 12px; padding: 8px 10px; border: 1px solid rgba(var(--accent-rgb),.15); border-radius: 10px; color: var(--mint); background: rgba(var(--accent-rgb),.05); cursor: pointer; font: inherit; font-size: .76rem; font-weight: 750; }
.plan-progress { height: 3px; margin-top: 14px; overflow: hidden; border-radius: 99px; background: rgba(var(--ink-rgb),.07); }
.plan-progress i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--mint), var(--mint-soft)); transition: width .35s; }

.content { min-width: 0; padding: 38px 42px 48px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.page-header h1 { margin: 10px 0 7px; font-size: clamp(2rem, 3vw, 2.75rem); letter-spacing: -.055em; }
.page-header p { margin: 0; color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.metric { position: relative; display: flex; flex-direction: column; gap: 16px; min-width: 0; min-height: 172px; padding: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(var(--surface-rgb),.98), rgba(var(--surface-rgb),.96)); }
.metric::after { content: ""; position: absolute; right: -52px; bottom: -76px; width: 160px; height: 160px; border: 1px solid rgba(var(--ink-rgb),.035); border-radius: 50%; box-shadow: 0 0 0 26px rgba(var(--ink-rgb),.012); }
.metric-primary { border-color: rgba(var(--accent-rgb),.24); background: linear-gradient(145deg, rgba(var(--surface-rgb),.96), rgba(var(--surface-rgb),.98)); }
.metric > div { display: flex; flex-direction: column; gap: 8px; padding-right: 48px; }
.metric span, .panel-header span, .launch-panel header span { color: var(--muted); font-size:12px; font-weight: 800; letter-spacing: .15em; }
.metric b { display: block; margin-top: 10px; font-size: 2.5rem; letter-spacing: -.06em; }
.metric > i { position: absolute; top: 20px; right: 20px; display: grid; place-items: center; width: 37px; height: 37px; border: 1px solid var(--line); border-radius: 11px; color: var(--mint); font-style: normal; background: rgba(var(--ink-rgb),.025); }
.metric p { position: relative; margin: auto 0 0; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(310px, .65fr); gap: 15px; margin-top: 15px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(var(--surface-rgb),.9); }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 25px 18px; }
.panel-header h2, .section-toolbar h2 { margin: 6px 0 0; font-size: 1.45rem; letter-spacing: -.035em; }
.text-button { padding: 8px 0; border: 0; color: var(--muted); background: transparent; font-size: .82rem; cursor: pointer; }
.text-button span { margin-left: 7px; color: var(--mint); }
.assistant-list { padding: 0 12px 12px; }
.assistant-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 14px; min-height: 82px; padding: 12px; border-top: 1px solid rgba(var(--accent-rgb),.09); border-radius: 13px; cursor: pointer; transition: background .16s, transform .16s; }
.assistant-row:first-child { border-top: 0; }
.assistant-row:hover { background: rgba(var(--accent-rgb),.045); transform: translateX(2px); }
.assistant-row-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; max-width: 210px; }
.assistant-row-actions button, .assistant-table-actions button { padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: rgba(var(--ink-rgb),.025); font-size:12px; cursor: pointer; }
.assistant-row:focus-visible, .assistant-table-actions button:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
.assistant-avatar { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid rgba(var(--accent-rgb),.21); border-radius: 14px; color: var(--mint-soft); background: linear-gradient(145deg, var(--surface-3), var(--surface-2)); font-weight: 800; }
.assistant-info { min-width: 0; }
.assistant-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .96rem; }
.assistant-info p { margin: 5px 0 0; overflow: hidden; color: var(--muted); font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; color: var(--muted); background: rgba(var(--ink-rgb),.035); font-size:12px; font-weight: 700; }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.status-pill.is-connected::before { background: var(--mint); }
.assistant-info .status-pill { margin-top: 8px; }
.dashboard-status { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; color: var(--muted); font-size: .78rem; }
.workspace-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 24px; border-bottom: 1px solid var(--line); }
.workspace-plan { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: .78rem; }
.workspace-plan strong { margin-left: 6px; color: var(--text); }
.workspace-toolbar .workspace-switcher { padding: 0; }
.workspace-toolbar .workspace-switcher label { display: grid; }
.workspace-toolbar .workspace-switcher small { font-size:12px; }
.workspace-toolbar .workspace-switcher select { max-width: 300px; }
.launch-panel.is-complete .launch-ring { width: 72px; height: 72px; margin: 18px auto; }
.launch-panel.is-complete li { padding: 7px; }
.launch-panel.is-complete h2 { color: var(--mint-soft); }
.empty-state { display: grid; place-items: center; align-content: center; min-height: 340px; padding: 40px; text-align: center; }
.empty-state i { display: grid; place-items: center; width: 58px; height: 58px; border: 1px solid rgba(var(--accent-rgb),.25); border-radius: 18px; color: var(--mint); background: rgba(var(--accent-rgb),.06); font-size: 1.5rem; font-style: normal; }
.empty-state h3 { margin: 19px 0 8px; font-size: 1.15rem; }
.empty-state p { max-width: 360px; margin: 0 0 20px; color: var(--muted); font-size: .86rem; line-height: 1.55; }
.launch-panel { padding: 24px; }
.launch-panel header { display: flex; justify-content: space-between; align-items: center; }
.launch-panel header strong { color: var(--mint); font-size: .86rem; }
.launch-ring { position: relative; width: 116px; height: 116px; margin: 27px auto 22px; border-radius: 50%; background: conic-gradient(var(--mint) 0deg, rgba(var(--ink-rgb),.06) 0); }
.launch-ring::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.launch-ring b { position: absolute; z-index: 1; inset: 0; display: grid; place-items: center; font-size: 1.3rem; }
.launch-panel h2 { margin: 0 0 20px; font-size: 1.15rem; text-align: center; }
.launch-panel ol { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.launch-panel li { display: flex; align-items: center; gap: 12px; padding: 11px; border-radius: 12px; }
.launch-panel li:not(.is-done) { cursor: pointer; }
.launch-panel li:not(.is-done):hover { background: rgba(var(--ink-rgb),.035); }
.launch-panel li em { margin-left: auto; color: var(--mint); font-style: normal; }
.launch-panel li i { display: grid; place-items: center; flex: 0 0 30px; height: 30px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: .76rem; font-style: normal; }
.launch-panel li b, .launch-panel li small { display: block; }
.launch-panel li b { font-size: .8rem; }
.launch-panel li small { margin-top: 3px; color: var(--muted-2); font-size:12px; }
.launch-panel li.is-done { background: rgba(var(--accent-rgb),.045); }
.launch-panel li.is-done i { border-color: rgba(var(--accent-rgb),.25); color: var(--mint); background: rgba(var(--accent-rgb),.08); }

.section-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-toolbar p { margin: 7px 0 0; color: var(--muted); font-size: .88rem; }
.search-field { display: flex; align-items: center; min-width: 280px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.search-field span { padding-left: 13px; color: var(--muted-2); }
.search-field input { min-height: 44px; border: 0; background: transparent; box-shadow: none; }
.assistant-grid { overflow-x: auto; border: 1px solid var(--line); border-radius: 17px; background: rgba(var(--surface-rgb),.8); }
.team-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 16px; }
.team-panel, .invite-panel { min-width: 0; }
.support-access-panel { grid-column:1 / -1; padding:22px; }
.support-access-panel > header { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; margin-bottom:14px; }
.support-access-panel h2 { margin:8px 0 5px; }
.support-access-panel p { margin:0; max-width:780px; color:var(--muted); }
.support-access-actions { display:flex; gap:8px; }
.support-access-actions button { border:1px solid var(--line); border-radius:9px; padding:8px 10px; background:transparent; color:var(--accent); font:inherit; font-weight:800; }
.invite-panel { padding: 22px; }
.invite-panel h2 { margin: 12px 0 20px; }
.invite-panel form { display: grid; gap: 14px; }
.team-list { display: grid; gap: 8px; padding: 10px 18px 18px; }
.team-member { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; min-height: 64px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; background: rgba(var(--ink-rgb),.018); }
.team-member strong, .team-member small { display: block; }
.team-member small { margin-top: 4px; color: var(--muted); }
.team-member select { min-height: 36px; padding: 0 30px 0 10px; }
.team-member button { border: 0; color: var(--danger); background: transparent; cursor: pointer; }
.compact-team-list { max-height: 240px; margin-top: 18px; padding: 0; overflow: auto; }
.invite-link { grid-column: 1 / -1; display: flex; gap: 8px; }
.invite-link input { min-height: 38px; font-size: .75rem; }
.invite-link button { color: var(--mint); }
.billing-section { padding-bottom: 30px; }
.usage-panel { margin-bottom: 16px; padding: 22px; border: 1px solid rgba(var(--accent-rgb),.24); border-radius: 20px; background: linear-gradient(135deg, rgba(var(--accent-rgb),.09), rgba(var(--surface-rgb),.96) 42%); box-shadow: 0 0 34px rgba(var(--accent-rgb),.08); }
.usage-panel > header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.usage-panel header span { color: var(--mint); font-size: 12px; font-weight: 850; letter-spacing: .14em; }
.usage-panel h3 { margin: 5px 0 0; font-size: 1.2rem; }
.usage-panel header > strong { color: var(--muted); font-size: .82rem; }
.usage-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.usage-metrics article { min-height: 134px; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: rgba(var(--surface-rgb),.7); }
.usage-metrics article > span,.usage-metrics small { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; }
.usage-metrics article > strong { display: block; margin: 10px 0; font-size: 1.15rem; }
.usage-metrics article > div { height: 5px; margin: 12px 0 9px; overflow: hidden; border-radius: 99px; background: rgba(var(--ink-rgb),.08); }
.usage-metrics article > div i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--accent),var(--mint)); box-shadow: 0 0 12px rgba(var(--accent-rgb),.45); }
.plan-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.price-card { position: relative; display: flex; min-height: 380px; padding: 22px; overflow: hidden; flex-direction: column; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(150deg, rgba(var(--surface-rgb),.96), rgba(var(--surface-rgb),.96)); }
.price-card::before { position: absolute; inset: 0 0 auto; height: 2px; content: ""; background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb),.55), transparent); opacity: 0; }
.price-card.is-featured { border-color: rgba(var(--accent-rgb),.32); box-shadow: 0 18px 60px rgba(var(--accent-rgb),.13); }
.price-card.is-featured::before { opacity: 1; }
.price-card header { display: flex; min-height: 24px; align-items: center; justify-content: space-between; gap: 10px; }
.price-card header span { color: var(--mint); font-size:12px; font-weight: 850; letter-spacing: .15em; }
.price-card header em { padding: 5px 7px; border-radius: 999px; color: var(--surface); background: var(--mint); font-size:12px; font-style: normal; font-weight: 900; letter-spacing: .08em; }
.price-card h3 { margin: 28px 0 8px; font-size: 1.45rem; }
.price-card > strong { display: block; font-size: 1.75rem; letter-spacing: -.045em; }
.price-card > strong small { color: var(--muted); font-size:12px; font-weight: 600; letter-spacing: 0; }
.price-card > p { margin: 9px 0 18px; color: var(--muted); font-size: .86rem; }
.price-card ul { display: grid; gap: 11px; margin: 0 0 24px; padding: 18px 0 0; border-top: 1px solid var(--line); list-style: none; }
.price-card li { color: var(--muted); font-size: .82rem; line-height: 1.4; }
.price-card li::first-letter { color: var(--mint); }
.price-card .button { width: 100%; margin-top: auto; }
.price-card .button:disabled { cursor: default; opacity: .48; }
.billing-note { display: grid; grid-template-columns: .7fr 1fr 1.5fr; align-items: center; gap: 20px; margin-top: 16px; padding: 22px 24px; border: 1px solid var(--line); border-radius: 18px; background: rgba(var(--ink-rgb),.018); }
.billing-note span { color: var(--mint); font-size:12px; font-weight: 850; letter-spacing: .14em; }
.billing-note h3, .billing-note p { margin: 0; }
.billing-note h3 { font-size: 1rem; }
.billing-note p { color: var(--muted); font-size: .84rem; line-height: 1.55; }
.payment-history { margin-top: 16px; padding: 20px 22px; border: 1px solid var(--line); border-radius: 18px; background: rgba(var(--surface-rgb),.72); }
.payment-history > header { display:flex; align-items:end; justify-content:space-between; gap:16px; padding-bottom:14px; border-bottom:1px solid var(--line); }
.payment-history header span { color:var(--mint); font-size:12px; font-weight:850; letter-spacing:.14em; }
.payment-history h3 { margin:4px 0 0; font-size:1.05rem; }
.payment-history header small,.payment-empty { color:var(--muted); font-size:.8rem; }
.payment-row { display:grid; grid-template-columns:1fr auto auto; align-items:center; gap:18px; padding:14px 0; border-bottom:1px solid var(--line); }
.payment-row:last-child { border-bottom:0; }
.payment-row strong,.payment-row small { display:block; }
.payment-row small { margin-top:3px; color:var(--muted); font-size:12px; }
.payment-row > b { font-size:.9rem; }
.payment-empty { padding:18px 0 2px; }
.assistant-runtime { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; color: var(--muted); background: rgba(var(--ink-rgb),.035); font-size:12px; font-weight: 750; white-space: nowrap; }
.assistant-runtime i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.assistant-runtime.is-live { color: var(--mint-soft); background: rgba(var(--accent-rgb),.07); }
.assistant-runtime.is-live i { background: var(--mint); box-shadow: 0 0 11px rgba(var(--accent-rgb),.55); }
.assistant-table { min-width: 980px; }
.assistant-table-head, .assistant-table-row { display: grid; grid-template-columns: minmax(220px,1.25fr) minmax(145px,.75fr) minmax(240px,1.25fr) minmax(145px,.75fr) minmax(105px,.55fr) minmax(185px,.85fr); align-items: center; column-gap: 18px; }
.assistant-table-head { min-height: 44px; padding: 0 18px; border-bottom: 1px solid var(--line); color: var(--muted-2); background: rgba(var(--ink-rgb),.018); font-size:12px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.assistant-table-row { min-height: 92px; padding: 13px 18px; border-bottom: 1px solid rgba(var(--accent-rgb),.09); transition: background .16s; }
.assistant-table-row:last-child { border-bottom: 0; }
.assistant-table-row:hover { background: rgba(var(--accent-rgb),.035); }
.assistant-table-identity { display: flex; min-width: 0; align-items: center; gap: 12px; }
.assistant-table-identity > div, .assistant-table-cell { min-width: 0; }
.assistant-table-identity strong, .assistant-table-identity small, .assistant-table-cell strong, .assistant-table-cell small { display: block; }
.assistant-table-identity strong, .assistant-table-cell strong { overflow: hidden; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
.assistant-table-identity small, .assistant-table-cell small { margin-top: 5px; overflow: hidden; color: var(--muted); font-size:12px; text-overflow: ellipsis; white-space: nowrap; }
.assistant-table-bots > strong { color: var(--mint-soft); }
.assistant-bot-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.assistant-bot-chips em { overflow: hidden; max-width: 100%; padding: 3px 6px; border-radius: 6px; color: var(--mint-soft); background: rgba(var(--accent-rgb),.07); font-size:12px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.assistant-table-actions { display: flex; justify-content: flex-end; gap: 7px; }
.assistant-table-actions .assistant-open-action { border-color: rgba(var(--accent-rgb),.28); color: var(--on-accent); background: linear-gradient(135deg, var(--mint), var(--accent-solid)); font-weight: 800; }

.assistant-dialog { width: min(680px, calc(100% - 30px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 24px; color: var(--text); background: var(--surface-2); box-shadow: 0 40px 120px rgba(var(--surface-rgb),.7); }
.assistant-dialog::backdrop { background: rgba(var(--surface-rgb),.76); backdrop-filter: blur(8px); }
.assistant-dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 30px); }
.assistant-dialog form > header { display: flex; align-items: flex-start; justify-content: space-between; padding: 26px 28px 22px; border-bottom: 1px solid var(--line); }
.details-shell { display: flex; flex-direction: column; height: min(740px, calc(100vh - 30px)); }
.details-shell > form { flex: 1 1 auto; min-height: 0; max-height: none; }
.details-shell > form .dialog-body { flex: 1 1 auto; }
.details-shell > header { display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: space-between; padding: 26px 28px 20px; border-bottom: 1px solid var(--line); }
.assistant-dialog h2 { margin: 9px 0 6px; font-size: 1.7rem; letter-spacing: -.04em; }
.assistant-dialog header p { margin: 0; color: var(--muted); font-size: .86rem; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: var(--surface-2); cursor: pointer; }
.dialog-body { display: grid; gap: 19px; min-height: 0; padding: 24px 28px; overflow-y: auto; }
.field-label { color: var(--muted); font-size: .85rem; font-weight: 700; }
.template-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.assistant-wizard-progress { display:grid; grid-template-columns:repeat(5,1fr); gap:8px; margin-bottom:18px; }
.assistant-wizard-progress i { height:3px; border-radius:99px; background:var(--line-strong); }
.assistant-wizard-progress i.is-active { background:var(--accent); box-shadow:0 0 14px rgba(var(--accent-rgb),.35); }
.assistant-wizard-step { min-height:230px; }
.creation-next-step { display: grid; gap: 5px; margin-top: 14px; padding: 15px 16px; border: 1px solid rgba(var(--accent-rgb),.2); border-radius: 14px; background: rgba(var(--accent-rgb),.06); }
.creation-next-step span { color: var(--accent); font-size: .75rem; font-weight: 850; letter-spacing: .12em; }
.creation-next-step strong { font-size: .9rem; }
.creation-next-step p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.ai-draft-card.is-stale { border-color:rgba(232,168,67,.7); box-shadow:0 0 0 3px rgba(232,168,67,.08); }
.message-media-unsupported { display:block; margin-top:8px; color:var(--muted); font-size:12px; }
.composer-actions small { display:block; margin-top:5px; color:var(--muted); font-size:12px; white-space:nowrap; }
.template-option { position: relative; display: block; padding: 16px; border: 1px solid var(--line); border-radius: 14px; color: var(--muted); background: var(--surface); cursor: pointer; }
.template-option input { position: absolute; opacity: 0; pointer-events: none; }
.template-option strong, .template-option small { display: block; }
.template-option strong { color: var(--text); font-size: .9rem; }
.template-option small { margin-top: 5px; font-size:12px; }
.template-option span { display:block; margin-top:9px; color:var(--text); font-size:12px; line-height:1.45; opacity:.78; }
.creation-tone-preview { margin-top:14px; padding:16px 18px; border:1px solid rgba(var(--accent-rgb),.22); border-radius:14px; background:rgba(var(--accent-rgb),.06); }
.creation-tone-preview span { color:var(--muted); font-size:12px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.creation-tone-preview p { margin:9px 0 0; color:var(--text); font-size:15px; line-height:1.5; }
.template-option:has(input:checked) { border-color: rgba(var(--accent-rgb),.45); background: rgba(var(--accent-rgb),.07); box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb),.07); }
.template-option.is-preview { cursor: not-allowed; opacity: .58; }
.template-option em { position: absolute; top: 11px; right: 11px; padding: 4px 7px; border-radius: 999px; color: var(--gold); background: rgba(232,189,111,.08); font-size:12px; font-style: normal; font-weight: 800; letter-spacing: .08em; }
.assistant-dialog footer { display: flex; flex: 0 0 auto; justify-content: flex-end; gap: 10px; padding: 18px 28px 24px; border-top: 1px solid var(--line); background: var(--surface-2); }
.details-dialog { width: min(620px, calc(100% - 30px)); }
.details-tabs { display: grid; flex: 0 0 auto; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 14px 28px 0; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.details-tab { min-height: 39px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: .82rem; font-weight: 700; cursor: pointer; }
.details-tab.is-active { color: var(--text); background: var(--surface-3); box-shadow: 0 6px 18px rgba(var(--surface-rgb),.22); }
.connection-summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(var(--accent-rgb),.035); }
.connection-summary div { min-width: 0; }
.connection-summary strong, .connection-summary small { display: block; }
.connection-summary strong { font-size: .91rem; }
.connection-summary small { margin-top: 4px; color: var(--muted); font-size: .75rem; }
.setup-guide { display: flex; gap: 14px; padding: 3px 2px; }
.setup-number { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border: 1px solid var(--line-strong); border-radius: 11px; color: var(--mint); font-size:12px; font-weight: 800; }
.setup-guide strong { font-size: .9rem; }
.setup-guide p { margin: 5px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.setup-guide code { color: var(--mint-soft); }
.telegram-methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; border: 0; }
.telegram-methods legend { grid-column: 1 / -1; display: grid; gap: 5px; margin-bottom: 2px; }
.telegram-methods legend strong { font-size: 1rem; }
.telegram-method { position: relative; display: block; min-width: 0; padding: 17px 44px 17px 17px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); cursor: pointer; transition: border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease; }
.telegram-method:hover { border-color: rgba(var(--accent-rgb),.48); transform: translateY(-1px); }
.telegram-method:focus-within { outline: 3px solid rgba(var(--accent-rgb),.2); outline-offset: 2px; }
.telegram-method.is-selected { border-color: var(--accent); background: rgba(var(--accent-rgb),.08); box-shadow: 0 10px 28px rgba(var(--accent-rgb),.12); }
.telegram-method input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.telegram-method-check { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--line-strong); border-radius: 50%; color: transparent; font-size: 13px; font-weight: 900; }
.telegram-method.is-selected .telegram-method-check { border-color: var(--accent-solid); color: var(--on-accent); background: var(--accent-solid); }
.telegram-method h3 { margin: 8px 0; font-size: 16px; }
.telegram-method p, .telegram-method-note { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.telegram-test-step { display:grid; grid-template-columns:42px minmax(0,1fr); gap:13px; padding:16px; border:1px solid rgba(var(--accent-rgb),.35); border-radius:15px; background:rgba(var(--accent-rgb),.07); }
.telegram-test-step strong,.telegram-test-step p { display:block; margin:0; }
.telegram-test-step p { margin-top:6px; color:var(--muted); font-size:14px; line-height:1.5; }
.telegram-test-step>div>div { display:flex; flex-wrap:wrap; gap:8px; margin-top:13px; }
.telegram-business-next { display:grid; grid-template-columns:42px minmax(0,1fr); gap:13px; padding:16px; border:1px solid rgba(var(--accent-rgb),.35); border-radius:15px; background:rgba(var(--accent-rgb),.07); }
.telegram-business-next strong,.telegram-business-next p { display:block; margin:0; }
.telegram-business-next p { margin-top:6px; color:var(--muted); font-size:14px; line-height:1.5; }
.telegram-business-next ol { margin:12px 0; padding-left:20px; color:var(--muted); font-size:13px; line-height:1.7; }
.connector-diagnostics .is-waiting { color:var(--gold); }
.connection-stage-track { display:grid; gap:4px; margin:9px 0 0; padding:0; list-style:none; }
.connection-stage-track li { display:flex; gap:6px; align-items:center; color:var(--muted); font-size:12px; line-height:1.25; }
.connection-stage-track li i { width:13px; color:var(--muted-2); font-style:normal; text-align:center; }
.connection-stage-track li.is-done { color:var(--text); }
.connection-stage-track li.is-done i { color:var(--mint); }
.connection-action-error { padding-left:9px; border-left:2px solid var(--danger); color:var(--danger) !important; line-height:1.45; }
.connection-assistant-select { width:100%; min-height:40px; padding:8px 30px 8px 10px; border:1px solid var(--line); border-radius:10px; color:var(--text); background:var(--surface-2); font-weight:750; }
.bot-actions .is-danger { color:var(--danger,#b64242); }
@media (max-width: 700px) { .telegram-methods { grid-template-columns: 1fr; } }
.product-tour-dialog > section { width: min(520px, calc(100vw - 28px)); border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: 0 24px 70px rgba(0,0,0,.28); }
.product-tour-dialog .dialog-body { display: grid; justify-items: start; gap: 16px; padding: 26px; }
.product-tour-dialog .dialog-body p { margin: 0; color: var(--muted); font-size: .95rem; line-height: 1.65; }
.product-tour-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; color: var(--accent); background: rgba(var(--accent-rgb),.1); font-size: 1.45rem; }
.help-library { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.help-library > header { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.help-library h3 { margin: 5px 0 0; font-size: 1.15rem; }
.help-library .search-field { width: min(300px, 100%); }
.help-guide-list { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin-top: 18px; }
.help-guide-card { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 11px; min-height: 82px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: var(--surface); text-align: left; cursor: pointer; }
.help-guide-card:hover { border-color: rgba(var(--accent-rgb),.46); background: rgba(var(--accent-rgb),.04); }
.help-guide-card > i { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: var(--accent); background: rgba(var(--accent-rgb),.09); font-style: normal; }
.help-guide-card strong,.help-guide-card small { display: block; }
.help-guide-card small { margin-top: 3px; color: var(--muted); font-size: .75rem; }
.help-guide-dialog > section { width: min(700px,calc(100vw - 28px)); border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
.help-guide-dialog .dialog-body { display: grid; gap: 18px; max-height: min(65vh,650px); overflow: auto; }
.help-guide-block { padding: 14px 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.help-guide-block strong { display: block; margin-bottom: 5px; font-size: .8rem; }
.help-guide-block p,.help-guide-block ol { margin: 0; color: var(--muted); line-height: 1.55; }
.help-guide-block ol { padding-left: 20px; }
.help-guide-version { margin: 0; color: var(--muted); font-size: .75rem; }
@media(max-width:900px){.help-guide-list{grid-template-columns:repeat(2,minmax(0,1fr));}}
@media(max-width:620px){.help-library>header{align-items:stretch;flex-direction:column}.help-library .search-field{width:100%}.help-guide-list{grid-template-columns:1fr;}}
.business-accounts-block { display: grid; gap: 10px; }
.business-accounts-block > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.business-accounts-block > div:first-child small { color: var(--muted); font-size: .75rem; }
.business-account-list { display: grid; gap: 7px; }
.business-account { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.business-account > div { min-width: 0; }
.business-account strong, .business-account small { display: block; }
.business-account strong { font-size: .86rem; }
.business-account small { margin-top: 3px; color: var(--muted); font-size:12px; }
.business-account em { margin-left: auto; color: var(--mint); font-size:12px; font-style: normal; }
.telegram-connector { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(145deg, rgba(var(--surface-rgb),.95), rgba(var(--surface-rgb),.98)); }
.telegram-connector > header { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 14px; }
.connector-diagnostics { display:flex; flex-wrap:wrap; gap:7px 14px; padding:9px 14px; border-top:1px solid var(--line); border-bottom:1px solid var(--line); color:var(--muted-2); font-size:12px; }
.connector-diagnostics .is-ok { color:var(--mint-soft); }
.connector-diagnostics .is-error { color:var(--danger); }
.connector-index { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(var(--accent-rgb),.25); border-radius: 12px; color: var(--mint); background: rgba(var(--accent-rgb),.07); font-size:12px; font-weight: 800; }
.telegram-connector header div { min-width: 0; }
.telegram-connector header small, .telegram-connector header strong, .telegram-connector header a { display: block; }
.telegram-connector header small { margin-bottom: 3px; color: var(--muted-2); font-size:12px; font-weight: 800; letter-spacing: .12em; }
.telegram-connector header strong { overflow: hidden; font-size: .9rem; text-overflow: ellipsis; white-space: nowrap; }
.telegram-connector header a { margin-top: 3px; color: var(--mint-soft); font-size:12px; text-decoration: none; }
.connector-state { padding: 6px 9px; border: 1px solid rgba(232,189,111,.18); border-radius: 999px; color: var(--gold); background: rgba(232,189,111,.07); font-size:12px; font-style: normal; white-space: nowrap; }
.connector-state.is-live { border-color: rgba(var(--accent-rgb),.2); color: var(--mint); background: rgba(var(--accent-rgb),.07); }
.connector-branch { position: relative; display: grid; grid-template-columns: 27px minmax(0,1fr); padding: 0 14px 14px 22px; }
.branch-line { position: relative; border-left: 1px solid rgba(var(--accent-rgb),.22); border-bottom: 1px solid rgba(var(--accent-rgb),.22); border-bottom-left-radius: 9px; transform: translateY(-13px); }
.connector-account-list { display: grid; gap: 7px; }
.connector-account { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 10px 11px; border: 1px solid rgba(var(--accent-rgb),.12); border-radius: 11px; background: rgba(var(--ink-rgb),.018); }
.connector-account .dialogue-avatar { width: 38px; height: 38px; }
.connector-account small, .connector-account strong, .connector-account p { display: block; margin: 0; }
.connector-account small { color: var(--muted-2); font-size:12px; font-weight: 800; letter-spacing: .1em; }
.connector-account strong { margin-top: 2px; font-size: .82rem; }
.connector-account p { margin-top: 2px; color: var(--muted); font-size:12px; }
.connector-account em { color: var(--mint); font-size:12px; font-style: normal; }
.connector-empty { display: flex; gap: 10px; align-items: center; padding: 11px 12px; border: 1px dashed rgba(232,189,111,.22); border-radius: 11px; color: var(--muted); background: rgba(232,189,111,.025); }
.connector-empty > i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px rgba(232,189,111,.35); }
.connector-empty strong, .connector-empty small { display: block; }
.connector-empty strong { color: var(--text); font-size: .77rem; }
.connector-empty small { margin-top: 3px; font-size:12px; line-height: 1.4; }
.details-dialog label small { color: var(--muted-2); font-size:12px; font-weight: 500; line-height: 1.45; }
.toggle-field { display: flex; align-items: center; justify-content: space-between; min-height: 74px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.toggle-field span, .toggle-field b, .toggle-field small { display: block; }
.toggle-field b { color: var(--text); font-size: .84rem; }
.toggle-field small { margin-top: 4px; }
.toggle-field input { width: 42px; min-height: 24px; height: 24px; accent-color: var(--mint); }
.quiet-hours-fields { padding: 14px; border: 1px dashed var(--line); border-radius: 13px; background: rgba(var(--ink-rgb),.015); }
.response-delay-setting { display: grid; padding: 15px; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 18px; border: 1px solid rgba(var(--accent-rgb),.17); border-radius: 13px; background: rgba(var(--accent-rgb),.035); }
.response-delay-setting > div:first-child b, .response-delay-setting > div:first-child small { display: block; }
.response-delay-setting > div:first-child b { font-size: .86rem; }
.response-delay-setting > div:first-child small { max-width: 330px; margin-top: 5px; color: var(--muted); font-size:12px; line-height: 1.45; }
.automation-guard-settings { display: grid; gap: 12px; padding: 15px; border: 1px solid rgba(244,122,136,.18); border-radius: 13px; background: rgba(244,122,136,.025); }
.automation-guard-settings > div:first-child b, .automation-guard-settings > div:first-child small { display: block; }
.automation-guard-settings > div:first-child b { font-size: .86rem; }
.automation-guard-settings > div:first-child small { margin-top: 5px; color: var(--muted); font-size:12px; line-height: 1.45; }
.automation-guard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.automation-guard-grid .toggle-field { min-height: 64px; padding: 10px 12px; }
.automation-guard-settings > p { margin: 0; color: var(--danger); font-size:12px; line-height: 1.4; }
.followup-settings { border-color: var(--line); background: transparent; }
.followup-settings > p { color: var(--muted); }
.response-delay-range { display: flex; align-items: end; gap: 8px; }
.response-delay-range > i { padding-bottom: 12px; color: var(--muted-2); font-style: normal; }
.response-delay-range label { gap: 5px; color: var(--muted); font-size:12px; }
.response-delay-range label > span { display: flex; align-items: center; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.response-delay-range input { width: 66px; min-height: 36px; padding: 0 7px; border: 0; background: transparent; box-shadow: none; text-align: right; }
.response-delay-range em { padding-right: 8px; color: var(--muted-2); font-size:12px; font-style: normal; }
.learning-intro { display: flex; gap: 13px; padding: 15px; border: 1px solid rgba(var(--accent-rgb),.18); border-radius: 14px; background: rgba(var(--accent-rgb),.045); }
.learning-intro > span { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 11px; color: var(--mint); background: rgba(var(--accent-rgb),.09); font-size:12px; font-weight: 800; }
.learning-intro strong { font-size: .88rem; }
.learning-intro p { margin: 5px 0 0; color: var(--muted); font-size:12px; line-height: 1.45; }
.learning-list { display: grid; gap: 8px; margin-top: 10px; }
.learning-example { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 12px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.learning-example strong, .learning-example small { display: block; }
.learning-example strong { overflow: hidden; color: var(--text); font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.learning-example small { margin-top: 4px; overflow: hidden; color: var(--muted); font-size:12px; text-overflow: ellipsis; white-space: nowrap; }
.learning-example button { border: 0; color: var(--danger); background: transparent; font-size:12px; cursor: pointer; }
.learning-list .empty-state { min-height: 0; padding: 20px 8px; }
.learning-list .empty-state p { margin: 0; }
.owner-memory-panel { display: grid; gap: 13px; padding: 16px; border: 1px solid rgba(var(--accent-rgb),.25); border-radius: 15px; background: linear-gradient(135deg, rgba(var(--accent-rgb),.07), rgba(var(--accent-rgb),.015)); }
.owner-memory-panel > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.owner-memory-panel > header strong, .owner-memory-panel > header p { display: block; }
.owner-memory-panel > header strong { margin-top: 5px; font-size: .92rem; }
.owner-memory-panel > header p { max-width: 560px; margin: 5px 0 0; color: var(--muted); font-size:12px; line-height: 1.45; }
.owner-memory-toggle { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; cursor: pointer; }
.owner-memory-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.owner-memory-toggle span { position: relative; width: 42px; height: 24px; border: 1px solid var(--line-strong); border-radius: 99px; background: var(--surface); transition: .18s ease; }
.owner-memory-toggle span::after { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); content: ""; transition: .18s ease; }
.owner-memory-toggle input:checked + span { border-color: rgba(var(--accent-rgb),.6); background: rgba(var(--accent-rgb),.18); }
.owner-memory-toggle input:checked + span::after { left: 21px; background: var(--mint); box-shadow: 0 0 14px rgba(var(--accent-rgb),.45); }
.owner-memory-toggle b { min-width: 66px; color: var(--muted); font-size:12px; }
.owner-memory-toggle input:checked ~ b { color: var(--mint-soft); }
.owner-memory-status { padding: 9px 11px; border-radius: 10px; color: var(--muted); background: rgba(var(--surface-rgb),.2); font-size:12px; }
.owner-memory-add { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.owner-memory-add input { grid-column: 1 / -1; min-width: 0; }
.owner-memory-add .button { min-width: 0; white-space: normal; }
.owner-memory-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.owner-fact-list { display: grid; gap: 6px; margin-top: 8px; }
.owner-fact { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: rgba(var(--surface-rgb),.65); font-size:12px; line-height: 1.4; }
.owner-fact button { border: 0; color: var(--danger); background: none; cursor: pointer; }
.owner-fact-list > small { color: var(--muted-2); font-size:12px; }
.draft-edit-error { margin: 0 0 8px; padding: 9px 11px; border: 1px solid rgba(244,122,136,.3); border-radius: 9px; color: var(--danger); background: rgba(244,122,136,.07); font-size:12px; }
.owner-memory-card { border-color: rgba(var(--accent-rgb),.22) !important; background: rgba(var(--accent-rgb),.035) !important; }
.owner-memory-card button { width: 100%; margin-top: 9px; }
.safety-card { padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.safety-card > span { color: var(--mint); font-size:12px; font-weight: 800; letter-spacing: .12em; }
.safety-card h3 { margin: 9px 0 6px; font-size: 1rem; }
.safety-card p { margin: 0 0 15px; color: var(--muted); font-size: .81rem; line-height: 1.55; }
.toast { position: fixed; z-index: 100; right: 26px; bottom: 26px; max-width: 360px; padding: 13px 16px; border: 1px solid rgba(var(--accent-rgb),.28); border-radius: 12px; color: var(--mint-soft); background: var(--surface-2); box-shadow: 0 18px 50px rgba(var(--surface-rgb),.4); opacity: 0; transform: translateY(15px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.telegram-mini-app .app-shell { min-height: var(--tg-viewport-height, 100vh); }

.content.is-dialogue-view { display: flex; height: calc(100dvh - 174px); min-height: 420px; padding: 12px; overflow: hidden; }
.dialogues-section { display: grid; flex: 1; min-width: 0; min-height: 0; grid-template-rows: 70px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: rgba(var(--surface-rgb),.84); box-shadow: 0 24px 80px rgba(var(--surface-rgb),.24); }
.assistant-context-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(var(--surface-rgb),.96), rgba(var(--surface-rgb),.96)); }
.assistant-context-identity, .assistant-context-actions { display: flex; align-items: center; gap: 12px; }
.assistant-settings-scope { display: grid; justify-items: end; gap: 4px; }
.assistant-settings-scope > small { color: var(--muted-2); font-size:12px; font-weight: 800; letter-spacing: .13em; }
.assistant-settings-scope .button { display: flex; align-items: center; gap: 10px; }
.assistant-settings-scope .button span { color: var(--mint-soft); font-size:12px; font-weight: 750; }
.assistant-settings-scope .button b { padding-left: 10px; border-left: 1px solid var(--line); color: var(--text); font-size:12px; }
.global-auto-scope { position: relative; display: grid; justify-items: end; gap: 4px; }
.global-auto-scope > small { color: var(--muted-2); font-size:12px; font-weight: 800; letter-spacing: .13em; }
.global-auto-row { display: flex; align-items: stretch; min-height: 38px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface); }
.global-auto-row > span { display: inline-flex; align-items: center; padding: 0 10px; color: var(--muted); font-size:12px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.global-auto-row > span.is-active { color: var(--mint-soft); }
.global-auto-row button { padding: 0 10px; border: 0; border-radius: 8px; color: var(--text); background: rgba(var(--ink-rgb),.055); font: inherit; font-size:12px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.global-auto-row button:hover { background: rgba(var(--accent-rgb),.1); }
.global-auto-row button:last-child { min-width: 58px; margin-left: 3px; padding: 0 8px; color: var(--muted); }
.global-auto-row button:disabled { cursor: wait; opacity: .55; }
.global-auto-menu { position: absolute; z-index: 15; top: calc(100% + 8px); right: 0; display: grid; width: 260px; padding: 7px; border: 1px solid var(--line-strong); border-radius: 13px; background: var(--surface); box-shadow: 0 20px 55px rgba(var(--surface-rgb),.52); }
.global-auto-menu button { display: grid; gap: 3px; padding: 10px 11px; border: 0; border-radius: 9px; color: var(--text); text-align: left; background: transparent; cursor: pointer; }
.global-auto-menu button:hover { background: rgba(var(--accent-rgb),.08); }
.global-auto-menu button b { font-size:12px; }
.global-auto-menu button small { color: var(--muted); font-size:12px; }
.assistant-context-identity label { min-width: 220px; gap: 2px; }
.assistant-context-identity label em { display: block; margin-top: 2px; color: var(--muted-2); font-size:12px; font-style: normal; }
.assistant-context-identity small { color: var(--muted-2); font-size:12px; letter-spacing: .14em; }
.assistant-context-identity select { min-height: 30px; padding: 0 24px 0 0; border: 0; border-radius: 0; background: transparent; font-size: 1rem; font-weight: 750; box-shadow: none; }
.button-compact { min-height: 38px; padding: 0 14px; font-size: .83rem; }
.runtime-status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .81rem; }
.runtime-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.runtime-status.is-running i { background: var(--mint); box-shadow: 0 0 12px rgba(var(--accent-rgb),.5); }
.dialogue-workspace { display: grid; min-width: 0; min-height: 0; grid-template-columns: 286px minmax(430px, 1fr) 270px; }
.dialogue-list-panel, .conversation-panel, .person-panel { min-width: 0; min-height: 0; }
.dialogue-list-panel { display: grid; grid-template-rows: auto auto minmax(0, 1fr); border-right: 1px solid var(--line); background: rgba(var(--surface-rgb),.78); }
.dialogue-list-panel > header { display: grid; gap: 11px; padding: 15px 12px 11px; }
.dialogue-list-panel > header > div:first-child { display: flex; align-items: center; justify-content: space-between; }
.dialogue-list-panel > header > div:first-child span, .person-panel > header span { color: var(--mint); font-size:12px; font-weight: 800; letter-spacing: .14em; }
.dialogue-list-panel > header > div:first-child b { color: var(--muted); font-size: .78rem; }
.compact-search { min-width: 0; }
.compact-search input { min-height: 42px; font-size: .88rem; }
.account-filter { min-height: 42px; padding: 0 34px 0 11px; border-color: rgba(var(--accent-rgb),.18); background-color: rgba(var(--surface-rgb),.92); font-size: .78rem; font-weight: 700; }
#followup-button { width: auto; min-width: 34px; padding: 0 7px; font-size:12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
#followup-button.is-followup-waiting { color: var(--mint-soft); border-color: var(--mint); }
#followup-dialog .dialog-body > p { margin: 0; color: var(--muted); font-size: .85rem; line-height: 1.45; }
.telegram-channel-heading { display: grid; gap: 3px; padding-top: 2px; }
.telegram-channel-heading strong { color: var(--muted); font-size:12px; letter-spacing: .12em; }
.telegram-channel-heading small { color: var(--muted-2); font-size:12px; line-height: 1.3; }
.telegram-channel-tabs { display: grid; gap: 6px; }
@media (max-height: 780px) {
  .telegram-channel-tabs, .telegram-channel-heading small { display: none; }
  #account-filter { display: block !important; grid-row: 3; }
  .dialogue-list-panel > header { gap: 7px; padding-top: 10px; }
}
.telegram-channel { display: grid; width: 100%; grid-template-columns: 30px minmax(0,1fr) auto; gap: 9px; align-items: center; min-height: 50px; padding: 7px 9px; border: 1px solid rgba(var(--accent-rgb),.1); border-radius: 11px; color: inherit; text-align: left; background: rgba(var(--ink-rgb),.018); cursor: pointer; }
.telegram-channel:hover { border-color: rgba(var(--accent-rgb),.25); background: rgba(var(--accent-rgb),.035); }
.telegram-channel.is-active { border-color: rgba(var(--accent-rgb),.38); background: linear-gradient(90deg, rgba(var(--accent-rgb),.13), rgba(var(--accent-rgb),.035)); box-shadow: inset 3px 0 var(--mint); }
.telegram-channel > i { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: var(--mint-soft); background: rgba(var(--accent-rgb),.09); font-size:12px; font-style: normal; font-weight: 800; }
.telegram-channel span, .telegram-channel strong, .telegram-channel small { display: block; min-width: 0; }
.telegram-channel strong { overflow: hidden; font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.telegram-channel small { margin-top: 3px; overflow: hidden; color: var(--muted-2); font-size:12px; text-overflow: ellipsis; white-space: nowrap; }
.telegram-channel > em { display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 8px; color: var(--muted); background: rgba(var(--ink-rgb),.04); font-size:12px; font-style: normal; font-weight: 800; }
.telegram-channel > em.is-live { color: var(--on-accent); background: var(--mint); }
.connection-architecture { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 10px; align-items: center; margin-bottom: 14px; padding: 13px; border: 1px solid rgba(var(--accent-rgb),.15); border-radius: 14px; background: rgba(var(--accent-rgb),.035); }
.connection-architecture > div { display: flex; gap: 9px; align-items: center; min-width: 0; }
.connection-architecture i { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; border-radius: 9px; color: var(--mint-soft); background: rgba(var(--accent-rgb),.1); font-size:12px; font-style: normal; font-weight: 850; }
.connection-architecture span, .connection-architecture b, .connection-architecture small { display: block; min-width: 0; }
.connection-architecture b { font-size:12px; letter-spacing: .06em; }
.connection-architecture small { margin-top: 2px; color: var(--muted-2); font-size:12px; line-height: 1.3; }
.connection-architecture > strong { color: var(--mint); font-size: .8rem; }
.dialogue-filter-stack { display: grid; gap: 7px; padding: 5px 9px 10px; border-bottom: 1px solid var(--line); }
.dialogue-filters { display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: 4px; }
.dialogue-filters button { min-height: 35px; padding: 0 7px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: .75rem; cursor: pointer; }
.dialogue-filters button.is-active { color: var(--mint-soft); background: rgba(var(--accent-rgb),.09); }
.dialogue-mode-filter { display: grid; gap: 5px; }
.dialogue-mode-filter > span { padding-left: 4px; color: var(--muted-2); font-size:12px; font-weight: 800; letter-spacing: .13em; }
#dialogue-mode-filters { display: grid; padding: 3px; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; border: 1px solid rgba(var(--accent-rgb),.1); border-radius: 10px; background: rgba(var(--ink-rgb),.018); }
#dialogue-mode-filters button { display: flex; min-width: 0; min-height: 31px; padding: 0 6px; align-items: center; justify-content: center; gap: 5px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size:12px; font-weight: 720; cursor: pointer; }
#dialogue-mode-filters button b { display: grid; min-width: 18px; height: 18px; padding: 0 4px; place-items: center; border-radius: 6px; color: var(--muted-2); background: rgba(var(--ink-rgb),.045); font-size:12px; }
#dialogue-mode-filters button.is-active { color: var(--on-accent); background: linear-gradient(135deg, var(--mint), var(--accent-solid)); box-shadow: 0 5px 14px rgba(var(--accent-rgb),.12); }
#dialogue-mode-filters button.is-active b { color: var(--mint-soft); background: rgba(var(--surface-rgb),.68); }
.runtime-dialogue-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.runtime-dialogue { position: relative; display: grid; width: 100%; grid-template-columns: 42px minmax(0,1fr) auto; gap: 11px; align-items: center; min-height: 78px; padding: 11px 12px; border: 0; border-bottom: 1px solid rgba(var(--accent-rgb),.08); color: inherit; text-align: left; background: transparent; cursor: pointer; }
.runtime-dialogue:hover { background: rgba(var(--ink-rgb),.025); }
.runtime-dialogue.is-active { background: linear-gradient(90deg, rgba(var(--accent-rgb),.12), rgba(var(--accent-rgb),.035)); box-shadow: inset 3px 0 var(--mint); }
.runtime-dialogue.is-auto-mode:not(.is-active) { background: linear-gradient(90deg, rgba(var(--accent-rgb),.055), transparent 76%); box-shadow: inset 2px 0 rgba(var(--accent-rgb),.42); }
.runtime-dialogue.is-auto-mode .dialogue-avatar { border-color: rgba(var(--accent-rgb),.38); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.045), 0 0 18px rgba(var(--accent-rgb),.08); }
.dialogue-avatar { position: relative; overflow: hidden; display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(var(--accent-rgb),.18); border-radius: 13px; color: var(--mint-soft); background: var(--surface-2); font-size: .78rem; font-weight: 800; }
#conversation-avatar { position: relative; overflow: hidden; }
.telegram-avatar-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.telegram-avatar-photo[hidden] { display: none; }
.dialogue-copy, .dialogue-copy strong, .dialogue-copy small, .dialogue-copy em { display: block; min-width: 0; }
.dialogue-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.dialogue-copy small { margin-top: 5px; overflow: hidden; color: var(--muted); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.dialogue-copy em { display: flex; gap: 5px; align-items: center; margin-top: 5px; color: var(--muted-2); font-size:12px; font-style: normal; }
.dialogue-copy em b { overflow: hidden; max-width: 112px; padding: 2px 5px; border: 1px solid rgba(var(--accent-rgb),.13); border-radius: 5px; color: var(--mint); background: rgba(var(--accent-rgb),.06); font-size: inherit; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.dialogue-copy em span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialogue-side { align-self: stretch; display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; }
.dialogue-side time { color: var(--muted-2); font-size:12px; }
.dialogue-side b { display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 8px; color: var(--on-accent); background: var(--gold); font-size:12px; }
.dialogue-side-bottom { display: flex; align-items: center; gap: 5px; }
.dialogue-auto-badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 7px; border: 1px solid rgba(var(--accent-rgb),.28); border-radius: 7px; color: var(--mint-soft); background: rgba(var(--accent-rgb),.1); font-size:12px; font-style: normal; font-weight: 850; letter-spacing: .08em; }
.dialogue-auto-badge i { width: 5px; height: 5px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0 rgba(var(--accent-rgb),.5); animation: auto-mode-pulse 1.8s ease-out infinite; }
.dialogue-queue-countdown { margin-left: 2px; padding-left: 6px; border-left: 1px solid rgba(var(--accent-rgb),.22); font-size:12px; letter-spacing: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.runtime-dialogue.is-review-required { box-shadow: inset 3px 0 var(--danger); }
.dialogue-review-badge { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border: 1px solid rgba(244,122,136,.3); border-radius: 7px; color: var(--danger); background: rgba(244,122,136,.08); font-size:12px; font-style: normal; font-weight: 850; letter-spacing: .04em; }
.list-empty { display: grid; place-items: center; align-content: center; gap: 9px; min-height: 260px; padding: 24px; text-align: center; }
.list-empty strong { font-size: .92rem; }
.list-empty span { color: var(--muted); font-size: .8rem; line-height: 1.5; }
.list-empty .button { margin-top: 7px; }
.conversation-panel { position: relative; border-right: 1px solid var(--line); background: radial-gradient(circle at 85% 0, rgba(41,100,102,.09), transparent 35%), var(--surface); }
.conversation-active { display: grid; height: 100%; min-width: 0; min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: 76px minmax(0, 1fr) auto; }
.conversation-header { display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--line); background: rgba(var(--surface-rgb),.96); }
.conversation-header .assistant-avatar { width: 42px; height: 42px; border-radius: 13px; }
.conversation-header > div { min-width: 0; }
.conversation-header h2 { margin: 0; overflow: hidden; font-size: 1.02rem; text-overflow: ellipsis; white-space: nowrap; }
.conversation-header p { margin: 4px 0 0; overflow: hidden; color: var(--muted); font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
.conversation-automation-hold { display: block; max-width: 220px; margin-top: 4px; overflow: hidden; color: var(--danger); font-size:12px; font-style: normal; font-weight: 850; letter-spacing: .045em; text-overflow: ellipsis; white-space: nowrap; }
.conversation-header > div:not(.conversation-header-actions) { flex: 1; }
.conversation-header-actions { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.conversation-header-actions .status-pill { margin-right: 4px; }
.chat-settings-scope { display: grid; gap: 4px; width: 146px; }
.chat-settings-scope > small { overflow: hidden; color: var(--mint-soft); font-size:12px; font-weight: 850; letter-spacing: .06em; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chat-state-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 82px; height: 36px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--text); background: var(--surface-2); font: inherit; font-size:12px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.chat-state-button:hover { border-color: rgba(var(--accent-rgb),.34); background: rgba(var(--accent-rgb),.08); }
.chat-state-button.is-start { border-color: rgba(var(--accent-rgb),.45); color: var(--on-accent); background: linear-gradient(135deg, var(--mint), var(--accent-solid)); box-shadow: 0 6px 18px rgba(var(--accent-rgb),.16); }
.chat-state-button:disabled { cursor: wait; opacity: .6; }
.conversation-active.is-auto-mode .conversation-header { border-bottom-color: rgba(var(--accent-rgb),.3); background: linear-gradient(90deg, rgba(var(--surface-rgb),.98) 48%, rgba(var(--surface-rgb),.58)); box-shadow: inset 0 -1px rgba(var(--accent-rgb),.08); }
.conversation-active.is-auto-mode .conversation-header h2::after { content: "ИИ отвечает сам"; display: inline-flex; align-items: center; min-height: 20px; margin-left: 9px; padding: 0 7px; border: 1px solid rgba(var(--accent-rgb),.25); border-radius: 7px; color: var(--mint-soft); background: rgba(var(--accent-rgb),.08); font-size:12px; font-weight: 800; letter-spacing: .06em; vertical-align: 3px; }
.chat-response-mode { display: flex; padding: 3px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface); }
.chat-response-mode button { min-width: 70px; height: 30px; padding: 0 10px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font: inherit; font-size:12px; font-weight: 750; cursor: pointer; }
.chat-response-mode button.is-active { color: var(--on-accent); background: linear-gradient(135deg, var(--mint), var(--accent-solid)); box-shadow: 0 5px 15px rgba(var(--accent-rgb),.16); }
.chat-response-mode button[data-chat-response-mode="automatic"].is-active::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--on-accent); box-shadow: 0 0 0 0 rgba(var(--surface-rgb),.4); animation: auto-mode-pulse-dark 1.8s ease-out infinite; vertical-align: 1px; }
.chat-response-mode button:disabled { cursor: wait; opacity: .58; }

@keyframes auto-mode-pulse {
  0% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb),.5); }
  70% { box-shadow: 0 0 0 6px rgba(var(--accent-rgb),0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb),0); }
}
@keyframes auto-mode-pulse-dark {
  0% { box-shadow: 0 0 0 0 rgba(var(--surface-rgb),.4); }
  70% { box-shadow: 0 0 0 5px rgba(var(--surface-rgb),0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--surface-rgb),0); }
}
@media (prefers-reduced-motion: reduce) {
  .dialogue-auto-badge i,
  .chat-response-mode button[data-chat-response-mode="automatic"].is-active::before,
  .draft-send-status i { animation: none; }
}
.danger-icon { color: var(--danger); }
.mobile-back { display: none; }
.conversation-messages { display: flex; flex-direction: column; gap: 9px; min-height: 0; padding: 18px 20px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.message { width: fit-content; max-width: min(74%, 620px); padding: 10px 12px 7px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-2); box-shadow: 0 8px 24px rgba(var(--surface-rgb),.08); }
.message.is-outgoing { align-self: flex-end; border-color: rgba(var(--accent-rgb),.19); border-bottom-right-radius: 5px; background: var(--surface-3); }
.message.is-incoming { align-self: flex-start; border-bottom-left-radius: 5px; }
.message p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .91rem; line-height: 1.45; }
.message time { display: block; margin-top: 4px; color: var(--muted-2); font-size:12px; text-align: right; }
.message-media { display: block; margin-top: 8px; padding: 6px 9px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--mint-soft); background: rgba(var(--accent-rgb),.06); font-size: .75rem; cursor: pointer; }
.security-warning { display: block; margin-top: 8px; padding: 6px 8px; border: 1px solid rgba(244,122,136,.25); border-radius: 8px; color: var(--danger); background: rgba(244,122,136,.07); font-size:12px; line-height: 1.35; }
.conversation-empty { display: grid; height: 100%; place-items: center; align-content: center; padding: 30px; text-align: center; }
.conversation-empty i { display: grid; place-items: center; width: 56px; height: 56px; border: 1px solid var(--line-strong); border-radius: 18px; color: var(--mint); font-style: normal; background: rgba(var(--accent-rgb),.05); }
.conversation-empty h2 { margin: 17px 0 7px; font-size: 1.25rem; }
.conversation-empty p { margin: 0; color: var(--muted); font-size: .86rem; }
.conversation-empty.compact { height: auto; min-height: 180px; }
.conversation-dock { position: relative; z-index: 3; display: grid; gap: 9px; padding: 10px; border-top: 1px solid var(--line); background: rgba(var(--surface-rgb),.98); box-shadow: 0 -18px 45px rgba(var(--surface-rgb),.17); }
.ai-draft-card { display: grid; gap: 8px; padding: 11px 12px; border: 1px solid rgba(232,189,111,.32); border-radius: 14px; background: linear-gradient(100deg, rgba(var(--surface-rgb),.46), rgba(var(--surface-rgb),.84)); }
.ai-draft-card > header { display: grid; grid-template-columns: max-content minmax(0,1fr); align-items: center; gap: 14px; min-width: 0; }
.draft-card-heading { display: inline-flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; }
.draft-card-heading span { color: var(--gold); font-size:12px; font-weight: 800; letter-spacing: .08em; }
.ai-draft-card > header em { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border: 1px solid rgba(var(--accent-rgb),.24); border-radius: 999px; color: var(--mint-soft); font-size:12px; font-style: normal; letter-spacing: 0; white-space: nowrap; }
.ai-draft-card > header em.is-weak { border-color: rgba(244,122,136,.3); color: var(--danger); }
.ai-draft-card > header small { min-width: 0; overflow: hidden; color: var(--muted); font-size:12px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.draft-send-status { display: flex; align-items: center; gap: 8px; min-height: 28px; padding: 5px 9px; border: 1px solid rgba(var(--accent-rgb),.2); border-radius: 9px; color: var(--mint-soft); background: rgba(var(--accent-rgb),.07); font-size:12px; font-weight: 750; font-variant-numeric: tabular-nums; }
.draft-send-status span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-send-status i { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0 rgba(var(--accent-rgb),.45); animation: auto-mode-pulse 1.8s ease-out infinite; }
.draft-send-status.is-waiting { border-color: rgba(232,189,111,.22); color: var(--gold); background: rgba(232,189,111,.06); }
.draft-send-status.is-waiting i { background: var(--gold); animation: none; }
.ai-draft-card > p { margin: 0; overflow-wrap: anywhere; font-size: .94rem; line-height: 1.4; }
.ai-draft-card textarea { min-height: 60px; max-height: 120px; resize: vertical; font-size: .92rem; }
.draft-actions { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)) auto; gap: 7px; align-items: stretch; }
.draft-actions .button { min-width: 0; min-height: 39px; padding: 0 11px; border-radius: 10px; font-size: .78rem; white-space: nowrap; }
.draft-actions .text-danger { min-height: 39px; white-space: nowrap; }
.text-danger { padding: 0 10px; border: 0; color: var(--danger); background: transparent; font-size: .76rem; cursor: pointer; }
.variant-panel { padding: 10px; border: 1px solid var(--line-strong); border-radius: 13px; background: var(--surface); }
.variant-panel > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.variant-panel > header strong { font-size: .82rem; }
.variant-panel > header button { width: 28px; height: 28px; border: 0; color: var(--muted); background: transparent; font-size: 1.2rem; cursor: pointer; }
.variant-panel > div { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; max-height: 142px; overflow-y: auto; }
.variant-panel > div > button { min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); text-align: left; background: var(--surface-2); cursor: pointer; }
.variant-panel > div > button:hover { border-color: var(--line-strong); background: rgba(var(--accent-rgb),.06); }
.variant-panel button span, .variant-panel button strong { display: block; }
.variant-panel button span { color: var(--mint); font-size:12px; font-weight: 800; }
.variant-panel button strong { margin-top: 5px; overflow: hidden; font-size: .76rem; font-weight: 600; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.composer-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px; align-items: end; }
.composer-row textarea { min-height: 54px; max-height: 110px; resize: vertical; font-size: .9rem; }
.composer-actions { display: flex; gap: 7px; }
.composer-actions .button { min-height: 54px; padding: 0 15px; font-size: .8rem; white-space: nowrap; }
.person-panel { display: grid; grid-template-rows: 52px minmax(0,1fr); background: rgba(var(--surface-rgb),.78); }
.person-panel > header { display: flex; align-items: center; padding: 0 15px; border-bottom: 1px solid var(--line); }
.person-card { min-height: 0; padding: 13px; overflow-y: auto; overscroll-behavior: contain; }
.person-empty { display: grid; min-height: 220px; place-items: center; color: var(--muted); font-size: .8rem; line-height: 1.5; text-align: center; }
.person-summary { display: flex; align-items: center; gap: 11px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.person-summary strong, .person-summary small { display: block; }
.person-summary strong { font-size: .91rem; }
.person-summary small { margin-top: 4px; color: var(--muted); font-size: .75rem; }
.person-card section { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(var(--ink-rgb),.018); }
.person-card section > span { color: var(--mint); font-size:12px; font-weight: 800; letter-spacing: .11em; }
.person-card section p { margin: 8px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.memory-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.memory-chips i { padding: 5px 7px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--surface); font-size:12px; font-style: normal; line-height: 1.3; }

.section-select { min-width: 240px; min-height: 44px; padding: 0 38px 0 14px; font-size: .86rem; }
.analytics-metrics { grid-template-columns: repeat(5, minmax(0,1fr)); }
.metric-link { text-align: left; color: inherit; cursor: pointer; font: inherit; }
.metric-link:hover, .metric-link:focus-visible { border-color: var(--mint); background: var(--surface-2); outline: 2px solid rgba(var(--accent-rgb),.18); outline-offset: 2px; }
.metric-link p::after { content: ' Подробнее →'; color: var(--mint); white-space: nowrap; }
.attention-list .queue-status { margin-top: 8px; color: var(--mint); white-space: normal; font-variant-numeric: tabular-nums; }
.analytics-details-list { display: grid; gap: 12px; }
.analytics-details-list article { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); min-width: 0; }
.analytics-details-list p, .analytics-details-list small { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.analytics-details-list small { display: block; color: var(--muted); }
.analytics-details-list button { margin-top: 12px; }
#analytics-details-more { margin-top: 16px; }
#analytics-details-more[hidden] { display: none; }
.analytics-metrics .metric:last-child { grid-column: auto; }
.analytics-grid { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(320px,.8fr); gap: 16px; margin-top: 16px; }
.analytics-panel { min-width: 0; }
.panel-copy { margin: 0; color: var(--muted); font-size: .8rem; }
.attention-list, .trash-list { display: grid; gap: 7px; max-height: 430px; padding: 0 18px 18px; overflow-y: auto; overscroll-behavior: contain; }
.attention-list > button, .trash-list > article { display: grid; grid-template-columns: minmax(0,1fr) minmax(180px,.75fr); gap: 14px; align-items: center; min-height: 68px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; color: inherit; text-align: left; background: var(--surface-2); }
.attention-list > button { cursor: pointer; }
.attention-list > button:hover { border-color: var(--line-strong); background: rgba(var(--accent-rgb),.05); }
.attention-list span, .attention-list strong, .attention-list small, .attention-list em, .trash-list span, .trash-list strong, .trash-list small { display: block; min-width: 0; }
.attention-list strong, .trash-list strong { font-size: .84rem; }
.attention-list small, .trash-list small { margin-top: 4px; overflow: hidden; color: var(--muted); font-size:12px; text-overflow: ellipsis; white-space: nowrap; }
.attention-list em { overflow: hidden; color: var(--mint-soft); font-size: .76rem; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.trash-list > article { grid-template-columns: minmax(0,1fr) auto; }
.trash-list button { min-height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--mint-soft); background: transparent; font-size:12px; cursor: pointer; }
.analytics-panel > .panel-copy { padding: 0 18px 12px; }
.analytics-panel .list-empty { min-height: 220px; }

@media (min-width: 761px) and (max-width: 1450px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding-top: 12px; padding-bottom: 8px; }
  .topnav { order: 3; width: 100%; margin-left: 0; }
  .top-actions { margin-left: auto; }
  .nav-item { flex: 1; padding: 0 9px; }
  .content.is-dialogue-view { height: calc(100dvh - 222px); }
}
@media (min-width: 761px) and (max-width: 1200px) {
  .content { padding: 28px; }
  .content.is-dialogue-view { height: calc(100dvh - 222px); padding: 10px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr) 310px; }
  .assistant-row { grid-template-columns: 46px minmax(0, 1fr); }
  .assistant-row-actions { grid-column: 2; justify-content: flex-start; }
  .dialogue-workspace { grid-template-columns: 270px minmax(0, 1fr); }
  .person-panel { display: none; }
}

@media (max-width: 1050px) {
  .auth-layout { grid-template-columns: 1fr; max-width: 680px; }
  .auth-story { min-height: 330px; }
  .auth-copy h1 { font-size: 3rem; }
  .workspace-frame { grid-template-columns: 78px minmax(0, 1fr); }
  .workspace-switcher label, .sidebar-label, .side-item b, .side-item em, .plan-card { display: none; }
  .workspace-switcher { justify-content: center; }
  .side-item { justify-content: center; }
  .metric-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .metric:last-child { grid-column: auto; }
  .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .analytics-metrics { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .analytics-metrics .metric:last-child { grid-column: auto; }
  .analytics-grid { grid-template-columns: 1fr; }
  .team-layout { grid-template-columns: 1fr; }
  .dialogue-workspace { grid-template-columns: 250px minmax(0, 1fr); }
  .person-panel { display: none; }
}

/* Laptop windows: allocate the available height to conversation content,
   not to stacked navigation, decorative labels or fixed minimum heights. */
@media (min-width: 761px) and (max-height: 850px) {
  .app-shell:has(.content.is-dialogue-view) { display: grid; grid-template-rows: 54px 36px minmax(0,1fr); height: calc(100dvh - 12px); min-height: 0; width: min(1540px, calc(100% - 12px)); margin: 6px auto; border-radius: 16px; }
  .app-shell:has(.content.is-dialogue-view) .workspace-frame { min-height: 0; overflow: hidden; }
  .content.is-dialogue-view { height: 100%; min-height: 0; padding: 6px; }
  .app-shell:has(.content.is-dialogue-view) .topbar { flex-wrap: nowrap; min-height: 0; gap: 10px; padding: 4px 12px; }
  .app-shell:has(.content.is-dialogue-view) .topnav { order: 0; width: auto; flex-wrap: nowrap; margin-left: 10px; gap: 2px; }
  .app-shell:has(.content.is-dialogue-view) .nav-item { flex: 0 0 auto; min-height: 36px; padding: 0 9px; font-size: .8rem; white-space: nowrap; }
  .app-shell:has(.content.is-dialogue-view) .system-status { display: none; }
  .app-shell:has(.content.is-dialogue-view) .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .app-shell:has(.content.is-dialogue-view) .brand small { display: none; }
  .app-shell:has(.content.is-dialogue-view) .brand strong { font-size: .88rem; }
  .app-shell:has(.content.is-dialogue-view) .account-button { min-height: 36px; }
  .app-shell:has(.content.is-dialogue-view) .account-button span { width: 26px; height: 26px; }
  .app-shell:has(.content.is-dialogue-view) .workspace-toolbar { padding: 2px 12px; }
  .app-shell:has(.content.is-dialogue-view) .workspace-icon,
  .app-shell:has(.content.is-dialogue-view) .workspace-switcher small { display: none; }
  .dialogues-section { grid-template-rows: 56px minmax(0,1fr); border-radius: 12px; }
  .assistant-context-bar { padding: 5px 12px; gap: 8px; }
  .assistant-context-identity small, .assistant-context-identity label em, .runtime-status { display: none; }
  .assistant-context-identity label { min-width: 150px; }
  .assistant-context-identity .assistant-avatar { width: 34px; height: 34px; }
  .assistant-context-actions { gap: 8px; }
  .telegram-channel-tabs, .telegram-channel-heading { display: none; }
  #account-filter { display: block !important; grid-row: 2; min-height: 34px; }
  .dialogue-list-panel > header { gap: 6px; padding: 8px; }
  .compact-search input { min-height: 34px; }
  .dialogue-filter-stack { gap: 4px; padding: 0 8px 6px; }
  .dialogue-filters button { min-height: 28px; }
  .dialogue-mode-filter { gap: 3px; }
  #dialogue-mode-filters { padding: 2px; }
  #dialogue-mode-filters button { min-height: 26px; }
  .runtime-dialogue { min-height: 64px; padding: 7px 10px; gap: 8px; }
  .conversation-active { grid-template-rows: 60px minmax(0,1fr) auto; }
  .conversation-header { padding: 5px 10px; gap: 8px; }
  .conversation-header .assistant-avatar { width: 34px; height: 34px; }
  .conversation-header h2 { font-size: .9rem; }
  .conversation-header-actions .status-pill { display: none; }
  .conversation-messages { padding: 10px 14px; }
  .conversation-dock { display: flex; flex-direction: column; min-height: 0; max-height: 210px; gap: 6px; padding: 6px; overflow: hidden; }
  .ai-draft-card { min-height: 0; flex: 0 1 auto; grid-template-rows: auto auto minmax(0,1fr) auto; overflow: hidden; gap: 5px; padding: 7px 9px; }
  .ai-draft-card > p { min-height: 0; margin: 0; overflow-y: auto; }
  .conversation-dock:has(.ai-draft-card > textarea) { max-height: 240px; }
  .ai-draft-card > textarea { min-height: 0; height: 100%; padding: 8px 10px; }
  .draft-actions .button { min-height: 32px; }
  .composer-row { flex: 0 0 auto; }
  .composer-row textarea { height: 42px; min-height: 42px; max-height: 70px; padding: 10px; }
  .composer-actions .button { min-height: 42px; padding: 0 11px; }
  .variant-panel { min-height: 0; flex: 0 1 90px; overflow-y: auto; }
  .toast { top: 64px; bottom: auto; max-width: 360px; }
}
@media (min-width: 761px) and (max-width: 1100px) and (max-height: 850px) {
  .app-shell:has(.content.is-dialogue-view) .brand > span:last-child { display: none; }
  .app-shell:has(.content.is-dialogue-view) .account-button b { max-width: 60px; }
  .assistant-context-identity label { min-width: 0; }
  .assistant-context-identity .assistant-avatar { display: none; }
}

@media (max-width: 760px) {
  .usage-metrics { grid-template-columns: 1fr; }
  .app-shell { width: 100%; min-height: 100vh; margin: 0; border: 0; border-radius: 0; }
  .topbar { min-height: 68px; padding: 0 14px; }
  .topnav, .system-status, .account-button b, .account-button em { display: none; }
  .workspace-frame { display: block; }
  .sidebar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(6, 1fr); min-height: 68px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); border: 0; border-top: 1px solid var(--line); background: rgba(var(--surface-rgb),.96); backdrop-filter: blur(20px); }
  .workspace-switcher, .sidebar-divider, .sidebar-label, .sidebar-spacer, .plan-card { display: none; }
  .side-item { justify-content: center; gap: 4px; min-height: 48px; padding: 0 4px; }
  .side-item b { display: block; font-size:12px; }
  .side-item { flex-direction: column; }
  .workspace-toolbar { min-height: 56px; padding: 7px 14px; gap: 8px; }
  .workspace-toolbar .workspace-switcher { display: flex; min-width: 0; }
  .workspace-toolbar .workspace-icon { display: none; }
  .workspace-toolbar .workspace-switcher select { max-width: 200px; font-size: .8rem; }
  .workspace-plan { gap: 6px; }
  .workspace-plan > span:nth-child(2), .workspace-plan > button { display: none; }
  .assistant-row { grid-template-columns: 42px minmax(0, 1fr); gap: 10px; }
  .assistant-row-actions { grid-column: 2; justify-content: flex-start; }
  .dashboard-status { align-items: flex-start; padding: 10px 0; }
  .dashboard-status button { padding-top: 0; flex-shrink: 0; }
  .content { padding: 26px 16px 100px; }
  .page-header { align-items: flex-start; }
  .page-header h1 { font-size: 2rem; }
  .page-header p { max-width: 300px; font-size: .86rem; }
  .page-header .button { width: 48px; padding: 0; }
  .page-header .button:not(:focus) { font-size: 0; }
  .page-header .button span { font-size: 1.2rem; }
  .metric-grid, .dashboard-grid { grid-template-columns: 1fr; }
  .plan-grid { grid-template-columns: 1fr; }
  .analytics-metrics { grid-template-columns: 1fr 1fr; }
  .analytics-metrics .metric:last-child { grid-column: 1 / -1; }
  .analytics-grid { grid-template-columns: 1fr; }
  .section-select { width: 100%; min-width: 0; }
  .billing-note { grid-template-columns: 1fr; }
  .metric:last-child { grid-column: auto; }
  .metric { min-height: 145px; }
  .dashboard-grid { gap: 14px; }
  .section-toolbar { align-items: stretch; flex-direction: column; }
  .search-field { min-width: 0; }
  .auth-layout { width: 100%; min-height: 100vh; margin: 0; border: 0; border-radius: 0; }
  .auth-story { display: none; }
  .auth-card { padding: 32px 22px; }
  .form-grid, .template-options { grid-template-columns: 1fr; }
  .automation-guard-grid { grid-template-columns: 1fr; }
  .assistant-dialog form > header, .dialog-body, .assistant-dialog footer { padding-left: 20px; padding-right: 20px; }
  .details-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-right: 20px; margin-left: 20px; }
  .details-tab { flex: 0 0 96px; }
  .details-shell > header { padding: 20px; gap: 12px; }
  .details-shell > header .icon-button { flex-shrink: 0; }
  .details-dialog footer .button { padding: 0 12px; font-size: .8rem; }
  .team-member { grid-template-columns: minmax(0,1fr) auto; }
  .content.is-dialogue-view { height: calc(100dvh - 124px); min-height: 0; padding: 0 0 calc(68px + env(safe-area-inset-bottom)); }
  .dialogues-section { grid-template-rows: 62px minmax(0,1fr); border: 0; border-radius: 0; }
  .assistant-context-bar { padding: 8px 12px; }
  .assistant-context-identity label { min-width: 0; }
  .assistant-context-identity .assistant-avatar, .runtime-status { display: none; }
  .assistant-settings-scope { display: none; }
  .global-auto-scope > small { display: none; }
  .global-auto-row > span { padding: 0 7px; }
  .global-auto-row button { padding: 0 7px; }
  .button-compact { padding: 0 11px; }
  .dialogue-workspace { display: block; position: relative; }
  .dialogue-list-panel, .conversation-panel { position: absolute; inset: 0; }
  .conversation-panel { z-index: 2; display: none; border-right: 0; }
  .dialogues-section.has-open-conversation .conversation-panel { display: block; }
  .dialogues-section.has-open-conversation .dialogue-list-panel { display: none; }
  .mobile-back { display: grid; }
  .conversation-active { grid-template-rows: 76px minmax(0,1fr) auto; }
  .chat-settings-scope { width: 126px; }
  .chat-settings-scope > small { display: none; }
  .conversation-messages { padding: 14px 12px; }
  .message { max-width: 86%; }
  .conversation-dock { padding: 8px; }
  .ai-draft-card > header small { display: none; }
  .draft-actions { display: flex; overflow-x: auto; }
  .draft-actions .button { flex: 1 0 max-content; min-width: max-content; }
  .variant-panel > div { display: flex; max-height: 116px; overflow-x: auto; }
  .variant-panel > div > button { flex: 0 0 220px; }
  .composer-row { grid-template-columns: 1fr; }
  .composer-actions .button { flex: 1; min-height: 44px; padding: 0 10px; }
  .dialogues-section { grid-template-columns: minmax(0,1fr); grid-template-rows: 102px minmax(0,1fr); }
  .assistant-context-bar { flex-direction: column; align-items: stretch; gap: 4px; }
  .assistant-context-identity { min-width: 0; }
  .assistant-context-identity label { width: 100%; }
  .assistant-context-identity small, .assistant-context-identity label em { display: none; }
  .assistant-context-actions { justify-content: space-between; gap: 6px; }
  .assistant-settings-scope { display: block; min-width: 0; }
  .assistant-settings-scope > small, .assistant-settings-scope .button > span { display: none; }
  .assistant-settings-scope .button { padding: 0 8px; }
  .assistant-settings-scope .button b { border: 0; padding: 0; }
  .conversation-active { grid-template-rows: 104px minmax(0,1fr) auto; }
  .conversation-header { flex-wrap: wrap; gap: 6px; padding: 8px 12px; }
  .conversation-header-actions { flex: 1 0 100%; justify-content: space-between; gap: 5px; }
  .conversation-header-actions .status-pill { display: none; }
  .conversation-header .assistant-avatar { flex: 0 0 34px; width: 34px; height: 34px; }
  .conversation-active.is-auto-mode .conversation-header h2::after { display: none; }
  .chat-settings-scope { width: auto; }
  .chat-response-mode button { min-width: 62px; padding: 0 8px; }
  .conversation-dock { display: flex; flex-direction: column; min-width: 0; max-height: min(56dvh, 380px); overflow: hidden; }
  .ai-draft-card { min-width: 0; min-height: 0; overflow-y: auto; flex: 0 1 auto; }
  .ai-draft-card > p { overflow-wrap: anywhere; }
  .draft-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); overflow: visible; }
  .draft-actions .button { min-width: 0; padding: 0 5px; font-size:12px; }
  .composer-row { flex: 0 0 auto; min-width: 0; grid-template-columns: minmax(0,1fr); }
  .composer-row textarea { min-width: 0; min-height: 48px; }
  .composer-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .composer-actions .button { min-width: 0; font-size:12px; white-space: normal; }
  .variant-panel { flex: 0 1 120px; min-height: 0; overflow-y: auto; }
  .toast { left: 12px; right: 12px; bottom: 84px; font-size: .8rem; }
  .telegram-mini-app .app-shell { height: var(--tg-viewport-height, 100vh); overflow: hidden; }
  .telegram-mini-app .topbar { min-height: 58px; padding-top: env(safe-area-inset-top); }
  .telegram-mini-app .content { height: calc(var(--tg-viewport-height, 100dvh) - 114px); overflow-y: auto; }
  .telegram-mini-app .content.is-dialogue-view { height: calc(var(--tg-viewport-height, 100dvh) - 114px); }
  .telegram-mini-app .sidebar { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
}

/* Two explicit scopes: assistant-wide toolbar, then this chat's controls. */
.dialogues-section { grid-template-rows: 72px minmax(0,1fr); }
.assistant-context-actions { flex-shrink: 0; }
.assistant-settings-scope .button { display: grid; align-content: center; justify-items: start; gap: 3px; min-height: 50px; }
.assistant-settings-scope .button b { padding: 0; border: 0; font-size: .76rem; }
.assistant-settings-scope .button span { display: block; font-size:12px; font-weight: 500; color: var(--muted); }
.global-auto-scope > small { display: block; color: var(--muted); }
.conversation-active { grid-template-rows: auto minmax(0,1fr) auto; }
.conversation-header { display: grid; align-content: start; gap: 8px; padding: 10px 12px; }
.chat-identity-row { display: flex; align-items: center; min-width: 0; gap: 8px; }
.chat-identity { min-width: 0; flex: 1; }
.chat-identity-row > button { flex-shrink: 0; }
.chat-identity-row .assistant-avatar { flex-shrink: 0; }
.chat-identity-row .status-pill { display: none; }
.conversation-active.is-auto-mode .conversation-header h2::after { display: none; }
.chat-controls-row { display: grid; grid-template-columns: minmax(150px, .8fr) minmax(210px,1.2fr); gap: 10px; }
.chat-mode-control { display: grid; gap: 4px; align-content: center; }
.chat-mode-control > small, .followup-control > span { color: var(--muted); font-size:12px; font-weight: 750; letter-spacing: .06em; }
.chat-response-mode button { flex: 1; min-width: 0; }
#followup-button { width: 100%; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; text-align: left; display: grid; gap: 3px; white-space: normal; }
.followup-control > span { display: flex; justify-content: space-between; gap: 6px; }
.followup-control i { font-style: normal; color: var(--muted); letter-spacing: 0; font-weight: 500; }
.followup-control b { font-size: .78rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.followup-control > small { font-size:12px; color: var(--muted); }
#followup-button.is-enabled { border-color: rgba(var(--accent-rgb),.45); background: rgba(var(--accent-rgb),.07); }
#followup-button.is-enabled b { color: var(--mint-soft); }
#followup-button:hover, #chat-settings-button:hover { border-color: var(--mint); }
.chat-control-status { display: grid; gap: 3px; min-height: 32px; color: var(--muted); font-size:12px; line-height: 1.35; font-variant-numeric: tabular-nums; }
#followup-inline-status { color: var(--mint-soft); }
.chat-control-status .conversation-automation-hold { max-width: none; margin: 0; white-space: normal; font-size:12px; }
.settings-readout { border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.settings-readout h3 { margin: 0 0 8px; font-size: 1rem; }
.settings-readout p { margin: 0; font-size: .78rem; line-height: 1.45; color: var(--muted); }
.settings-readout dl { margin: 0 0 16px; }
.settings-readout dl > div { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0,1.2fr); gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: .8rem; line-height: 1.45; }
.settings-readout dt { color: var(--muted); }
.settings-readout dd { margin: 0; overflow-wrap: anywhere; }
.settings-readout dd small { display: block; margin-top: 4px; color: var(--muted); font-size:12px; }
.chat-identity-row button:focus-visible, #followup-button:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
@media (max-width: 760px) {
  .dialogues-section { grid-template-rows: 116px minmax(0,1fr); }
  .assistant-context-actions { align-items: end; }
  .assistant-settings-scope .button { min-height: 45px; padding: 6px 8px; }
  .assistant-settings-scope .button b { font-size:12px; }
  .assistant-settings-scope .button span { font-size:12px; }
  .global-auto-row { min-height: 38px; }
  .global-auto-row > span { padding: 0 5px; font-size:12px; }
  .global-auto-row button { font-size:12px; padding: 0 5px; }
  .global-auto-row button:last-child { min-width: 38px; padding: 0 3px; }
  .global-auto-scope > small { font-size:12px; letter-spacing: .04em; }
  .conversation-header { padding: 8px; gap: 6px; }
  .chat-identity-row { flex-wrap: wrap; gap: 5px; }
  .chat-identity-row .assistant-avatar { display: none; }
  .chat-identity-row .chat-state-button { min-width: 0; padding: 0 7px; font-size:12px; }
  .chat-identity-row .icon-button { width: 28px; height: 32px; }
  .chat-controls-row { grid-template-columns: minmax(120px,.8fr) minmax(170px,1.2fr); gap: 6px; }
  .chat-response-mode button { min-width: 0; padding: 0 5px; font-size:12px; }
  .followup-control i { display: none; }
  .settings-readout { padding: 12px; }
  .settings-readout dl > div { grid-template-columns: 1fr; gap: 4px; }
}
.dashboard-scope{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:12px;font-weight:700}.dashboard-scope select{min-width:180px;height:40px;padding:0 34px 0 13px;border:1px solid var(--line);border-radius:12px;background:var(--surface);color:var(--text);font:inherit}
.analytics-filters{display:flex;align-items:flex-end;gap:10px;flex-wrap:wrap}.analytics-filters label{display:grid;gap:5px;color:var(--muted);font-size:12px;font-weight:700}.analytics-filters select{min-width:140px;height:40px;padding:0 34px 0 12px;border:1px solid var(--line);border-radius:12px;background:var(--surface);color:var(--text)}#analytics-status{display:block;margin-top:8px;color:var(--muted)}
.member-permissions{grid-column:1/-1;width:100%;padding-top:8px;border-top:1px solid var(--line)}.member-permissions summary{cursor:pointer;color:var(--muted);font-weight:700}.member-permissions>div{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 16px;padding:12px 0}.member-permissions label{display:flex;align-items:center;gap:8px;font-size:13px}.member-permissions input{width:18px;height:18px}
.member-remove{display:flex;align-items:center;gap:8px}.member-remove select{max-width:190px;height:38px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--text)}
@media(max-width:720px){.dashboard-scope span{display:none}.dashboard-scope select{min-width:0;max-width:160px}}
