/* ================================================================
   Jaxis — оформление панели
   Токены, компоненты, страницы. Светлая и тёмная темы.
   ================================================================ */

:root {
  --paper: #f6f5f2;
  --card: #ffffff;
  --card-2: #fbfaf8;
  --ink: #14161a;
  --ink-2: #3c4046;
  --muted: #74726c;
  --line: #e6e3dc;
  --line-strong: #d6d2c9;
  --accent: #0f6b4f;
  --accent-ink: #0b4f3b;
  --accent-soft: #e7f1ec;
  --warn: #9a5b00;
  --warn-soft: #fbf0dd;
  --danger: #a1301f;
  --danger-soft: #fbecea;
  --side: #101317;
  --side-2: #171b21;
  --side-ink: #dfe3e8;
  --side-muted: #868d97;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(20, 22, 26, 0.04);
  --shadow: 0 1px 2px rgba(20, 22, 26, 0.04), 0 12px 32px -20px rgba(20, 22, 26, 0.22);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, "Liberation Mono", monospace;
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

[data-theme="dark"] {
  --paper: #0c0e11;
  --card: #14171c;
  --card-2: #181c22;
  --ink: #eceff2;
  --ink-2: #c6cad0;
  --muted: #8c929b;
  --line: #232830;
  --line-strong: #30363f;
  --accent: #48c79c;
  --accent-ink: #9be3c9;
  --accent-soft: #12251e;
  --warn: #e0a458;
  --warn-soft: #2a2118;
  --danger: #e88b7d;
  --danger-soft: #2b1a18;
  --side: #0a0c0f;
  --side-2: #11141a;
  --side-ink: #dde1e6;
  --side-muted: #7d848e;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 16px 40px -24px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
button { font-family: inherit; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

/* ------------------------------ каркас ------------------------------ */

.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 12px 14px;
  background: var(--side);
  color: var(--side-ink);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 18px;
}

.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; }
.brand-mark svg { width: 17px; height: 17px; }
.brand-name { font-size: 14.5px; font-weight: 600; letter-spacing: 0.01em; }
.brand-sub { display: block; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--side-muted); margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-label {
  padding: 0 10px;
  margin: 16px 0 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--side-muted);
}
.nav-label:first-child { margin-top: 2px; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  color: #aeb4bd;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.14s ease, color 0.14s ease;
}
.nav-item svg { width: 16px; height: 16px; flex: none; opacity: 0.85; }
.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.nav-item.active { background: rgba(255, 255, 255, 0.07); color: #fff; }
.nav-item.active svg { opacity: 1; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 9px;
  bottom: 9px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}
.nav-count { margin-left: auto; font-size: 11px; color: var(--side-muted); font-variant-numeric: tabular-nums; }

.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.07); }

.who { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px; }
.who:hover { background: rgba(255, 255, 255, 0.04); }
.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.who-meta { min-width: 0; }
.who-name { font-size: 12.5px; font-weight: 500; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-role { font-size: 11px; color: var(--side-muted); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.06); }
.icon-btn svg { width: 16px; height: 16px; }
.sidebar .icon-btn { color: var(--side-muted); margin-left: auto; }
.sidebar .icon-btn:hover { color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 32px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(10px);
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.crumbs strong { color: var(--ink); font-weight: 500; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 30px 32px 72px; }

.page-head { display: flex; align-items: flex-start; gap: 24px; margin-bottom: 24px; }
.page-title { font-size: 25px; font-weight: 600; letter-spacing: -0.022em; }
.page-desc { margin-top: 6px; font-size: 13.5px; color: var(--muted); max-width: 62ch; }
.page-actions { margin-left: auto; display: flex; gap: 8px; flex: none; }

/* ------------------------------ карточки ------------------------------ */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.card-title { font-size: 13.5px; font-weight: 600; letter-spacing: -0.005em; }
.card-hint { font-size: 12px; color: var(--muted); margin-left: auto; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  position: relative;
  padding: 16px 17px 15px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.stat-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-label svg { width: 14px; height: 14px; opacity: 0.7; }
.stat-value { margin-top: 9px; font-size: 26px; font-weight: 600; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.stat-foot { margin-top: 4px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; }
.key-add { display: flex; gap: 10px; align-items: center; }
.key-add .input { flex: 1; }
.int-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ------------------------------ кнопки ------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}
.btn svg { width: 15px; height: 15px; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 86%, var(--accent)); }
[data-theme="dark"] .btn-primary { background: var(--accent); color: #06231a; }
[data-theme="dark"] .btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, white); }

.btn-secondary { background: var(--card); border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { border-color: var(--muted); }

.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 5%, transparent); }

.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 28%, transparent); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-block { width: 100%; }

/* ------------------------------ формы ------------------------------ */

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.field .hint { font-size: 11.5px; color: var(--muted); }

.input, select.input, textarea.input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
textarea.input { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input:disabled { background: var(--card-2); color: var(--muted); }

.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 4px; }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 0.16s ease;
  flex: none;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.16s ease;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--ring); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; }
.segmented button {
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ------------------------------ таблицы ------------------------------ */

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--card);
}
.table td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--ink) 2.2%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .mono { font-family: var(--mono); font-size: 12px; }
.table .muted { color: var(--muted); }
.table-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* ------------------------------ мелочи ------------------------------ */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.ok { color: var(--accent-ink); background: var(--accent-soft); }
.pill.warn { color: var(--warn); background: var(--warn-soft); }
.pill.danger { color: var(--danger); background: var(--danger-soft); }
.pill.neutral { color: var(--muted); background: color-mix(in srgb, var(--ink) 5%, transparent); }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kv { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; }
.kv dt { font-size: 12.5px; color: var(--muted); }
.kv dd { margin: 0; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 44px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 26px; height: 26px; opacity: 0.5; }
.empty strong { color: var(--ink-2); font-size: 13.5px; font-weight: 500; }
.empty p { font-size: 12.5px; max-width: 42ch; }

.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 12.5px;
  border: 1px solid transparent;
}
.banner svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.banner.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.banner.danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 22%, transparent); }
.banner.info { background: var(--accent-soft); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 20%, transparent); }

/* ------------------------------ график ------------------------------ */

.chart { width: 100%; height: 132px; display: block; }
.chart .bar { fill: color-mix(in srgb, var(--accent) 26%, transparent); transition: fill 0.14s ease; }
.chart .bar:hover { fill: var(--accent); }
.chart .bar.empty { fill: color-mix(in srgb, var(--ink) 7%, transparent); }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 9.5px; font-family: var(--font); }
.chart-legend { display: flex; align-items: center; gap: 14px; margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.chart-empty { display: flex; align-items: center; justify-content: center; gap: 8px; height: 132px; color: var(--muted); font-size: 12.5px; }
.chart-empty svg { width: 18px; height: 18px; opacity: 0.5; }
.legend-dot { width: 7px; height: 7px; border-radius: 2px; background: var(--accent); display: inline-block; margin-right: 6px; }

/* ------------------------------ вход ------------------------------ */

.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr); }
.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 52px;
  background: var(--side);
  color: #fff;
  background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.07) 1px, transparent 0);
  background-size: 24px 24px;
}
.auth-brand .brand { padding: 0 0 40px; }
.auth-headline { max-width: 30ch; font-size: 30px; line-height: 1.18; letter-spacing: -0.028em; font-weight: 600; }
.auth-lead { margin-top: 14px; max-width: 46ch; font-size: 13.5px; line-height: 1.6; color: #a9b0ba; }
.auth-points { margin-top: 26px; display: flex; flex-direction: column; gap: 12px; max-width: 44ch; }
.auth-point { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: #c8cdd4; }
.auth-point svg { width: 15px; height: 15px; color: var(--accent); flex: none; margin-top: 2px; }
.auth-foot { position: absolute; left: 52px; bottom: 44px; font-size: 11.5px; color: #6f7681; letter-spacing: 0.02em; }

.auth-panel {
  display: grid;
  place-items: center;
  padding: 40px 24px;
  background: var(--paper);
  border-left: 1px solid var(--line);
}
.auth-card { width: 100%; max-width: 372px; }
.auth-title { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; }
.auth-sub { margin-top: 6px; font-size: 13px; color: var(--muted); }
.auth-form { margin-top: 26px; display: flex; flex-direction: column; gap: 14px; }
.auth-note { margin-top: 18px; font-size: 11.5px; color: var(--muted); text-align: center; }

/* ------------------------------ чат ------------------------------ */

.chat { display: flex; flex-direction: column; min-height: 480px; }
.chat-toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chat-thread { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 18px; max-height: 54vh; }
.msg { display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
.msg-role { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.msg-body { font-size: 13.5px; line-height: 1.62; white-space: pre-wrap; word-break: break-word; }
.msg-body code { font-family: var(--mono); font-size: 12px; background: color-mix(in srgb, var(--ink) 6%, transparent); padding: 1px 5px; border-radius: 5px; }
.msg-body pre { margin: 8px 0 0; padding: 12px; border-radius: 9px; background: var(--card-2); border: 1px solid var(--line); overflow-x: auto; }
.msg-body pre code { background: none; padding: 0; font-size: 12px; }
.msg.user .msg-body { padding: 10px 13px; background: var(--accent-soft); border-radius: 12px; color: var(--ink); align-self: flex-start; }
.msg.assistant .msg-body { color: var(--ink); }
.msg-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.msg-loading { display: inline-flex; gap: 4px; align-items: center; padding: 4px 0; }
.msg-loading i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: blink 1.1s infinite; }
.msg-loading i:nth-child(2) { animation-delay: 0.15s; }
.msg-loading i:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.composer { border-top: 1px solid var(--line); padding: 12px 16px 14px; display: flex; flex-direction: column; gap: 8px; }
.composer-row { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 180px;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  resize: none;
  line-height: 1.5;
}
.composer textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.composer-foot { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--muted); }
.send-btn { width: 38px; height: 38px; border-radius: 10px; padding: 0; }
.send-btn svg { width: 17px; height: 17px; }

/* ------------------------------ провайдеры ------------------------------ */

.providers { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
.provider-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.provider-name { font-size: 14px; font-weight: 600; }
.provider-url { font-size: 11.5px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }
.provider-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.metric { background: var(--card); padding: 12px 16px; }
.metric-label { font-size: 11px; color: var(--muted); }
.metric-value { margin-top: 4px; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.keys-table { max-height: 268px; overflow-y: auto; }
.keys-table table { font-size: 12.5px; }
.keys-table .table th { position: sticky; top: 0; z-index: 2; }

/* ------------------------------ диалоги ------------------------------ */

dialog {
  border: 0;
  padding: 0;
  width: min(460px, calc(100vw - 32px));
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 32px 80px -32px rgba(0, 0, 0, 0.45);
}
dialog::backdrop { background: rgba(10, 12, 15, 0.45); backdrop-filter: blur(3px); }
.dialog-head { padding: 18px 20px 0; }
.dialog-title { font-size: 16px; font-weight: 600; letter-spacing: -0.015em; }
.dialog-desc { margin-top: 5px; font-size: 12.5px; color: var(--muted); }
.dialog-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 20px; }

/* ------------------------------ уведомления ------------------------------ */

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 220px;
  max-width: 380px;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--side);
  color: #edf0f3;
  font-size: 12.5px;
  box-shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.55);
  animation: toast-in 0.18s ease;
}
.toast svg { width: 15px; height: 15px; flex: none; }
.toast.ok svg { color: #5fd3a5; }
.toast.err svg { color: #f09a8d; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ------------------------------ скелетон ------------------------------ */

.skeleton { position: relative; overflow: hidden; background: color-mix(in srgb, var(--ink) 6%, transparent); border-radius: 6px; }
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--card) 60%, transparent), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* ------------------------------ адаптив ------------------------------ */

@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .providers { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: auto;
    flex-direction: column;
    padding: 10px 12px 8px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .brand { padding: 0 4px 10px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .nav-label { display: none; }
  .nav-item { height: 32px; padding: 0 10px; flex: none; }
  .nav-item.active::before { display: none; }
  .sidebar-foot { display: flex; align-items: center; margin-top: 6px; padding-top: 8px; }
  .who { padding: 0; }
  .topbar { padding: 10px 16px; }
  .content { padding: 20px 16px 56px; }
  .page-head { flex-direction: column; gap: 12px; }
  .page-actions { margin-left: 0; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-brand { display: none; }
}

@media (max-width: 560px) {
  .stats { grid-template-columns: minmax(0, 1fr); }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .page-title { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}