/* PAI console design system, after the console mockups of 2026-09-12 (platform/ux/*.svg): a dark teal sidebar,
   white content, white cards with a hairline border, teal as the one accent, green/orange/red only for state.
   Tokens first, then the shell, then components. No page-specific selectors except the graph canvas. */

:root {
  --navy: #0B1F2A;          /* sidebar, headings, primary text */
  --navy-2: #12303D;        /* sidebar hover, the user box */
  --teal: #0B7285;          /* the accent: active item, buttons, links, badges of "ours" */
  --teal-strong: #095C6C;
  --teal-soft: #E3F4F7;     /* soft teal: idle step pills, info notices, the side panel */
  --teal-line: #9FC5CE;
  --fg: #0B1F2A;
  --muted: #4A5B66;
  --subtle: #8A9BA6;        /* raw identifiers, timestamps, dashes */
  --line: #D3DCE2;
  --line-soft: #E9EEF2;
  --panel: #F3F6F8;         /* stat tiles, table hover, quiet notes */
  --bg: #FFFFFF;
  --white: #FFFFFF;
  --ok: #2B8A3E;
  --ok-soft: #EBF9EE;
  --warn: #E8590C;
  --warn-soft: #FFF1E6;
  --danger: #C92A2A;
  --danger-soft: #FFE3E3;
  --info: #0B7285;
  --info-soft: #E3F4F7;
  --data: #0B7285;          /* measurements: chart bars, meters */
  --data-2: #E8590C;
  --sidebar-fg: #C9D7DD;
  --sidebar-fg-dim: #9FC5CE;
  --focus-ring: 0 0 0 3px rgba(11, 114, 133, .18);
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: none;
  --shadow-md: 0 8px 28px rgba(11, 31, 42, .12);
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --sidebar-w: 232px;
  --page-max: 1280px;
  --page-max-wide: 1480px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Liberation Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  /* the old names, still used by a few rules below */
  --brand: var(--teal);
  --brand-strong: var(--teal-strong);
  --brand-soft: var(--teal-soft);
  --brand-line: var(--teal-line);
  --amber: var(--warn);
  --amber-soft: var(--warn-soft);
  --link: var(--teal);
  --fg-subtle: var(--subtle);
  --zebra: var(--white);
  --data-soft: var(--teal-soft);
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font: 14px/1.5 var(--font);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
.sidebar a:hover, .brand:hover, .nav a:hover, .btn:hover, a.btn:hover, .badge a:hover, .lang-switch a:hover { text-decoration: none; }
code, pre { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--panel); padding: 1px 6px; border-radius: 5px; color: var(--fg); }
small, .muted { color: var(--muted); }
small { font-size: 12px; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.25; color: var(--navy); }
h1 { font-size: 28px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 var(--s3); }
ul, ol { margin: 0 0 var(--s3); padding-left: 1.2rem; }
hr { border: 0; border-top: 1px solid var(--line-soft); margin: var(--s4) 0; }
.hidden { display: none !important; }
.js .nojs { display: none; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.text-ok, .test-ok { color: var(--ok); font-weight: 600; }
.text-danger, .test-fail, .warn-price { color: var(--danger); }
.text-warn { color: var(--warn); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-3 { margin-bottom: 12px; }
.stack > * + * { margin-top: var(--s3); }

/* ---------- app shell: sidebar + content ---------- */

.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; align-self: flex-start; height: 100vh; flex: 0 0 var(--sidebar-w); width: var(--sidebar-w);
  background: var(--navy); color: var(--sidebar-fg); overflow-y: auto;
  display: flex; flex-direction: column; padding: 22px 14px 16px;
  z-index: 10;
}
.brand { display: flex; align-items: baseline; gap: 10px; color: #fff; margin: 0 12px 22px; }
.brand .logo { font-size: 26px; font-weight: 800; letter-spacing: .02em; color: #fff; }
.brand .tagline { font-size: 12px; color: var(--sidebar-fg-dim); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: block; padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--sidebar-fg); font-size: 15px; line-height: 1.3;
}
.nav a:hover { background: var(--navy-2); color: #fff; }
.nav a.active { background: var(--teal); color: #fff; font-weight: 700; }
.nav .nav-sep { height: 10px; }
/* a workspace opens its team and its projects: the two live one level in, on a thin guide line */
.nav .nav-children { display: flex; flex-direction: column; gap: 2px; margin: 0 0 2px 22px; padding-left: 8px; border-left: 1px solid rgba(201, 215, 221, .28); }
.nav .nav-children a { font-size: 14px; padding: 7px 12px; }
.nav-group { display: block; height: 10px; }  /* the groups keep their place as quiet gaps, no labels */
.sidebar-user {
  margin-top: auto; background: var(--navy-2); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 13px; line-height: 1.5;
}
.sidebar-user .email { color: var(--sidebar-fg); word-break: break-all; display: block; }
.sidebar-user .role { color: var(--sidebar-fg-dim); font-size: 12px; display: block; }
.sidebar-user small { color: var(--sidebar-fg-dim); font-size: 12px; }
.sidebar-user form { margin-top: var(--s2); }
.sidebar-user button.link { color: var(--sidebar-fg); font-size: 13px; }
.sidebar-user button.link:hover { color: #fff; }
/* the context switcher (platform/ux/12-context-switcher.png): a dark inset box under the brand; its open panel
   is white and floats over the content, so the sidebar must not clip it while it is open */
.switcher { position: relative; margin: 0 0 18px; }
.switcher > summary {
  list-style: none; cursor: pointer; display: block; position: relative; padding: 9px 36px 9px 14px;
  background: var(--navy-2); border: 1px solid rgba(159, 197, 206, .25); border-radius: var(--radius-sm);
}
.switcher > summary::-webkit-details-marker { display: none; }
.switcher > summary:hover, .switcher[open] > summary { border-color: var(--teal); }
.switcher .switcher-label { display: block; font-size: 11.5px; line-height: 1.3; color: var(--sidebar-fg-dim); }
.switcher .switcher-current {
  display: block; margin-top: 2px; color: #fff; font-size: 15px; font-weight: 700; line-height: 1.3;
  overflow-wrap: anywhere;  /* a long workspace name takes a second line rather than an ellipsis */
}
.switcher .switcher-caret { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--teal-line); font-size: 16px; }
.switcher[open] .switcher-caret { color: var(--teal); }
.switcher > .switcher-body {
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 30; width: 300px; padding: 6px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; gap: 2px; color: var(--fg);
}
.switcher .switcher-body form { margin: 0; }
.switcher .switcher-body .divider { display: block; height: 1px; margin: 4px 6px; background: var(--line-soft); }
.switcher .switcher-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 8px 12px;
  border: 0; border-radius: 6px; background: none; box-shadow: none; color: var(--fg); font-size: 14px; font-weight: 500;
  line-height: 1.35; text-align: left; cursor: pointer;
}
.switcher .switcher-item:hover { background: var(--panel); color: var(--fg); }
.switcher .switcher-item.current { background: var(--teal-soft); color: var(--teal-strong); }
.switcher .switcher-item .text { display: flex; flex-direction: column; min-width: 0; }
.switcher .switcher-item .name { font-weight: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switcher .switcher-item .caption { font-size: 12px; font-weight: 400; color: var(--muted); }
.switcher .switcher-item .check { flex: 0 0 auto; color: var(--teal); font-weight: 800; }
.switcher .switcher-create { display: block; padding: 8px 12px; border-radius: 6px; color: var(--teal); font-size: 13.5px; font-weight: 500; }
.switcher .switcher-create:hover { background: var(--panel); color: var(--teal-strong); }
/* console.js mirrors the open state as .switcher-open for browsers without :has() */
.sidebar.switcher-open, .sidebar:has(.switcher[open]) { overflow: visible; }

.content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.page { padding: 26px 36px 40px; max-width: var(--page-max); width: 100%; }
.page.wide { max-width: var(--page-max-wide); }
.footer { padding: var(--s4) 36px; color: var(--subtle); font-size: 12px; margin-top: auto; }
.footer code { background: transparent; padding: 0; color: var(--muted); }

/* language switch: two pills, the current one filled */
.lang-switch { display: inline-flex; gap: 4px; }
.lang-switch a, .lang-switch strong {
  display: inline-block; min-width: 44px; padding: 5px 12px; text-align: center; font-size: 13px; font-weight: 700;
  color: var(--teal); border: 1px solid var(--teal); border-radius: var(--radius-sm); background: var(--white);
}
.lang-switch a:hover { background: var(--teal-soft); }
.lang-switch strong { background: var(--teal); color: #fff; }

/* page header: title and subtitle on the left, the language switch and the page's one action on the right */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s5); margin-bottom: 26px; }
.page-header .page-title { min-width: 0; }
.page-header .subtitle { color: var(--muted); margin: 10px 0 0; max-width: 84ch; font-size: 14px; }
.page-header .page-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; flex-shrink: 0; }
.page-header .actions { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.page-header .actions .toolbar { align-items: center; }
.page-header .actions .toolbar .field { margin: 0; }
.page-header .actions .toolbar .field > .label { display: none; }
.topbar { display: flex; justify-content: flex-end; padding: var(--s4) 36px 0; }

/* ---------- cards ---------- */

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: var(--s5); }
.card > .card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 18px 22px 0; flex-wrap: wrap; }
.card > .card-header h2, .card > .card-header h3 { margin: 0; }
.card > .card-header .card-tools { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; flex: 0 0 auto; margin-left: auto; }
.card > .card-header > .card-title-row { flex: 1 1 420px; min-width: 0; flex-wrap: nowrap; align-items: flex-start; }
.card-title-text { flex: 1 1 auto; min-width: 0; }
.card > .card-body { padding: 18px 22px; }
.card > .card-header + .card-body { padding-top: 14px; }
.card > .card-body + .card-body { border-top: 1px solid var(--line-soft); }
.card > .card-footer { padding: 12px 22px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 13px; }
.card.primary { border: 2px solid var(--teal); }
.card.disabled { opacity: .7; }
.card.flat { box-shadow: none; }
.card.soft { background: var(--teal-soft); border-color: transparent; }
.card.soft h3, .card.soft h2 { color: var(--teal); font-size: 17px; margin-bottom: 10px; }
.card.soft ul { padding-left: 1.1rem; }
.card.soft li { margin-bottom: 6px; }
.card .card-title-row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.card .card-title-row h2 { font-size: 20px; }
.card-meta { color: var(--muted); font-size: 13px; margin: var(--s1) 0 0; overflow-wrap: anywhere; }
.card-badges { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); align-items: center; margin-top: var(--s1); }
.card-badges .badge + .badge { margin-left: 0; }
.card-meta code { background: transparent; padding: 0; }
.card-note { margin: var(--s3) 0 0; font-size: 12.5px; }
.card-state { margin: var(--s2) 0 0; font-size: 14px; }

.grid { display: grid; gap: var(--s5); margin-bottom: var(--s5); align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 5fr) minmax(280px, 3fr); }
.grid-side-main { grid-template-columns: minmax(280px, 3fr) minmax(0, 5fr); }
.grid .card { margin-bottom: 0; }

/* avatars (the stepper's preset cards) */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 40px; height: 40px; border-radius: 10px; font-weight: 800; font-size: 18px;
  background: var(--teal-soft); color: var(--teal);
}
.avatar.sm { width: 32px; height: 32px; font-size: 15px; border-radius: 8px; }
.avatar.kind-anthropic { background: var(--teal); color: #fff; }
.avatar.kind-anthropic_compatible { background: var(--teal-soft); color: var(--teal); }
.avatar.kind-openai_compatible { background: var(--warn-soft); color: var(--warn); }
.avatar.kind-bedrock { background: var(--panel); color: var(--muted); }

/* ---------- stat tiles ---------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s4); margin-bottom: var(--s5); }
.kpi { background: var(--panel); border-radius: var(--radius); padding: 18px 22px; }
.kpi .value { font-size: 28px; font-weight: 800; color: var(--teal); line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi .value.neutral { color: var(--navy); }
.kpi .value.accent { color: var(--warn); }
.kpi .value.danger { color: var(--danger); }
.kpi .value.small-value { font-size: 20px; line-height: 1.4; }
.kpi .label { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* ---------- badges ---------- */

.badge {
  display: inline-block; font-size: 12px; font-weight: 700; line-height: 1.2;
  padding: 4px 12px; border-radius: 999px; background: var(--panel); color: var(--muted);
  vertical-align: middle; white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger, .badge.off { background: var(--danger-soft); color: var(--danger); }
.badge.muted { background: var(--panel); color: var(--muted); }
.badge.info { background: var(--teal-soft); color: var(--teal); }
.badge.accent { background: var(--warn-soft); color: var(--warn); }
.badge.kind-anthropic, .badge.kind-anthropic_compatible { background: var(--teal-soft); color: var(--teal); }
.badge.kind-openai_compatible { background: var(--warn-soft); color: var(--warn); }
.badge.kind-bedrock { background: var(--panel); color: var(--muted); }
.badge + .badge { margin-left: var(--s1); }
.badge.mono { font-family: var(--mono); font-weight: 600; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; }
.card > .table-wrap { margin: 0 22px 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.card > .table-wrap:first-child { margin-top: 18px; }
.card > .table-wrap:only-child, .card > .table-wrap:first-child:last-child { margin: 0; border: 0; }
.card > .card-header + .table-wrap { margin-top: 14px; }
.card > .table-wrap + .card-body { border-top: 0; padding-top: 0; }
.card > .table-wrap:only-child + .card-body, .card > .table-wrap:only-child + .card-footer { border-top: 1px solid var(--line-soft); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--white); font-size: 14px; }
.table th, .table td { padding: 11px 16px; text-align: left; vertical-align: top; border-bottom: 1px dashed var(--line); }
.table thead th {
  position: sticky; top: 0; z-index: 1; background: var(--white); color: var(--muted); font-weight: 700; font-size: 13px;
  white-space: nowrap; border-bottom: 1px solid var(--line);
}
.table tbody tr:hover td { background: var(--panel); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.actions, .table th.actions { text-align: right; white-space: nowrap; }
.table th.num, .table td.num { text-align: right; }  /* .num alone (0,1,0) loses to the cell rule above */
.table td.actions form { display: inline-block; margin-left: var(--s1); }
.table tr.muted td { color: var(--muted); }
.table tr.state-soft_exceeded td { background: var(--warn-soft); }
.table tr.state-hard_exceeded td { background: var(--danger-soft); }
.table td .sub { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.table td .sub code { background: transparent; padding: 0; }
.table td .sub form { display: inline; }
.table.compact th, .table.compact td { padding: 9px 12px; }
.table.compact { font-size: 13.5px; }
.table.compact thead th { white-space: normal; }
.table.compact .actions .btn, .table.compact .actions button { padding: 3px 8px; }
.table.plain { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.table .empty td { color: var(--muted); text-align: center; padding: var(--s5); }
.table .tree-1 { padding-left: 32px; }
.table .tree-2 { padding-left: 56px; }
.table .cell-check { color: var(--ok); font-weight: 700; }
.chips code { white-space: nowrap; }
.table td.details { min-width: 200px; max-width: 420px; }
.table td.details code { display: block; white-space: pre-wrap; word-break: break-all; }
.table .test-ok, .table .test-fail { white-space: nowrap; font-weight: 600; }
.table .test-ok { color: var(--ok); }
.table .test-fail { color: var(--danger); }
.renew-row td, .credit-edit-row td { padding-top: 0; padding-bottom: 0; }
tr.renew-row:has(details:not([open])) td, tr.credit-edit-row:has(details:not([open])) td { padding: 0; border-bottom: 0; }

/* ---------- forms ---------- */

.form { display: block; }
.field { display: block; margin-bottom: var(--s4); }
.field > .label, .field-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.field .help { display: block; font-size: 12px; color: var(--muted); margin-top: 5px; }
.field.error .input { border-color: var(--danger); }
.field.error .help { color: var(--danger); }
.input, input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=url], select, textarea {
  display: block; width: 100%; padding: 9px 12px; font: inherit; color: var(--fg);
  border: 1px solid #C3CED6; border-radius: var(--radius-sm); background: var(--white);
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus, .input:focus { outline: none; border-color: var(--teal); box-shadow: var(--focus-ring); }
input::placeholder, textarea::placeholder { color: var(--subtle); }
textarea { min-height: 84px; resize: vertical; }
textarea.mono { font-family: var(--mono); font-size: 12.5px; }
select { appearance: auto; }
.input.inline, select.inline, input.inline { display: inline-block; width: auto; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s4); }
.form-row .field { margin-bottom: 0; }
.form-row + .form-row, .form-row + .field, .form-row + .check, .form-row + .form-actions { margin-top: var(--s4); }
.form-actions { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; margin-top: var(--s4); }
.form-actions .hint { color: var(--muted); font-size: 13px; }
.check { display: flex; align-items: flex-start; gap: var(--s2); margin-bottom: var(--s3); font-size: 13.5px; cursor: pointer; }
.check input { width: auto; margin: 3px 0 0; flex-shrink: 0; accent-color: var(--teal); }
.check.inline { display: inline-flex; margin-right: var(--s4); }
.toolbar { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: flex-end; }
.toolbar .field { margin-bottom: 0; min-width: 160px; flex: 1 1 160px; }
.toolbar .field.wide { flex: 3 1 320px; }
.toolbar .field.mode { flex: 2 1 320px; }
.toolbar .field.narrow { flex: 0 1 200px; }
.toolbar .field.grow { flex: 4 1 400px; }
.toolbar textarea { min-height: 42px; }
.toolbar > form.toolbar { flex: 1 1 auto; }
.secret {
  display: block; padding: var(--s3) var(--s4); background: var(--white); border: 1px dashed var(--teal);
  border-radius: var(--radius-sm); font-family: var(--mono); font-size: 13px; word-break: break-all; user-select: all;
}
.secret-row { display: flex; gap: var(--s2); align-items: flex-start; }
.secret-row .secret, .secret-row .secret-wrap { flex: 1; min-width: 0; }

/* ---------- buttons ---------- */

.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm); border: 2px solid var(--teal);
  background: var(--teal); color: #fff; font: inherit; font-weight: 700; font-size: 14px; line-height: 1.2;
  cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s, color .12s;
}
.btn:hover, button:hover { background: var(--teal-strong); border-color: var(--teal-strong); color: #fff; }
.btn.secondary, button.secondary { background: var(--white); color: var(--teal); border-color: var(--teal); }
.btn.secondary:hover, button.secondary:hover { background: var(--teal-soft); color: var(--teal); border-color: var(--teal); }
.btn.ghost, button.ghost { background: transparent; color: var(--teal); border-color: transparent; }
.btn.ghost:hover, button.ghost:hover { background: var(--teal-soft); }
.btn.danger, button.danger { background: var(--white); color: var(--danger); border-color: var(--danger); }
.btn.danger:hover, button.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.btn.accent, button.accent { background: var(--warn); border-color: var(--warn); }
.btn.small, button.small { padding: 4px 10px; font-size: 12.5px; font-weight: 600; border-width: 1px; }
.btn.big, button.big { padding: 12px 26px; font-size: 15px; }
.btn.block { width: 100%; }
.btn:disabled, button:disabled { opacity: .5; cursor: default; }
.btn-link, button.link {
  display: inline; background: none; border: 0; padding: 0; margin: 0; color: var(--teal); font: inherit;
  font-weight: 500; cursor: pointer; text-decoration: none; border-radius: 0;
}
.btn-link:hover, button.link:hover { background: none; text-decoration: underline; color: var(--teal-strong); }
button.link.danger { color: var(--danger); border: 0; background: none; }
button.link.danger:hover { background: none; color: var(--danger); }
button.link.small { font-size: 12.5px; padding: 0; border: 0; }
.actions-row { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.actions-row form { display: inline; }
.table .actions .btn, .table .actions button { padding: 4px 10px; font-size: 12.5px; font-weight: 600; border-width: 1px; }
.table .actions .btn-link, .table .actions button.link { padding: 0; font-size: 12.5px; border: 0; }
form.inline { display: inline; }

/* a row of quiet actions under a table: "+ Добавить ключ · Привязки: … · Изменить · Удалить" */
.links-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 0; margin: 12px 0 0; font-size: 13.5px; color: var(--muted); }
.links-row > * + *::before { content: "·"; color: var(--subtle); margin: 0 10px; }
.links-row form { display: inline-flex; align-items: center; }
.links-row button.link, .links-row a { font-size: 13.5px; }
.links-row .plain-text { color: var(--muted); }

/* a compact "⋯" menu of row actions; CSS only (<details class="menu">) */
.menu { position: relative; display: inline-block; text-align: left; }
.menu > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 26px; border-radius: 6px; color: var(--teal); font-weight: 800; font-size: 16px; letter-spacing: 1px;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover, .menu[open] > summary { background: var(--teal-soft); }
.menu > .menu-body {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 200px; padding: 6px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; gap: 2px;
}
.menu .menu-body form { display: block; margin: 0; }
/* one row height for a <button> and an <a> item (the table's .actions button rules are more specific, hence the
   third selector) */
.menu .menu-body button, .menu .menu-body a, .table .actions .menu .menu-body button {
  display: flex; width: 100%; justify-content: flex-start; padding: 7px 10px; border: 0; border-radius: 6px;
  background: none; color: var(--fg); font-weight: 500; font-size: 13.5px; line-height: 1.3; white-space: nowrap; text-align: left;
}
.menu .menu-body button:hover, .menu .menu-body a:hover { background: var(--panel); color: var(--fg); }
/* the table's .actions button rule (0,4,1) would out-rank the plain selector: the danger colour needs both */
.menu .menu-body button.danger, .table .actions .menu .menu-body button.danger { color: var(--danger); }
.menu .menu-body button.danger:hover, .table .actions .menu .menu-body button.danger:hover { background: var(--danger-soft); }
.menu .menu-body small { padding: 4px 10px; color: var(--subtle); }

/* ---------- notices ---------- */

.notice {
  display: flex; gap: var(--s3); align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-sm);
  margin-bottom: var(--s4); border: 1px solid transparent; font-size: 13.5px; line-height: 1.45;
}
.notice.info { background: var(--teal-soft); color: var(--navy); }
.notice.success { background: var(--ok-soft); color: var(--ok); }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.notice.warning { background: var(--warn-soft); color: var(--warn); }
.notice.small { padding: 8px 12px; font-size: 12.5px; margin-bottom: var(--s3); }
.notice a { color: inherit; text-decoration: underline; }
.notice code { background: rgba(255, 255, 255, .6); }
.msg { display: block; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: var(--s3); border: 1px solid transparent; }
.msg.info { background: var(--teal-soft); color: var(--navy); }
.msg.error { background: var(--danger-soft); color: var(--danger); }
.msg.warning { background: var(--warn-soft); color: var(--warn); }
.panel { background: var(--panel); border-radius: var(--radius-sm); padding: 12px 16px; color: var(--muted); font-size: 13.5px; margin-bottom: var(--s4); }
.panel.teal { background: var(--teal-soft); color: var(--navy); }
.panel ul { margin: 0; padding-left: 1.1rem; }
.panel p:last-child { margin-bottom: 0; }
/* a sentence in the accent tone that wants to be read: an unpriced model, a limit the gateway cannot lift */
.warn-line { color: var(--warn); font-size: 13.5px; margin: 8px 0 0; }
.warn-line a { color: inherit; text-decoration: underline; }
.ok-line { color: var(--ok); font-size: 13.5px; margin: 8px 0 0; }

/* ---------- progress bars ---------- */

.progress { display: flex; align-items: center; gap: var(--s3); min-width: 120px; }
.progress .bar { flex: 1; height: 10px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: var(--data); border-radius: 999px; }
.progress.soft_exceeded .bar i, .progress.warn .bar i { background: var(--warn); }
.progress.hard_exceeded .bar i, .progress.danger .bar i { background: var(--danger); }
.progress .bar i.w-0 { width: 0%; }
.progress .bar i.w-5 { width: 5%; }
.progress .bar i.w-10 { width: 10%; }
.progress .bar i.w-15 { width: 15%; }
.progress .bar i.w-20 { width: 20%; }
.progress .bar i.w-25 { width: 25%; }
.progress .bar i.w-30 { width: 30%; }
.progress .bar i.w-35 { width: 35%; }
.progress .bar i.w-40 { width: 40%; }
.progress .bar i.w-45 { width: 45%; }
.progress .bar i.w-50 { width: 50%; }
.progress .bar i.w-55 { width: 55%; }
.progress .bar i.w-60 { width: 60%; }
.progress .bar i.w-65 { width: 65%; }
.progress .bar i.w-70 { width: 70%; }
.progress .bar i.w-75 { width: 75%; }
.progress .bar i.w-80 { width: 80%; }
.progress .bar i.w-85 { width: 85%; }
.progress .bar i.w-90 { width: 90%; }
.progress .bar i.w-95 { width: 95%; }
.progress .bar i.w-100 { width: 100%; }
.progress .pct { min-width: 44px; text-align: right; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.progress-list { list-style: none; margin: 0; padding: 0; }
.progress-list li { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(140px, 1fr); gap: var(--s4); align-items: center; padding: var(--s2) 0; }
.progress-list li + li { border-top: 1px solid var(--line-soft); }
.progress-list .name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-list .name small { display: block; }

/* ---------- stepper (the «Добавить провайдера» wizard) ---------- */

.stepper { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); margin-bottom: 20px; }
.stepper .step {
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px var(--s3);
  border: 2px solid var(--teal); border-radius: 999px; background: var(--teal-soft); color: var(--teal); font-weight: 700; font-size: 14px;
  cursor: pointer;
}
.stepper .step:hover { background: var(--teal-soft); color: var(--teal); border-color: var(--teal); }
.stepper .step.current, .stepper .step.current:hover { background: var(--teal); color: #fff; border-color: var(--teal); }
.stepper .step .n::after { content: " ·"; }
.stepper .step:disabled { opacity: .55; cursor: default; }
.wizard-summary { display: flex; flex-wrap: wrap; gap: 6px 28px; margin-bottom: 14px; font-size: 14px; color: var(--muted); }
.wizard-summary b { color: var(--navy); font-weight: 700; }
.step-block { margin-bottom: var(--s4); }
.step-block > .step-title { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }
.step-block > .step-title .n { display: none; }
.step-block > .step-title h2 { font-size: 16px; }
.step-nav { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; margin-top: var(--s4); }
.step-nav .hint { color: var(--muted); font-size: 13px; }
.wizard-notes { margin-top: 18px; font-size: 13px; color: var(--muted); }
.wizard-notes p { margin: 0 0 6px; }
.wizard-notes p:last-child { margin-bottom: 0; }

/* preset radio cards */
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--s3); margin-bottom: var(--s3); }
.preset {
  position: relative; display: flex; gap: var(--s3); align-items: flex-start; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); cursor: pointer; margin: 0;
  transition: border-color .12s, box-shadow .12s;
}
.preset:hover { border-color: var(--teal-line); }
.preset input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.preset.selected, .preset:has(input:checked) { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal) inset; background: var(--teal-soft); }
.preset:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.preset .preset-body { min-width: 0; }
.preset .preset-title { font-weight: 700; display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.preset .preset-title .badge { white-space: normal; line-height: 1.3; text-align: left; }
.preset .preset-desc { color: var(--muted); font-size: 12px; margin-top: 2px; }
.preset-help { margin-bottom: var(--s3); }
.preset-help details.help { margin: 0; }
.preset-help[data-hidden="1"] { display: none; }

/* ---------- details / accordions ---------- */

details.help, details.edit, details.addkey, details.accordion { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white); margin: var(--s3) 0; }
details.help > summary, details.edit > summary, details.addkey > summary, details.accordion > summary {
  cursor: pointer; padding: 9px var(--s4); font-weight: 600; color: var(--teal); list-style: none; display: flex; align-items: center; gap: var(--s2); font-size: 13.5px;
}
details > summary::-webkit-details-marker { display: none; }
details.help > summary::before, details.edit > summary::before, details.addkey > summary::before, details.accordion > summary::before {
  content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .12s; margin-right: 2px; flex-shrink: 0;
}
details[open] > summary::before { transform: rotate(45deg); }
details.help > summary:hover, details.edit > summary:hover, details.addkey > summary:hover, details.accordion > summary:hover { background: var(--teal-soft); border-radius: var(--radius-sm); }
details.help > dl, details.edit > form, details.addkey > form, details.accordion > .accordion-body, details.accordion > form, details.edit > .table-wrap, details.edit > pre, details.edit > ul { padding: var(--s3) var(--s4) var(--s4); border-top: 1px solid var(--line-soft); margin: 0; }
details.help dl { font-size: 13px; }
details.help dt { font-weight: 700; margin-top: var(--s2); }
details.help dt:first-child { margin-top: 0; }
details.help dd { margin: 2px 0 0 0; color: var(--fg); }
details.help ul { margin: var(--s1) 0 0; padding-left: 1.1rem; }
details.help a { word-break: break-all; }
details.addkey { border-color: var(--teal-line); }
details.addkey[open] { border-color: var(--teal); }
/* a form that already has its own button does not also need a bar to announce itself */
.headless > summary { display: none; }
details.edit.headless > summary { display: none; }  /* details.edit's own summary rule is more specific than .headless */
.headless:not([open]) { display: none; }
/* quiet disclosures ("Технические детали", "Управлять моделями"): a link, then the content */
details.quiet { margin: 10px 0 0; }
details.quiet > summary { list-style: none; cursor: pointer; color: var(--teal); font-size: 13.5px; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
details.quiet > summary::-webkit-details-marker { display: none; }
details.quiet > summary::before { content: "›"; display: inline-block; transition: transform .12s; }
details.quiet[open] > summary::before { transform: rotate(90deg); }
details.quiet > *:not(summary) { margin-top: 10px; }
details.quiet .toolbar { margin-top: 10px; }
.tech-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px var(--s4); margin: 0; font-size: 13px; }
.tech-list dt { color: var(--muted); }
.tech-list dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- tabs ---------- */

.tabs { display: flex; gap: var(--s1); border-bottom: 1px solid var(--line); margin-bottom: var(--s4); }
.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted);
  padding: 9px 14px; font-weight: 600; margin-bottom: -1px;
}
.tabs button:hover { background: var(--teal-soft); color: var(--teal); }
.tabs button.active { color: var(--teal); border-bottom-color: var(--teal); }
.pane { display: none; }
.pane.active { display: block; }

/* ---------- providers ---------- */

.provider-grid { grid-template-columns: repeat(auto-fit, minmax(580px, 1fr)); }
.provider-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.provider-head .provider-name { font-size: 22px; font-weight: 700; margin: 0; }
.provider-head .badge + .badge { margin-left: 0; }
.provider-url { color: var(--muted); font-size: 13.5px; margin: 6px 0 14px; overflow-wrap: anywhere; }
.table-wrap.inset { border: 1px solid var(--line); border-radius: var(--radius-sm); }
.provider-card .table.compact th, .provider-card .table.compact td { padding: 8px 10px; }
.provider-card .table.compact { font-size: 13px; }
.provider-card .table td.actions { overflow: visible; }
.models-line { margin: 14px 0 0; font-size: 13.5px; }
.models-line code { background: transparent; padding: 0; font-size: 13px; }
.credit-line { margin-top: 12px; padding: 10px 12px; background: var(--panel); border-radius: var(--radius-sm); font-size: 13px; }
.credit-line .credit-figures { margin-bottom: 6px; }
.credit-line .credit-name { font-weight: 700; color: var(--navy); margin-right: 6px; }
.credit-line .credit-panel .progress { margin-top: 2px; }
.credit-line .notice { margin: 6px 0 0; }
/* the old collapsed provider row, kept for the tests and for anyone with an old template cached */
.provider > summary.provider-summary { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2) var(--s3); padding: var(--s4) var(--s5); cursor: pointer; list-style: none; }
.provider > summary::-webkit-details-marker { display: none; }
.provider-state { margin-left: auto; font-size: 14px; text-align: right; }
.provider-tools { display: flex; flex-wrap: wrap; gap: var(--s2); padding: 0 var(--s5) var(--s4); }
.provider-host { color: var(--muted); font-family: var(--mono); font-size: 12px; }

/* purchased credit pool (provider key): two bars against the purchased pool as 100% */
.credit-cell { min-width: 240px; }
.credit-panel { display: flex; flex-direction: column; gap: 4px; }
.credit-figures { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); }
.credit-figures strong { color: var(--navy); font-variant-numeric: tabular-nums; }
.credit-panel .progress { min-width: 0; }
.credit-panel .progress .pct { min-width: auto; }

/* A single access key is the normal case: the table folds into a block and the headers move inline. */
.table.stacked thead { display: none; }
.table.stacked, .table.stacked tbody, .table.stacked td { display: block; width: auto; }
.table.stacked tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2) var(--s5); border: 0; padding: var(--s2) 0; }
.table.stacked td.actions { grid-column: 1 / -1; }
.table.stacked td { border: 0; padding: var(--s1) 0; }
.table.stacked td[data-label]:not([data-label=""])::before { content: attr(data-label); display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.table.stacked td.actions { padding-top: var(--s3); text-align: left; }

/* ---------- overview: daily spend bars and budget meters ---------- */

.chart { display: flex; align-items: flex-end; gap: 4px; height: 190px; padding: var(--s4) 0 var(--s2); }
.chart .col { flex: 1 1 0; min-width: 0; display: flex; align-items: flex-end; height: 100%; }
.chart .col i { display: block; width: 100%; background: var(--data); border-radius: 3px 3px 0 0; }
.chart .col.today i { background: var(--data-2); }
.chart .col:hover i { background: var(--teal-strong); }
.chart .col.h-0 i { height: 0%; }
.chart .col.h-5 i { height: 5%; }
.chart .col.h-10 i { height: 10%; }
.chart .col.h-15 i { height: 15%; }
.chart .col.h-20 i { height: 20%; }
.chart .col.h-25 i { height: 25%; }
.chart .col.h-30 i { height: 30%; }
.chart .col.h-35 i { height: 35%; }
.chart .col.h-40 i { height: 40%; }
.chart .col.h-45 i { height: 45%; }
.chart .col.h-50 i { height: 50%; }
.chart .col.h-55 i { height: 55%; }
.chart .col.h-60 i { height: 60%; }
.chart .col.h-65 i { height: 65%; }
.chart .col.h-70 i { height: 70%; }
.chart .col.h-75 i { height: 75%; }
.chart .col.h-80 i { height: 80%; }
.chart .col.h-85 i { height: 85%; }
.chart .col.h-90 i { height: 90%; }
.chart .col.h-95 i { height: 95%; }
.chart .col.h-100 i { height: 100%; }
.chart-axis { display: flex; gap: 4px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-axis span { flex: 1 1 0; min-width: 0; text-align: center; }
.card > .chart, .card > .chart-axis { margin: 0 22px; }
.card > .chart-axis { padding-bottom: 14px; }

.meters { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.card > .meters { padding: 14px 22px 18px; }
.meters .meter-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); }
.meters .meter-head .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meters .meter-state { display: flex; align-items: center; gap: var(--s2); white-space: nowrap; }
.meters .meter-head .pct { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.meters .meter-foot { font-size: 12.5px; margin-top: 4px; }
.meters .progress { margin-top: 6px; }
.card > .card-note { margin: 0; padding: 0 22px 16px; }

/* unpriced models: a sentence, a list, a consequence */
.notice.unpriced { display: block; }
.notice.unpriced p { margin: 0; }
.unpriced-head { font-weight: 700; }
.unpriced-list { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin: var(--s2) 0 !important; }
.unpriced-item { white-space: nowrap; font-variant-numeric: tabular-nums; }
.unpriced-why { font-size: 13px; }

/* ---------- auth layout (login stages, errors) ---------- */

.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 8vh var(--s4) var(--s6); background: var(--line-soft); }
.auth .auth-top { width: 100%; max-width: 440px; display: flex; justify-content: flex-end; margin-bottom: var(--s4); }
.auth .auth-card { width: 100%; max-width: 440px; background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 30px 32px; }
.auth .auth-card.wide { max-width: 640px; }
.auth .auth-logo { font-size: 30px; font-weight: 800; color: var(--teal); letter-spacing: .02em; margin-bottom: var(--s4); display: block; }
.auth .auth-logo small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.auth h1 { font-size: 22px; margin-bottom: var(--s1); }
.auth .auth-sub { color: var(--muted); margin-bottom: var(--s4); }
.auth .btn, .auth button[type=submit]:not(.link) { width: 100%; margin-top: var(--s2); }
.auth .auth-links { margin-top: var(--s4); font-size: 13.5px; }
.auth .auth-links p { margin-bottom: var(--s2); }
.auth .auth-hint { color: var(--muted); font-size: 13px; margin-top: var(--s4); }
.auth .footer { margin-top: var(--s5); text-align: center; }
.auth .address { display: inline-block; margin-bottom: var(--s3); }
.error-page { text-align: center; }
.error-page .code { font-size: 56px; font-weight: 800; color: var(--teal); line-height: 1; margin-bottom: var(--s3); }

/* ---------- graph page (vis-network canvases) ---------- */

.stats { display: flex; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); }
.stat { background: var(--panel); border-radius: var(--radius-sm); padding: var(--s2) var(--s4); min-width: 110px; text-align: center; }
.stat .val { font-size: 20px; font-weight: 800; color: var(--teal); }
.stat .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
#graph, #graph2 { height: calc(100vh - 420px); min-height: 380px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.legend { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); font-size: 12px; color: var(--muted); align-items: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; background: #adb5bd; }
.legend i.g-User { background: #1f5fbf; } .legend i.g-Agent { background: #7a3db8; } .legend i.g-Session { background: #1e3a5f; }
.legend i.g-Message { background: #9fb6cd; } .legend i.g-Tool { background: #6f42c1; } .legend i.g-File { background: #fd7e14; }
.legend i.g-Entity { background: #198754; } .legend i.g-Model { background: #0dcaf0; } .legend i.g-Provider { background: #6c757d; }
.legend i.g-Group { background: #b54708; } .legend i.g-Application { background: #027a48; }
.ask-row { border-bottom: 1px solid var(--line-soft); padding: var(--s3) 0; }
.ask-row .meta { color: var(--muted); font-size: 12px; margin-bottom: var(--s1); }
.ask-row .txt { white-space: pre-wrap; }
.score { background: var(--teal); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 700; }
textarea.cypher { font-family: var(--mono); min-height: 84px; }
.qr svg { width: 180px; height: 180px; display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px; }
.qr-row { display: flex; gap: var(--s4); align-items: flex-start; flex-wrap: wrap; }
.qr-row .qr-side { flex: 1 1 240px; }

/* ---------- «Мой доступ» (platform/ux/20-my-access.png): one 860px column, three cards ---------- */

.page.me-page { max-width: 932px; }  /* 860px of cards inside the page padding */
.me-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; font-size: 14px; }
.me-name { font-size: 16px; font-weight: 700; color: var(--navy); }
.me-email, .me-label { color: var(--muted); }
.me-hint { color: var(--subtle); font-size: 12.5px; }
.me-line .badge { font-size: 12.5px; padding: 4px 12px; }
.me-line .badge + .badge { margin-left: 0; }
/* the keys card: the issue band under the header, the once-shown key, six columns with the spend on the right */
#keys-card > .card-header .btn { margin-left: auto; }
#keys-card > details.band.add-band + .table-wrap, #keys-card > details.band.add-band + .card-empty { margin-top: 12px; }
#keys-card > .card-body.me-newkey { padding-bottom: 0; }
#keys-card > .card-body.me-newkey + .table-wrap { margin-top: 14px; }
.me-newkey .card { margin: 0; }
.table.me-keys thead th { white-space: nowrap; }
.table.me-keys th, .table.me-keys td { padding: 11px 12px; }
.table.me-keys .warn-text { color: var(--warn); font-weight: 600; }
.card > .table-wrap + .card-body.me-howto, .card > .card-empty + .card-body.me-howto { border-top: 0; padding-top: 0; }
.me-howto details.quiet { margin: 0; }
.me-howto .secret { white-space: pre-wrap; word-break: normal; overflow-wrap: anywhere; background: var(--panel); border: 0; line-height: 1.7; }
.me-howto .secret-row { align-items: center; }
/* the sign-in card: label · sentence · quiet actions per row, a band bleeding to the card's edges under its row */
.me-row { display: grid; grid-template-columns: 150px 1fr auto; column-gap: var(--s4); align-items: baseline; padding: 13px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
#signin-card > .card-body > .me-row:last-of-type { border-bottom: 0; }
#signin-card > .card-body > .me-row:last-child { padding-bottom: 4px; }
.me-row:first-child, #signin-card .notice + .me-row { padding-top: 4px; }
.me-row .me-key { font-weight: 700; color: var(--navy); }
.me-row .me-text { min-width: 0; }
.me-row .me-sub { grid-column: 2 / -1; margin-top: 3px; }
.me-row .me-actions { display: flex; align-items: center; white-space: nowrap; justify-self: end; }
.me-actions form { display: inline-flex; align-items: center; }
.me-actions > * + *::before { content: "·"; color: var(--subtle); margin: 0 8px; }
.me-actions button.link { font-size: 14px; font-weight: 500; }
#signin-card > .card-body > details.band { margin: 0 -22px; border-radius: 0; padding: 14px 22px 14px 18px; }
#signin-card > .card-body > details.band h3 { margin-bottom: 8px; }
#signin-card > .card-body > details.band + .me-row { border-top: 0; }
#signin-card .notice { margin: 0 0 8px; }
.me-row:has(+ details.band[open]) { border-bottom-color: transparent; }
.band-row.me-fields .field { flex: 1 1 180px; min-width: 150px; max-width: 260px; }
.band-row .field.narrow { flex: 0 1 200px; min-width: 150px; }
/* the enrolment band: the QR on the left, the secret on one line, the codes once in the highlighted block */
.me-qr .qr svg { width: 128px; height: 128px; }
.me-qr .secret { display: inline-block; padding: 2px 8px; font-size: 13px; word-break: normal; vertical-align: baseline; }
.me-qr p { margin: 0 0 8px; }
.me-codes { margin: 4px 0 12px; }
.me-row:has(+ .me-codes) { border-bottom-color: transparent; }
#signin-card > .card-body > .me-codes + .me-row { border-top: 1px dashed var(--line); }
.me-codes .secret { white-space: pre-wrap; word-break: normal; line-height: 1.8; letter-spacing: .02em; }
.model-list { columns: 2; column-gap: var(--s5); margin-bottom: var(--s3); }
.model-list .check { break-inside: avoid; margin-bottom: var(--s1); }
/* the «Модели» cell of a project row: chips, then the quiet editor; capped so an open editor does not squeeze
   the columns to its right */
.table td.models { min-width: 220px; max-width: 340px; }
.table td.actions select { min-width: 9em; }
.table td.models .model-list { margin-bottom: var(--s2); }
.table td.models .check code { white-space: nowrap; }
.key-list { display: flex; gap: var(--s2); flex-wrap: wrap; }

/* ---------- «Команда»: people, groups, roles (platform/ux/13-team-people.png, 14-team-groups-roles.png) ---------- */

.subtle { color: var(--subtle); }
/* the parent menu item: bold and white while one of its children is the pill, never the pill itself */
.nav a.parent { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.nav a.parent .caret { font-size: 11px; color: var(--sidebar-fg-dim); }
.nav a.parent.open { color: #fff; font-weight: 700; }
.nav a.parent.open .caret { color: #fff; }
/* the «+ Добавить …» form above a table: a headless details the page action opens */
details.add-form { margin: 0 0 var(--s4); border-color: var(--teal); }
details.add-form > summary { display: none; }  /* the form carries its own title; details.edit's summary rule is more specific than .headless */
details.add-form > form { border-top: 0; }
details.add-form > form h3 { margin-bottom: 12px; font-size: 17px; }
/* an open row menu may hang below the table: the wrap stops clipping while one is open */
.card > .table-wrap:has(details.menu[open]) { overflow: visible; }
/* search + type above the people table, the count on the right */
.filter-row { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; margin-bottom: var(--s4); }
.filter-row input[type=text] { flex: 0 1 450px; width: auto; min-width: 200px; }
.filter-row select { flex: 0 1 215px; width: auto; }
.filter-row .filter-count { margin-left: auto; font-size: 13.5px; white-space: nowrap; }
/* chips of groups and roles stack vertically in a cell; fit-content (not max-content) lets the column shrink and a
   long chip wrap, so an eight-column table still fits the card */
.table td.chips-stack .badge { display: block; width: fit-content; max-width: 100%; white-space: normal; margin: 0 0 4px; }
.table td.chips-stack .badge:last-child { margin-bottom: 0; }
.table td.chips-stack .badge + .badge { margin-left: 0; }
/* a row that only holds an inline form (grant a role, add to a group): nothing while the form is closed */
tr.row-form td { padding-top: 0; padding-bottom: 0; }
tr.row-form:has(details:not([open])) td { padding: 0; border-bottom: 0; }
.table tbody tr.row-form:hover td { background: transparent; }
/* the inline form: a soft teal band under the row with a teal rule on the left */
details.band { background: var(--teal-soft); border-left: 4px solid var(--teal); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 12px 18px 12px 18px; margin: 4px 0 8px; }
details.band h3 { font-size: 15px; margin-bottom: 10px; }
.band-row { display: flex; gap: var(--s4); align-items: flex-end; flex-wrap: wrap; }
.band-row .field { margin-bottom: 0; flex: 0 1 380px; min-width: 220px; }
/* three selects in one band, or two inside a card column: narrower fields so they stay on one line */
.band-row.compact .field { flex: 1 1 180px; min-width: 160px; max-width: 320px; }
.band-row .form-actions { margin-top: 0; }
details.band .caption { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
/* the group row: a caret in front of the name; the panel row under it opens with it */
details.disclosure { display: inline-block; vertical-align: middle; }  /* a badge after the name stays on its line */
details.disclosure > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: "▸"; color: var(--subtle); font-size: 12px; }
details.disclosure[open] > summary { font-weight: 700; }
details.disclosure[open] > summary::before { content: "▾"; color: var(--teal); }
tr.group-body { display: none; }
tr.group-row:has(details.disclosure[open]) + tr.group-body, tr.group-body.open { display: table-row; }
tr.group-body td { padding: 0 12px 12px; }
.table tbody tr.group-body:hover td { background: transparent; }
.group-panel { background: var(--panel); border-radius: var(--radius-sm); padding: 14px 18px 16px; }
.group-panel h4 { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.member-line { display: flex; align-items: center; gap: var(--s4); background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 14px; margin-bottom: 8px; font-size: 14px; }
.member-line .name { font-weight: 500; }
.member-line form { margin-left: auto; }
.group-panel .add-member { margin-top: 14px; }
.group-panel .add-member .label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.group-panel .add-member select { width: auto; flex: 0 1 420px; }
.group-panel .add-member .band-row { align-items: center; }
.group-panel .caption { margin: 6px 0 0; font-size: 12px; }
/* two-line empty states; a divider inside a row menu */
.table .empty .empty-hint { display: block; color: var(--subtle); font-size: 13px; margin-top: 4px; }
.menu .menu-body hr { margin: 4px 0; }
.table td .when { font-size: 12px; }
.table.compact thead th.nowrap { white-space: nowrap; }

/* ---------- «Каталог» and «Участники» (platform/ux/15-company-directory.png, 16-workspace-members.png) ---------- */

/* the name of a person leads to their page */
.table a.person-link { color: var(--fg); font-weight: 500; }
.table a.person-link:hover { color: var(--teal); }
.table a.person-link.muted { color: var(--muted); }  /* a suspended person in the list */
/* chips side by side in a cell (a person's workspaces, groups); a chip may be a link */
.table td.chips .badge { margin: 0 4px 4px 0; }
.table td.chips .badge + .badge { margin-left: 0; }
a.badge:hover { text-decoration: none; filter: brightness(.96); }
/* a company group among a workspace's: white with a hairline */
.badge.outline { background: var(--white); color: var(--muted); border: 1px solid var(--line); }
/* the row just added */
.table tbody tr.highlight td { background: var(--teal-soft); }
/* the danger band («Удалить из компании», «Убрать из воркспейса»): a red rule, a pale red field */
details.band.danger { background: #FFF1F1; border-left-color: var(--danger); }
/* an exception rather than a setting (36 §3: a model shown in the chat without a price) */
details.band.warn { background: var(--warn-soft); border-left-color: var(--warn); }
button.warn, .btn.warn { background: var(--warn); color: #fff; border-color: var(--warn); }
button.warn:hover, .btn.warn:hover { filter: brightness(.95); }
.badge.outline-warn { background: transparent; border: 1px solid var(--warn); color: var(--warn); }
.band-text.strong { color: var(--fg); }
details.band.warn .unpriced-reason { max-width: 640px; }
/* a band's long paragraphs must not re-spread the columns of the table it opens in: with automatic layout
   their one-line width was spread across the cells, and opening the band moved «Вход» by 18px */
.models-table tr.row-form details.band { contain: inline-size; }
details.band.warn .form-actions .hint { margin-left: auto; color: var(--subtle); font-size: 12px; }
.menu .menu-body .divider { display: block; margin: 6px 0; border-top: 1px solid var(--line); }
details.band .band-text { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.band-row .radio { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; white-space: nowrap; }
.band-row .radio input { accent-color: var(--teal); margin: 0; width: 16px; height: 16px; }
.band-row select.inline { flex: 0 1 280px; min-width: 200px; }
/* the one destructive confirmation of a band is a filled red button */
.btn.fill.danger, button.fill.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.fill.danger:hover, button.fill.danger:hover { background: #A61E1E; border-color: #A61E1E; color: #fff; }
/* a menu item that is not for this row (one's own): muted, the reason in its title */
.menu .menu-body button:disabled, .table .actions .menu .menu-body button:disabled { color: var(--subtle); opacity: 1; cursor: default; }
.menu .menu-body button:disabled:hover { background: none; }
/* the add-person form: the fields and the buttons on one row, the two checkboxes with their selects on the next */
.form-row-main { grid-template-columns: minmax(200px, 1fr) minmax(220px, 1fr) auto; align-items: start; }
.form-row-main .form-actions { margin-top: 24px; }
.check-row { display: flex; align-items: center; gap: 10px 24px; flex-wrap: wrap; margin-top: var(--s4); }
.check-row .check { margin: 0; align-items: center; font-size: 14px; }
.check-row .check input { margin: 0; width: 16px; height: 16px; }
.check-row select.inline { width: auto; min-width: 180px; }
.check-row select:disabled { opacity: .55; }
input:disabled { background: var(--panel); color: var(--muted); cursor: not-allowed; }
details.add-form .caption { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.field.error input { border-color: var(--danger); }
/* the two-way add-member form: a select on the left, name and e-mail on the right, «или» between them */
.two-way { display: grid; grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr); gap: var(--s4); align-items: start; }
.two-way .way > .label { display: block; font-size: 13.5px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.two-way .way .form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.two-way .way .caption { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.two-way .or { position: relative; align-self: stretch; display: flex; align-items: center; justify-content: center; min-height: 88px; }
.two-way .or::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px solid var(--line); }
.two-way .or-badge { position: relative; background: var(--white); border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; font-size: 11.5px; color: var(--subtle); }
.form-error { margin: 12px 0 0; color: var(--danger); font-size: 13.5px; }
/* two sections in one groups table, 13px bold headers; the hint line when the second section is empty */
.table tr.section td { padding: 12px 12px 6px; font-size: 13px; font-weight: 700; color: var(--navy); border-bottom: 1px solid var(--line); }
.table tbody tr.section:hover td, .table tbody tr.hint-row:hover td { background: transparent; }
.table tr.hint-row td { font-size: 13px; }

/* ---------- the person page (platform/ux/19-person-page.png) ---------- */

.page.person-page { max-width: 1280px; }
h1 .h1-link { color: var(--navy); }
h1 .h1-link:hover { color: var(--teal); text-decoration: none; }
.page-header .subtitle .subtitle-text { margin-left: 10px; }
/* the header card: name, status and dates on the left, the three actions on the right */
.person-head { padding: 20px 24px; }
.person-head-body { display: flex; align-items: center; justify-content: space-between; gap: var(--s5); flex-wrap: wrap; }
.person-head-main { flex: 1 1 420px; min-width: 0; }
.person-line1 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.person-name { font-size: 22px; font-weight: 700; color: var(--navy); line-height: 1.25; }
.small-link, button.link.small-link { font-size: 13px; font-weight: 500; }
.person-line2 { margin-top: 6px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.person-line2 .muted { font-size: 13px; }
.person-head-actions { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.person-head-actions .btn.danger-outline { margin-left: 16px; }
.btn.danger-outline, button.danger-outline { background: var(--white); color: var(--danger); border: 1px solid var(--danger); font-weight: 700; }
.btn.danger-outline:hover, button.danger-outline:hover { background: #FFF1F1; color: var(--danger); border-color: var(--danger); }
/* «Изменить» replaces the two lines with the form, in place */
.person-edit .form-row { grid-template-columns: repeat(2, minmax(200px, 1fr)); max-width: 620px; }
.person-head:has(#edit-person[open]) .person-lines { display: none; }
.person-edit input[readonly] { color: var(--muted); background: var(--panel); }
/* a band under the header card, the same danger band as everywhere */
details.band.head-band { margin: -8px 0 var(--s5); }
/* two columns: 800 / 380 on the mockup; stacked below 1100px */
.person-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--s5); align-items: start; }
.person-main, .person-side { min-width: 0; }
.person-grid .card { margin-bottom: var(--s5); }
.card > .card-header .card-summary { font-size: 13px; margin-left: auto; }
.card > .card-header .badge { margin-left: auto; }
/* the add-workspace band is the first child of its card */
.card > details.band.add-band { margin: 14px 22px 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.card > details.band.add-band + .table-wrap { margin-top: 12px; }
/* six columns in a 700px card: the two-word heads stay on one line, the cells give up some padding for it */
.table.compact.person-keys thead th { white-space: nowrap; }
.table.compact.person-keys th, .table.compact.person-keys td { padding: 9px 8px; }
.table.compact.person-keys td.actions a { white-space: nowrap; }
.card-empty { padding: 26px 22px 28px; text-align: center; color: var(--muted); }
.card-empty.inset { background: var(--panel); border-radius: var(--radius-sm); padding: 18px; margin-bottom: 12px; }
.card-empty .empty-hint { display: block; color: var(--subtle); font-size: 13px; margin-top: 4px; }
/* the console card: the role row, then three account rows with a dashed line between them */
.console-role > .label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.console-role .band-row { gap: var(--s3); }
.console-role .band-row select { flex: 1 1 160px; min-width: 0; }
.console-role .caption { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
#console-card hr { margin: 14px 0 6px; }
.account-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 9px 0; border-bottom: 1px dashed var(--line); }
.account-row:last-of-type { border-bottom: 0; }
.account-cell { display: flex; flex-direction: column; min-width: 0; }
.account-label { font-size: 14px; color: var(--fg); }
.account-state { font-size: 12px; color: var(--muted); }
button.link.row-action { font-size: 13px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; }
.account-row:has(+ details[open]) .row-action { background: var(--teal-soft); text-decoration: none; }
#console-card details.band { margin: 4px 0 8px; }
/* the groups card: a chip, its type, «Убрать»; the add row under them */
.group-line { display: flex; align-items: center; gap: var(--s3); padding: 8px 0; border-bottom: 1px dashed var(--line); }
.group-line .group-type { font-size: 12px; }
.group-line form { margin-left: auto; }
.group-line button.link { font-size: 13px; }
.add-group-row { display: flex; gap: var(--s3); align-items: center; margin-top: 14px; }
.add-group-row select { flex: 1 1 auto; min-width: 0; }
@media (max-width: 1100px) {
  .person-grid { grid-template-columns: minmax(0, 1fr); }
  .person-grid .person-side { order: -1; }
}

/* ---------- responsive ---------- */

@media (max-width: 1280px) {
  :root { --sidebar-w: 208px; }
  .page, .footer, .topbar { padding-left: var(--s5); padding-right: var(--s5); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .provider-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1100px) {
  .grid-2, .grid-3, .grid-main-side, .grid-side-main { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  :root { --sidebar-w: 184px; }
  .nav a { font-size: 14px; padding: 8px 12px; }
  .brand .tagline { display: none; }
  .page-header { flex-direction: column; }
  .page-header .page-side { align-items: flex-start; }
  .page-header .actions { justify-content: flex-start; }
  h1 { font-size: 22px; }
}
@media print {
  .sidebar, .topbar, .footer, .page-header .page-side { display: none; }
  .content { margin: 0; }
}

/* ---------- «Провайдеры» compact (platform/ux/17-providers-compact.png) ---------- */

/* the title row: name, the one state chip, grey meta that ellipsises before the «⋯» */
.provider-card .provider-head { flex-wrap: nowrap; gap: 10px; min-height: 30px; }
.provider-card .provider-head h2 { font-size: 18px; margin: 0; white-space: nowrap; }
.provider-card .provider-head .badge { flex-shrink: 0; }
.provider-card .provider-head .badge + .badge { margin-left: 0; }
.provider-meta { flex: 1 1 auto; min-width: 0; font-size: 12.5px; color: var(--subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.provider-head > .menu { flex-shrink: 0; margin-left: auto; }
/* one line per key: 34 px rows, a 12 px muted header, dashed lines; the same grid in every card */
.provider-card .key-table { margin-top: 12px; }
.provider-card .table.compact th, .provider-card .table.compact td { padding: 6px 12px; vertical-align: middle; }
.provider-card .table.compact thead th { font-size: 12px; }
.provider-card .table.compact { font-size: 13.5px; }
.provider-card .key-role { font-size: 12.5px; color: var(--subtle); margin-left: 8px; }
.provider-card code.prefix { background: transparent; padding: 0; font-size: 13px; color: var(--muted); }
.provider-card .table td.actions .link { font-size: 13.5px; margin-right: 6px; }
.provider-card .table-wrap:has(details.menu[open]) { overflow: visible; }
/* the footer line of facts; the warning segment in the accent tone, a credit problem in red */
.provider-card .links-row { margin-top: 10px; }
.links-row .text-warn { color: var(--warn); }
.links-row .text-danger { color: var(--danger); }
.links-row .subtle { color: var(--subtle); }
/* the blocks under the footer («Управлять моделями», «Технические детали», «Помощь»): quiet panels, no chrome */
details.block { margin: 12px 0 0; padding: 12px 16px; background: var(--panel); border-radius: var(--radius-sm); font-size: 13px; }
details.block > p { margin: 0 0 10px; }
details.block > form.inline { display: block; }
details.block .discovery-head { margin: 12px 0 8px; }
details.block .model-list { margin-bottom: 0; }
details.block .form-actions { margin-top: 12px; }
details.block > dl.tech-list { margin: 0; }
.help-plain dl { font-size: 13px; margin: 0; }
.help-plain dt { font-weight: 700; margin-top: var(--s2); }
.help-plain dt:first-child { margin-top: 0; }
.help-plain dd { margin: 2px 0 0; color: var(--fg); }
.help-plain ul { margin: var(--s1) 0 0; padding-left: 1.1rem; }
.help-plain a { word-break: break-all; }
.provider-card details.edit.headless > form, .provider-card details.addkey.headless > form { border-top: 0; }

/* ---------- «Модели» (platform/ux/18-models-simple.png) ---------- */

/* a section head: h2 16 px, a subtle caption beside it, an optional link on the right */
.card > .card-header.section-head { align-items: baseline; gap: 10px; padding-bottom: 0; justify-content: flex-start; }
.section-head h2 { font-size: 16px; }
.section-head .section-caption { color: var(--subtle); font-size: 13px; }
.section-head .head-link { margin-left: auto; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.card > .card-header.section-head + .card-body { padding: 12px 22px; }
.card > .card-header.section-head + .table-wrap { margin-top: 12px; }
.card > .card-body + .table-wrap { margin-top: 0; }
.filter-row { margin-bottom: 0; }
.filter-row .check.inline { margin: 0; align-items: center; font-size: 13.5px; }
.filter-row .check.inline input { margin: 0; width: 16px; height: 16px; }
.filter-row button.small { padding: 6px 12px; }
/* the models table: the checkbox column, the price link cell, muted rows for models outside the list */
.models-table th.check-col, .models-table td.check-col { width: 96px; text-align: center; }
.models-table td.check-col .allow-form { display: inline-flex; align-items: center; gap: 6px; }
.models-table td.check-col .check { margin: 0; }
.models-table td.check-col .check input { margin: 0; width: 16px; height: 16px; }
.models-table th.row-action, .models-table td.row-action { text-align: right; white-space: nowrap; width: 110px; }
.models-table td.row-action a { font-size: 13.5px; }
.models-table tr.muted code { color: var(--muted); }
.models-table tr.row-note td { padding-top: 0; }
.table tbody tr.row-note:hover td { background: transparent; }
.models-foot { font-size: 12.5px; }
/* the price band: five short fields with the labels above, the buttons at the end of the same line */
.price-row .field { flex: 0 1 140px; min-width: 110px; }
.price-row .field input { font-variant-numeric: tabular-nums; }
details.band h3 .section-caption { font-weight: 400; font-size: 12.5px; color: var(--muted); margin-left: 8px; }
input.mono { font-family: var(--mono); font-size: 13px; }
/* the aliases table: narrower than the page, an inline edit row on a panel background in place of the row */
.aliases-card { max-width: 840px; }
.alias-fields input[type=text] { flex: 0 1 220px; min-width: 160px; width: auto; }
.alias-fields select { flex: 0 1 300px; min-width: 200px; width: auto; }
details.band.edit-row { background: var(--panel); border-left-color: var(--teal-line); }
tr.alias-row:has(+ tr.row-form details.edit-row[open]) { display: none; }
.alias-table tbody tr.row-form + tr.row-form td { border-top: 0; }
/* the same column grid in every card: fixed shares for the five data columns, the rest for the actions */
.provider-card .key-table thead th { white-space: nowrap; }
.provider-card .key-table th:nth-child(1) { width: 23%; }
.provider-card .key-table th:nth-child(2) { width: 15%; }
.provider-card .key-table th:nth-child(3) { width: 20%; }
.provider-card .key-table th:nth-child(4) { width: 13%; }
/* model ids read as plain monospace text in the two tables, not as chips */
.models-table code, .alias-table code { background: transparent; padding: 0; font-size: 13px; }
/* the alias band keeps its input, select and buttons on one line */
.alias-fields { flex-wrap: nowrap; }
.alias-fields input[type=text] { flex: 1 1 180px; min-width: 120px; }
.alias-fields select { flex: 1 1 240px; min-width: 160px; }
.alias-fields .form-actions { flex: 0 0 auto; }

/* ---------- designer review of the two pages (2026-09-20) ---------- */

/* a block opened from the provider «⋯»: its title and a quiet «Скрыть» on one line */
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.block-head h3 { font-size: 14px; margin: 0; }
.block-head button.link { font-size: 12.5px; font-weight: 500; }
/* ≈38 px rows in the models tables */
.models-table th, .models-table td { padding: 6px 12px; }
/* an open band runs edge to edge under its row; its own padding lines its content up with the cells */
.models-table tr.row-form:has(details[open]) td, .alias-table tr.row-form:has(details[open]) td { padding: 0; }
.models-table details.band { padding-left: 8px; }
/* the aliases table keeps its columns while a band is open: fixed shares, and the band's input and select take
   the same shares (the cell padding of 16 px on each side is what the calc()s subtract) */
.alias-table { table-layout: fixed; }
.alias-table th:nth-child(1) { width: 25%; }
.alias-table th:nth-child(2) { width: 40%; }
.alias-table th:nth-child(3) { width: 25%; }
.alias-table th:nth-child(4) { width: 10%; }
.alias-table details.band { padding-left: 12px; padding-right: 16px; }
.alias-fields { display: grid; grid-template-columns: calc(25% - 24px) calc(40% - 19.2px) auto; column-gap: 32px; align-items: center; }
.alias-fields input[type=text], .alias-fields select { width: 100%; min-width: 0; }
.alias-fields .form-actions { margin: 0; flex-wrap: nowrap; }
.alias-fields .alias-fixed { display: inline-flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.alias-fields .alias-fixed .subtle { font-size: 12px; }
/* the workspace's «Ключи со своим списком»: name and prefix on one line, the list takes the rest */
.keys-list th:nth-child(1) { width: 30%; }
.keys-list th:nth-child(2) { width: 25%; }
.keys-list code { background: transparent; padding: 0; font-size: 13px; }

/* «Чат» (platform/ux/21-chat.png, 23-chat-compare.png): a 232px rail of one's own chats and the conversation.
   The whole page is server-rendered; only sending needs JavaScript (CONTRACTS section 19). */
.page.chat-page { max-width: var(--page-max-wide); }
.chat-shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: var(--s5); align-items: start; }
.chat-rail { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4); }
.chat-rail .btn.block { margin-bottom: var(--s3); }
.chat-search { margin-bottom: var(--s3); }
.chat-search input[type=search] { width: 100%; padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; font-size: 13.5px; background: var(--white); color: var(--fg); }
.chat-search input[type=search]:focus { outline: none; border-color: var(--teal); box-shadow: var(--focus-ring); }
.chat-rail-label { color: var(--muted); font-size: 12.5px; margin: 0 0 var(--s2); }
.chat-list { list-style: none; margin: 0; padding: 0; }
.chat-list li + li { border-top: 1px dashed var(--line-soft); }
.chat-list li.active { background: var(--teal-soft); border-radius: var(--radius-sm); border-top-color: transparent; }
.chat-list a { display: block; padding: 9px 10px; color: var(--fg); }
.chat-list a:hover { text-decoration: none; color: var(--teal); }
.chat-item-title { display: block; font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* one line per chat, as the mockup draws it: the chip on the left, the time on the right. With wrapping on,
   «claude-haiku-4-5» plus «11 дней назад · $0.01» did not fit into 178px and every other item was twice as tall. */
.chat-item-meta { display: flex; align-items: center; flex-wrap: nowrap; gap: 3px 6px; margin-top: 5px; }
.chat-item-meta .chat-chip { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; padding: 2px 6px; }
.badge.outline { background: transparent; border: 1px solid var(--teal); color: var(--teal); }
.chat-item-when { color: var(--muted); font-size: 12px; white-space: nowrap; margin-left: auto; }
.chat-list-empty { color: var(--muted); font-size: 13px; padding: 6px 10px; }
.chat-more { margin-top: var(--s3); font-size: 13.5px; }

/* no `min-height` here any more: how tall the conversation is, the window says (34-chat-height-spec.md §6) */
.chat-main { display: flex; flex-direction: column; margin-bottom: 0; }
.chat-strip { padding: 14px 22px 12px; border-bottom: 1px solid var(--line-soft); }
.chat-strip-row { display: flex; align-items: center; gap: var(--s3); min-height: 38px; flex-wrap: wrap; }  /* three rows of the same height in every mode */
/* the row of controls is the one that must never wrap: a wrapping flex line does not shrink its items,
   it moves them down, and «⋯» ended up on a line of its own at 1280px. Everything inside it shrinks. */
.chat-strip-row.controls { flex-wrap: nowrap; }
.chat-strip-row + .chat-strip-row { margin-top: 6px; }
.chat-strip-note, .chat-estimate { font-size: 12.5px; }
/* inside the row that never wraps, the note shrinks with an ellipsis instead of taking a second line
   and making the strip taller — it is a hint, and the row is a fixed height (21-23-chat-spec.md) */
.chat-pickers .chat-strip-note { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-modes { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; flex: 0 0 auto; }
.chat-mode { padding: 6px 16px; font-size: 13.5px; font-weight: 600; color: var(--muted); background: var(--white); }
.chat-mode + .chat-mode { border-left: 1px solid var(--line); }
.chat-mode:hover { background: var(--teal-soft); color: var(--teal); text-decoration: none; }
.chat-mode.current { background: var(--teal); color: #fff; }
.chat-mode.disabled { color: var(--subtle); cursor: default; }
.chat-mode.disabled:hover { background: var(--white); color: var(--subtle); }
/* the strip is three rows of the same height in every mode (spec 21-23-chat-spec.md), and the first row holds
   four things: the segmented control, the project, the model and «⋯». Everything in the middle therefore has to
   shrink rather than push the last one onto a line of its own — measured at 1280px, where the un-shrinkable
   380px model select plus a 280px chip made the strip 192px instead of 154px. */
select.chat-model { flex: 0 1 320px; width: auto; min-width: 0; }
/* `1 1 auto` and not `0 1 auto`: the free space of the row belongs inside this box, so the hint next to the
   project keeps its words instead of being clipped to «модель — аг…» while 300px sat unused to the right.
   Nothing else moves — the chips do not grow, the model select is capped at 320px, and «⋯» is still pushed
   to the far edge by its own `margin-left: auto`. */
.chat-pickers { display: flex; align-items: center; gap: var(--s3); flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; }
select.chat-project { flex: 0 1 220px; width: auto; min-width: 0; }
/* a read-only label, not a fourth button: the project of a started chat and the models of a closed one. It
   does not shrink — the name is the whole point of it — but it is capped, and the select next to it gives way
   instead; past the cap the name is cut with an ellipsis and stays whole in the `title`. */
.chat-strip-chip { flex: 0 0 auto; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-menu { margin-left: auto; }
/* the handle stays in the strip, the textarea opens as a band under it — the three rows keep their height */
.chat-system-open { font-size: 13.5px; }
/* the same triangle as `details.disclosure`, following the band the button opens */
.chat-system-open::before { content: "▸"; margin-right: 6px; }
.chat-system-open[aria-expanded="true"]::before { content: "▾"; }

/* «Поиск в интернете» (platform/ux/37-web-search-spec.md §2): flush right in row 2 of the strip, never wrapping —
   the strip is three rows of one height (measure_chat.py). The price words go first when the row is tight. */
/* its own class: `.chat-search` is the rail's «Поиск по чатам…» form, and borrowing it broke that box */
.chat-web-search { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 13.5px; line-height: 20px; }
.chat-strip-row .chat-system-open { line-height: 20px; }
.chat-web-search.off .switch-label { color: var(--subtle); }
.chat-web-search-price { font-size: 12.5px; }
.chat-web-search-price[hidden] { display: none; }
@media (max-width: 1152px) { .chat-web-search-price { display: none; } }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { position: relative; width: 30px; height: 17px; border-radius: 9px; background: var(--line); transition: background .15s; flex: 0 0 auto; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--white); transition: left .15s; }
.switch input:checked + .switch-track { background: var(--teal); }
.switch input:checked + .switch-track::after { left: 15px; }
.switch input:checked ~ .switch-label { font-weight: 600; }
.switch input:focus-visible + .switch-track { box-shadow: var(--focus-ring); }
.switch input:disabled + .switch-track { opacity: .5; }
.switch:has(input:disabled) { cursor: default; }

/* the heading of the agent's «Доступы» sits with the band's fields, not against its edge, under the one rule the
   form above already draws */
/* «Веб-поиск» on «Провайдеры» (39): the mode as two radio cards, the cache, the month's numbers */
.section-title { font-size: 17px; margin: 28px 0 10px; }
.section-sub { font-size: 12.5px; font-weight: 400; margin-left: 8px; }
.ws-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-start; }
.auto-ceiling-row { display: flex; align-items: center; gap: 12px; }
.auto-ceiling-row select.auto-ceiling { width: 50%; flex: 0 0 50%; }
.auto-split { margin-top: 12px; }
.auto-unpriced-help { padding-left: 22px; }
.ws-line { font-size: 13px; margin: 0 0 12px; }
.ws-warn { color: var(--warn); font-size: 13.5px; margin: 0 0 10px; }
.ws-form h3 { font-size: 14.5px; margin: 14px 0 8px; }
.ws-sub { font-size: 12.5px; font-weight: 400; margin-left: 6px; }
.ws-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label.choice { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 12px 40px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 13px; position: relative; }
/* the radio before the title, as the mockups and the convention have it */
label.choice input[type=radio] { position: absolute; top: 14px; left: 14px; accent-color: var(--teal); }
label.choice strong { font-size: 14px; }
label.choice.selected { background: var(--teal-soft); border-color: var(--teal); }
label.choice.disabled { cursor: default; opacity: .7; }
.ws-normalizer { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line-soft); font-size: 12.5px; }
.ws-ttl { font-size: 13.5px; }
/* the global `input[type=number] { display: block; width: 100% }` broke «Хранить найденное [24] часов» into three lines */
.ws-ttl input[type=number] { display: inline-block; width: 80px; margin: 0 6px; }
.ws-normalizer .subtle { display: block; margin-top: 2px; }
.ws-shared { font-size: 13px; margin: 8px 0 2px; }
.ws-note { font-size: 12.5px; margin: 0 0 10px; }
.ws-form .form-actions .hint { margin-left: auto; font-size: 12px; }
.ws-stats { margin-top: 16px; padding: 12px 14px; background: var(--panel); border-radius: 10px; }
.ws-stats-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ws-figures { display: flex; gap: 32px; flex-wrap: wrap; }
.ws-figures > div { display: flex; flex-direction: column; font-size: 12px; }
.ws-fig { font-size: 20px; font-weight: 700; color: var(--fg); }
.ws-fig.ok-text { color: var(--ok); }

/* «Как подключить инструменты PAI» (38): the continuation lines of a shell command must not reflow */
.me-tools .nowrap-code { white-space: pre; overflow-x: auto; display: block; }
/* as specific as `.me-howto details.quiet { margin: 0 }`, which otherwise wins and glues the two disclosures */
.me-howto details.me-tools { margin-top: 12px; }
.me-tools-table td .badge { white-space: nowrap; }
.me-tools-tail { font-size: 12.5px; margin-left: 6px; }
.me-tools-table { margin: 8px 0 12px; border: 1px solid var(--line); border-radius: 10px; }
.me-tools-table .table { margin: 0; }
.me-tools-step { margin: 14px 0 6px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.me-tools-step .step-no { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--teal-soft); color: var(--teal); font-size: 12.5px; font-weight: 700; }
.me-tools-step .muted { font-size: 13px; font-weight: 400; }
.me-tools-hint { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }
.me-tools-hint code { font-size: 12px; }
.me-tools-cost { font-size: 12.5px; margin: 10px 0 0; padding-top: 8px; border-top: 1px dashed var(--line-soft); }

.agent-grants-title { font-size: 14px; margin: 6px 0 6px 17px; }
.badge.wrap { white-space: normal; }

/* a band that opens under a table row (the project's «Веб-поиск»): the row that holds it is invisible while it
   is closed, and the band spans the table once open */
tr.band-tr > td { padding: 0; border: 0; }
tr.band-tr details.band[open] { margin: 0 12px 10px; }

/* the searches of an answer: quiet collapsed rows above its text, the sites found inside */
.searches { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.search-row { font-size: 12.5px; color: var(--muted); }
.search-row > summary { list-style: none; cursor: pointer; }
.search-row > summary::-webkit-details-marker { display: none; }
.search-row code { font-size: 12px; background: transparent; padding: 0; color: var(--fg); }
.search-row .search-mark { color: var(--ok); }
.search-row.failed .search-mark, .search-row.failed .search-meta { color: var(--warn); }
.search-row.running .search-verb { color: var(--teal); font-weight: 600; }
.search-row .search-meta { margin-left: 8px; color: var(--subtle); }
/* the footer of an answer with a search part: «(N запросов)» goes first on a narrow window, before anything wraps */
@media (max-width: 1152px) { .msg-search-count { display: none; } }

/* Images of a message (41): the paperclip left of the field, the thumbnails above it, the images in the bubble */
.chat-attach { flex: 0 0 auto; align-self: flex-end; padding: 10px; background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: var(--radius-sm); }
.chat-attach:hover { color: var(--teal); border-color: var(--teal); }
.chat-attach:disabled { opacity: .45; cursor: default; }
.chat-attachments { margin: 0 0 8px; }
.chat-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.chat-thumb { position: relative; width: 60px; height: 60px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.chat-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chat-thumb-x { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; padding: 0; line-height: 16px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; border: 0; font-size: 13px; }
.chat-attach-note { font-size: 12px; margin: 4px 0 0; }
.chat-composer.dropping { outline: 2px dashed var(--teal); outline-offset: -4px; }
.msg-images { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.msg-images img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; display: block; }

/* «Авто» (40): the mini badge before the model the router picked; grey when the pick failed */
.auto-badge { display: inline-block; padding: 0 6px; border-radius: 9px; background: var(--teal-soft); color: var(--teal); font-size: 11px; font-weight: 600; line-height: 17px; }
.auto-badge.failed { background: var(--panel); color: var(--subtle); }

/* 39 §2: a search answered from the company's cache, and what it was looked up by */
.pill-cache { display: inline-block; padding: 0 7px; border-radius: 9px; background: var(--teal-soft); color: var(--teal); font-size: 11px; line-height: 18px; }
.search-why { margin: 4px 0 0; padding: 6px 10px 0; font-size: 12px; color: var(--muted); }
.search-why code { font-size: 12px; }

/* a collapsed row has to look like one: the caret turns when it opens */
.search-row .search-caret::before { content: "▸"; display: inline-block; width: 12px; color: var(--subtle); }
.search-row[open] .search-caret::before { content: "▾"; }
.search-lens { vertical-align: -1px; color: var(--subtle); }
.search-sites { list-style: none; margin: 4px 0 0; padding: 8px 10px; background: var(--panel); border-radius: var(--radius-sm); max-height: 180px; overflow-y: auto; }
.search-sites li + li, .msg-sources li + li { margin-top: 2px; }
.msg-sources { margin-top: 10px; font-size: 13px; }
.msg-sources-label { display: block; color: var(--muted); font-weight: 700; font-size: 12.5px; margin-bottom: 2px; }
.msg-sources ul { list-style: none; margin: 0; padding: 0; }
.msg-sources-more > summary { cursor: pointer; color: var(--teal); font-size: 12.5px; list-style: none; margin: 2px 0 0; }
.msg-sources-more > summary::-webkit-details-marker { display: none; }
details.band.chat-system .band-row { display: block; }
details.band.chat-system textarea { width: 100%; }
#chat-cost { font-size: 13.5px; }
.chat-hint { color: var(--warn); font-size: 12.5px; margin: 0 0 8px; }
.chat-sep { color: var(--subtle); }

.chat-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); align-items: start; }
.chat-cols-head { padding: 12px 22px; border-bottom: 1px solid var(--line-soft); }
.chat-cols-head select { width: 100%; min-width: 0; }
.chat-cols > .chat-col { min-width: 0; }
.chat-cols > .chat-col + .chat-col { border-left: 1px solid var(--line-soft); padding-left: var(--s4); }

/* No minimum of its own and no `56vh` ceiling any more (34-chat-height-spec.md §2): inside the lock below the
   thread is the one elastic band and takes whatever the window leaves; outside it — a short or narrow window,
   print — it keeps a small floor so a scrolling page still shows a thread. */
.chat-thread { flex: 1 1 auto; overflow-y: auto; min-height: 200px; max-height: 60vh; padding: 18px 22px; }
.chat-thread.empty { display: flex; align-items: center; justify-content: center; }
.chat-empty { color: var(--muted); text-align: center; margin: 48px 0; }
.chat-thread.empty .chat-empty { margin: 0; }
.turn + .turn { margin-top: var(--s5); }
.msg-user { display: flex; justify-content: flex-end; margin-bottom: var(--s4); }
.msg-user .bubble { background: var(--panel); border-radius: 12px; padding: 10px 16px; max-width: 70%; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.msg-assistant + .msg-assistant { margin-top: var(--s4); }
pre.msg { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg); }
.msg-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 0 8px; margin-top: 8px; color: var(--muted); font-size: 12.5px; }
.msg-foot .msg-copy, .msg-foot button.link { font-size: 12.5px; }
.msg-foot .msg-stop { margin-left: 8px; }
.chat-error { background: var(--warn-soft); border-left: 4px solid var(--warn); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--warn); font-size: 13.5px; padding: 8px 12px; margin: 8px 0 0; }
.chat-error button.link { color: var(--warn); font-size: 13.5px; margin-left: 8px; }
.rate-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0 10px; margin-top: var(--s3); justify-content: center; font-size: 13.5px; }
.rate-row form { display: inline; }
.rate-row button.chosen { font-weight: 700; color: var(--teal-strong); text-decoration: underline; }
.chat-rate-hint { flex: 1 1 100%; text-align: center; color: var(--subtle); font-size: 12px; }

.chat-composer { border-top: 1px solid var(--line-soft); padding: 14px 22px 16px; }
.chat-form { display: flex; gap: var(--s3); align-items: flex-end; }
.chat-form textarea { flex: 1 1 auto; min-height: 46px; margin: 0; }
.chat-form button { flex: 0 0 auto; padding: 11px 24px; }
.chat-honesty, .chat-nojs { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }
.chat-nomodels { font-size: 14px; }
.chat-budget { background: var(--warn-soft); border-left: 4px solid var(--warn); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--warn); font-weight: 600; font-size: 13.5px; padding: 9px 12px; margin: 0 0 12px; }
.rate-row.chat-continue { margin-top: 6px; }
.rate-row.chat-continue button.link { font-size: 12.5px; }

/* «Агент» (platform/ux/30-admin-agent-plan.md §1). A run is a list of steps under the person's message, and
   every step prints the literal argv the control-plane stored — monospaced, on its own line, never mixed
   with the agent's prose above it. That separation is the whole security property the bar has. */
.steps { display: flex; flex-direction: column; gap: 8px; }
.step { font-size: 13px; }
.step-tool { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: baseline; gap: 0 8px; }
.step-name { font-weight: 600; color: var(--teal-strong); white-space: nowrap; }
.step-state { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.step-tool[data-status="error"] .step-state { color: var(--warn); }
/* the argv is bounded like the output beside it: a padded command of two thousand characters used to push
   the rest of the journal — and the «Разрешить / Запретить» under it — off the screen entirely */
pre.step-argv { margin: 0; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg); max-height: 160px; overflow-y: auto; }
pre.step-output { grid-column: 1 / -1; margin: 4px 0 0; padding: 8px 10px; background: var(--panel); border-radius: var(--radius-sm); font-family: var(--mono); font-size: 12px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 180px; overflow-y: auto; color: var(--muted); }
.step-note { color: var(--muted); font-size: 12.5px; border-left: 3px solid var(--line-soft); padding-left: 10px; }
.step-permission { border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--panel); }
.step-permission.asking { border-color: var(--warn); background: var(--warn-soft); }
.step-permission.asking.tainted { border-width: 2px; }
.step-ask { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.step-permission pre.step-argv { padding: 6px 8px; background: var(--bg); border-radius: var(--radius-sm); }
.step-taint { color: var(--warn); font-size: 12.5px; margin-top: 6px; font-weight: 600; }
.step-decided { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.step-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

.chat-run { display: flex; align-items: center; flex-wrap: wrap; gap: 0 14px; border-top: 1px solid var(--line-soft); padding: 8px 22px; font-size: 12.5px; color: var(--muted); }
.chat-run .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--subtle); margin-right: 6px; }
.chat-run .dot.live { background: var(--ok); }
.chat-run-taint { color: var(--warn); font-weight: 600; }
.chat-run-branch code { font-size: 12px; }
.chat-run-actions { margin-left: auto; display: flex; gap: 8px; }
/* `.btn` sets a display of its own, which beats the browser's default rule for [hidden] and left
   «Продолжить» on screen through a live run. The two verbs are never both offered. */
.chat-run-actions [hidden] { display: none; }

/* ---------- «Чат»: страница ровно в высоту окна (34-chat-height-spec.md) ----------
   The defect this answers: the composer sat below the bottom edge of the window — 21px down on a new chat
   with the system prompt open at 1440×900, 327px down in «Сравнить» at 1280×720 — and a person looking at an
   empty thread decided there was nowhere to write. The cause was one rule: the thread's *maximum* followed
   the window (56vh) while its *minimum* did not (340px), so on a laptop it refused to shrink and pushed
   everything below it out of sight.

   The rule now: only the thread scrolls (and the rail of chats); the composer is the last band of the window
   and never moves. Everything that opens — the system prompt, «Переименовать», the columns of «Сравнить»,
   the run journal of «Агента» — takes its height out of the thread, not out of the page.

   `min-height: 0` on every link of the chain is the whole trick: a flex item refuses to shrink below its
   content without it, and the column would stay taller than the window — the same defect in a new costume. */
@media (min-height: 640px) and (min-width: 980px) {
  body.chat-locked .shell { height: 100vh; height: 100dvh; overflow: hidden; }
  body.chat-locked .content { height: 100vh; height: 100dvh; min-height: 0; }
  /* on a page that is exactly one window tall the last line belongs to the composer, not to «время UTC» */
  body.chat-locked .footer { display: none; }
  body.chat-locked .page.chat-page { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding-bottom: 20px; }
  body.chat-locked .page.chat-page .page-header { margin-bottom: 14px; }
  body.chat-locked .chat-shell { flex: 1 1 auto; min-height: 0; align-items: stretch; }
  body.chat-locked .chat-main, body.chat-locked .chat-rail { min-height: 0; height: 100%; }
  body.chat-locked .chat-thread { min-height: 0; max-height: none; }
  /* forty chats in the rail pushed the composer down exactly the way the system prompt did: «Новый чат», the
     search and «Мои чаты» stay put, and the list alone scrolls */
  body.chat-locked .chat-rail { display: flex; flex-direction: column; }
  body.chat-locked .chat-rail ul.chat-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  /* the band sits between two rules, so its own margin is a gap rather than a shape; and its inner label
     repeats the handle in the strip above it. 154+12 → 129px, and all of it comes out of the thread. */
  body.chat-locked details.band.chat-system, body.chat-locked details.band#chat-rename { margin: 0; }
  body.chat-locked details.band.chat-system .field > .label { display: none; }
}
/* Outside the lock — a short or narrow window, a phone — nothing is locked and the page scrolls as a normal
   document: a 320px-tall browser cannot hold a strip, a thread and a composer at once, and pretending it can
   is how the composer went off screen in the first place. */
@media print {
  body.chat-locked .shell, body.chat-locked .content { height: auto; overflow: visible; }
  body.chat-locked .chat-thread { max-height: none; overflow: visible; }
}

/* 41: the paperclip is a 40×40 square at the field's bottom edge — `.chat-form button` padded it into a 66px pill */
.chat-form .chat-attach { width: 40px; height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
/* 41: what dropping does, over the composer while a file is dragged across it */
.chat-composer { position: relative; }
.chat-composer.dropping::after { content: attr(data-drop); position: absolute; inset: 4px; display: flex; align-items: center; justify-content: center; padding: 0 24px; text-align: center; background: rgba(255,255,255,.94); color: var(--teal); font-size: 13px; font-weight: 600; border-radius: var(--radius-sm); pointer-events: none; }
/* 40, 37: the state badge sits right after the title, the meta after it — not pushed to the far edge by `.card-header .badge` */
.card > .card-header.ws-head { justify-content: flex-start; }
.card > .card-header.ws-head .badge { margin-left: 0; }
/* 40: the hint belongs to its checkbox — 4px under it, aligned with the checkbox's text */
.auto-unpriced { margin-bottom: 0; }
.ws-note.auto-unpriced-help { margin-top: 4px; }
/* 40: the «Авто» settings as one block — greyed as a whole while there is no router */
.auto-fields { border: 0; margin: 0; padding: 0; min-width: 0; }
.auto-fields:disabled { opacity: .55; }
/* an answer with no text yet (the router still picking, the first delta not in) takes no room above its footer */
.msg-assistant > pre.msg:empty { display: none; }
/* ux 42: «Нужно: Картинки · Поиск · …» in the strip — toggles, pressed in teal; one ticked by the message itself is solid */
.chat-needs { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; margin-left: auto; margin-right: 16px; font-size: 13px; }
.need-chip { padding: 2px 10px; border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--muted); font-size: 12px; line-height: 18px; }
.need-chip:hover { border-color: var(--teal); color: var(--teal); }
.need-chip[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-soft); color: var(--teal); }
.chat-needs .need-chip.auto, .chat-needs .need-chip.auto:hover { background: var(--teal); border-color: var(--teal); color: #fff; cursor: default; }
.chat-fit { margin: 0 0 8px; }
.chat-fit-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; font-size: 12px; }
.fit-chip { padding: 2px 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--fg); font-size: 12px; line-height: 18px; }
.fit-chip:hover { border-color: var(--teal); }
.fit-chip.chosen { border-color: var(--teal); background: var(--teal-soft); }
.fit-chip.maybe { border-style: dashed; }
.fit-model { font-family: var(--mono, monospace); }
.chat-fit-warn { font-size: 12px; margin: 4px 0 0; }
/* ux 42: what the model can do, one quiet line under its id on «Модели» */
.caps-line { display: inline-block; font-size: 11px; margin-top: 2px; white-space: normal; max-width: 240px; line-height: 15px; }
.caps-manual { color: var(--teal); }
.band-row.caps-row .field { flex: 0 1 150px; min-width: 120px; }
.need-chips { display: inline-flex; gap: 6px; }
.need-fold { display: none; padding: 2px 10px; border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--fg); font-size: 12px; line-height: 18px; white-space: nowrap; }
/* ux 42 §5: at 1152 and narrower the chips fold into «Нужно: … ▾» with a popover under it */
@media (max-width: 1152px) {
  .chat-needs { position: relative; }
  .chat-needs .needs-label { display: none; }
  .need-fold { display: inline-block; }
  .need-chips { display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 20; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 6px 18px rgba(16, 42, 56, .12); }
  .chat-needs.open .need-chips { display: flex; }
}
.chat-needs + .chat-web-search { margin-left: 0; }
/* ux 42: the chosen model cannot — the band of 41 above the field: orange when it blocks sending, quiet when it only advises */
.chat-fit-band { background: var(--panel); border-left: 4px solid var(--line); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 8px 12px; }
.chat-fit-band.hard { background: var(--warn-soft); border-left-color: var(--warn); }
.chat-fit-band .chat-fit-warn { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--fg); }
.chat-fit-band.hard .chat-fit-warn { color: var(--warn); }
.chat-fit-band + .chat-fit-band { margin-top: 6px; }
/* 43: dashboards inside PAI — the card under an answer, the embedded dashboard on «Дашборды» */
.dash-card { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 10px 0 4px; padding: 10px 12px; border: 1px solid var(--line); border-left: 4px solid var(--teal); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: #fff; font-size: 13.5px; }
.dash-card-mark { color: var(--teal); font-size: 16px; line-height: 1; }
.dash-bar { justify-content: flex-start; gap: 10px; }
.dash-bar .badge { margin-left: 0; }
.dash-bar .card-tools { margin-left: auto; }
.dash-frame { height: calc(100vh - 220px); min-height: 560px; margin: 12px 0 0; border-top: 1px solid var(--line-soft); }
.dash-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.dash-honesty { padding: 8px 22px 14px; font-size: 12.5px; }
.dash-failed { padding: 0 22px 14px; }
.dash-empty .dash-examples { margin: 6px 0 14px; padding-left: 18px; }
tr.selected td { background: var(--teal-soft); }
/* 038: the switch of a PAI tool on one level — «как выше», on, (with confirmation), off */
.tool-switch { border: 0; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tool-switch .choice-line { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; }
.tool-switch .choice-line.disabled { opacity: .5; }
.tool-switch .warn-line { font-size: 12.5px; }
.ws-tools .card-body { padding-top: 10px; }
/* 039, ux 45: connections */
.conn-kind { font-family: var(--mono, monospace); font-size: 11px; }
.conn-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 24px; align-items: start; }
.conn-kinds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 8px 0 18px; }
.conn-kind-card { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.conn-kind-card input { position: absolute; opacity: 0; }
.conn-kind-card.selected { border-color: var(--teal); background: var(--teal-soft); }
.conn-new h3 { margin: 16px 0 8px; } .conn-new h3:first-child { margin-top: 0; }
.conn-new .step { display: inline-flex; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--teal); color: var(--teal); font-size: 12px; align-items: center; justify-content: center; margin-right: 6px; }
.copy-row { display: flex; gap: 8px; } .copy-row input { flex: 1; }
.conn-howto { margin: 12px 0 0; padding: 12px 14px; background: var(--teal-soft); border-radius: var(--radius-sm); font-size: 13px; }
.conn-howto ol { margin: 6px 0 8px; padding-left: 18px; }
.conn-share { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; padding-left: 22px; }
.tabs-head, .card > .card-header.tabs-head { gap: 22px; justify-content: flex-start; }
.tabs-head .tab { padding-bottom: 8px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs-head .tab.current { color: var(--fg); font-weight: 600; border-bottom-color: var(--teal); }
.tabs-head .count { font-size: 12px; color: var(--teal); }
@media (max-width: 1152px) { .conn-cols { grid-template-columns: 1fr; } }
/* a folding group of the menu (Команда, Каталог): the summary looks like a menu item, the caret turns when folded */
.nav details.nav-fold > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: 10px 14px; border-radius: var(--radius-sm); color: var(--sidebar-fg); font-size: 15px; line-height: 1.3; cursor: pointer; user-select: none; }
.nav details.nav-fold > summary::-webkit-details-marker { display: none; }
.nav details.nav-fold > summary:hover { background: var(--navy-2); color: #fff; }
.nav details.nav-fold > summary.current-group { color: #fff; font-weight: 700; }
.nav details.nav-fold > summary .caret { font-size: 11px; color: var(--sidebar-fg-dim); transition: transform .15s; }
.nav details.nav-fold:not([open]) > summary .caret { transform: rotate(-90deg); }
/* provider credit allocation (2026-09-27) */
.alloc-summary { display: flex; gap: 40px; } .alloc-summary > div { display: flex; flex-direction: column; }
.alloc-warn { margin: 0 22px 12px; }
/* «Бюджеты»: a revoked key's leftover budget stands out — tinted row, a red badge (the owner, 2026-09-27) */
tr.revoked-row > td { background: #fdf1f1; }
tr.revoked-row > td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
/* delete a chat from the rail: a × at the right edge, on hover or keyboard focus */
.chat-list li { position: relative; }
.chat-list .chat-item-del { position: absolute; top: 6px; right: 4px; opacity: 0; transition: opacity .1s; }
.chat-list li:hover .chat-item-del, .chat-list .chat-item-del:focus-within { opacity: 1; }
.chat-list .chat-item-del button { padding: 2px 7px; font-size: 16px; line-height: 1; color: var(--muted); border-radius: 50%; }
.chat-list .chat-item-del button:hover { color: var(--danger); background: #fdf1f1; }
/* dashboards as tabs (2026-09-27): «Все» and one tab per dashboard, scrolling sideways when many */
.dash-tabs { display: flex; gap: 4px; overflow-x: auto; margin: 0 0 12px; border-bottom: 1px solid var(--line); }
.dash-tab { flex: 0 0 auto; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.dash-tab:hover { color: var(--teal); text-decoration: none; }
.dash-tab.current { color: var(--fg); font-weight: 600; border-bottom-color: var(--teal); }
.dash-tab .count { font-size: 12px; color: var(--teal); }

/* The key's panel (platform/ux/46): opens on the right of «Распределение», one form and one «Сохранить». */
.kp-veil { position: fixed; inset: 0; background: rgba(11, 31, 42, .28); z-index: 60; }
.kp-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(700px, calc(100vw - 40px)); background: var(--white);
  box-shadow: -12px 0 32px rgba(11, 31, 42, .16); z-index: 61; display: flex; flex-direction: column; }
.kp-drawer[hidden], .kp-veil[hidden] { display: none; }
.kp { display: flex; flex-direction: column; height: 100%; margin: 0; }
.kp-head { padding: 20px 28px 16px; border-bottom: 1px solid var(--line-soft); }
.kp-title { display: flex; align-items: center; gap: 12px; }
.kp-prefix { font-size: 20px; font-weight: 700; background: none; padding: 0; color: var(--fg); }
.kp-close { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 26px; line-height: 1; padding: 0 4px; cursor: pointer; }
.kp-close:hover { color: var(--fg); background: none; }
.kp-who { margin: 6px 0 14px; color: var(--muted); }
.kp-who strong { color: var(--fg); }
.kp-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kp-tile { background: var(--panel); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.kp-tile-label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.kp-tile-fig { font-size: 19px; font-weight: 700; }
.kp-tile-fig small { font-size: 12.5px; font-weight: 400; }
.kp-bar { position: relative; display: block; height: 5px; border-radius: 3px; background: var(--line-soft); overflow: visible; }
.kp-bar.empty { background: none; border-top: 1px dashed var(--line); height: 0; }
.kp-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--teal); max-width: 100%; }
.kp-bar i.warn { background: var(--warn); }
.kp-bar .kp-mark { position: absolute; top: -4px; width: 2px; height: 13px; background: var(--navy); }
.kp-body { flex: 1 1 auto; overflow-y: auto; padding: 4px 28px 20px; }
.kp-sec { padding: 18px 0; border-bottom: 1px solid var(--line-soft); }
.kp-sec:last-child { border-bottom: 0; }
.kp-sec h3 { display: flex; align-items: baseline; gap: 8px; margin: 0 0 12px; font-size: 17px; }
.kp-num { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--teal); color: var(--white); font-size: 11.5px; font-weight: 700; transform: translateY(-2px); }
.kp-aside { margin-left: auto; font-size: 13px; font-weight: 400; color: var(--muted); }
.kp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.kp-label { font-weight: 600; margin: 12px 0 6px; }
.kp-label .subtle { font-weight: 400; }
.kp-date { font-size: 15px; font-weight: 600; padding: 7px 10px; border: 1.5px solid var(--teal); border-radius: var(--radius-sm); }
.kp-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--white); color: var(--teal); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.kp-pill:hover { background: var(--teal-soft); color: var(--teal); }
.kp-pill.on, .kp-pill:has(input:checked) { background: var(--teal); color: var(--white); border-color: var(--teal); }
.kp-pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kp-chip { cursor: pointer; }
.kp-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kp-chip span { display: inline-block; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--muted); }
.kp-chip input:checked + span { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-strong); }
.kp-chip input:checked + span::before { content: "✓ "; }
.kp-chip input:focus-visible + span { box-shadow: var(--focus-ring); }
.kp-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.kp-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.kp-card.empty { border-style: dashed; }
.kp-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.kp-card-head .subtle { font-size: 12px; }
.kp-add { display: none; flex-direction: column; align-items: center; gap: 4px; padding: 16px 0 8px; background: none; border: 0; cursor: pointer; color: var(--muted); }
.kp-add:hover { background: none; }
.kp-plus { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--teal-soft); color: var(--teal); font-size: 22px; }
.kp-add .link { color: var(--teal); font-weight: 600; }
.kp-card.empty .kp-add { display: flex; }
.kp-card.empty .kp-fields { display: none; }
.kp-card:not(.empty) .kp-spent { display: none; }
.kp-fields { display: flex; flex-direction: column; gap: 8px; }
.kp-amount { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px 10px; }
.kp-amount:focus-within { border-color: var(--teal); box-shadow: var(--focus-ring); }
.kp-amount span { color: var(--subtle); }
.kp-amount input { border: 0; padding: 4px 0; font-size: 18px; font-weight: 700; width: 100%; min-width: 0; outline: none; }
.kp-soft { display: grid; grid-template-columns: 1fr auto; gap: 2px 6px; font-size: 13px; color: var(--muted); }
.kp-soft output { font-weight: 600; color: var(--fg); }
.kp-soft input { grid-column: 1 / -1; accent-color: var(--teal); width: 100%; }
.kp-fields .help { margin: -6px 0 0; font-size: 12px; }
.kp-now { margin: 0; font-size: 13px; }
.kp-now.warn-text { font-weight: 600; }
.kp-fields [data-kp-clear] { align-self: flex-start; font-size: 12.5px; padding: 0; }
.kp-spent, .kp-month-eq { margin: 0; font-size: 12.5px; }
.kp-spent { text-align: center; }
.kp-force { margin-top: 8px; }
.kp-whom { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.kp-rec { align-items: flex-start; }
.kp-rec .sub { display: block; font-size: 12.5px; }
.kp-emails { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px; }
.kp-emails:focus-within { border-color: var(--teal); box-shadow: var(--focus-ring); }
.kp-email { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--teal-soft); color: var(--teal-strong); font-weight: 600; font-size: 13px; }
.kp-email.bad { background: var(--danger-soft); color: var(--danger); }
.kp-email button { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; font-size: 14px; }
.kp-email-in { flex: 1 1 160px; border: 0; outline: none; padding: 4px; min-width: 120px; }
.error-text { color: var(--danger); font-size: 13px; margin: 4px 0 0; }
.kp-matrix th, .kp-matrix td.kp-cell { text-align: center; }
.kp-matrix th:first-child { text-align: left; }
.kp-matrix th .sub { display: block; font-weight: 400; font-size: 12px; color: var(--subtle); }
.kp-matrix th.off { color: var(--subtle); }
.kp-matrix td .sub { display: block; font-size: 12.5px; }
.kp-cell input { width: 18px; height: 18px; accent-color: var(--teal); }
.kp-summary { background: var(--teal-soft); border-radius: var(--radius-sm); padding: 10px 14px; margin: 12px 0; }
.kp-summary:empty { display: none; }
.kp-summary::before { content: "🔔 "; }
.kp-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 28px; border-top: 1px solid var(--line); background: var(--white); }
.kp-foot .changed { font-weight: 600; color: var(--fg); }
.kp-foot .changed::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--warn); }
.kp-foot-actions { display: flex; gap: 10px; }
.table tr.kp-open-row td { background: var(--teal-soft); }
.table tr[data-kp-row] { cursor: pointer; }
@media (max-width: 900px) { .kp-cards, .kp-tiles, .kp-whom { grid-template-columns: 1fr; } }

/* the bell (041): unread notices of the signed-in person, next to RU | EN */
.bell { position: relative; }
.bell > summary { list-style: none; display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; color: var(--muted); }
.bell > summary::-webkit-details-marker { display: none; }
.bell > summary:hover { border-color: var(--teal); color: var(--teal); }
.bell-count { position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: var(--white); font-size: 10.5px; font-weight: 700; line-height: 16px; text-align: center; }
.bell-count[hidden] { display: none; }
.bell-list { position: absolute; right: 0; top: 36px; width: 360px; max-height: 60vh; overflow-y: auto; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); z-index: 50; padding: 6px; }
.bell-item { display: block; padding: 8px 10px; border-radius: 6px; color: var(--fg); }
.bell-item:hover { background: var(--panel); text-decoration: none; }
.bell-item strong { display: block; font-size: 13.5px; }
.bell-item span { display: block; font-size: 12.5px; color: var(--muted); }
.bell-item.unread strong::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--teal); vertical-align: 1px; }
.bell-empty { padding: 12px; color: var(--subtle); }
.page-side-top { display: flex; align-items: center; gap: 10px; }

/* «Подключения» → «Уведомления» (platform/ux/46-notify-channels) */
.ntf-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 12px 0 16px; }
.ntf-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ntf-card.empty { border-style: dashed; }
.ntf-card form { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.ntf-card-head { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.ntf-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 13.5px; }
.ntf-dl dt { color: var(--muted); }
.ntf-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ntf-card .help { margin: 0; }
.ntf-card summary.link { color: var(--teal); font-weight: 600; cursor: pointer; }
.ntf-defaults { background: var(--panel); border-radius: var(--radius-sm); padding: 12px 16px; }
.ntf-defaults .sub { display: block; margin-top: 4px; font-size: 12.5px; }
@media (max-width: 1100px) { .ntf-cards { grid-template-columns: 1fr; } }
.bell-icon { display: block; width: 16px; height: 16px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9'/%3E%3Cpath d='M10.3 21a1.94 1.94 0 0 0 3.4 0'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9'/%3E%3Cpath d='M10.3 21a1.94 1.94 0 0 0 3.4 0'/%3E%3C/svg%3E") center / contain no-repeat; }
.kp-force[hidden], .kp [hidden] { display: none; }
.kp-date { width: auto; }
.kp-emails input.kp-email-in { border: 0; box-shadow: none; background: none; padding: 4px; width: auto; }
.kp.scrolled .kp-tiles, .kp.scrolled .kp-who { display: none; }
.kp.scrolled .kp-head { padding-bottom: 12px; }
.kp input.kp-date { width: auto; flex: 0 0 190px; }
.ntf-card form button { align-self: flex-start; }
.conn-howto pre { margin: 6px 0 4px; padding: 8px 10px; background: var(--white); border: 1px solid var(--line-soft); border-radius: 6px; overflow-x: auto; }
.conn-howto pre code { font-size: 12px; white-space: pre-wrap; word-break: break-word; background: none; padding: 0; }
.conn-howto li + li { margin-top: 4px; }
.conn-share.off { opacity: .55; }

/* an answer's markdown (chat.html md()): the same text, set as paragraphs, lists and code */
pre.msg.md { white-space: normal; }
pre.msg.md p { margin: 0 0 10px; }
pre.msg.md p:last-child, pre.msg.md ul:last-child, pre.msg.md ol:last-child { margin-bottom: 0; }
pre.msg.md ul, pre.msg.md ol { margin: 0 0 10px; padding-left: 22px; }
pre.msg.md li + li { margin-top: 3px; }
pre.msg.md h4.md-h { margin: 14px 0 6px; font-size: 15px; }
pre.msg.md code { font-family: var(--mono); font-size: 12.5px; background: var(--panel); padding: 1px 5px; border-radius: 4px; }
pre.msg.md pre.md-code { margin: 0 0 10px; padding: 10px 12px; background: var(--panel); border-radius: var(--radius-sm); white-space: pre; overflow-x: auto; }
pre.msg.md pre.md-code code { background: none; padding: 0; }

/* «Присылать на почту» (platform/ux/47): the chip on the dashboard's bar and the panel over it (kp-* of 46) */
.dm-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--teal-line);
  background: var(--teal-soft); color: var(--teal-strong); font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.dm-chip:hover { background: var(--teal-soft); color: var(--teal-strong); text-decoration: none; border-color: var(--teal); }
.dm-title { font-family: var(--font); font-size: 20px; }
.dm-last { margin: 0; font-size: 13.5px; }
.dm-warn { background: var(--warn-soft); border-radius: var(--radius-sm); padding: 8px 12px; margin-top: 10px; }
.dm-lbl { margin: 0; min-width: 44px; font-weight: 400; color: var(--muted); }
.dm-me { margin: 0 0 10px; }
.dm-eye { background: var(--panel); border-radius: var(--radius-sm); padding: 10px 14px; margin: 12px 0 0; font-size: 13px; }
.dm-summary::before { content: "✉ "; }
.dm-dl { margin-bottom: 12px; }
.dm .kp-row[hidden] { display: none; }
.dm-list-warn { margin: 0 22px 8px; }
.ok-text { color: var(--ok); }
.danger-text { color: var(--danger); }
